diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-09-14 16:42:39 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-09-14 17:26:34 +0900 |
commit | 0af88ed18a22b7d038c735093236c54eadc3b118 (patch) | |
tree | b9f6ee74bff33452f67110e58a132ed982bf7790 | |
parent | 0d5b6957aef95872dd34ba0eb4284ebe70ee685d (diff) |
glamor: Fix amdgpu_glamor_share_pixmap_backing for priv->bo == NULL
Fixes crash when running a compositor and DRI_PRIME client via DRI2.
Reported-by: Qiang Yu <qiang.yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Qiang Yu <qiang.yu@amd.com>
(Cherry picked from commit b36c77695ba77b59a0ccd868454e3af4fc04d5ff)
-rw-r--r-- | src/amdgpu_glamor.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c index 52aa30d..b6ec98f 100644 --- a/src/amdgpu_glamor.c +++ b/src/amdgpu_glamor.c @@ -278,12 +278,17 @@ static Bool amdgpu_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave, void **handle_p) { - struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap); + ScreenPtr screen = pixmap->drawable.pScreen; + CARD16 stride; + CARD32 size; + int fd; - if (!priv) + fd = glamor_fd_from_pixmap(screen, pixmap, &stride, &size); + if (fd < 0) return FALSE; - return amdgpu_share_pixmap_backing(priv->bo, handle_p); + *handle_p = (void *)(long)fd; + return TRUE; } static Bool |