rpms/xorg-x11-drv-ati/devel copy-fb-contents.patch, NONE, 1.1 xorg-x11-drv-ati.spec, 1.114, 1.115

Kristian Høgsberg krh at fedoraproject.org
Mon Sep 22 19:01:40 UTC 2008


Author: krh

Update of /cvs/pkgs/rpms/xorg-x11-drv-ati/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv22162

Modified Files:
	xorg-x11-drv-ati.spec 
Added Files:
	copy-fb-contents.patch 
Log Message:
* Fri Sep 19 2008 Kristian Høgsberg <krh at redhat.com> - 6.9.0-15
- Add copy-fb-contents.patch to initialize the root window contents
  with the fbdev contents for slick startup.


copy-fb-contents.patch:

--- NEW FILE copy-fb-contents.patch ---
diff -up xf86-video-ati-6.9.0/src/drmmode_display.c.copy-fb-contents xf86-video-ati-6.9.0/src/drmmode_display.c
--- xf86-video-ati-6.9.0/src/drmmode_display.c.copy-fb-contents	2008-09-19 15:46:48.000000000 -0400
+++ xf86-video-ati-6.9.0/src/drmmode_display.c	2008-09-22 14:05:15.000000000 -0400
@@ -31,8 +31,11 @@
 
 #ifdef XF86DRM_MODE
 #include "radeon.h"
+#include "radeon_reg.h"
 #include "sarea.h"
 
+#include "dri_bufmgr.h"
+
 static Bool drmmode_resize_fb(ScrnInfoPtr scrn, drmmode_ptr drmmode, int width, int height);
 
 static Bool
@@ -119,6 +122,76 @@ drmmode_crtc_dpms(xf86CrtcPtr drmmode_cr
 
 }
 
+struct radeon_exa_pixmap_priv {
+    dri_bo *bo;
+    int flags;
+};
+
+static PixmapPtr
+create_pixmap_for_fb(drmmode_ptr drmmode, ScrnInfoPtr pScrn, drmModeFBPtr fb)
+{
+	ScreenPtr pScreen = pScrn->pScreen;
+	PixmapPtr pPixmap;
+	struct radeon_exa_pixmap_priv *driver_priv;
+	dri_bo *bo;
+
+	pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, fb->depth, 0);
+	driver_priv = exaGetPixmapDriverPrivate(pPixmap);
+	if (!driver_priv) {
+		(*pScreen->DestroyPixmap)(pPixmap);
+		return NULL;
+	}
+
+	miModifyPixmapHeader(pPixmap, fb->width, fb->height, fb->depth,
+                             pScrn->bitsPerPixel, fb->pitch, NULL);
+
+	bo = radeon_bo_gem_create_from_handle(drmmode->bufmgr,
+					      fb->handle,
+					      fb->pitch * fb->height);
+	driver_priv->bo = bo;
+	if (bo == NULL) {
+		(*pScreen->DestroyPixmap)(pPixmap);
+		return NULL;
+	}
+
+    	return pPixmap;
+}
+
+static void
+copy_fb_contents (drmmode_ptr drmmode,
+		  ScrnInfoPtr pScrn,
+		  unsigned int dest_id, int x, int y, unsigned int src_id)
+{
+	RADEONInfoPtr info = RADEONPTR(pScrn);
+	drmModeFBPtr dest_fb, src_fb;
+	dri_bo *dest_bo, *src_bo;
+	PixmapPtr src_pixmap, dest_pixmap;
+	ScreenPtr pScreen = pScrn->pScreen;
+
+	dest_fb = drmModeGetFB(drmmode->fd, dest_id);
+	src_fb = drmModeGetFB(drmmode->fd, src_id);
+	if (src_fb == NULL) {
+		ErrorF("failed to get old fb, id %d\n", src_id);
+		return;
+	}
+
+	dest_pixmap = create_pixmap_for_fb(drmmode, pScrn, dest_fb);
+	src_pixmap = create_pixmap_for_fb(drmmode, pScrn, src_fb);
+
+	info->exa->PrepareCopy (src_pixmap, dest_pixmap,
+				0, 0, GXcopy, 0xffffff);
+	info->exa->Copy (dest_pixmap, 0, 0, x, y,
+			 src_fb->width, src_fb->height);
+	info->exa->DoneCopy (dest_pixmap);
+	RADEONCPFlushIndirect(pScrn, 0);
+
+	(*pScreen->DestroyPixmap)(dest_pixmap);
+	(*pScreen->DestroyPixmap)(src_pixmap);
+
+	drmFree(dest_fb);
+	drmFree(src_fb);
+}
+
 static Bool
 drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		     Rotation rotation, int x, int y)
@@ -170,15 +243,14 @@ drmmode_set_mode_major(xf86CrtcPtr crtc,
 
 	drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
 
-
 	fb_id = drmmode->fb_id;
 	if (drmmode_crtc->rotate_fb_id)
 		fb_id = drmmode_crtc->rotate_fb_id;
-	ErrorF("fb id is %d\n", fb_id);
+	copy_fb_contents (drmmode, crtc->scrn, fb_id, x, y,
+			  drmmode_crtc->mode_crtc->buffer_id);
 	drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
 		       fb_id, x, y, output_ids, output_count, &kmode);
 
-
 done:
 	if (!ret) {
 		crtc->x = saved_x;
diff -up xf86-video-ati-6.9.0/src/radeon_bufmgr_gem.c.copy-fb-contents xf86-video-ati-6.9.0/src/radeon_bufmgr_gem.c
--- xf86-video-ati-6.9.0/src/radeon_bufmgr_gem.c.copy-fb-contents	2008-09-19 15:46:48.000000000 -0400
+++ xf86-video-ati-6.9.0/src/radeon_bufmgr_gem.c	2008-09-19 15:46:48.000000000 -0400
@@ -353,6 +353,27 @@ void radeon_bufmgr_gem_wait_rendering(dr
 	return;
 }
 
+dri_bo *
+radeon_bo_gem_create_from_handle(dri_bufmgr *bufmgr,
+				 uint32_t handle, unsigned long size)
+{
+    dri_bo_gem *bo_gem;
+
+    bo_gem = calloc(1, sizeof(*bo_gem));
+    if (!bo_gem)
+	return NULL;
+
+    bo_gem->bo.size = size;
+    bo_gem->bo.offset = 0;
+    bo_gem->bo.virtual = NULL;
+    bo_gem->bo.bufmgr = bufmgr;
+    bo_gem->name = 0;
+    bo_gem->refcount = 1;
+    bo_gem->gem_handle = handle;
+
+    return &bo_gem->bo;
+}
+
 /**
  * Returns a dri_bo wrapping the given buffer object handle.
  *
@@ -364,32 +385,20 @@ radeon_bo_gem_create_from_name(dri_bufmg
 			       unsigned int handle)
 {
     dri_bufmgr_gem *bufmgr_gem = (dri_bufmgr_gem *)bufmgr;
-    dri_bo_gem *bo_gem;
     int ret;
     struct drm_gem_open open_arg;
 
-    bo_gem = calloc(1, sizeof(*bo_gem));
-    if (!bo_gem)
-	return NULL;
-
     memset(&open_arg, 0, sizeof(open_arg));
     open_arg.name = handle;
     ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_GEM_OPEN, &open_arg);
     if (ret != 0) {
 	fprintf(stderr, "Couldn't reference %s handle 0x%08x: %s\n",
 	       name, handle, strerror(-ret));
-	free(bo_gem);
 	return NULL;
     }
-    bo_gem->bo.size = open_arg.size;
-    bo_gem->bo.offset = 0;
-    bo_gem->bo.virtual = NULL;
-    bo_gem->bo.bufmgr = bufmgr;
-    bo_gem->name = name;
-    bo_gem->refcount = 1;
-    bo_gem->gem_handle = open_arg.handle;
 
-    return &bo_gem->bo;
+    return radeon_bo_gem_create_from_handle(bufmgr,
+					    open_arg.handle, open_arg.size);
 }
 
 #define BUF_OUT_RING(x)	 do {			\
diff -up xf86-video-ati-6.9.0/src/radeon_bufmgr_gem.h.copy-fb-contents xf86-video-ati-6.9.0/src/radeon_bufmgr_gem.h
diff -up xf86-video-ati-6.9.0/src/radeon_bufmgr.h.copy-fb-contents xf86-video-ati-6.9.0/src/radeon_bufmgr.h
--- xf86-video-ati-6.9.0/src/radeon_bufmgr.h.copy-fb-contents	2008-09-19 15:46:48.000000000 -0400
+++ xf86-video-ati-6.9.0/src/radeon_bufmgr.h	2008-09-19 15:46:48.000000000 -0400
@@ -16,6 +16,8 @@ struct radeon_bufmgr {
 dri_bufmgr *radeon_bufmgr_gem_init(int fd);
 dri_bo *radeon_bo_gem_create_from_name(dri_bufmgr *bufmgr, const char *name,
 				       unsigned int handle);
+dri_bo *radeon_bo_gem_create_from_handle(dri_bufmgr *bufmgr,
+					 uint32_t handle, unsigned long size);
 
 void radeon_bufmgr_emit_reloc(dri_bo *buf, uint32_t *head, uint32_t *count_p, uint32_t read_domains, uint32_t write_domain);
 
diff -up xf86-video-ati-6.9.0/src/radeon_driver.c.copy-fb-contents xf86-video-ati-6.9.0/src/radeon_driver.c
--- xf86-video-ati-6.9.0/src/radeon_driver.c.copy-fb-contents	2008-09-19 15:46:48.000000000 -0400
+++ xf86-video-ati-6.9.0/src/radeon_driver.c	2008-09-19 15:46:48.000000000 -0400
@@ -3644,6 +3644,24 @@ Bool RADEONScreenInit(int scrnIndex, Scr
     /* xf86CrtcRotate() accesses pScrn->pScreen */
     pScrn->pScreen = pScreen;
 
+    /* Enable aceleration */
+    if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) {
+	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
+		       "Initializing Acceleration\n");
+	if (RADEONAccelInit(pScreen)) {
+	    xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n");
+	    info->accelOn = TRUE;
+	} else {
+	    xf86DrvMsg(scrnIndex, X_ERROR,
+		       "Acceleration initialization failed\n");
+	    xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+	    info->accelOn = FALSE;
+	}
+    } else {
+	xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+	info->accelOn = FALSE;
+    }
+
     if (!xf86SetDesiredModes (pScrn))
 	return FALSE;
 
@@ -3714,25 +3732,6 @@ Bool RADEONScreenInit(int scrnIndex, Scr
         RADEONChangeSurfaces(pScrn);
     }
 
-
-    /* Enable aceleration */
-    if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) {
-	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
-		       "Initializing Acceleration\n");
-	if (RADEONAccelInit(pScreen)) {
-	    xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n");
-	    info->accelOn = TRUE;
-	} else {
-	    xf86DrvMsg(scrnIndex, X_ERROR,
-		       "Acceleration initialization failed\n");
-	    xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
-	    info->accelOn = FALSE;
-	}
-    } else {
-	xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
-	info->accelOn = FALSE;
-    }
-
     /* Init DPMS */
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
 		   "Initializing DPMS\n");


Index: xorg-x11-drv-ati.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-ati/devel/xorg-x11-drv-ati.spec,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- xorg-x11-drv-ati.spec	11 Sep 2008 19:44:55 -0000	1.114
+++ xorg-x11-drv-ati.spec	22 Sep 2008 19:01:10 -0000	1.115
@@ -5,7 +5,7 @@
 Summary:   Xorg X11 ati video driver
 Name:      xorg-x11-drv-ati
 Version:   6.9.0
-Release:   14%{?dist}
+Release:   15%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X Hardware Support
@@ -20,6 +20,7 @@
 Patch3:	    radeon-fix-pipe-config.patch
 Patch4:     radeon-6.9.0-remove-limit-heuristics.patch
 Patch5:	    radeon-6.9.0-panel-size-sanity.patch
+Patch6:     copy-fb-contents.patch
 
 ExcludeArch: s390 s390x
 
@@ -44,6 +45,7 @@
 %patch3 -p1 -b .pipe-config
 %patch4 -p1 -b .remove-limit-heuristics
 %patch5 -p1 -b .panel-size
+%patch6 -p1 -b .copy-fb-contents
 
 %build
 autoreconf
@@ -75,6 +77,10 @@
 %{_mandir}/man4/radeon.4*
 
 %changelog
+* Fri Sep 19 2008 Kristian Høgsberg <krh at redhat.com> - 6.9.0-15
+- Add copy-fb-contents.patch to initialize the root window contents
+  with the fbdev contents for slick startup.
+
 * Thu Sep 11 2008 Adam Jackson <ajax at redhat.com> 6.9.0-14
 - radeon-6.9.0-panel-size-sanity.patch: Panels smaller than 800x480 are
   highly implausible, disable them if we find them.  If you have one,




More information about the fedora-extras-commits mailing list