diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-09-12 18:02:07 +0900 |
---|---|---|
committer | Michel Dänzer <michel.daenzer@amd.com> | 2016-09-12 18:02:07 +0900 |
commit | e91858e435672c32f9c4a854b3dec048199d6f7f (patch) | |
tree | 5f33641df8c0b7b54ff78588e5e2110f0a107d96 /src/radeon_glamor.c | |
parent | 38797a33117222dadbc89e5f21ed8cd5deef9bea (diff) |
glamor: Fix radeon_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>
(Ported from amdgpu commit b36c77695ba77b59a0ccd868454e3af4fc04d5ff)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_glamor.c')
-rw-r--r-- | src/radeon_glamor.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c index f94e0fd3..5c4191b5 100644 --- a/src/radeon_glamor.c +++ b/src/radeon_glamor.c @@ -289,12 +289,17 @@ static Bool radeon_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave, void **handle_p) { - struct radeon_pixmap *priv = radeon_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 radeon_share_pixmap_backing(priv->bo, handle_p); + *handle_p = (void *)(long)fd; + return TRUE; } static Bool |