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

Dave Airlie airlied at kemper.freedesktop.org
Thu Nov 19 16:15:30 PST 2009


 src/drmmode_display.c            |    1 +
 src/radeon.h                     |    1 +
 src/radeon_kms.c                 |   26 ++++++++++++++++++++++----
 src/radeon_textured_videofuncs.c |   30 ++++++++++++++++++++----------
 4 files changed, 44 insertions(+), 14 deletions(-)

New commits:
commit eb9bc133fc426e67b397e661bfd22bf62009d9d3
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Nov 20 09:23:31 2009 +1000

    kms: recalculate the flush limits after screen resize.
    
    When we resize the front buffer we need to reduce the flush limits
    appropriately.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 29c3ff1..3147981 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1095,6 +1095,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
 	if (old_front)
 		radeon_bo_unref(old_front);
 
+	radeon_kms_update_vram_limit(scrn, screen_size);
 	return TRUE;
 
  fail:
diff --git a/src/radeon.h b/src/radeon.h
index 7fd297e..5cdc3db 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -1282,6 +1282,7 @@ extern void radeon_cs_flush_indirect(ScrnInfoPtr pScrn);
 extern void radeon_ddx_cs_start(ScrnInfoPtr pScrn,
 				int num, const char *file,
 				const char *func, int line);
+void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, int new_fb_size);
 #endif
 struct radeon_bo *radeon_get_pixmap_bo(PixmapPtr pPix);
 void radeon_set_pixmap_bo(PixmapPtr pPix, struct radeon_bo *bo);
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 8e46a8a..5a4255f 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -946,13 +946,31 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
     }
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Front buffer size: %dK\n", info->front_bo->size/1024);
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Remaining VRAM size (used for pixmaps): %dK\n", remain_size_bytes/1024);
+    radeon_kms_update_vram_limit(pScrn, screen_size);
+    return TRUE;
+}
 
-    /* set the emit limit at 90% of VRAM */
-    remain_size_bytes = (remain_size_bytes / 10) * 9;
+void radeon_kms_update_vram_limit(ScrnInfoPtr pScrn, int new_fb_size)
+{
+    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    RADEONInfoPtr info = RADEONPTR(pScrn);
+    int remain_size_bytes;
+    int total_size_bytes;
+    int c;
 
+    for (c = 0; c < xf86_config->num_crtc; c++) {
+	if (info->cursor_bo[c] != NULL) {
+	    total_size_bytes += (64 * 4 * 64);
+	}
+    }
+
+    total_size_bytes += new_fb_size;
+    remain_size_bytes = info->vram_size - new_fb_size;
+    remain_size_bytes = (remain_size_bytes / 10) * 9;
     radeon_cs_set_limit(info->cs, RADEON_GEM_DOMAIN_VRAM, remain_size_bytes);
-    return TRUE;
+
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VRAM usage limit set to %dK\n", remain_size_bytes / 1024);
 }
 
+
 #endif
commit f7f58ef4c042e492618665a6c5555e8e67387ab3
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Nov 20 09:22:39 2009 +1000

    radeon: r100/r200 have a 2047 scissor limit
    
    We were overflowing this in my case with a 2704 width desktop,
    so videos were stopping around 700 bytes across the screen.
    
    can I haz shatter already?
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index c7d9b02..6ac2d6e 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -344,12 +344,17 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
 	FINISH_ACCEL();
     }
 
-    BEGIN_ACCEL(2);
-    OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
-    OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, (((pPixmap->drawable.width) << RADEON_RE_WIDTH_SHIFT) |
-					   ((pPixmap->drawable.height) << RADEON_RE_HEIGHT_SHIFT)));
-    FINISH_ACCEL();
-
+    {
+      int scissor_w, scissor_h;
+      scissor_w = MIN(pPixmap->drawable.width, 2047);
+      scissor_h = MIN(pPixmap->drawable.height, 2047);
+
+      BEGIN_ACCEL(2);
+      OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
+      OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, ((scissor_w << RADEON_RE_WIDTH_SHIFT) |
+					     (scissor_h << RADEON_RE_HEIGHT_SHIFT)));
+      FINISH_ACCEL();
+    }
     if (pPriv->vsync) {
 	xf86CrtcPtr crtc;
 	if (pPriv->desired_crtc)
@@ -907,10 +912,15 @@ FUNC_NAME(R200DisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv)
 	FINISH_ACCEL();
     }
 
-    BEGIN_ACCEL(2);
-    OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
-    OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, (((pPixmap->drawable.width) << RADEON_RE_WIDTH_SHIFT) |
-					   ((pPixmap->drawable.height) << RADEON_RE_HEIGHT_SHIFT)));
+    {
+      int scissor_w, scissor_h;
+      scissor_w = MIN(pPixmap->drawable.width, 2047);
+      scissor_h = MIN(pPixmap->drawable.height, 2047);
+      BEGIN_ACCEL(2);
+      OUT_ACCEL_REG(RADEON_RE_TOP_LEFT, 0);
+      OUT_ACCEL_REG(RADEON_RE_WIDTH_HEIGHT, ((scissor_w << RADEON_RE_WIDTH_SHIFT) |
+					     (scissor_h << RADEON_RE_HEIGHT_SHIFT)));
+    }
     FINISH_ACCEL();
 
     if (pPriv->vsync) {


More information about the xorg-commit mailing list