[PATCH] DRI2: Install client callback only once

Michel Dänzer michel at daenzer.net
Thu Sep 26 07:48:55 PDT 2013


From: Michel Dänzer <michel.daenzer at amd.com>

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60182
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/radeon_dri2.c  | 13 +++++++------
 src/radeon_probe.h |  1 -
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index fa3719d..a211960 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -520,6 +520,8 @@ typedef struct _DRI2ClientEvents {
 
 #if HAS_DEVPRIVATEKEYREC
 
+static int DRI2InfoCnt;
+
 static DevPrivateKeyRec DRI2ClientEventsPrivateKeyRec;
 #define DRI2ClientEventsPrivateKey (&DRI2ClientEventsPrivateKeyRec)
 
@@ -1543,7 +1545,6 @@ radeon_dri2_screen_init(ScreenPtr pScreen)
     RADEONInfoPtr info = RADEONPTR(pScrn);
     DRI2InfoRec dri2_info = { 0 };
 #ifdef USE_DRI2_SCHEDULING
-    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
     const char *driverNames[2];
     Bool scheduling_works = TRUE;
 #endif
@@ -1607,7 +1608,7 @@ radeon_dri2_screen_init(ScreenPtr pScreen)
         dri2_info.driverNames = driverNames;
         driverNames[0] = driverNames[1] = dri2_info.driverName;
 
-	if (pRADEONEnt->dri2_info_cnt == 0) {
+	if (DRI2InfoCnt == 0) {
 #if HAS_DIXREGISTERPRIVATEKEY
 	    if (!dixRegisterPrivateKey(DRI2ClientEventsPrivateKey,
 				       PRIVATE_CLIENT, sizeof(DRI2ClientEventsRec))) {
@@ -1627,7 +1628,7 @@ radeon_dri2_screen_init(ScreenPtr pScreen)
 	    AddCallback(&ClientStateCallback, radeon_dri2_client_state_changed, 0);
 	}
 
-	pRADEONEnt->dri2_info_cnt++;
+	DRI2InfoCnt++;
     }
 #endif
 
@@ -1646,12 +1647,12 @@ void radeon_dri2_close_screen(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
-#ifdef USE_DRI2_SCHEDULING
-    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
 
-    if (--pRADEONEnt->dri2_info_cnt == 0)
+#ifdef USE_DRI2_SCHEDULING
+    if (--DRI2InfoCnt == 0)
     	DeleteCallback(&ClientStateCallback, radeon_dri2_client_state_changed, 0);
 #endif
+
     DRI2CloseScreen(pScreen);
     drmFree(info->dri2.device_name);
 }
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 67e70ef..de0135d 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -135,7 +135,6 @@ typedef struct
     int fd_ref;
     unsigned long     fd_wakeup_registered; /* server generation for which fd has been registered for wakeup handling */
     int fd_wakeup_ref;
-    int dri2_info_cnt;
 } RADEONEntRec, *RADEONEntPtr;
 
 extern const OptionInfoRec *RADEONOptionsWeak(void);
-- 
1.8.4.rc3



More information about the xorg-driver-ati mailing list