xf86-video-ati: Branch 'master' - 2 commits

Dave Airlie airlied at kemper.freedesktop.org
Sat Jun 2 09:24:41 PDT 2012


 src/drmmode_display.c |   60 +++++++++++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 25 deletions(-)

New commits:
commit 9307609420b4b209767d2057b4803bcb16cc1455
Author: Dave Airlie <airlied at redhat.com>
Date:   Sat Jun 2 17:16:34 2012 +0100

    radeon: improve smooth startup fallbacks.
    
    If we can't handover the framebuffer, memset it to black.
    
    mostly ported from nouveau.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index d407a88..fad13db 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -194,42 +194,41 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 
 static PixmapPtr
 create_pixmap_for_fbcon(drmmode_ptr drmmode,
-			ScrnInfoPtr pScrn, int crtc_id)
+			ScrnInfoPtr pScrn, int fbcon_id)
 {
-	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-	drmmode_crtc_private_ptr drmmode_crtc;
-	PixmapPtr pixmap;
+	PixmapPtr pixmap = NULL;
 	struct radeon_bo *bo;
 	drmModeFBPtr fbcon;
 	struct drm_gem_flink flink;
 
-	drmmode_crtc = xf86_config->crtc[crtc_id]->driver_private;
-
-	fbcon = drmModeGetFB(drmmode->fd, drmmode_crtc->mode_crtc->buffer_id);
+	fbcon = drmModeGetFB(drmmode->fd, fbcon_id);
 	if (fbcon == NULL)
 		return NULL;
 
+	if (fbcon->depth != pScrn->depth ||
+	    fbcon->width != pScrn->virtualX ||
+	    fbcon->height != pScrn->virtualY)
+		goto out_free_fb;
+
 	flink.handle = fbcon->handle;
 	if (ioctl(drmmode->fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) {
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Couldn't flink fbcon handle\n");
-		return NULL;
+		goto out_free_fb;
 	}
 
 	bo = radeon_bo_open(drmmode->bufmgr, flink.name, 0, 0, 0, 0);
 	if (bo == NULL) {
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Couldn't allocate bo for fbcon handle\n");
-		return NULL;
+		goto out_free_fb;
 	}
 
 	pixmap = drmmode_create_bo_pixmap(pScrn, fbcon->width, fbcon->height,
 					  fbcon->depth, fbcon->bpp,
 					  fbcon->pitch, 0, bo, NULL);
-	if (!pixmap) 
-		return NULL;
-
 	radeon_bo_unref(bo);
+out_free_fb:
 	drmModeFreeFB(fbcon);
 	return pixmap;
 }
@@ -240,27 +239,28 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 	RADEONInfoPtr info = RADEONPTR(pScrn);
 	PixmapPtr src, dst;
 	ScreenPtr pScreen = pScrn->pScreen;
-	int crtc_id = 0;
+	int fbcon_id = 0;
 	int i;
 	int pitch;
 	uint32_t tiling_flags = 0;
 	Bool ret;
 
 	if (info->accelOn == FALSE)
-		return;
+		goto fallback;
 
 	for (i = 0; i < xf86_config->num_crtc; i++) {
-		xf86CrtcPtr crtc = xf86_config->crtc[i];
-		drmmode_crtc_private_ptr drmmode_crtc;
+		drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[i]->driver_private;
 
-		drmmode_crtc = crtc->driver_private;
 		if (drmmode_crtc->mode_crtc->buffer_id)
-			crtc_id = i;
+			fbcon_id = drmmode_crtc->mode_crtc->buffer_id;
 	}
 
-	src = create_pixmap_for_fbcon(drmmode, pScrn, crtc_id);
+	if (!fbcon_id)
+		goto fallback;
+
+	src = create_pixmap_for_fbcon(drmmode, pScrn, fbcon_id);
 	if (!src)
-		return;
+		goto fallback;
 
 	if (info->allowColorTiling) {
 		if (info->ChipFamily >= CHIP_FAMILY_R600) {
@@ -299,7 +299,15 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 	drmmode_destroy_bo_pixmap(dst);
  out_free_src:
 	drmmode_destroy_bo_pixmap(src);
+	return;
+
+fallback:
+	/* map and memset the bo */
+	if (radeon_bo_map(info->front_bo, 1))
+		return;
 
+	memset(info->front_bo->ptr, 0x00, info->front_bo->size);
+	radeon_bo_unmap(info->front_bo);
 }
 
 static Bool
commit 89a4c79a43a2b6963e41d7812e8fe5beedb556af
Author: Dave Airlie <airlied at redhat.com>
Date:   Sat Jun 2 17:14:14 2012 +0100

    radeon: fix smooth startup with tiling enabled.
    
    We need to use the surface we worked out when we allocated the front bo,
    not work out a new surface from scratch.
    
    This fixes smooth handover from plymouth to gdm on F17.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index a304c1d..d407a88 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -53,7 +53,7 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
 					  int width, int height,
 					  int depth, int bpp,
 					  int pitch, int tiling,
-					  struct radeon_bo *bo)
+					  struct radeon_bo *bo, struct radeon_surface *psurf)
 {
 	RADEONInfoPtr info = RADEONPTR(pScrn);
 	ScreenPtr pScreen = pScrn->pScreen;
@@ -73,7 +73,9 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
 	radeon_set_pixmap_bo(pixmap, bo);
 	if (info->ChipFamily >= CHIP_FAMILY_R600) {
 		surface = radeon_get_pixmap_surface(pixmap);
-		if (surface) {
+		if (surface && psurf) 
+			*surface = *psurf;
+		else if (surface) {
 			memset(surface, 0, sizeof(struct radeon_surface));
 			surface->npix_x = width;
 			surface->npix_y = height;
@@ -223,7 +225,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 
 	pixmap = drmmode_create_bo_pixmap(pScrn, fbcon->width, fbcon->height,
 					  fbcon->depth, fbcon->bpp,
-					  fbcon->pitch, 0, bo);
+					  fbcon->pitch, 0, bo, NULL);
 	if (!pixmap) 
 		return NULL;
 
@@ -278,7 +280,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 	dst = drmmode_create_bo_pixmap(pScrn, pScrn->virtualX,
 				       pScrn->virtualY, pScrn->depth,
 				       pScrn->bitsPerPixel, pitch,
-				       tiling_flags, info->front_bo);
+				       tiling_flags, info->front_bo, &info->front_surface);
 	if (!dst)
 		goto out_free_src;
 
@@ -551,7 +553,7 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 						 pScrn->depth,
 						 pScrn->bitsPerPixel,
 						 rotate_pitch,
-						 0, drmmode_crtc->rotate_bo);
+						 0, drmmode_crtc->rotate_bo, NULL);
 	if (rotate_pixmap == NULL) {
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Couldn't allocate shadow pixmap for rotated CRTC\n");


More information about the xorg-commit mailing list