sna: Suppress DBG prints along potential SIGIO paths

As ErrorF/fprintf is not re-entrant due to its mutex we can not use DBG
from code that could be called by a signal handler. X's SIGIO handler
attempts to move the cursor from within the handler (eek!) and so we
need to be careful not to take any locks, such in as the aforementioned
fprintf, along the cursor paths.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=50744
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-06-07 11:18:27 +01:00
parent 3f5b94f3d1
commit c58d137d3e
1 changed files with 15 additions and 3 deletions

View File

@ -53,6 +53,12 @@
#define DBG(x) ErrorF x
#endif
#if 0
#define __DBG DBG
#else
#define __DBG(x)
#endif
struct sna_crtc {
struct drm_mode_modeinfo kmode;
PixmapPtr shadow;
@ -766,7 +772,7 @@ sna_crtc_hide_cursor(xf86CrtcPtr crtc)
struct sna_crtc *sna_crtc = crtc->driver_private;
struct drm_mode_cursor arg;
DBG(("%s: CRTC:%d\n", __FUNCTION__, crtc_id(sna_crtc)));
__DBG(("%s: CRTC:%d\n", __FUNCTION__, crtc_id(sna_crtc)));
VG_CLEAR(arg);
arg.flags = DRM_MODE_CURSOR_BO;
@ -784,7 +790,7 @@ sna_crtc_show_cursor(xf86CrtcPtr crtc)
struct sna_crtc *sna_crtc = crtc->driver_private;
struct drm_mode_cursor arg;
DBG(("%s: CRTC:%d\n", __FUNCTION__, crtc_id(sna_crtc)));
__DBG(("%s: CRTC:%d\n", __FUNCTION__, crtc_id(sna_crtc)));
VG_CLEAR(arg);
arg.flags = DRM_MODE_CURSOR_BO;
@ -798,6 +804,8 @@ sna_crtc_show_cursor(xf86CrtcPtr crtc)
static void
sna_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg)
{
__DBG(("%s: CRTC:%d (bg=%x, fg=%x)\n", __FUNCTION__,
crtc_id(crtc->driver_private), bg, fg));
}
static void
@ -807,7 +815,7 @@ sna_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
struct sna_crtc *sna_crtc = crtc->driver_private;
struct drm_mode_cursor arg;
DBG(("%s: CRTC:%d (%d, %d)\n", __FUNCTION__, crtc_id(sna_crtc), x, y));
__DBG(("%s: CRTC:%d (%d, %d)\n", __FUNCTION__, crtc_id(sna_crtc), x, y));
VG_CLEAR(arg);
arg.flags = DRM_MODE_CURSOR_MOVE;
@ -826,6 +834,8 @@ sna_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
struct sna_crtc *sna_crtc = crtc->driver_private;
struct drm_i915_gem_pwrite pwrite;
__DBG(("%s: CRTC:%d\n", __FUNCTION__, crtc_id(sna_crtc)));
VG_CLEAR(pwrite);
pwrite.handle = sna_crtc->cursor;
pwrite.offset = 0;
@ -1005,6 +1015,8 @@ sna_crtc_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
crtc->driver_private = sna_crtc;
sna_crtc->cursor = gem_create(sna->kgem.fd, 64*64*4);
DBG(("%s: created handle=%d for cursor on CRTC:%d\n",
__FUNCTION__, sna_crtc->cursor, sna_crtc->id));
list_add(&sna_crtc->link, &mode->crtcs);