summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2013-09-18 10:57:52 +0200
committerMichel Dänzer <michel@daenzer.net>2013-09-18 10:58:40 +0200
commitc45e728107269c6f51599dad4f6a02ccfef703f1 (patch)
tree3d1cf228331e57710bb3a61d8c0a3159d0af6eee /src/radeon_dri2.c
parentb955ddd0d41801e4ca0c30a70a5d0b27c3f366c8 (diff)
DRI2: Install client callback only once
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60182 Acked-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_dri2.c')
-rw-r--r--src/radeon_dri2.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index fa3719d6..a211960c 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);
}