Commit 017307f0 authored by Keith Packard's avatar Keith Packard
Browse files

xfree86/dri: Mark DRIDrvMsg and dri_drm_debug_print _X_ATTRIBUTE_PRINTF



And fix resulting warnings.

v2: (Adam Jackson) Cast handles through uintptr_t to avoid size change warnings
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Reviewed-by: default avatarIan Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent 22592855
...@@ -100,6 +100,11 @@ drmServerInfo DRIDRMServerInfo; ...@@ -100,6 +100,11 @@ drmServerInfo DRIDRMServerInfo;
* easily changed here. * easily changed here.
*/ */
#define DRI_MSG_VERBOSITY 1 #define DRI_MSG_VERBOSITY 1
static void
DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3,4);
static void static void
DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
{ {
...@@ -400,7 +405,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) ...@@ -400,7 +405,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
} }
DRIDrvMsg(pScreen->myNum, X_INFO, DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] added %d byte SAREA at %p\n", "[drm] added %d byte SAREA at %p\n",
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA); (int) pDRIPriv->pDriverInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA);
/* Backwards compat. */ /* Backwards compat. */
if (drmMap(pDRIPriv->drmFD, if (drmMap(pDRIPriv->drmFD,
...@@ -414,7 +419,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) ...@@ -414,7 +419,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
return FALSE; return FALSE;
} }
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n", DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
pDRIPriv->hSAREA, pDRIPriv->pSAREA); (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
} }
else { else {
...@@ -442,7 +447,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) ...@@ -442,7 +447,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
return FALSE; return FALSE;
} }
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n", DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
pDRIPriv->pDriverInfo->hFrameBuffer); (void *) (uintptr_t) pDRIPriv->pDriverInfo->hFrameBuffer);
} }
else { else {
DRIDrvMsg(pScreen->myNum, X_INFO, DRIDrvMsg(pScreen->myNum, X_INFO,
...@@ -513,7 +518,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) ...@@ -513,7 +518,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->myContextPriv = pDRIContextPriv; pDRIPriv->myContextPriv = pDRIContextPriv;
DRIDrvMsg(pScreen->myNum, X_INFO, DRIDrvMsg(pScreen->myNum, X_INFO,
"X context handle = %p\n", pDRIPriv->myContext); "X context handle = %p\n", (void *) (uintptr_t) pDRIPriv->myContext);
/* Now that we have created the X server's context, we can grab the /* Now that we have created the X server's context, we can grab the
* hardware lock for the X server. * hardware lock for the X server.
...@@ -731,13 +736,13 @@ DRICloseScreen(ScreenPtr pScreen) ...@@ -731,13 +736,13 @@ DRICloseScreen(ScreenPtr pScreen)
if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) { if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
DRIDrvMsg(pScreen->myNum, X_INFO, DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] unmapping %d bytes of SAREA %p at %p\n", "[drm] unmapping %d bytes of SAREA %p at %p\n",
pDRIInfo->SAREASize, pDRIPriv->hSAREA, pDRIPriv->pSAREA); (int) pDRIInfo->SAREASize, (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) { if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
DRIDrvMsg(pScreen->myNum, X_ERROR, DRIDrvMsg(pScreen->myNum, X_ERROR,
"[drm] unable to unmap %d bytes" "[drm] unable to unmap %d bytes"
" of SAREA %p at %p\n", " of SAREA %p at %p\n",
pDRIInfo->SAREASize, (int) pDRIInfo->SAREASize,
pDRIPriv->hSAREA, pDRIPriv->pSAREA); (void *) (uintptr_t) pDRIPriv->hSAREA, pDRIPriv->pSAREA);
} }
} }
else { else {
...@@ -759,6 +764,10 @@ DRICloseScreen(ScreenPtr pScreen) ...@@ -759,6 +764,10 @@ DRICloseScreen(ScreenPtr pScreen)
#define DRM_MSG_VERBOSITY 3 #define DRM_MSG_VERBOSITY 3
static int
dri_drm_debug_print(const char *format, va_list ap)
_X_ATTRIBUTE_PRINTF(1,0);
static int static int
dri_drm_debug_print(const char *format, va_list ap) dri_drm_debug_print(const char *format, va_list ap)
{ {
...@@ -2214,9 +2223,9 @@ DRILock(ScreenPtr pScreen, int flags) ...@@ -2214,9 +2223,9 @@ DRILock(ScreenPtr pScreen, int flags)
else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) { else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
DRIDrvMsg(pScreen->myNum, X_ERROR, DRIDrvMsg(pScreen->myNum, X_ERROR,
"[DRI] Locking deadlock.\n" "[DRI] Locking deadlock.\n"
"\tAlready locked with context %d,\n" "\tAlready locked with context %p,\n"
"\ttrying to lock with context %d.\n", "\ttrying to lock with context %p.\n",
pDRIPriv->pLockingContext, pDRIPriv->myContext); pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext);
} }
(*pDRIPriv->pLockRefCount)++; (*pDRIPriv->pLockRefCount)++;
} }
...@@ -2233,8 +2242,8 @@ DRIUnlock(ScreenPtr pScreen) ...@@ -2233,8 +2242,8 @@ DRIUnlock(ScreenPtr pScreen)
if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) { if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
DRIDrvMsg(pScreen->myNum, X_ERROR, DRIDrvMsg(pScreen->myNum, X_ERROR,
"[DRI] Unlocking inconsistency:\n" "[DRI] Unlocking inconsistency:\n"
"\tContext %d trying to unlock lock held by context %d\n", "\tContext %p trying to unlock lock held by context %p\n",
pDRIPriv->pLockingContext, pDRIPriv->myContext); pDRIPriv->pLockingContext, (void *) (uintptr_t) pDRIPriv->myContext);
} }
(*pDRIPriv->pLockRefCount)--; (*pDRIPriv->pLockRefCount)--;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment