xf86-video-amdgpu: Branch 'master' - 2 commits
Michel Dänzer
daenzer at kemper.freedesktop.org
Thu Jan 28 01:15:57 PST 2016
src/amdgpu_glamor.c | 74 ++++++++++++++++++++++++++--------------------------
1 file changed, 38 insertions(+), 36 deletions(-)
New commits:
commit 2fcb7dadd3c71cd405cbbaafc777697538ca9c29
Author: jimqu <Jim.Qu at amd.com>
Date: Mon Jan 25 09:47:00 2016 +0800
glamor: Return NullPixmap on failure to create shareable pixmap
If we were asked to create a shareable pixmap, it doesn't make sense
to return a pixmap which isn't shareable. Doing so caused trouble down
the line such as a crash with older versions of glamor when trying to
use GLX pixmaps of bpp < 32 via DRI2.
Signed-off-by: JimQu <jim.qu at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 59233d2..efde2b0 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -251,7 +251,9 @@ fallback_glamor:
*/
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Failed to create textured DRI2/PRIME pixmap.");
- return pixmap;
+
+ amdgpu_glamor_destroy_pixmap(pixmap);
+ return NullPixmap;
}
/* Create textured pixmap failed means glamor failed to
* create a texture from current BO for some reasons. We turn
commit 5269a2228bff6023c1a7f3e8534027e1d7addc25
Author: jimqu <Jim.Qu at amd.com>
Date: Mon Jan 25 10:12:02 2016 +0800
Move amdgpu_glamor_destroy_pixmap before amdgpu_glamor_create_pixmap
The next commit will call the former from the latter. No functional
change.
Signed-off-by: JimQu <jim.qu at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index b11ee10..59233d2 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -147,6 +147,41 @@ amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_pixmap *pri
pixmap->devKind);
}
+static Bool amdgpu_glamor_destroy_pixmap(PixmapPtr pixmap)
+{
+#ifndef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ AMDGPUInfoPtr info = AMDGPUPTR(xf86ScreenToScrn(screen));
+ Bool ret;
+#endif
+
+ if (pixmap->refcnt == 1) {
+ if (pixmap->devPrivate.ptr) {
+ struct amdgpu_buffer *bo = amdgpu_get_pixmap_bo(pixmap);
+
+ if (bo)
+ amdgpu_bo_unmap(bo);
+ }
+
+#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
+ glamor_egl_destroy_textured_pixmap(pixmap);
+#endif
+ amdgpu_set_pixmap_bo(pixmap, NULL);
+ }
+
+#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
+ fbDestroyPixmap(pixmap);
+ return TRUE;
+#else
+ screen->DestroyPixmap = info->glamor.SavedDestroyPixmap;
+ ret = screen->DestroyPixmap(pixmap);
+ info->glamor.SavedDestroyPixmap = screen->DestroyPixmap;
+ screen->DestroyPixmap = amdgpu_glamor_destroy_pixmap;
+
+ return ret;
+#endif
+}
+
static PixmapPtr
amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned usage)
@@ -239,41 +274,6 @@ fallback_pixmap:
return fbCreatePixmap(screen, w, h, depth, usage);
}
-static Bool amdgpu_glamor_destroy_pixmap(PixmapPtr pixmap)
-{
-#ifndef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
- ScreenPtr screen = pixmap->drawable.pScreen;
- AMDGPUInfoPtr info = AMDGPUPTR(xf86ScreenToScrn(screen));
- Bool ret;
-#endif
-
- if (pixmap->refcnt == 1) {
- if (pixmap->devPrivate.ptr) {
- struct amdgpu_buffer *bo = amdgpu_get_pixmap_bo(pixmap);
-
- if (bo)
- amdgpu_bo_unmap(bo);
- }
-
-#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
- glamor_egl_destroy_textured_pixmap(pixmap);
-#endif
- amdgpu_set_pixmap_bo(pixmap, NULL);
- }
-
-#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
- fbDestroyPixmap(pixmap);
- return TRUE;
-#else
- screen->DestroyPixmap = info->glamor.SavedDestroyPixmap;
- ret = screen->DestroyPixmap(pixmap);
- info->glamor.SavedDestroyPixmap = screen->DestroyPixmap;
- screen->DestroyPixmap = amdgpu_glamor_destroy_pixmap;
-
- return ret;
-#endif
-}
-
#ifdef AMDGPU_PIXMAP_SHARING
static Bool
More information about the xorg-commit
mailing list