[Intel-gfx] [PATCH 4/6] KMS: Map frame buffer at alloc time when running without UXA

Keith Packard keithp at keithp.com
Wed Jul 8 22:28:21 CEST 2009


Under KMS, the whole frame buffer is never allocated to the X server, and so
accessing the frame buffer must be done by directly mapping it using
drm_intel_gem_bo_map_gtt when it is created.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 src/drmmode_display.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e9296dc..6681e7e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1021,6 +1021,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	ScreenPtr   screen = screenInfo.screens[scrn->scrnIndex];
 	uint32_t    old_fb_id;
 	int	    i, pitch, old_width, old_height, old_pitch;
+	pointer	    *data;
 
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
@@ -1052,10 +1053,21 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 		goto fail;
 
 	i830_set_pixmap_bo(screen->GetScreenPixmap(screen), pI830->front_buffer->bo);
-	scrn->fbOffset = pI830->front_buffer->offset;
+	if (pI830->accel == ACCEL_UXA)
+		data = NULL;
+	else {
+		drm_intel_gem_bo_map_gtt(pI830->front_buffer->bo);
+		data = pI830->front_buffer->bo->virtual;
+	}
 
 	screen->ModifyPixmapHeader(screen->GetScreenPixmap(screen),
-				   width, height, -1, -1, pitch * pI830->cpp, NULL);
+				   width, height, -1, -1, pitch * pI830->cpp,
+				   data);
+
+	/* ick. xf86EnableDisableFBAccess smashes the screen pixmap devPrivate,
+	 * so update the value it uses
+	 */
+	scrn->pixmapPrivate.ptr = data;
 	xf86DrvMsg(scrn->scrnIndex, X_INFO, "New front buffer at 0x%lx\n",
 		   pI830->front_buffer->offset);
 
-- 
1.6.3.3




More information about the Intel-gfx mailing list