glamor-ddx: Destroy all the pixmap cursors when close current screen.

As now we use pixmap to handle cursor, and pixmaps are related to
current screen. If we close the screen, then we have to destroy all
the related cursors.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2011-09-20 17:15:12 +08:00
parent f1c36c611e
commit 483717484a

View File

@ -512,6 +512,34 @@ drmmode_hide_cursor (xf86CrtcPtr crtc)
0, 64, 64);
}
static void
_drmmode_destroy_cursor(xf86CrtcPtr crtc)
{
drmmode_crtc_private_ptr
drmmode_crtc = crtc->driver_private;
if (drmmode_crtc->cursor == NULL)
return;
drmmode_hide_cursor(crtc);
glamor_destroy_cursor(crtc->scrn, drmmode_crtc->cursor);
free(drmmode_crtc->cursor);
drmmode_crtc->cursor = NULL;
}
static void
drmmode_destroy_cursor(ScrnInfoPtr scrn)
{
int i;
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
for (i = 0; i < xf86_config->num_crtc; i++)
_drmmode_destroy_cursor(xf86_config->crtc[i]);
}
static void
drmmode_show_cursor (xf86CrtcPtr crtc)
{
@ -629,12 +657,7 @@ drmmode_crtc_destroy(xf86CrtcPtr crtc)
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
ScrnInfoPtr scrn = crtc->scrn;
if (drmmode_crtc->cursor) {
drmmode_hide_cursor(crtc);
glamor_destroy_cursor(scrn, drmmode_crtc->cursor);
free(drmmode_crtc->cursor);
drmmode_crtc->cursor = NULL;
}
_drmmode_destroy_cursor(crtc);
free(drmmode_crtc->cursor);
crtc->driver_private = NULL;
}
@ -1539,6 +1562,8 @@ void drmmode_closefb(ScrnInfoPtr scrn)
drmmode_crtc = xf86_config->crtc[0]->driver_private;
drmmode = drmmode_crtc->drmmode;
drmmode_destroy_cursor(scrn);
drmModeRmFB(drmmode->fd, drmmode->fb_id);
drmmode->fb_id = 0;
}