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

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Aug 27 00:55:08 PDT 2009


 src/r600_exa.c              |   43 ++++++++++++++----------------
 src/radeon_dri2.c           |   23 ++++++++++++++++
 src/radeon_exa.c            |   10 ++-----
 src/radeon_exa_funcs.c      |   58 ++++++++++++++++-------------------------
 src/radeon_exa_render.c     |   62 ++++++++++++++++++++++++--------------------
 src/radeon_textured_video.c |    2 -
 6 files changed, 106 insertions(+), 92 deletions(-)

New commits:
commit 7d36f13afa5da742aa6c989a2652e92c96e5f80e
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Aug 27 09:52:11 2009 +0200

    KMS: Remove explicit radeon_bo_wait calls before radeon_bo_map.
    
    libdrm_radeon always takes care of this implicitly now.

diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index b7013c9..ca4c523 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -350,8 +350,6 @@ static Bool RADEONPrepareAccess_CS(PixmapPtr pPix, int index)
     if (driver_priv->bo->cref > 1)
         radeon_cs_flush_indirect(pScrn);
     
-    radeon_bo_wait(driver_priv->bo);
-
     /* flush IB */
     ret = radeon_bo_map(driver_priv->bo, 1);
     if (ret) {
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 58cd527..c74b9d9 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -572,7 +572,6 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
                     RADEON_GEM_DOMAIN_GTT);
     FLUSH_RING();
 
-    radeon_bo_wait(scratch);
     r = radeon_bo_map(scratch, 0);
     if (r) {
         r = FALSE;
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index a9d6fc3..932759b 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -367,7 +367,6 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
     pPriv->src_offset = pPriv->video_offset;
     if (info->cs) {
 	int ret;
-	radeon_bo_wait(pPriv->src_bo);
 	ret = radeon_bo_map(pPriv->src_bo, 1);
 	if (ret)
 	    return BadAlloc;
@@ -690,7 +689,6 @@ Bool radeon_load_bicubic_texture(ScrnInfoPtr pScrn)
 	uint8_t *bicubic_addr;
 	int ret;
 	if (info->cs) {
-	    radeon_bo_wait(info->bicubic_bo);
 	    ret = radeon_bo_map(info->bicubic_bo, 1);
 	    if (ret)
 		return FALSE;
commit 066c90e8f5b93c80195dc43486ad3efa083a1f3a
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Aug 27 09:52:11 2009 +0200

    KMS: Don't use a blit for UploadToScreen if the pixmap BO will be idle anyway.
    
    Direct CPU writes should be at least as fast in that case.

diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index d95adb5..58cd527 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -455,6 +455,7 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
     struct radeon_bo *scratch;
     unsigned size;
     uint32_t datatype = 0;
+    uint32_t dst_domain;
     uint32_t dst_pitch_offset;
     unsigned bpp = pDst->drawable.bitsPerPixel;
     uint32_t scratch_pitch = (w * bpp / 8 + 63) & ~63;
@@ -466,6 +467,11 @@ RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
 
     driver_priv = exaGetPixmapDriverPrivate(pDst);
 
+    /* If we know the BO won't be busy, don't bother */
+    if (driver_priv->bo->cref == 1 &&
+	!radeon_bo_is_busy(driver_priv->bo, &dst_domain))
+	return FALSE;
+
     size = scratch_pitch * h;
     scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
     if (scratch == NULL) {
commit 174b61bb786a841cebd354e23b4b0caa85b541aa
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Aug 27 09:52:11 2009 +0200

    KMS: DownloadFromScreen improvements.
    
    * Drop superfluous RADEONDownloadFromScreenGTT function, EXA does the same
      thing when we return FALSE.
    * Take unflushed operations into account for determining which GEM domain the
      pixmap BO will end up in.
    * Only use a blit if it ends up in VRAM.

diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index f937c4e..d95adb5 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -507,33 +507,6 @@ out:
 }
 
 static Bool
-RADEONDownloadFromScreenGTT(PixmapPtr pSrc, int x, int y, int w,
-			    int h, char *dst, int dst_pitch)
-{
-    struct radeon_exa_pixmap_priv *driver_priv;
-    int src_pitch = exaGetPixmapPitch(pSrc);
-    int bpp = pSrc->drawable.bitsPerPixel;
-    int src_offset;
-    int r;
-
-    driver_priv = exaGetPixmapDriverPrivate(pSrc);
-    r = radeon_bo_map(driver_priv->bo, 0);
-    if (r)
-	return FALSE;
-
-    src_offset = (x * bpp / 8) + (y * src_pitch);
-    w *= bpp / 8;
-
-    while (h--) {
-        memcpy(dst, driver_priv->bo->ptr + src_offset, w);
-        src_offset += src_pitch;
-        dst += dst_pitch;
-    }
-    radeon_bo_unmap(driver_priv->bo);
-    return TRUE;
-}
-
-static Bool
 RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
                            int h, char *dst, int dst_pitch)
 {
@@ -542,23 +515,33 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     struct radeon_bo *scratch;
     unsigned size;
     uint32_t datatype = 0;
+    uint32_t src_domain = 0;
     uint32_t src_pitch_offset;
     unsigned bpp = pSrc->drawable.bitsPerPixel;
     uint32_t scratch_pitch = (w * bpp / 8 + 63) & ~63;
     Bool r;
-    uint32_t src_domain;
-    int busy;
 
     if (bpp < 8)
 	return FALSE;
 
     driver_priv = exaGetPixmapDriverPrivate(pSrc);
- 
-    busy = radeon_bo_is_busy(driver_priv->bo, &src_domain);
 
-    if (src_domain == RADEON_GEM_DOMAIN_GTT)
-	return RADEONDownloadFromScreenGTT(pSrc, x, y, w, h,
-					   dst, dst_pitch);
+    /* If we know the BO won't end up in VRAM anyway, don't bother */
+    if (driver_priv->bo->cref > 1) {
+	src_domain = driver_priv->bo->space_accounted & 0xffff;
+	if (!src_domain)
+	    src_domain = driver_priv->bo->space_accounted >> 16;
+
+	if ((src_domain & (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM)) ==
+	    (RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM))
+	    src_domain = 0;
+    }
+
+    if (!src_domain)
+	radeon_bo_is_busy(driver_priv->bo, &src_domain);
+
+    if (src_domain != RADEON_GEM_DOMAIN_VRAM)
+	return FALSE;
 
     size = scratch_pitch * h;
     scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
commit 7623e169e1f7d5afbd4108de03f28098bca519db
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Aug 27 09:52:11 2009 +0200

    EXA: Allocate pixmap BOs in VRAM.
    
    This is the intention with EXA in xserver Git, and IME it improves performance
    significantly even with older versions.

diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 3f3c9ba..b7013c9 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -390,8 +390,8 @@ void *RADEONEXACreatePixmap(ScreenPtr pScreen, int size, int align)
     if (size == 0)
 	return new_priv;
 
-    new_priv->bo = radeon_bo_open(info->bufmgr, 0, size,
-				  align, 0, 0);
+    new_priv->bo = radeon_bo_open(info->bufmgr, 0, size, align,
+				  RADEON_GEM_DOMAIN_VRAM, 0);
     if (!new_priv->bo) {
 	xfree(new_priv);
 	ErrorF("Failed to alloc memory\n");
@@ -442,8 +442,8 @@ void *RADEONEXACreatePixmap2(ScreenPtr pScreen, int width, int height,
 
     *new_pitch = padded_width;
 
-    new_priv->bo = radeon_bo_open(info->bufmgr, 0, size,
-				  0, 0, 0);
+    new_priv->bo = radeon_bo_open(info->bufmgr, 0, size, 0,
+				  RADEON_GEM_DOMAIN_VRAM, 0);
     if (!new_priv->bo) {
 	xfree(new_priv);
 	ErrorF("Failed to alloc memory\n");
commit b90b823790657707b5bf7249095833bef959b0e8
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Aug 27 09:52:11 2009 +0200

    DRI2: Set tiling for depth/stencil buffers with all DRI2 interface versions.

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index c303f7b..613fde8 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -91,6 +91,10 @@ radeon_dri2_create_buffers(DrawablePtr drawable,
         } else {
 	    /* tile the back buffer */
 	    switch(attachments[i]) {
+	    case DRI2BufferDepth:
+	    case DRI2BufferDepthStencil:
+		flags = RADEON_CREATE_PIXMAP_TILING_MACRO | RADEON_CREATE_PIXMAP_TILING_MICRO;
+		break;
 	    case DRI2BufferBackLeft:
 	    case DRI2BufferBackRight:
 	    case DRI2BufferFakeFrontLeft:
commit 27d9664f8862d1948dd32021f8e9bcb94f23e4ef
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Aug 27 09:52:10 2009 +0200

    EXA: RENDER repeat cleanups.
    
    We can't rely on the server setting pPict->repeatType to something sensible
    when pPict->repeat is FALSE, but we can do it ourselves.

diff --git a/src/r600_exa.c b/src/r600_exa.c
index 3e77515..57867f1 100644
--- a/src/r600_exa.c
+++ b/src/r600_exa.c
@@ -1258,30 +1258,29 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
     tex_samp.id                 = unit;
     tex_samp.border_color       = SQ_TEX_BORDER_COLOR_TRANS_BLACK;
 
-    if (pPict->repeat) {
-	switch (pPict->repeatType) {
-	case RepeatNormal:
-	    tex_samp.clamp_x            = SQ_TEX_WRAP;
-	    tex_samp.clamp_y            = SQ_TEX_WRAP;
-	    break;
-	case RepeatPad:
-	    tex_samp.clamp_x            = SQ_TEX_CLAMP_LAST_TEXEL;
-	    tex_samp.clamp_y            = SQ_TEX_CLAMP_LAST_TEXEL;
-	    break;
-	case RepeatReflect:
-	    tex_samp.clamp_x            = SQ_TEX_MIRROR;
-	    tex_samp.clamp_y            = SQ_TEX_MIRROR;
-	    break;
-	case RepeatNone:
-	    tex_samp.clamp_x            = SQ_TEX_CLAMP_BORDER;
-	    tex_samp.clamp_y            = SQ_TEX_CLAMP_BORDER;
-	    break;
-	default:
-	    RADEON_FALLBACK(("Bad repeat 0x%x\n", pPict->repeatType));
-	}
-    } else {
+    /* Unfortunately we can't rely on the X server doing this for us */
+    if (!pPict->repeat)
+	pPict->repeatType = RepeatNone;
+
+    switch (pPict->repeatType) {
+    case RepeatNormal:
+	tex_samp.clamp_x            = SQ_TEX_WRAP;
+	tex_samp.clamp_y            = SQ_TEX_WRAP;
+	break;
+    case RepeatPad:
+	tex_samp.clamp_x            = SQ_TEX_CLAMP_LAST_TEXEL;
+	tex_samp.clamp_y            = SQ_TEX_CLAMP_LAST_TEXEL;
+	break;
+    case RepeatReflect:
+	tex_samp.clamp_x            = SQ_TEX_MIRROR;
+	tex_samp.clamp_y            = SQ_TEX_MIRROR;
+	break;
+    case RepeatNone:
 	tex_samp.clamp_x            = SQ_TEX_CLAMP_BORDER;
 	tex_samp.clamp_y            = SQ_TEX_CLAMP_BORDER;
+	break;
+    default:
+	RADEON_FALLBACK(("Bad repeat 0x%x\n", pPict->repeatType));
     }
 
     switch (pPict->filter) {
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index 4dbdc14..cc97760 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -410,6 +410,10 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
 	RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter));
     }
 
+    /* Unfortunately we can't rely on the X server doing this for us */
+    if (!pPict->repeat)
+	pPict->repeatType = RepeatNone;
+
     switch (pPict->repeatType) {
 	case RepeatNormal:
 	    txfilter |= RADEON_CLAMP_S_WRAP | RADEON_CLAMP_T_WRAP;
@@ -793,6 +797,10 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
 	RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter));
     }
 
+    /* Unfortunately we can't rely on the X server doing this for us */
+    if (!pPict->repeat)
+	pPict->repeatType = RepeatNone;
+
     switch (pPict->repeatType) {
 	case RepeatNormal:
 	    txfilter |= R200_CLAMP_S_WRAP | R200_CLAMP_T_WRAP;
@@ -1171,36 +1179,36 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
 
     txfilter = (unit << R300_TX_ID_SHIFT);
 
-    if (pPict->repeat) {
-	switch (pPict->repeatType) {
-	case RepeatNormal:
-	    if (unit != 0 || !info->accel_state->need_src_tile_x)
-		txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_WRAP);
-	    else
-		txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL);
+    /* Unfortunately we can't rely on the X server doing this for us */
+    if (!pPict->repeat)
+	pPict->repeatType = RepeatNone;
 
-	    if (unit != 0 || !info->accel_state->need_src_tile_y)
-		txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_WRAP);
-	    else
-		txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL);
+    switch (pPict->repeatType) {
+    case RepeatNormal:
+	if (unit != 0 || !info->accel_state->need_src_tile_x)
+	    txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_WRAP);
+	else
+	    txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL);
+	
+	if (unit != 0 || !info->accel_state->need_src_tile_y)
+	    txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_WRAP);
+	else
+	    txfilter |= R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL);
 
-	    break;
-	case RepeatPad:
-	    txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) |
-		        R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST);
-	    break;
-	case RepeatReflect:
-	    txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_MIRROR) |
-		        R300_TX_CLAMP_T(R300_TX_CLAMP_MIRROR);
-	    break;
-	case RepeatNone:
-	    txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL) |
-		        R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL);
-	    break;
-	}
-    } else
+	break;
+    case RepeatPad:
+	txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_LAST) |
+	    R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_LAST);
+	break;
+    case RepeatReflect:
+	txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_MIRROR) |
+	    R300_TX_CLAMP_T(R300_TX_CLAMP_MIRROR);
+	break;
+    case RepeatNone:
 	txfilter |= R300_TX_CLAMP_S(R300_TX_CLAMP_CLAMP_GL) |
-	            R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL);
+	    R300_TX_CLAMP_T(R300_TX_CLAMP_CLAMP_GL);
+	break;
+    }
 
     switch (pPict->filter) {
     case PictFilterNearest:
commit 9b5517fcf7f2397a1a814d396fc9dc24769a6d9f
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Thu Aug 27 09:52:10 2009 +0200

    Throttle DRI2 buffer swaps / frontbuffer flushes.

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index b52f965..c303f7b 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -275,6 +275,25 @@ radeon_dri2_copy_region(DrawablePtr drawable,
     (*gc->funcs->ChangeClip) (gc, CT_REGION, copy_clip, 0);
     ValidateGC(&dst_pixmap->drawable, gc);
 
+    /* If this is a full buffer swap or frontbuffer flush, throttle on the
+     * previous one
+     */
+    if (dst_private->attachment == DRI2BufferFrontLeft) {
+	if (REGION_NUM_RECTS(region) == 1) {
+	    BoxPtr extents = REGION_EXTENTS(pScreen, region);
+
+	    if (extents->x1 == 0 && extents->y1 == 0 &&
+		extents->x2 == drawable->width &&
+		extents->y2 == drawable->height) {
+		struct radeon_exa_pixmap_priv *exa_priv =
+		    exaGetPixmapDriverPrivate(dst_pixmap);
+
+		if (exa_priv && exa_priv->bo)
+		    radeon_bo_wait(exa_priv->bo);
+	    }
+	}
+    }
+
     vsync = info->accel_state->vsync;
     info->accel_state->vsync = TRUE;
 


More information about the xorg-commit mailing list