xf86-video-intel: 8 commits - src/drmmode_display.c src/i830_batchbuffer.c src/i830_driver.c src/i830.h src/i830_memory.c

Eric Anholt anholt at kemper.freedesktop.org
Thu Mar 4 11:29:47 PST 2010


 src/drmmode_display.c  |   25 +++++++++++-------
 src/i830.h             |    5 ---
 src/i830_batchbuffer.c |    7 ++---
 src/i830_driver.c      |   64 ++++++++++++++++------------------------------
 src/i830_memory.c      |   68 -------------------------------------------------
 5 files changed, 42 insertions(+), 127 deletions(-)

New commits:
commit 7b7c724da97f358f5d2d4d4dae75cfc85bde2c62
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 10:29:09 2010 -0800

    Remove remaining fbOffset setting.
    
    In the long long ago, fbOffset was used for DGA.  The server now has
    only one reference to fbOffset, a leftover setting of it in fbdevhw.
    We can safely ignore it now, which is good since we weren't updating
    it in other places where the front buffer offset could change.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9cdb7e8..b1531bd 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1368,7 +1368,6 @@ drmmode_do_pageflip(ScreenPtr screen, dri_bo *new_front, dri_bo *old_front,
 	dri_bo_pin(new_front, 0);
 	dri_bo_unpin(new_front);
 
-	scrn->fbOffset = new_front->offset;
 	intel->front_buffer = new_front;
 	drmmode->old_fb_id = old_fb_id;
 
diff --git a/src/i830.h b/src/i830.h
index 6d88a4c..7593cde 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -432,7 +432,6 @@ Bool i830_tiled_width(intel_screen_private *intel, int *width, int cpp);
 int i830_pad_drawable_width(int width, int cpp);
 
 /* i830_memory.c */
-Bool i830_reinit_memory(ScrnInfoPtr scrn);
 unsigned long i830_get_fence_size(intel_screen_private *intel, unsigned long size);
 unsigned long i830_get_fence_pitch(intel_screen_private *intel, unsigned long pitch,
 				   uint32_t tiling_mode);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 284ad71..53d8663 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1389,8 +1389,7 @@ static Bool I830EnterVT(int scrnIndex, int flags)
 			   strerror(errno));
 	}
 
-	if (!i830_reinit_memory(scrn))
-		return FALSE;
+	i830_set_gem_max_sizes(scrn);
 
 	if (!xf86SetDesiredModes(scrn))
 		return FALSE;
diff --git a/src/i830_memory.c b/src/i830_memory.c
index ae5e9f0..a21f29b 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -276,21 +276,6 @@ drm_intel_bo *i830_allocate_framebuffer(ScrnInfoPtr scrn)
 	return front_buffer;
 }
 
-/**
- * Called at EnterVT to reinit memory related stuff..
- */
-Bool i830_reinit_memory(ScrnInfoPtr scrn)
-{
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-
-	i830_set_gem_max_sizes(scrn);
-
-	if (intel->front_buffer)
-		scrn->fbOffset = intel->front_buffer->offset;
-
-	return TRUE;
-}
-
 static void i830_set_max_gtt_map_size(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
commit 15026d64d3c0d8ad96e0a73fcae3103d1c41fd46
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 10:28:09 2010 -0800

    Remove a piece of fbOffset cruft from non-DRM support.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 046adce..284ad71 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1200,12 +1200,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
 	if (scrn->virtualX > scrn->displayWidth)
 		scrn->displayWidth = scrn->virtualX;
 
-	/* If the front buffer is not a BO, we need to
-	 * set the initial framebuffer pixmap to point at
-	 * it
-	 */
-	scrn->fbOffset = intel->front_buffer->offset;
-
 	DPRINTF(PFX, "assert( if(!fbScreenInit(screen, ...) )\n");
 	if (!fbScreenInit(screen, NULL,
 			  scrn->virtualX, scrn->virtualY,
commit e8e615289213ba1704e402b923c51ce9d196f06f
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 10:27:51 2010 -0800

    Remove i830_allocate_2d_memory() now that it only called one function.

diff --git a/src/i830.h b/src/i830.h
index 9b3282a..6d88a4c 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -425,7 +425,6 @@ extern int i830_crtc_to_pipe(xf86CrtcPtr crtc);
 extern Bool I830AccelInit(ScreenPtr pScreen);
 
 void i830_reset_allocations(ScrnInfoPtr scrn);
-Bool i830_allocate_2d_memory(ScrnInfoPtr scrn);
 void i830_init_bufmgr(ScrnInfoPtr scrn);
 
 Bool i830_tiled_width(intel_screen_private *intel, int *width, int cpp);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 6381549..046adce 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -987,17 +987,17 @@ static Bool i830_try_memory_allocation(ScrnInfoPtr scrn)
 		   "Attempting memory allocation with %stiled buffers.\n",
 		   tiled ? "" : "un");
 
-	if (!i830_allocate_2d_memory(scrn))
-		goto failed;
+	intel->front_buffer = i830_allocate_framebuffer(scrn);
+	if (!intel->front_buffer) {
+		xf86DrvMsg(scrn->scrnIndex, X_INFO,
+			   "%siled allocation failed.\n",
+			   tiled ? "T" : "Unt");
+		return FALSE;
+	}
 
 	xf86DrvMsg(scrn->scrnIndex, X_INFO, "%siled allocation successful.\n",
 		   tiled ? "T" : "Unt");
 	return TRUE;
-
-failed:
-	xf86DrvMsg(scrn->scrnIndex, X_INFO, "%siled allocation failed.\n",
-		   tiled ? "T" : "Unt");
-	return FALSE;
 }
 
 /*
diff --git a/src/i830_memory.c b/src/i830_memory.c
index d1a2b6b..ae5e9f0 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -276,21 +276,6 @@ drm_intel_bo *i830_allocate_framebuffer(ScrnInfoPtr scrn)
 	return front_buffer;
 }
 
-/*
- * Allocate memory for 2D operation.  This includes only the (front)
- * framebuffer now.
- */
-Bool i830_allocate_2d_memory(ScrnInfoPtr scrn)
-{
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-
-	intel->front_buffer = i830_allocate_framebuffer(scrn);
-	if (intel->front_buffer == NULL)
-		return FALSE;
-
-	return TRUE;
-}
-
 /**
  * Called at EnterVT to reinit memory related stuff..
  */
commit e37b562083aa3293e0c009171724a3f122d8a32d
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 10:23:12 2010 -0800

    Init CRTC cursors with CRTC setup instead of i830_memory.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fd31b1d..9cdb7e8 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -582,6 +582,15 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc,
 			    size, red, green, blue);
 }
 
+static void
+drmmode_crtc_destroy(xf86CrtcPtr crtc)
+{
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+	drm_intel_bo_unreference(drmmode_crtc->cursor);
+	drmmode_crtc->cursor = NULL;
+}
+
 static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
 	.dpms = drmmode_crtc_dpms,
 	.set_mode_major = drmmode_set_mode_major,
@@ -594,13 +603,14 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
 	.shadow_allocate = drmmode_crtc_shadow_allocate,
 	.shadow_destroy = drmmode_crtc_shadow_destroy,
 	.gamma_set = drmmode_crtc_gamma_set,
-	.destroy = NULL, /* XXX */
+	.destroy = drmmode_crtc_destroy,
 };
 
 
 static void
 drmmode_crtc_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num)
 {
+	intel_screen_private *intel = intel_get_screen_private(scrn);
 	xf86CrtcPtr crtc;
 	drmmode_crtc_private_ptr drmmode_crtc;
 
@@ -614,14 +624,12 @@ drmmode_crtc_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num)
 	drmmode_crtc->drmmode = drmmode;
 	crtc->driver_private = drmmode_crtc;
 
-	return;
-}
+	drmmode_crtc->cursor = drm_intel_bo_alloc(intel->bufmgr, "ARGB cursor",
+						  HWCURSOR_SIZE_ARGB,
+						  GTT_PAGE_SIZE);
+	drm_intel_bo_disable_reuse(drmmode_crtc->cursor);
 
-void
-drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo *cursor)
-{
-	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-	drmmode_crtc->cursor = cursor;
+	return;
 }
 
 static xf86OutputStatus
diff --git a/src/i830.h b/src/i830.h
index 2547b6f..9b3282a 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -234,8 +234,6 @@ typedef struct intel_screen_private {
 	long GTTMapSize;
 
 	drm_intel_bo *front_buffer;
-	/* One big buffer for all cursors for kernels that support this */
-	drm_intel_bo *cursor_mem_argb[2];
 
 	dri_bufmgr *bufmgr;
 
@@ -421,7 +419,6 @@ extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr * bufmgr,
 					 xf86CrtcPtr crtc);
 extern int drmmode_output_dpms_status(xf86OutputPtr output);
 extern int drmmode_crtc_id(xf86CrtcPtr crtc);
-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_driver.c b/src/i830_driver.c
index e7bfb9b..6381549 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -704,6 +704,8 @@ static Bool I830DrmModeInit(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
+	i830_init_bufmgr(scrn);
+
 	if (drmmode_pre_init(scrn, intel->drmSubFD, intel->cpp) == FALSE) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "Kernel modesetting setup failed\n");
@@ -711,8 +713,6 @@ static Bool I830DrmModeInit(ScrnInfoPtr scrn)
 		return FALSE;
 	}
 
-	i830_init_bufmgr(scrn);
-
 	return TRUE;
 }
 
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 7d0e336..d1a2b6b 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -169,16 +169,10 @@ i830_check_display_stride(ScrnInfoPtr scrn, int stride, Bool tiling)
 void i830_reset_allocations(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-	int p;
 
 	/* Null out the pointers for all the allocations we just freed.  This is
 	 * kind of gross, but at least it's just one place now.
 	 */
-	for (p = 0; p < 2; p++) {
-		drm_intel_bo_unreference(intel->cursor_mem_argb[p]);
-		intel->cursor_mem_argb[p] = NULL;
-	}
-
 	drm_intel_bo_unreference(intel->front_buffer);
 	intel->front_buffer = NULL;
 }
@@ -282,39 +276,14 @@ drm_intel_bo *i830_allocate_framebuffer(ScrnInfoPtr scrn)
 	return front_buffer;
 }
 
-static Bool i830_allocate_cursor_buffers(ScrnInfoPtr scrn)
-{
-	intel_screen_private *intel = intel_get_screen_private(scrn);
-	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-	int i;
-
-	for (i = 0; i < xf86_config->num_crtc; i++) {
-		intel->cursor_mem_argb[i] =
-			drm_intel_bo_alloc(intel->bufmgr, "ARGB cursor",
-					 HWCURSOR_SIZE_ARGB, GTT_PAGE_SIZE);
-
-		if (!intel->cursor_mem_argb[i])
-			return FALSE;
-
-		drm_intel_bo_disable_reuse(intel->cursor_mem_argb[i]);
-	}
-	return TRUE;
-}
-
 /*
- * Allocate memory for 2D operation.  This includes the (front) framebuffer,
- * and HW cursor.
+ * Allocate memory for 2D operation.  This includes only the (front)
+ * framebuffer now.
  */
 Bool i830_allocate_2d_memory(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
-	if (!i830_allocate_cursor_buffers(scrn)) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "Failed to allocate HW cursor space.\n");
-		return FALSE;
-	}
-
 	intel->front_buffer = i830_allocate_framebuffer(scrn);
 	if (intel->front_buffer == NULL)
 		return FALSE;
@@ -323,18 +292,11 @@ Bool i830_allocate_2d_memory(ScrnInfoPtr scrn)
 }
 
 /**
- * Called at EnterVT to reinit memory related stuff. Also reinits the drmmode
- * cursors.
+ * Called at EnterVT to reinit memory related stuff..
  */
 Bool i830_reinit_memory(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-	int i;
-
-	for (i = 0; i < xf86_config->num_crtc; i++)
-		drmmode_crtc_set_cursor_bo(xf86_config->crtc[i],
-					   intel->cursor_mem_argb[i]);
 
 	i830_set_gem_max_sizes(scrn);
 
commit a36bdaba6136054ae7c67943ca0215cfd177bc5b
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 09:47:10 2010 -0800

    Remove intel_sync() at teardown time.
    
    The kernel's still running after we're gone.  This didn't matter.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 86ef0fa..e7bfb9b 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1432,8 +1432,6 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 		intel->front_buffer = NULL;
 	}
 
-	intel_sync(scrn);
-
 	intel_batch_teardown(scrn);
 
 	if (IS_I965G(intel))
commit 4ada6d7a856a941b834871ff8a7c5505ff26ae23
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 09:32:42 2010 -0800

    Remove 3D state clobber on EnterVT, and always clobber at batch start.
    
    We know that it's clobbered at each batchbuffer, anyway.  And even if
    this server isn't running DRI2, it can still be clobbered at batch
    start in the KMS world.

diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index b8995e2..bf0b55b 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -59,11 +59,10 @@ static void intel_next_batch(ScrnInfoPtr scrn)
 	intel->batch_used = 0;
 	intel->batch_ptr = intel->batch_bo->virtual;
 
-	/* If we are using DRI2, we don't know when another client has executed,
-	 * so we have to reinitialize our 3D state per batch.
+	/* We don't know when another client has executed, so we have
+	 * to reinitialize our 3D state per batch.
 	 */
-	if (intel->directRenderingType == DRI_DRI2)
-		intel->last_3d = LAST_3D_OTHER;
+	intel->last_3d = LAST_3D_OTHER;
 }
 
 void intel_batch_init(ScrnInfoPtr scrn)
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 33138d7..86ef0fa 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1401,9 +1401,6 @@ static Bool I830EnterVT(int scrnIndex, int flags)
 	if (!xf86SetDesiredModes(scrn))
 		return FALSE;
 
-	/* Mark all state as being clobbered. */
-	intel->last_3d = LAST_3D_OTHER;
-
 	return TRUE;
 }
 
commit d92d42303e5ca9f4208ed97823ad8f691121370f
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 09:31:56 2010 -0800

    Remove pre-2.6.29 error message handling since we require KMS.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index c65de28..33138d7 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1390,15 +1390,9 @@ static Bool I830EnterVT(int scrnIndex, int flags)
 
 	ret = drmSetMaster(intel->drmSubFD);
 	if (ret) {
-		if (errno == EINVAL) {
-			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-				   "drmSetMaster failed: 2.6.29 or newer kernel required for "
-				   "multi-server DRI\n");
-		} else {
-			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-				   "drmSetMaster failed: %s\n",
-				   strerror(errno));
-		}
+		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+			   "drmSetMaster failed: %s\n",
+			   strerror(errno));
 	}
 
 	if (!i830_reinit_memory(scrn))
commit faecd155c49229499e29815eb6e79662ed33ddd5
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar 4 09:31:15 2010 -0800

    Move batch and 965 render state setup/teardown to screen init/close.
    
    Whether we're VT switched or not shouldn't impact rendering.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 99db7c6..c65de28 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1182,6 +1182,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
 
 	i830_fixup_mtrrs(scrn);
 
+	intel_batch_init(scrn);
+
+	if (IS_I965G(intel))
+		gen4_render_state_init(scrn);
+
 	miClearVisualTypes();
 	if (!miSetVisualTypes(scrn->depth,
 			      miGetDefaultVisualMask(scrn->depth),
@@ -1366,13 +1371,6 @@ static void I830LeaveVT(int scrnIndex, int flags)
 
 	xf86_hide_cursors(scrn);
 
-	intel_sync(scrn);
-
-	intel_batch_teardown(scrn);
-
-	if (IS_I965G(intel))
-		gen4_render_state_cleanup(scrn);
-
 	ret = drmDropMaster(intel->drmSubFD);
 	if (ret)
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
@@ -1406,11 +1404,6 @@ static Bool I830EnterVT(int scrnIndex, int flags)
 	if (!i830_reinit_memory(scrn))
 		return FALSE;
 
-	intel_batch_init(scrn);
-
-	if (IS_I965G(intel))
-		gen4_render_state_init(scrn);
-
 	if (!xf86SetDesiredModes(scrn))
 		return FALSE;
 
@@ -1448,6 +1441,13 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 		intel->front_buffer = NULL;
 	}
 
+	intel_sync(scrn);
+
+	intel_batch_teardown(scrn);
+
+	if (IS_I965G(intel))
+		gen4_render_state_cleanup(scrn);
+
 	xf86_cursors_fini(screen);
 
 	/* Free most of the allocations */


More information about the xorg-commit mailing list