From 03623de2944d40b77adebc65e375dd6b7e050b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 18 Sep 2013 10:57:52 +0200 Subject: [PATCH] DRI2: Install client callback only once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60182 Signed-off-by: Michel Dänzer --- 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