xf86-video-ati: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Mon Nov 16 19:28:18 PST 2015


 configure.ac                 |    6 ++++++
 src/radeon.h                 |   12 ++++++++----
 src/radeon_glamor.c          |   38 ++++++++++++++++++++++++++++++++++++++
 src/radeon_glamor.h          |    2 ++
 src/radeon_glamor_wrappers.c |    5 -----
 src/radeon_kms.c             |    2 ++
 6 files changed, 56 insertions(+), 9 deletions(-)

New commits:
commit 10b7c3def58bb34acc38f076bc230e25b454ab79
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Nov 10 16:31:09 2015 +0900

    glamor: Deal with glamor_egl_destroy_textured_pixmap being removed
    
    When it's not available, it's safe to call down to the glamor
    DestroyPixmap hook instead.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/configure.ac b/configure.ac
index 0ff901b..0a95420 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,12 @@ if test "x$GLAMOR" != "xno"; then
 					 [Have glamor_glyphs_init API])], [],
 			      [#include "xorg-server.h"
 			       #include "glamor.h"])
+
+		AC_CHECK_DECL(glamor_egl_destroy_textured_pixmap,
+			      [AC_DEFINE(HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP, 1,
+					 [Have glamor_egl_destroy_textured_pixmap API])], [],
+			      [#include "xorg-server.h"
+			       #include "glamor.h"])
 	fi
 
 	if test "x$GLAMOR_XSERVER" != xyes; then
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index 8fb3a1e..86db4e2 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -252,6 +252,12 @@ fallback_pixmap:
 
 static Bool radeon_glamor_destroy_pixmap(PixmapPtr pixmap)
 {
+#ifndef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
+	ScreenPtr screen = pixmap->drawable.pScreen;
+	RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen));
+	Bool ret;
+#endif
+
 	if (pixmap->refcnt == 1) {
 		if (pixmap->devPrivate.ptr) {
 			struct radeon_bo *bo = radeon_get_pixmap_bo(pixmap);
@@ -260,11 +266,23 @@ static Bool radeon_glamor_destroy_pixmap(PixmapPtr pixmap)
 				radeon_bo_unmap(bo);
 		}
 
+#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
 		glamor_egl_destroy_textured_pixmap(pixmap);
+#endif
 		radeon_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 = radeon_glamor_destroy_pixmap;
+
+	return ret;
+#endif
 }
 
 #ifdef RADEON_PIXMAP_SHARING
commit 535e5438b2c32f774b9c8c27ee0289b4749548ef
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Nov 10 17:31:52 2015 +0900

    glamor: Restore all ScreenRec hooks during CloseScreen
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/radeon.h b/src/radeon.h
index e2fd41c..0ee6adc 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -157,6 +157,10 @@ typedef enum {
 } RADEONOpts;
 
 
+#if XF86_CRTC_VERSION >= 5
+#define RADEON_PIXMAP_SHARING 1
+#endif
+
 #define RADEON_VSYNC_TIMEOUT	20000 /* Maximum wait for VSYNC (in usecs) */
 
 /* Buffer are aligned on 4096 byte boundaries */
@@ -561,6 +565,10 @@ typedef struct {
 	AddTrapsProcPtr SavedAddTraps;
 	UnrealizeGlyphProcPtr SavedUnrealizeGlyph;
 #endif
+#ifdef RADEON_PIXMAP_SHARING
+	SharePixmapBackingProcPtr SavedSharePixmapBacking;
+	SetSharedPixmapBackingProcPtr SavedSetSharedPixmapBacking;
+#endif
     } glamor;
 #endif /* USE_GLAMOR */
 } RADEONInfoRec, *RADEONInfoPtr;
@@ -623,10 +631,6 @@ extern RADEONEntPtr RADEONEntPriv(ScrnInfoPtr pScrn);
 
 drmVBlankSeqType radeon_populate_vbl_request_type(xf86CrtcPtr crtc);
 
-#if XF86_CRTC_VERSION >= 5
-#define RADEON_PIXMAP_SHARING 1
-#endif
-
 static inline struct radeon_surface *radeon_get_pixmap_surface(PixmapPtr pPix)
 {
 #ifdef USE_GLAMOR
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index fdd5aea..8fb3a1e 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -368,10 +368,14 @@ radeon_glamor_init(ScreenPtr screen)
 		ps->UnrealizeGlyph = SavedUnrealizeGlyph;
 #endif
 
+	info->glamor.SavedCreatePixmap = screen->CreatePixmap;
 	screen->CreatePixmap = radeon_glamor_create_pixmap;
+	info->glamor.SavedDestroyPixmap = screen->DestroyPixmap;
 	screen->DestroyPixmap = radeon_glamor_destroy_pixmap;
 #ifdef RADEON_PIXMAP_SHARING
+	info->glamor.SavedSharePixmapBacking = screen->SharePixmapBacking;
 	screen->SharePixmapBacking = radeon_glamor_share_pixmap_backing;
+	info->glamor.SavedSetSharedPixmapBacking = screen->SetSharedPixmapBacking;
 	screen->SetSharedPixmapBacking = radeon_glamor_set_shared_pixmap_backing;
 #endif
 
@@ -380,6 +384,22 @@ radeon_glamor_init(ScreenPtr screen)
 	return TRUE;
 }
 
+void
+radeon_glamor_fini(ScreenPtr screen)
+{
+	RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen));
+
+	if (!info->use_glamor)
+		return;
+
+	screen->CreatePixmap = info->glamor.SavedCreatePixmap;
+	screen->DestroyPixmap = info->glamor.SavedDestroyPixmap;
+#ifdef RADEON_PIXMAP_SHARING
+	screen->SharePixmapBacking = info->glamor.SavedSharePixmapBacking;
+	screen->SetSharedPixmapBacking = info->glamor.SavedSetSharedPixmapBacking;
+#endif
+}
+
 XF86VideoAdaptorPtr radeon_glamor_xv_init(ScreenPtr pScreen, int num_adapt)
 {
 	return glamor_xv_init(pScreen, num_adapt);
diff --git a/src/radeon_glamor.h b/src/radeon_glamor.h
index 246336b..75129f8 100644
--- a/src/radeon_glamor.h
+++ b/src/radeon_glamor.h
@@ -64,6 +64,7 @@ struct radeon_pixmap;
 
 Bool radeon_glamor_pre_init(ScrnInfoPtr scrn);
 Bool radeon_glamor_init(ScreenPtr screen);
+void radeon_glamor_fini(ScreenPtr screen);
 void radeon_glamor_screen_init(ScreenPtr screen);
 Bool radeon_glamor_create_screen_resources(ScreenPtr screen);
 void radeon_glamor_free_screen(int scrnIndex, int flags);
@@ -77,6 +78,7 @@ XF86VideoAdaptorPtr radeon_glamor_xv_init(ScreenPtr pScreen, int num_adapt);
 
 static inline Bool radeon_glamor_pre_init(ScrnInfoPtr scrn) { return FALSE; }
 static inline Bool radeon_glamor_init(ScreenPtr screen) { return FALSE; }
+static inline void radeon_glamor_fini(ScreenPtr screen) { }
 static inline Bool radeon_glamor_create_screen_resources(ScreenPtr screen) { return FALSE; }
 static inline void radeon_glamor_free_screen(int scrnIndex, int flags) { }
 
diff --git a/src/radeon_glamor_wrappers.c b/src/radeon_glamor_wrappers.c
index ec81560..cd02b06 100644
--- a/src/radeon_glamor_wrappers.c
+++ b/src/radeon_glamor_wrappers.c
@@ -917,8 +917,6 @@ radeon_glamor_close_screen(CLOSE_SCREEN_ARGS_DECL)
 	pScreen->CloseScreen = info->glamor.SavedCloseScreen;
 	pScreen->GetImage = info->glamor.SavedGetImage;
 	pScreen->GetSpans = info->glamor.SavedGetSpans;
-	pScreen->CreatePixmap = info->glamor.SavedCreatePixmap;
-	pScreen->DestroyPixmap = info->glamor.SavedDestroyPixmap;
 	pScreen->CopyWindow = info->glamor.SavedCopyWindow;
 	pScreen->ChangeWindowAttributes =
 	    info->glamor.SavedChangeWindowAttributes;
@@ -962,9 +960,6 @@ radeon_glamor_screen_init(ScreenPtr screen)
 	info->glamor.SavedGetSpans = screen->GetSpans;
 	screen->GetSpans = radeon_glamor_get_spans;
 
-	info->glamor.SavedCreatePixmap = screen->CreatePixmap;
-	info->glamor.SavedDestroyPixmap = screen->DestroyPixmap;
-
 	info->glamor.SavedCopyWindow = screen->CopyWindow;
 	screen->CopyWindow = radeon_glamor_copy_window;
 
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 8aa7633..49b922d 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1490,6 +1490,8 @@ static Bool RADEONCloseScreen_KMS(CLOSE_SCREEN_ARGS_DECL)
     if (info->dri2.enabled)
 	radeon_dri2_close_screen(pScreen);
 
+    radeon_glamor_fini(pScreen);
+
     pScrn->vtSema = FALSE;
     xf86ClearPrimInitDone(info->pEnt->index);
     pScreen->BlockHandler = info->BlockHandler;


More information about the xorg-commit mailing list