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

Michel Dänzer daenzer at kemper.freedesktop.org
Fri Aug 7 02:57:28 PDT 2009


 src/radeon_dri2.c      |    2 +
 src/radeon_exa_funcs.c |   81 +++++++++++++++++++++++++++++++++++++++++++------
 src/radeon_kms.c       |    5 +--
 3 files changed, 76 insertions(+), 12 deletions(-)

New commits:
commit cd99d9f0d715f1f74de4fe22f2fd30046f2c7568
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Fri Aug 7 11:56:50 2009 +0200

    Properly let radeon_cs_flush_indirect() re-emit 2D state if necessary.
    
    Also remove a superfluous assignment.

diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 599084f..605e598 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -222,7 +222,6 @@ FUNC_NAME(RADEONSolid)(PixmapPtr pPix, int x1, int y1, int x2, int y2)
     if (info->cs && CS_FULL(info->cs)) {
 	FUNC_NAME(RADEONDone2D)(info->accel_state->dst_pix);
 	radeon_cs_flush_indirect(pScrn);
-	FUNC_NAME(Emit2DState)(pScrn, RADEON_2D_EXA_SOLID);
     }
 #endif
 
@@ -333,7 +332,6 @@ FUNC_NAME(RADEONCopy)(PixmapPtr pDst,
     if (info->cs && CS_FULL(info->cs)) {
 	FUNC_NAME(RADEONDone2D)(info->accel_state->dst_pix);
 	radeon_cs_flush_indirect(pScrn);
-	FUNC_NAME(Emit2DState)(pScrn, RADEON_2D_EXA_COPY);
     }
 #endif
 
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 148386b..d93a40b 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -84,8 +84,8 @@ void radeon_cs_flush_indirect(ScrnInfoPtr pScrn)
     if (ret)
       ErrorF("space check failed in flush\n");
 
-    if (info->reemit_current2d)
-      info->reemit_current2d(pScrn, 0);
+    if (info->reemit_current2d && info->state_2d.op)
+      info->reemit_current2d(pScrn, info->state_2d.op);
     if (info->dri2.enabled) {
       info->accel_state->XInited3D = FALSE;
       info->accel_state->engineMode = EXA_ENGINEMODE_UNKNOWN;
@@ -169,7 +169,6 @@ static void RADEONBlockHandler_KMS(int i, pointer blockData,
     if (info->VideoTimerCallback)
 	(*info->VideoTimerCallback)(pScrn, currentTime.milliseconds);
 
-    info->accel_state->engineMode = EXA_ENGINEMODE_UNKNOWN;
     radeon_cs_flush_indirect(pScrn);
 }
 
commit 577ff3ce922e457cc32f80d4365cb1da81552e72
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Fri Aug 7 11:56:49 2009 +0200

    Add support for EXA_MIXED_PIXMAPS in xserver master.

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 08da996..9c86244 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -98,6 +98,7 @@ radeon_dri2_create_buffers(DrawablePtr drawable,
         if (attachments[i] == DRI2BufferDepth) {
             depth_pixmap = pixmap;
         }
+	exaMoveInPixmap(pixmap);
         driver_priv = exaGetPixmapDriverPrivate(pixmap);
 	r = radeon_gem_get_kernel_name(driver_priv->bo, &buffers[i].name);
 	if (r)
@@ -159,6 +160,7 @@ radeon_dri2_create_buffer(DrawablePtr drawable,
     if (attachment == DRI2BufferDepth) {
         depth_pixmap = pixmap;
     }
+    exaMoveInPixmap(pixmap);
     driver_priv = exaGetPixmapDriverPrivate(pixmap);
     r = radeon_gem_get_kernel_name(driver_priv->bo, &buffers->name);
     if (r)
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index dc56c55..599084f 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -735,8 +735,12 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
     info->accel_state->exa->pixmapPitchAlign = 64;
 
 #ifdef EXA_HANDLES_PIXMAPS
-    if (info->cs)
+    if (info->cs) {
 	info->accel_state->exa->flags |= EXA_HANDLES_PIXMAPS;
+#ifdef EXA_MIXED_PIXMAPS
+	info->accel_state->exa->flags |= EXA_MIXED_PIXMAPS;
+#endif
+    }
 #endif
 
 #ifdef RENDER
commit e755fa56d03aa338d0c6345ed41e32aa3115ad4b
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Fri Aug 7 11:56:49 2009 +0200

    Minor fixes for KMS EXA DownloadFromScreen hook.
    
    Check we can handle the bpp, and remove superfluous flush.

diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 30d299f..dc56c55 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -522,11 +522,11 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     uint32_t scratch_pitch = (w * bpp / 8 + 63) & ~63;
     Bool r;
 
+    if (bpp < 8)
+	return FALSE;
+
     driver_priv = exaGetPixmapDriverPrivate(pSrc);
-    /* if we have more refs than just the BO then flush */
-    if (driver_priv->bo->cref)
-        radeon_cs_flush_indirect(pScrn);
-    radeon_bo_wait(driver_priv->bo);
+
     size = scratch_pitch * h;
     scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
     if (scratch == NULL) {
commit 4cebafae81c1738a1c330d52a2c5248869f06411
Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Fri Aug 7 11:56:40 2009 +0200

    Add KMS EXA UploadToScreen hook.
    
    Fixups by Michel Dänzer: Doesn't seem to be a win in terms of raw numbers, but
    should allow more pipelining and avoiding BO memory waste for small glyph
    pixmaps.

diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
index 145f13d..30d299f 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
@@ -447,7 +447,67 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, struct radeon_bo *src_bo,
     FINISH_ACCEL();
 }
 
-#if defined(ACCEL_CP) && defined(XF86DRM_MODE)
+#if defined(XF86DRM_MODE)
+static Bool
+RADEONUploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
+		       char *src, int src_pitch)
+{
+    RINFO_FROM_SCREEN(pDst->drawable.pScreen);
+    struct radeon_exa_pixmap_priv *driver_priv;
+    struct radeon_bo *scratch;
+    unsigned size;
+    uint32_t datatype = 0;
+    uint32_t dst_pitch_offset;
+    unsigned bpp = pDst->drawable.bitsPerPixel;
+    uint32_t scratch_pitch = (w * bpp / 8 + 63) & ~63;
+    Bool r;
+    int i;
+
+    if (bpp < 8)
+	return FALSE;
+
+    driver_priv = exaGetPixmapDriverPrivate(pDst);
+
+    size = scratch_pitch * h;
+    scratch = radeon_bo_open(info->bufmgr, 0, size, 0, RADEON_GEM_DOMAIN_GTT, 0);
+    if (scratch == NULL) {
+	return FALSE;
+    }
+    radeon_cs_space_reset_bos(info->cs);
+    radeon_add_pixmap(info->cs, pDst, 0, RADEON_GEM_DOMAIN_VRAM);
+    radeon_cs_space_add_persistent_bo(info->cs, scratch, RADEON_GEM_DOMAIN_GTT, 0);
+    r = radeon_cs_space_check(info->cs);
+    if (r) {
+        r = FALSE;
+        goto out;
+    }
+
+    r = radeon_bo_map(scratch, 0);
+    if (r) {
+        r = FALSE;
+        goto out;
+    }
+    r = TRUE;
+    size = w * bpp / 8;
+    for (i = 0; i < h; i++) {
+        memcpy(scratch->ptr + i * scratch_pitch, src, size);
+        src += src_pitch;
+    }
+    radeon_bo_unmap(scratch);
+
+    RADEONGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype);
+    RADEONGetPixmapOffsetPitch(pDst, &dst_pitch_offset);
+    ACCEL_PREAMBLE();
+    RADEON_SWITCH_TO_2D();
+    RADEONBlitChunk(pScrn, scratch, driver_priv->bo, datatype, scratch_pitch << 16,
+                    dst_pitch_offset, 0, 0, x, y, w, h,
+                    RADEON_GEM_DOMAIN_GTT, RADEON_GEM_DOMAIN_VRAM);
+
+out:
+    radeon_bo_unref(scratch);
+    return r;
+}
+
 static Bool
 RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
                            int h, char *dst, int dst_pitch)
@@ -460,7 +520,7 @@ RADEONDownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
     uint32_t src_pitch_offset;
     unsigned bpp = pSrc->drawable.bitsPerPixel;
     uint32_t scratch_pitch = (w * bpp / 8 + 63) & ~63;
-    int r;
+    Bool r;
 
     driver_priv = exaGetPixmapDriverPrivate(pSrc);
     /* if we have more refs than just the BO then flush */
@@ -652,6 +712,7 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
     }
 # if defined(XF86DRM_MODE)
     else {
+	info->accel_state->exa->UploadToScreen = &RADEONUploadToScreenCS;
         info->accel_state->exa->DownloadFromScreen = &RADEONDownloadFromScreenCS;
     }
 # endif


More information about the xorg-commit mailing list