aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c14
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c5
-rw-r--r--src/gallium/state_trackers/xorg/xorg_tracker.h1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex_copy.c4
4 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 44f7da0f960..7268a79a23d 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -276,7 +276,21 @@ err_bo_destroy:
static void
crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
modesettingPtr ms = modesettingPTR(crtc->scrn);
+
+ /* Older X servers have cursor reference counting bugs leading to use of
+ * freed memory and consequently random crashes. Should be fixed as of
+ * xserver 1.8, but this workaround shouldn't hurt anyway.
+ */
+ if (config->cursor)
+ config->cursor->refcnt++;
+
+ if (ms->cursor)
+ FreeCursor(ms->cursor, None);
+
+ ms->cursor = config->cursor;
+
if (ms->screen)
crtc_load_cursor_argb_ga3d(crtc, image);
#ifdef HAVE_LIBKMS
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 004a28f00e1..8ac5179545a 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -922,6 +922,11 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
drv_leave_vt(scrnIndex, 0);
}
+ if (ms->cursor) {
+ FreeCursor(ms->cursor, None);
+ ms->cursor = NULL;
+ }
+
if (cust && cust->winsys_screen_close)
cust->winsys_screen_close(cust);
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index 2f5cc64d9c5..c1884ebd115 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -90,6 +90,7 @@ typedef struct _modesettingRec
Bool noAccel;
Bool SWCursor;
+ CursorPtr cursor;
CloseScreenProcPtr CloseScreen;
/* Broken-out options. */
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
index a4bb03d5d39..5cfad6fc3c8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
@@ -93,6 +93,10 @@ do_copy_texsubimage(GLcontext *ctx,
src_bpp = _mesa_get_format_bytes(src_mesaformat);
dst_bpp = _mesa_get_format_bytes(dst_mesaformat);
if (!radeon->vtbl.check_blit(dst_mesaformat)) {
+ /* depth formats tend to be special */
+ if (_mesa_get_format_bits(dst_mesaformat, GL_DEPTH_BITS) > 0)
+ return GL_FALSE;
+
if (src_bpp != dst_bpp)
return GL_FALSE;