xf86-video-intel: 4 commits - src/drmmode_display.c src/i830_debug.c src/i830.h src/i830_memory.c uxa/uxa-accel.c uxa/uxa-priv.h

Keith Packard keithp at kemper.freedesktop.org
Tue Aug 25 19:34:43 PDT 2009


 src/drmmode_display.c |   18 +++++++++++------
 src/i830.h            |    2 +
 src/i830_debug.c      |    8 ++++++-
 src/i830_memory.c     |   51 +++++++++++++++++++++++++++++---------------------
 uxa/uxa-accel.c       |   13 +++++++++---
 uxa/uxa-priv.h        |   29 ++++------------------------
 6 files changed, 66 insertions(+), 55 deletions(-)

New commits:
commit 6361c3b9af39265df9222b1f3b6fb9c4197087c1
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 25 19:23:27 2009 -0700

    Fix SHM functions to work with server after 1.6.0
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index a225a4d..796f949 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -1,7 +1,7 @@
 /*
- * Copyright © 2001 Keith Packard
+ * Copyright ® 2001 Keith Packard
  *
- * Partly based on code that is Copyright © The XFree86 Project Inc.
+ * Partly based on code that is Copyright ® The XFree86 Project Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -23,7 +23,7 @@
  *
  * Authors:
  *    Eric Anholt <eric at anholt.net>
- *    Michel Dänzer <michel at tungstengraphics.com>
+ *    Michel Dänzer <michel at tungstengraphics.com>
  *
  */
 
@@ -216,6 +216,8 @@ uxa_do_put_image (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 
 #ifdef MITSHM
 
+#include "xorgVersion.h"
+
 static Bool
 uxa_do_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
 		 unsigned int format, int w, int h, int sx, int sy, int sw,
@@ -251,6 +253,8 @@ uxa_do_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
     return FALSE;
 }
 
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,5,99,0,0)
+
 /* The actual ShmPutImage isn't wrapped by the damage layer, so we need to
  * inform any interested parties of the damage incurred to the drawable.
  *
@@ -271,6 +275,9 @@ uxa_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int form
 	uxa_finish_access(pDrawable);
     }
 }
+#else
+#define uxa_shm_put_image NULL
+#endif
 
 ShmFuncs uxa_shm_funcs = { NULL, uxa_shm_put_image };
 
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index d469474..363b9f7 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -328,30 +328,8 @@ extern const GCOps uxa_ops;
 /* XXX these come from shmint.h, which isn't exported by the server */
 
 #ifdef HAVE_XEXTPROTO_71
-/* Up to xextproto 7.1, these were provided in shmstr.h */
-typedef struct _ShmFuncs {
-    PixmapPtr	(* CreatePixmap)(ScreenPtr pScreen,
-				 int	   width,
-				 int	   height,
-				 int	   depth,
-				 char	   *addr);
-    void	(* PutImage)(DrawablePtr  dst,
-			     GCPtr	  pGC,
-			     int	  depth,
-			     unsigned int format,
-			     int	  w,
-			     int	  h,
-			     int	  sx,
-			     int	  sy,
-			     int	  sw,
-			     int	  sh,
-			     int	  dx,
-			     int	  dy,
-			     char	 *data);
-} ShmFuncs, *ShmFuncsPtr;
-#endif
-
-extern ShmFuncs uxa_shm_funcs;
+#include "shmint.h"
+#else
 
 void
 ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
@@ -361,6 +339,9 @@ ShmSetPixmapFormat(ScreenPtr pScreen, int format);
 
 void
 fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
+#endif
+
+extern ShmFuncs uxa_shm_funcs;
 
 #endif
 
commit 2786a66719a6dbb735eb7c551c412475c30ffa51
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 25 18:35:54 2009 -0700

    KMS: allocate one bo per crtc for cursor
    
    The KMS API doesn't provide for sharing a single bo for multiple
    cursor images, so allocate one bo for each crtc to hold the cursor
    image. KMS also only supports ARGB cursors, so don't bother to
    allocate buffers for two color cursors.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 404f8b9..24c7659 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -421,12 +421,11 @@ drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
 static void
 drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
 {
-	ScrnInfoPtr pScrn = crtc->scrn;
-	I830Ptr pI830 = I830PTR(pScrn);
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	int ret;
 
 	/* cursor should be mapped already */
-	ret = dri_bo_subdata(pI830->cursor_mem->bo, 0, 64*64*4, image);
+	ret = dri_bo_subdata(drmmode_crtc->cursor, 0, 64*64*4, image);
 	if (ret)
 		xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
 			   "failed to set cursor: %s", strerror(-ret));
@@ -450,11 +449,9 @@ drmmode_show_cursor (xf86CrtcPtr crtc)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
-	ScrnInfoPtr pScrn = crtc->scrn;
-	I830Ptr pI830 = I830PTR(pScrn);
 
 	drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
-			 pI830->cursor_mem->bo->handle, 64, 64);
+			 drmmode_crtc->cursor->handle, 64, 64);
 }
 
 static void *
@@ -600,6 +597,13 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
 	return;
 }
 
+void
+drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo *cursor)
+{
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+	drmmode_crtc->cursor = cursor;
+}
+
 static xf86OutputStatus
 drmmode_output_detect(xf86OutputPtr output)
 {
diff --git a/src/i830.h b/src/i830.h
index b46eff1..3b2d166 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -693,6 +693,8 @@ void I830DRI2CloseScreen(ScreenPtr pScreen);
 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
 extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc);
 extern int drmmode_output_dpms_status(xf86OutputPtr output);
+void
+drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo *cursor);
 
 extern Bool i830_crtc_on(xf86CrtcPtr crtc);
 extern int i830_crtc_to_pipe(xf86CrtcPtr crtc);
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 434510a..26e4cfd 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1134,18 +1134,20 @@ i830_allocate_cursor_buffers(ScrnInfoPtr pScrn)
 
     flags |= DISABLE_REUSE;
 
-    /* Try to allocate one big blob for our cursor memory.  This works
-     * around a limitation in the FreeBSD AGP driver that allows only one
-     * physical allocation larger than a page, and could allow us
-     * to pack the cursors smaller.
-     */
-    size = xf86_config->num_crtc * (HWCURSOR_SIZE + HWCURSOR_SIZE_ARGB);
+    if (!pI830->use_drm_mode) {
+	/* Try to allocate one big blob for our cursor memory.  This works
+	 * around a limitation in the FreeBSD AGP driver that allows only one
+	 * physical allocation larger than a page, and could allow us
+	 * to pack the cursors smaller.
+	 */
+	size = xf86_config->num_crtc * (HWCURSOR_SIZE + HWCURSOR_SIZE_ARGB);
 
-    pI830->cursor_mem = i830_allocate_memory(pScrn, "HW cursors",
-					     size, PITCH_NONE, GTT_PAGE_SIZE,
-					     flags, TILE_NONE);
-    if (pI830->cursor_mem != NULL)
-	return TRUE;
+	pI830->cursor_mem = i830_allocate_memory(pScrn, "HW cursors",
+						 size, PITCH_NONE, GTT_PAGE_SIZE,
+						 flags, TILE_NONE);
+	if (pI830->cursor_mem != NULL)
+	    return TRUE;
+    }
 
     /*
      * Allocate four separate buffers when the kernel doesn't support
@@ -1154,15 +1156,17 @@ i830_allocate_cursor_buffers(ScrnInfoPtr pScrn)
      */
     for (i = 0; i < xf86_config->num_crtc; i++)
     {
-	pI830->cursor_mem_classic[i] = i830_allocate_memory (pScrn, 
-							     "Core cursor",
-							     HWCURSOR_SIZE,
-							     PITCH_NONE,
-							     GTT_PAGE_SIZE,
-							     flags,
-							     TILE_NONE);
-	if (!pI830->cursor_mem_classic[i])
-	    return FALSE;
+	if (!pI830->use_drm_mode) {
+	    pI830->cursor_mem_classic[i] = i830_allocate_memory (pScrn,
+								 "Core cursor",
+								 HWCURSOR_SIZE,
+								 PITCH_NONE,
+								 GTT_PAGE_SIZE,
+								 flags,
+								 TILE_NONE);
+	    if (!pI830->cursor_mem_classic[i])
+		return FALSE;
+	}
 	pI830->cursor_mem_argb[i] = i830_allocate_memory (pScrn, "ARGB cursor",
 							  HWCURSOR_SIZE_ARGB,
 							  PITCH_NONE,
@@ -1575,7 +1579,12 @@ i830_bind_all_memory(ScrnInfoPtr pScrn)
 		FatalError("Couldn't bind memory for BO %s\n", mem->name);
 	}
     }
-    if (!pI830->use_drm_mode)
+    if (pI830->use_drm_mode) {
+	int	i;
+	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+	for (i = 0; i < xf86_config->num_crtc; i++)
+	    drmmode_crtc_set_cursor_bo(xf86_config->crtc[i], pI830->cursor_mem_argb[i]->bo);
+    } else
 	i830_update_cursor_offsets(pScrn);
     i830_set_max_gtt_map_size(pScrn);
 
commit e51126c57132492c664f86981c55b166dbb54c79
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 25 18:34:25 2009 -0700

    Add cursor registers to debug dump output.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_debug.c b/src/i830_debug.c
index d49203a..1333796 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2006 Intel Corporation
+ * Copyright © 2006 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -686,6 +686,9 @@ static struct i830SnapshotRec i830_snapshot[] = {
     DEFINEREG(PIPEA_GMCH_DATA_N),
     DEFINEREG(PIPEA_DP_LINK_M),
     DEFINEREG(PIPEA_DP_LINK_N),
+    DEFINEREG(CURSOR_A_BASE),
+    DEFINEREG(CURSOR_A_CONTROL),
+    DEFINEREG(CURSOR_A_POSITION),
 
     DEFINEREG2(FPA0, i830_debug_fp),
     DEFINEREG2(FPA1, i830_debug_fp),
@@ -714,6 +717,9 @@ static struct i830SnapshotRec i830_snapshot[] = {
     DEFINEREG(PIPEB_GMCH_DATA_N),
     DEFINEREG(PIPEB_DP_LINK_M),
     DEFINEREG(PIPEB_DP_LINK_N),
+    DEFINEREG(CURSOR_B_BASE),
+    DEFINEREG(CURSOR_B_CONTROL),
+    DEFINEREG(CURSOR_B_POSITION),
 
     DEFINEREG2(FPB0, i830_debug_fp),
     DEFINEREG2(FPB1, i830_debug_fp),
commit 5fa8d04d9c86f343802c05bd3e11c6e733f01b63
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 25 18:33:04 2009 -0700

    Reload cursors as needed when setting new modes.
    
    Cursor images may need rotation, or positions updated when new modes
    are set. The server provides a convenience function,
    xf86_reload_cursors for precisely this purpose. Just call it after the
    new mode is set.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index af5e56b..404f8b9 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -391,6 +391,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 	i830_set_max_gtt_map_size(pScrn);
 
+	if (pScrn->pScreen)
+		xf86_reload_cursors(pScrn->pScreen);
 done:
 	if (!ret) {
 		crtc->x = saved_x;


More information about the xorg-commit mailing list