rpms/xorg-x11-drv-ati/F-10 radeon-modeset.patch, 1.38, 1.39 xorg-x11-drv-ati.spec, 1.150, 1.151
Dave Airlie
airlied at fedoraproject.org
Tue Nov 18 06:15:56 UTC 2008
Author: airlied
Update of /cvs/pkgs/rpms/xorg-x11-drv-ati/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28158
Modified Files:
radeon-modeset.patch xorg-x11-drv-ati.spec
Log Message:
- radeon - don't fail at integer division
radeon-modeset.patch:
Index: radeon-modeset.patch
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-ati/F-10/radeon-modeset.patch,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- radeon-modeset.patch 18 Nov 2008 04:37:02 -0000 1.38
+++ radeon-modeset.patch 18 Nov 2008 06:15:25 -0000 1.39
@@ -1,3 +1,17 @@
+commit 051302885dddaac1b3ae5b30dd6e46dbd15d7ab8
+Author: Dave Airlie <airlied at redhat.com>
+Date: Tue Nov 18 16:09:10 2008 +1000
+
+ radeon: even if kernels fails, struggle onwards
+
+ try and keep the session going even if visual glitches happen
+
+commit 68b88eda5de7d5ed0f8b13a0b5b861970826c2ed
+Author: Dave Airlie <airlied at redhat.com>
+Date: Tue Nov 18 15:46:46 2008 +1000
+
+ radeon_bufmgr: much more complete size check functionality
+
commit 07b2b3d3b2eac76c0d7f3b84cb342df3d1037403
Author: Dave Airlie <airlied at redhat.com>
Date: Tue Nov 18 14:33:44 2008 +1000
@@ -1925,10 +1939,18 @@
do { \
if (RADEON_VERBOSE) \
diff --git a/src/radeon_accel.c b/src/radeon_accel.c
-index a6e332d..03b49c1 100644
+index a6e332d..c65125c 100644
--- a/src/radeon_accel.c
+++ b/src/radeon_accel.c
-@@ -311,6 +311,9 @@ void RADEONEngineRestore(ScrnInfoPtr pScrn)
+@@ -91,6 +91,7 @@
+
+ /* X and server generic header files */
+ #include "xf86.h"
++#include "radeon_bufmgr_gem.h"
+
+
+ #ifdef USE_XAA
+@@ -311,6 +312,9 @@ void RADEONEngineRestore(ScrnInfoPtr pScrn)
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
@@ -1938,7 +1960,7 @@
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
"EngineRestore (%d/%d)\n",
info->CurrentLayout.pixel_code,
-@@ -370,8 +373,8 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
+@@ -370,8 +374,8 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
info->CurrentLayout.bitsPerPixel);
#ifdef XF86DRI
@@ -1949,7 +1971,7 @@
int num_pipes;
memset(&np, 0, sizeof(np));
-@@ -390,59 +393,62 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
+@@ -390,59 +394,62 @@ void RADEONEngineInit(ScrnInfoPtr pScrn)
}
#endif
@@ -2061,7 +2083,7 @@
switch (info->CurrentLayout.pixel_code) {
case 8: datatype = 2; break;
-@@ -550,6 +556,163 @@ int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info)
+@@ -550,6 +557,161 @@ int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info)
}
}
@@ -2136,13 +2158,11 @@
+ do {
+ ret = drmCommandWriteRead(info->dri->drmFD, DRM_RADEON_CS2,
+ &args, sizeof(args));
-+ if (ret)
-+ ErrorF("DRM Command submission failure %d\n", ret);
+ retry++;
+ } while (ret == -EAGAIN && retry < 1000);
+ if (ret) {
-+ FatalError("DRM Command submission failure %d\n", ret);
-+ return;
++ /* submit failed */
++ ErrorF("RADEON DRM CS failure - corruptions/glitches may occur %d\n", ret);
+ }
+
+
@@ -2151,7 +2171,7 @@
+ info->cp->indirectBuffer->total -= RADEON_IB_RESERVE;
+
+ if (info->bufmgr)
-+ radeon_gem_bufmgr_post_submit(info->bufmgr, &info->cp->relocs);
++ radeon_gem_bufmgr_post_submit(info->bufmgr, &info->cp->relocs, ret);
+
+ info->cp->relocs.num_reloc = 0;
+ /* copy some state into the buffer now - we need to add 2D state to each
@@ -2225,7 +2245,7 @@
/* Get an indirect buffer for the CP 2D acceleration commands */
drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn)
{
-@@ -560,6 +723,9 @@ drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn)
+@@ -560,6 +722,9 @@ drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn)
int size = 0;
int i = 0;
int ret;
@@ -2235,7 +2255,7 @@
#if 0
/* FIXME: pScrn->pScreen has not been initialized when this is first
-@@ -625,6 +791,11 @@ void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard)
+@@ -625,6 +790,11 @@ void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard)
if (!buffer) return;
if (start == buffer->used && !discard) return;
@@ -2247,7 +2267,7 @@
if (RADEON_VERBOSE) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Flushing buffer %d\n",
buffer->idx);
-@@ -659,10 +830,16 @@ void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn)
+@@ -659,10 +829,16 @@ void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn)
int start = info->cp->indirectStart;
drm_radeon_indirect_t indirect;
@@ -2264,7 +2284,7 @@
if (RADEON_VERBOSE) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Releasing buffer %d\n",
-@@ -789,6 +966,7 @@ RADEONHostDataBlit(
+@@ -789,6 +965,7 @@ RADEONHostDataBlit(
ret = ( uint8_t* )&__head[__count];
__count += dwords;
@@ -2272,7 +2292,7 @@
ADVANCE_RING();
*y += *hpass;
-@@ -926,7 +1104,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
+@@ -926,7 +1103,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
#ifdef USE_EXA
if (info->useEXA) {
# ifdef XF86DRI
@@ -2281,7 +2301,7 @@
if (!RADEONDrawInitCP(pScreen))
return FALSE;
} else
-@@ -947,7 +1125,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
+@@ -947,7 +1124,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
}
#ifdef XF86DRI
@@ -2290,7 +2310,7 @@
RADEONAccelInitCP(pScreen, a);
else
#endif /* XF86DRI */
-@@ -969,11 +1147,13 @@ void RADEONInit3DEngine(ScrnInfoPtr pScrn)
+@@ -969,11 +1146,13 @@ void RADEONInit3DEngine(ScrnInfoPtr pScrn)
RADEONInfoPtr info = RADEONPTR (pScrn);
#ifdef XF86DRI
@@ -2308,7 +2328,7 @@
RADEONInit3DEngineCP(pScrn);
} else
#endif
-@@ -981,7 +1161,7 @@ void RADEONInit3DEngine(ScrnInfoPtr pScrn)
+@@ -981,7 +1160,7 @@ void RADEONInit3DEngine(ScrnInfoPtr pScrn)
info->accel_state->XInited3D = TRUE;
}
@@ -2350,10 +2370,10 @@
+#endif
diff --git a/src/radeon_bufmgr_gem.c b/src/radeon_bufmgr_gem.c
new file mode 100644
-index 0000000..0591c42
+index 0000000..a0789f2
--- /dev/null
+++ b/src/radeon_bufmgr_gem.c
-@@ -0,0 +1,597 @@
+@@ -0,0 +1,626 @@
+/**************************************************************************
+ *
+ * Copyright © 2007-2008 Red Hat Inc.
@@ -2795,69 +2815,92 @@
+ return gem_bo->gem_handle;
+}
+
-+static int radeon_gem_bufmgr_check_aperture_space(dri_bo *buf, uint32_t read_domains, uint32_t write_domain)
++static int radeon_gem_bufmgr_check_aperture_space(struct radeon_space_check *bos, int num_bo)
+{
-+ dri_bufmgr_gem *bufmgr_gem = (dri_bufmgr_gem *)buf->bufmgr;
-+ dri_bo_gem *gem_bo = (dri_bo_gem *)buf;
-+ int old_accounted = 0;
++ dri_bufmgr_gem *bufmgr_gem;
++ dri_bo_gem *gem_bo;
++ dri_bo *buf;
++ int this_op_read = 0, this_op_write = 0;
++ uint32_t read_domains, write_domain;
++ int i;
++ /* check the totals for this operation */
+
-+ if (gem_bo->pinned)
++ if (num_bo == 0)
+ return 0;
+
-+ if (write_domain && (write_domain == gem_bo->space_accounted))
-+ return 0;
++ bufmgr_gem = (dri_bufmgr_gem *)bos[0].buf;
+
-+ if (read_domains && ((read_domains << 16) == gem_bo->space_accounted))
-+ return 0;
++ /* prepare */
++ for (i = 0; i < num_bo; i++) {
++ buf = bos[i].buf;
++ gem_bo = (dri_bo_gem *)buf;
+
-+ old_accounted = gem_bo->space_accounted;
++ read_domains = bos[i].read_domains;
++ write_domain = bos[i].write_domain;
++
++ /* pinned bos don't count */
++ if (gem_bo->pinned)
++ continue;
++
++ /* already accounted this bo */
++ if (write_domain && (write_domain == gem_bo->space_accounted))
++ continue;
++
++ if (read_domains && ((read_domains << 16) == gem_bo->space_accounted))
++ continue;
+
-+ if (gem_bo->space_accounted == 0) {
-+ gem_bo->space_accounted = (read_domains << 16) | write_domain;
-+ if (write_domain == RADEON_GEM_DOMAIN_VRAM) {
-+ bufmgr_gem->vram_write_used += buf->size;
++ if (gem_bo->space_accounted == 0) {
++ if (write_domain == RADEON_GEM_DOMAIN_VRAM)
++ this_op_write += buf->size;
++ else
++ this_op_read += buf->size;
++ bos[i].new_accounted = (read_domains << 16) | write_domain;
+ } else {
-+ bufmgr_gem->read_used += buf->size;
-+ }
-+ } else {
-+ uint16_t old_read, old_write;
++ uint16_t old_read, old_write;
+
-+ old_read = gem_bo->space_accounted >> 16;
-+ old_write = gem_bo->space_accounted & 0xffff;
++ old_read = gem_bo->space_accounted >> 16;
++ old_write = gem_bo->space_accounted & 0xffff;
+
-+ if (write_domain && (old_read & write_domain)) {
-+ gem_bo->space_accounted = write_domain;
-+ /* moving from read to a write domain */
-+ if (write_domain == RADEON_GEM_DOMAIN_VRAM) {
-+ bufmgr_gem->read_used -= buf->size;
-+ bufmgr_gem->vram_write_used += buf->size;
++ if (write_domain && (old_read & write_domain)) {
++ bos[i].new_accounted = write_domain;
++ /* moving from read to a write domain */
++ if (write_domain == RADEON_GEM_DOMAIN_VRAM) {
++ this_op_read -= buf->size;
++ this_op_write += buf->size;
++ }
++ } else if (read_domains & old_write) {
++ bos[i].new_accounted = gem_bo->space_accounted & 0xffff;
++ } else {
++ /* rewrite the domains */
++ if (write_domain != old_write)
++ ErrorF("WRITE DOMAIN RELOC FAILURE 0x%x %d %d\n", gem_bo->gem_handle, write_domain, old_write);
++ if (read_domains != old_read)
++ ErrorF("READ DOMAIN RELOC FAILURE 0x%x %d %d\n", gem_bo->gem_handle, read_domains, old_read);
+ }
-+ } else if (read_domains & old_write) {
-+ gem_bo->space_accounted &= 0xffff;
-+ } else {
-+ /* rewrite the domains */
-+ if (write_domain != old_write)
-+ ErrorF("WRITE DOMAIN RELOC FAILURE 0x%x %d %d\n", gem_bo->gem_handle, write_domain, old_write);
-+ if (read_domains != old_read)
-+ ErrorF("READ DOMAIN RELOC FAILURE 0x%x %d %d\n", gem_bo->gem_handle, read_domains, old_read);
+ }
+ }
+
-+ if (bufmgr_gem->vram_write_used > bufmgr_gem->vram_limit) {
-+ bufmgr_gem->vram_write_used = 0;
-+ bufmgr_gem->read_used = 0;
-+ gem_bo->space_accounted = old_accounted;
-+ return -1;
++ /* check sizes - operation first */
++ if ((this_op_read > bufmgr_gem->gart_limit) ||
++ (this_op_write > bufmgr_gem->vram_limit)) {
++ return BUFMGR_SPACE_OP_TO_BIG;
+ }
+
-+ if (bufmgr_gem->read_used > bufmgr_gem->gart_limit) {
-+ bufmgr_gem->vram_write_used = 0;
-+ bufmgr_gem->read_used = 0;
-+ gem_bo->space_accounted = old_accounted;
-+ return -1;
++ if (((bufmgr_gem->vram_write_used + this_op_write) > bufmgr_gem->vram_limit) ||
++ ((bufmgr_gem->read_used + this_op_read) > bufmgr_gem->gart_limit)) {
++ return BUFMGR_SPACE_FLUSH;
+ }
+
-+ return 0;
++ bufmgr_gem->vram_write_used += this_op_write;
++ bufmgr_gem->read_used += this_op_read;
++ /* commit */
++ for (i = 0; i < num_bo; i++) {
++ buf = bos[i].buf;
++ gem_bo = (dri_bo_gem *)buf;
++ gem_bo->space_accounted = bos[i].new_accounted;
++ }
++
++ return BUFMGR_SPACE_OK;
+}
+
+/**
@@ -2895,12 +2938,18 @@
+}
+
+
-+void radeon_gem_bufmgr_post_submit(dri_bufmgr *bufmgr, struct radeon_relocs_info *reloc_info)
++void radeon_gem_bufmgr_post_submit(dri_bufmgr *bufmgr, struct radeon_relocs_info *reloc_info, int error)
+{
+ dri_bufmgr_gem *bufmgr_gem = (dri_bufmgr_gem *)bufmgr;
+ struct _dri_bo_gem *trav, *prev;
+ int i;
+
++ if (error) {
++ ErrorF("bufmgr: last submission : r:%d vs g:%d w:%d vs v:%d\n",
++ bufmgr_gem->read_used, bufmgr_gem->gart_limit,
++ bufmgr_gem->vram_write_used, bufmgr_gem->vram_limit);
++ }
++
+ if (!bufmgr_gem->bo_list)
+ return;
+
@@ -2953,19 +3002,20 @@
+}
diff --git a/src/radeon_bufmgr_gem.h b/src/radeon_bufmgr_gem.h
new file mode 100644
-index 0000000..b13a642
+index 0000000..85deb91
--- /dev/null
+++ b/src/radeon_bufmgr_gem.h
-@@ -0,0 +1,18 @@
+@@ -0,0 +1,19 @@
+#ifndef RADEON_BUFMGR_GEM_H
+#define RADEON_BUFMGR_GEM_H
+
+#include "radeon_dri_bufmgr.h"
+
++
+extern void radeon_bufmgr_gem_wait_rendering(dri_bo *bo);
+extern dri_bo *radeon_bufmgr_gem_create_bo(dri_bufmgr *bufmgr, struct radeon_memory *mem);
+void radeon_bufmgr_gem_emit_reloc(dri_bo *bo, struct radeon_relocs_info *reloc_info, uint32_t *head, uint32_t *count_p, uint32_t read_domains, uint32_t write_domain);
-+void radeon_gem_bufmgr_post_submit(dri_bufmgr *bufmgr, struct radeon_relocs_info *reloc_info);
++void radeon_gem_bufmgr_post_submit(dri_bufmgr *bufmgr, struct radeon_relocs_info *reloc_info, int error);
+void radeon_bufmgr_pin(dri_bo *buf);
+void radeon_bufmgr_unpin(dri_bo *buf);
+uint32_t radeon_bufmgr_get_handle(dri_bo *buf);
@@ -3800,10 +3850,10 @@
+}
diff --git a/src/radeon_dri_bufmgr.c b/src/radeon_dri_bufmgr.c
new file mode 100644
-index 0000000..12263c3
+index 0000000..3e118d8
--- /dev/null
+++ b/src/radeon_dri_bufmgr.c
-@@ -0,0 +1,174 @@
+@@ -0,0 +1,177 @@
+/*
+ * Copyright © 2007 Intel Corporation
+ *
@@ -3959,9 +4009,12 @@
+}
+
+int
-+dri_bufmgr_check_aperture_space(dri_bo *bo, uint32_t read_domains, uint32_t write_domain)
++dri_bufmgr_check_aperture_space(struct radeon_space_check *bos, int num_bo)
+{
-+ return bo->bufmgr->check_aperture_space(bo, read_domains, write_domain);
++ if (num_bo)
++ return BUFMGR_SPACE_OK;
++
++ return bos[0].buf->bufmgr->check_aperture_space(bos, num_bo);
+}
+
+int dri_bo_pin(dri_bo *bo, int domain)
@@ -3980,10 +4033,10 @@
+}
diff --git a/src/radeon_dri_bufmgr.h b/src/radeon_dri_bufmgr.h
new file mode 100644
-index 0000000..026a751
+index 0000000..a19d7ec
--- /dev/null
+++ b/src/radeon_dri_bufmgr.h
-@@ -0,0 +1,281 @@
+@@ -0,0 +1,291 @@
+/**************************************************************************
+ *
+ * Copyright © 2007 Intel Corporation
@@ -4026,6 +4079,16 @@
+typedef struct _dri_bo dri_bo;
+typedef struct _dri_fence dri_fence;
+
++#define BUFMGR_SPACE_OK 0
++#define BUFMGR_SPACE_OP_TO_BIG 1
++#define BUFMGR_SPACE_FLUSH 2
++struct radeon_space_check {
++ dri_bo *buf;
++ uint32_t read_domains;
++ uint32_t write_domain;
++ uint32_t new_accounted;
++};
++
+/* reloc format */
+/* gem handle, read_domains, write_domain, reloc_count */
+#define RADEON_RELOC_SIZE 4
@@ -4173,7 +4236,7 @@
+
+ void (*post_submit)(dri_bo *batch_buf, dri_fence **fence);
+
-+ int (*check_aperture_space)(dri_bo *bo, uint32_t read_domains, uint32_t write_domain);
++ int (*check_aperture_space)(struct radeon_space_check *bos, int num_bo);
+
+ int (*pin)(dri_bo *bo, int domain);
+ void (*unpin)(dri_bo *bo);
@@ -4219,7 +4282,7 @@
+void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count);
+void dri_post_process_relocs(dri_bo *batch_buf);
+void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence);
-+int dri_bufmgr_check_aperture_space(dri_bo *bo, uint32_t read_domains, uint32_t write_domain);
++int dri_bufmgr_check_aperture_space(struct radeon_space_check *bos, int num_bo);
+
+int dri_bo_pin(dri_bo *bo, int domain);
+void dri_bo_unpin(dri_bo *bo);
@@ -6382,10 +6445,10 @@
}
#endif
diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
-index 62224d0..17b90dc 100644
+index 62224d0..0976963 100644
--- a/src/radeon_exa_funcs.c
+++ b/src/radeon_exa_funcs.c
-@@ -74,21 +74,71 @@ FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker)
+@@ -74,21 +74,73 @@ FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
RADEONInfoPtr info = RADEONPTR(pScrn);
@@ -6455,10 +6518,12 @@
+ struct radeon_exa_pixmap_priv *driver_priv;
+ int ret;
+ int retry_count = 0;
++ struct radeon_space_check bos[1];
++ int i;
ACCEL_PREAMBLE();
TRACE;
-@@ -97,25 +147,49 @@ FUNC_NAME(RADEONPrepareSolid)(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
+@@ -97,25 +149,58 @@ FUNC_NAME(RADEONPrepareSolid)(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
RADEON_FALLBACK(("24bpp unsupported\n"));
if (!RADEONGetDatatypeBpp(pPix->drawable.bitsPerPixel, &datatype))
RADEON_FALLBACK(("RADEONGetDatatypeBpp failed\n"));
@@ -6467,16 +6532,25 @@
- RADEON_FALLBACK(("RADEONGetPixmapOffsetPitch failed\n"));
+ RADEON_FALLBACK(("RADEONGetPixmapOffsetPitch failed\n"));
+
-+
-+ if (info->new_cs) {
+ retry:
-+ driver_priv = exaGetPixmapDriverPrivate(pPix);
-+ ret = dri_bufmgr_check_aperture_space(driver_priv->bo, 0, RADEON_GEM_DOMAIN_VRAM);
-+ if (ret) {
++ if (info->new_cs) {
++
++ i = 0;
++ driver_priv = exaGetPixmapDriverPrivate(pPix);
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = 0;
++ bos[i].write_domain = RADEON_GEM_DOMAIN_VRAM;;
++ i++;
++
++ ret = dri_bufmgr_check_aperture_space(bos, i);
++ if (ret == BUFMGR_SPACE_OP_TO_BIG) {
++ RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n"));
++ }
++ if (ret == BUFMGR_SPACE_FLUSH) {
+ RADEONCPFlushIndirect(pScrn, 1);
+ retry_count++;
+ if (retry_count == 2)
-+ RADEON_FALLBACK(("Not enough Video RAM for dst\n"));
++ RADEON_FALLBACK(("Not enough Video RAM for src\n"));
+ goto retry;
+ }
+ }
@@ -6523,7 +6597,7 @@
return TRUE;
}
-@@ -148,8 +222,10 @@ FUNC_NAME(RADEONDoneSolid)(PixmapPtr pPix)
+@@ -148,8 +233,10 @@ FUNC_NAME(RADEONDoneSolid)(PixmapPtr pPix)
OUT_ACCEL_REG(RADEON_WAIT_UNTIL,
RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE);
FINISH_ACCEL();
@@ -6534,7 +6608,7 @@
void
FUNC_NAME(RADEONDoPrepareCopy)(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,
uint32_t dst_pitch_offset, uint32_t datatype, int rop,
-@@ -160,23 +236,28 @@ FUNC_NAME(RADEONDoPrepareCopy)(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,
+@@ -160,23 +247,28 @@ FUNC_NAME(RADEONDoPrepareCopy)(ScrnInfoPtr pScrn, uint32_t src_pitch_offset,
RADEON_SWITCH_TO_2D();
@@ -6580,7 +6654,7 @@
}
static Bool
-@@ -187,7 +268,9 @@ FUNC_NAME(RADEONPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst,
+@@ -187,9 +279,46 @@ FUNC_NAME(RADEONPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst,
{
RINFO_FROM_SCREEN(pDst->drawable.pScreen);
uint32_t datatype, src_pitch_offset, dst_pitch_offset;
@@ -6588,10 +6662,47 @@
+ struct radeon_exa_pixmap_priv *driver_priv;
+ int ret;
+ int retry_count = 0;
++ struct radeon_space_check bos[2];
++ int i;
TRACE;
++retry:
++ if (info->new_cs) {
++
++ i = 0;
++ driver_priv = exaGetPixmapDriverPrivate(pSrc);
++ info->state_2d.src_bo = driver_priv->bo;
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
++
++
++ driver_priv = exaGetPixmapDriverPrivate(pDst);
++ info->state_2d.dst_bo = driver_priv->bo;
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = 0;
++ bos[i].write_domain = RADEON_GEM_DOMAIN_VRAM;;
++ i++;
++
++ ret = dri_bufmgr_check_aperture_space(bos, i);
++ if (ret == BUFMGR_SPACE_OP_TO_BIG) {
++ RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n"));
++ }
++ if (ret == BUFMGR_SPACE_FLUSH) {
++ RADEONCPFlushIndirect(pScrn, 1);
++ retry_count++;
++ if (retry_count == 2)
++ RADEON_FALLBACK(("Not enough Video RAM for src\n"));
++ goto retry;
++ }
++ }
++
++
info->accel_state->xdir = xdir;
-@@ -197,10 +280,40 @@ FUNC_NAME(RADEONPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst,
+ info->accel_state->ydir = ydir;
+
+@@ -197,10 +326,11 @@ FUNC_NAME(RADEONPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst,
RADEON_FALLBACK(("24bpp unsupported"));
if (!RADEONGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype))
RADEON_FALLBACK(("RADEONGetDatatypeBpp failed\n"));
@@ -6602,39 +6713,10 @@
if (!RADEONGetPixmapOffsetPitch(pDst, &dst_pitch_offset))
- RADEON_FALLBACK(("RADEONGetPixmapOffsetPitch dest failed\n"));
+ RADEON_FALLBACK(("RADEONGetPixmapOffsetPitch dest failed\n"));
-+
-+ retry:
-+ if (info->new_cs) {
-+ driver_priv = exaGetPixmapDriverPrivate(pSrc);
-+ if (driver_priv) {
-+ ret = dri_bufmgr_check_aperture_space(driver_priv->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0);
-+ if (ret) {
-+ RADEONCPFlushIndirect(pScrn, 1);
-+ retry_count++;
-+ if (retry_count == 2)
-+ RADEON_FALLBACK(("Not enough Video RAM for src\n"));
-+ goto retry;
-+ }
-+ info->state_2d.src_bo = driver_priv->bo;
-+
-+ driver_priv = exaGetPixmapDriverPrivate(pDst);
-+ if (driver_priv) {
-+ ret = dri_bufmgr_check_aperture_space(driver_priv->bo, 0, RADEON_GEM_DOMAIN_VRAM);
-+ if (ret) {
-+ RADEONCPFlushIndirect(pScrn, 1);
-+ retry_count++;
-+ if (retry_count == 2)
-+ RADEON_FALLBACK(("Not enough Video RAM for dst\n"));
-+ goto retry;
-+ }
-+ info->state_2d.dst_bo = driver_priv->bo;
-+ }
-+ }
-+ }
FUNC_NAME(RADEONDoPrepareCopy)(pScrn, src_pitch_offset, dst_pitch_offset,
datatype, rop, planemask);
-@@ -250,6 +363,8 @@ FUNC_NAME(RADEONDoneCopy)(PixmapPtr pDst)
+@@ -250,6 +380,8 @@ FUNC_NAME(RADEONDoneCopy)(PixmapPtr pDst)
OUT_ACCEL_REG(RADEON_WAIT_UNTIL,
RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE);
FINISH_ACCEL();
@@ -6643,7 +6725,7 @@
}
static Bool
-@@ -260,6 +375,8 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
+@@ -260,6 +392,8 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
uint8_t *dst = info->FB + exaGetPixmapOffset(pDst);
unsigned int dst_pitch = exaGetPixmapPitch(pDst);
unsigned int bpp = pDst->drawable.bitsPerPixel;
@@ -6652,7 +6734,7 @@
#ifdef ACCEL_CP
unsigned int hpass;
uint32_t buf_pitch, dst_pitch_off;
-@@ -276,10 +393,45 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
+@@ -276,10 +410,45 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
if (bpp < 8)
return FALSE;
@@ -6701,7 +6783,7 @@
int cpp = bpp / 8;
ACCEL_PREAMBLE();
-@@ -294,9 +446,10 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
+@@ -294,9 +463,10 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
exaMarkSync(pDst->drawable.pScreen);
return TRUE;
@@ -6714,7 +6796,7 @@
/* Do we need that sync here ? probably not .... */
exaWaitSync(pDst->drawable.pScreen);
-@@ -335,14 +488,20 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
+@@ -335,14 +505,20 @@ FUNC_NAME(RADEONUploadToScreen)(PixmapPtr pDst, int x, int y, int w, int h,
#ifdef ACCEL_CP
/* Emit blit with arbitrary source and destination offsets and pitches */
static void
@@ -6737,7 +6819,7 @@
OUT_ACCEL_REG(RADEON_DP_GUI_MASTER_CNTL,
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
-@@ -353,8 +512,14 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, uint32_t datatype, uint32_t src_pitch_offset,
+@@ -353,8 +529,14 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, uint32_t datatype, uint32_t src_pitch_offset,
RADEON_DP_SRC_SOURCE_MEMORY |
RADEON_GMC_CLR_CMP_CNTL_DIS |
RADEON_GMC_WR_MSK_DIS);
@@ -6752,7 +6834,7 @@
OUT_ACCEL_REG(RADEON_SRC_Y_X, (srcY << 16) | srcX);
OUT_ACCEL_REG(RADEON_DST_Y_X, (dstY << 16) | dstX);
OUT_ACCEL_REG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w);
-@@ -365,6 +530,107 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, uint32_t datatype, uint32_t src_pitch_offset,
+@@ -365,6 +547,107 @@ RADEONBlitChunk(ScrnInfoPtr pScrn, uint32_t datatype, uint32_t src_pitch_offset,
RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE);
FINISH_ACCEL();
}
@@ -6860,7 +6942,7 @@
#endif
static Bool
-@@ -389,12 +655,16 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
+@@ -389,12 +672,16 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
TRACE;
#ifdef ACCEL_CP
@@ -6878,7 +6960,7 @@
RADEONGetPixmapOffsetPitch(pSrc, &src_pitch_offset) &&
(scratch = RADEONCPGetBuffer(pScrn)))
{
-@@ -409,7 +679,8 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
+@@ -409,7 +696,8 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
RADEON_SWITCH_TO_2D();
/* Kick the first blit as early as possible */
@@ -6888,7 +6970,7 @@
x, y, 0, 0, w, hpass);
FLUSH_RING();
-@@ -436,7 +707,8 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
+@@ -436,7 +724,8 @@ FUNC_NAME(RADEONDownloadFromScreen)(PixmapPtr pSrc, int x, int y, int w, int h,
/* Prepare next blit if anything's left */
if (hpass) {
scratch_off = scratch->total/2 - scratch_off;
@@ -6898,7 +6980,7 @@
x, y, 0, 0, w, hpass);
}
-@@ -543,14 +815,17 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
+@@ -543,14 +832,17 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
info->accel_state->exa->UploadToScreen = FUNC_NAME(RADEONUploadToScreen);
info->accel_state->exa->DownloadFromScreen = FUNC_NAME(RADEONDownloadFromScreen);
@@ -6919,7 +7001,7 @@
#ifdef RENDER
if (info->RenderAccel) {
-@@ -560,7 +835,7 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
+@@ -560,7 +852,7 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
else if (IS_R300_3D || IS_R500_3D) {
if ((info->ChipFamily < CHIP_FAMILY_RS400)
#ifdef XF86DRI
@@ -6928,7 +7010,7 @@
#endif
) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Render acceleration "
-@@ -595,6 +870,16 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
+@@ -595,6 +887,16 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr pScreen)
}
#endif
@@ -6946,7 +7028,7 @@
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting EXA maxPitchBytes\n");
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
-index 97199ae..0de7666 100644
+index 97199ae..820f3c5 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -355,12 +355,14 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
@@ -7013,16 +7095,60 @@
}
FINISH_ACCEL();
-@@ -523,6 +545,8 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
+@@ -523,10 +545,52 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
uint32_t dst_format, dst_offset, dst_pitch, colorpitch;
uint32_t pp_cntl, blendcntl, cblend, ablend;
int pixel_shift;
+ struct radeon_exa_pixmap_priv *driver_priv;
+ int qwords;
++ int retry_count = 0;
++ struct radeon_space_check bos[3];
++ int i, ret;
ACCEL_PREAMBLE();
TRACE;
-@@ -540,15 +564,13 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
+
++ retry:
++ if (info->new_cs) {
++
++ i = 0;
++ driver_priv = exaGetPixmapDriverPrivate(pSrc);
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
++
++ if (pMask) {
++ driver_priv = exaGetPixmapDriverPrivate(pMask);
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
++ }
++
++ driver_priv = exaGetPixmapDriverPrivate(pDst);
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = 0;
++ bos[i].write_domain = RADEON_GEM_DOMAIN_VRAM;;
++ i++;
++
++ ret = dri_bufmgr_check_aperture_space(bos, i);
++ if (ret == BUFMGR_SPACE_OP_TO_BIG) {
++ RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n"));
++ }
++ if (ret == BUFMGR_SPACE_FLUSH) {
++ RADEONCPFlushIndirect(pScrn, 1);
++ retry_count++;
++ if (retry_count == 2)
++ RADEON_FALLBACK(("Not enough Video RAM for src\n"));
++ goto retry;
++ }
++ }
++
+ if (!info->accel_state->XInited3D)
+ RADEONInit3DEngine(pScrn);
+
+@@ -540,15 +604,13 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
@@ -7040,7 +7166,7 @@
RADEON_FALLBACK(("Bad destination offset 0x%x\n", (int)dst_offset));
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
-@@ -569,11 +591,19 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
+@@ -569,11 +631,19 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
}
RADEON_SWITCH_TO_3D();
@@ -7063,7 +7189,7 @@
OUT_ACCEL_REG(RADEON_RB3D_COLORPITCH, colorpitch);
/* IN operator: Multiply src by mask components or mask alpha.
-@@ -669,13 +699,17 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+@@ -669,13 +739,17 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
Bool repeat = pPict->repeat &&
!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
int i;
@@ -7084,7 +7210,7 @@
if ((txpitch & 0x1f) != 0)
RADEON_FALLBACK(("Bad texture pitch 0x%x\n", (int)txpitch));
-@@ -718,7 +752,8 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+@@ -718,7 +792,8 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
if (repeat)
txfilter |= R200_CLAMP_S_WRAP | R200_CLAMP_T_WRAP;
@@ -7094,7 +7220,7 @@
if (unit == 0) {
OUT_ACCEL_REG(R200_PP_TXFILTER_0, txfilter);
OUT_ACCEL_REG(R200_PP_TXFORMAT_0, txformat);
-@@ -726,7 +761,15 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+@@ -726,7 +801,15 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
OUT_ACCEL_REG(R200_PP_TXSIZE_0, (pPix->drawable.width - 1) |
((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
OUT_ACCEL_REG(R200_PP_TXPITCH_0, txpitch - 32);
@@ -7111,7 +7237,7 @@
} else {
OUT_ACCEL_REG(R200_PP_TXFILTER_1, txfilter);
OUT_ACCEL_REG(R200_PP_TXFORMAT_1, txformat);
-@@ -734,7 +777,17 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+@@ -734,7 +817,17 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
OUT_ACCEL_REG(R200_PP_TXSIZE_1, (pPix->drawable.width - 1) |
((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT));
OUT_ACCEL_REG(R200_PP_TXPITCH_1, txpitch - 32);
@@ -7130,16 +7256,61 @@
}
FINISH_ACCEL();
-@@ -823,6 +876,8 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
+@@ -823,10 +916,53 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
uint32_t dst_format, dst_offset, dst_pitch;
uint32_t pp_cntl, blendcntl, cblend, ablend, colorpitch;
int pixel_shift;
+ struct radeon_exa_pixmap_priv *driver_priv;
+ int qwords;
++ int retry_count = 0;
++ struct radeon_space_check bos[3];
++ int i, ret;
ACCEL_PREAMBLE();
TRACE;
-@@ -840,13 +895,13 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
+
++ retry:
++ if (info->new_cs) {
++
++ i = 0;
++ driver_priv = exaGetPixmapDriverPrivate(pSrc);
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
++
++ if (pMask) {
++ driver_priv = exaGetPixmapDriverPrivate(pMask);
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
++ }
++
++ driver_priv = exaGetPixmapDriverPrivate(pDst);
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = 0;
++ bos[i].write_domain = RADEON_GEM_DOMAIN_VRAM;;
++ i++;
++
++ ret = dri_bufmgr_check_aperture_space(bos, i);
++ if (ret == BUFMGR_SPACE_OP_TO_BIG) {
++ RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n"));
++ }
++ if (ret == BUFMGR_SPACE_FLUSH) {
++ RADEONCPFlushIndirect(pScrn, 1);
++ retry_count++;
++ if (retry_count == 2)
++ RADEON_FALLBACK(("Not enough Video RAM for src\n"));
++ goto retry;
++ }
++ }
++
++
+ if (!info->accel_state->XInited3D)
+ RADEONInit3DEngine(pScrn);
+
+@@ -840,13 +976,13 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
@@ -7155,7 +7326,7 @@
RADEON_FALLBACK(("Bad destination offset 0x%x\n", (int)dst_offset));
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
-@@ -868,11 +923,22 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
+@@ -868,11 +1004,22 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
RADEON_SWITCH_TO_3D();
@@ -7180,7 +7351,7 @@
OUT_ACCEL_REG(R200_SE_VTX_FMT_0, R200_VTX_XY);
if (pMask)
-@@ -941,6 +1007,10 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict,
+@@ -941,6 +1088,10 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict,
int unit,
Bool is_r500)
{
@@ -7191,7 +7362,7 @@
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int i;
-@@ -966,8 +1036,17 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict,
+@@ -966,8 +1117,17 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict,
RADEON_FALLBACK(("Unsupported picture format 0x%x\n",
(int)pPict->format));
@@ -7210,7 +7381,7 @@
if (pPict->filter != PictFilterNearest &&
pPict->filter != PictFilterBilinear)
-@@ -999,15 +1078,19 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+@@ -999,15 +1159,19 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
int w = pPict->pDrawable->width;
int h = pPict->pDrawable->height;
int i, pixel_shift;
@@ -7233,7 +7404,7 @@
if ((txpitch & 0x1f) != 0)
RADEON_FALLBACK(("Bad texture pitch 0x%x\n", (int)txpitch));
-@@ -1068,13 +1151,26 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+@@ -1068,13 +1232,26 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
RADEON_FALLBACK(("Bad filter 0x%x\n", pPict->filter));
}
@@ -7262,7 +7433,7 @@
if (!pPict->repeat)
OUT_ACCEL_REG(R300_TX_BORDER_COLOR_0 + (unit * 4), 0);
FINISH_ACCEL();
-@@ -1173,6 +1269,7 @@ static Bool R300CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+@@ -1173,6 +1350,7 @@ static Bool R300CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
return TRUE;
}
@@ -7270,60 +7441,60 @@
#endif /* ONLY_ONCE */
static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
-@@ -1184,10 +1281,52 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
+@@ -1184,10 +1362,51 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
uint32_t txenable, colorpitch;
uint32_t blendcntl;
int pixel_shift;
+ int qwords, ret;
+ int retry_count = 0;
+ struct radeon_exa_pixmap_priv *driver_priv;
++ struct radeon_space_check bos[3];
++ int i;
ACCEL_PREAMBLE();
-
+-
TRACE;
+ retry:
+ if (info->new_cs) {
++
++ i = 0;
+ driver_priv = exaGetPixmapDriverPrivate(pSrc);
-+ ret = dri_bufmgr_check_aperture_space(driver_priv->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0);
-+ if (ret) {
-+ RADEONCPFlushIndirect(pScrn, 1);
-+ retry_count++;
-+ if (retry_count == 2)
-+ RADEON_FALLBACK(("Not enough Video RAM for src\n"));
-+ goto retry;
-+ }
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
+
+ if (pMask) {
+ driver_priv = exaGetPixmapDriverPrivate(pMask);
-+ ret = dri_bufmgr_check_aperture_space(driver_priv->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0);
-+ if (ret) {
-+ RADEONCPFlushIndirect(pScrn, 1);
-+ retry_count++;
-+ if (retry_count == 2)
-+ RADEON_FALLBACK(("Not enough Video RAM for mask\n"));
-+ goto retry;
-+ }
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
+ }
+
+ driver_priv = exaGetPixmapDriverPrivate(pDst);
-+ if (driver_priv) {
-+ ret = dri_bufmgr_check_aperture_space(driver_priv->bo, 0, RADEON_GEM_DOMAIN_VRAM);
-+ if (ret) {
-+ RADEONCPFlushIndirect(pScrn, 1);
-+ retry_count++;
-+ if (retry_count == 2)
-+ RADEON_FALLBACK(("Not enough Video RAM for dst\n"));
-+ goto retry;
-+ }
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = 0;
++ bos[i].write_domain = RADEON_GEM_DOMAIN_VRAM;;
++ i++;
++
++ ret = dri_bufmgr_check_aperture_space(bos, i);
++ if (ret == BUFMGR_SPACE_OP_TO_BIG) {
++ RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n"));
++ }
++ if (ret == BUFMGR_SPACE_FLUSH) {
++ RADEONCPFlushIndirect(pScrn, 1);
++ retry_count++;
++ if (retry_count == 2)
++ RADEON_FALLBACK(("Not enough Video RAM - this really shouldn't happen\nm"));
++ goto retry;
+ }
+ }
-+
-+
+
if (!info->accel_state->XInited3D)
RADEONInit3DEngine(pScrn);
-@@ -1201,7 +1340,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
+@@ -1201,7 +1420,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
pixel_shift = pDst->drawable.bitsPerPixel >> 4;
@@ -7332,7 +7503,7 @@
dst_pitch = exaGetPixmapPitch(pDst);
colorpitch = dst_pitch >> pixel_shift;
-@@ -1210,7 +1349,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
+@@ -1210,7 +1429,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
colorpitch |= dst_format;
@@ -7341,7 +7512,7 @@
RADEON_FALLBACK(("Bad destination offset 0x%x\n", (int)dst_offset));
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
-@@ -1829,9 +1968,18 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
+@@ -1829,9 +2048,18 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
FINISH_ACCEL();
}
@@ -7997,25 +8168,60 @@
else
#endif
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
-index c5ad0e1..61fecc8 100644
+index c5ad0e1..481bfc8 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
-@@ -95,6 +95,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -95,6 +95,11 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
{
RADEONInfoPtr info = RADEONPTR(pScrn);
PixmapPtr pPixmap = pPriv->pPixmap;
+ struct radeon_exa_pixmap_priv *driver_priv;
++ struct radeon_space_check bos[2];
++ int i, ret;
++ int retry_count = 0;
+ dri_bo *dst_bo;
uint32_t txformat;
uint32_t txfilter, txformat0, txformat1, txoffset, txpitch;
uint32_t dst_offset, dst_pitch, dst_format;
-@@ -103,19 +105,25 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -103,19 +108,57 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
int dstxoff, dstyoff, pixel_shift, vtx_count;
BoxPtr pBox = REGION_RECTS(&pPriv->clip);
int nBox = REGION_NUM_RECTS(&pPriv->clip);
+ int qwords;
ACCEL_PREAMBLE();
++ retry:
++ if (info->new_cs) {
++
++ i = 0;
++ bos[i].buf = pPriv->src_bo;
++ bos[i].read_domains = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
++ bos[i].write_domain = 0;
++ i++;
++
++ driver_priv = exaGetPixmapDriverPrivate(pPixmap);
++ dst_bo = driver_priv->bo;
++ bos[i].buf = driver_priv->bo;
++ bos[i].read_domains = 0;
++ bos[i].write_domain = RADEON_GEM_DOMAIN_VRAM;;
++ i++;
++
++ ret = dri_bufmgr_check_aperture_space(bos, i);
++ if (ret == BUFMGR_SPACE_OP_TO_BIG) {
++ ErrorF("Not enough RAM to hw accel composite operation\n");
++ return;
++ }
++ if (ret == BUFMGR_SPACE_FLUSH) {
++ RADEONCPFlushIndirect(pScrn, 1);
++ retry_count++;
++ if (retry_count == 2) {
++ ErrorF("Not enough RAM to hw accel composite operation\n");
++ return;
++ }
++ goto retry;
++ }
++ }
++
pixel_shift = pPixmap->drawable.bitsPerPixel >> 4;
#ifdef USE_EXA
@@ -8038,7 +8244,7 @@
dst_pitch = pPixmap->devKind;
}
-@@ -210,13 +218,20 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -210,13 +253,20 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
txoffset = pPriv->src_offset;
@@ -8061,7 +8267,7 @@
FINISH_ACCEL();
txenable = R300_TEX_0_ENABLE;
-@@ -237,13 +252,19 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -237,13 +287,19 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
R300_TX_MAG_FILTER_NEAREST |
(1 << R300_TX_ID_SHIFT));
@@ -8083,7 +8289,7 @@
FINISH_ACCEL();
/* Enable tex 1 */
-@@ -980,11 +1001,18 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -980,11 +1036,18 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
}
}
@@ -8104,7 +8310,7 @@
OUT_ACCEL_REG(R300_RB3D_COLORPITCH0, colorpitch);
blendcntl = RADEON_SRC_BLEND_GL_ONE | RADEON_DST_BLEND_GL_ZERO;
-@@ -1029,6 +1057,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -1029,6 +1092,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE);
OUT_ACCEL_REG(RADEON_RB3D_CNTL,
dst_format | RADEON_ALPHA_BLEND_ENABLE);
@@ -8113,7 +8319,7 @@
OUT_ACCEL_REG(RADEON_RB3D_COLOROFFSET, dst_offset);
OUT_ACCEL_REG(RADEON_RB3D_COLORPITCH, colorpitch);
-@@ -1066,7 +1096,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -1066,7 +1131,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
((pPriv->h - 1) << RADEON_TEX_VSIZE_SHIFT));
OUT_ACCEL_REG(R200_PP_TXPITCH_0, pPriv->src_pitch - 32);
@@ -8123,7 +8329,7 @@
OUT_ACCEL_REG(R200_PP_TXCBLEND_0,
R200_TXC_ARG_A_ZERO |
-@@ -1099,8 +1130,10 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+@@ -1099,8 +1165,10 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
RADEON_CLAMP_S_CLAMP_LAST |
RADEON_CLAMP_T_CLAMP_LAST |
RADEON_YUV_TO_RGB);
Index: xorg-x11-drv-ati.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-ati/F-10/xorg-x11-drv-ati.spec,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -r1.150 -r1.151
--- xorg-x11-drv-ati.spec 18 Nov 2008 04:37:02 -0000 1.150
+++ xorg-x11-drv-ati.spec 18 Nov 2008 06:15:26 -0000 1.151
@@ -5,7 +5,7 @@
Summary: Xorg X11 ati video driver
Name: xorg-x11-drv-ati
Version: 6.9.0
-Release: 50%{?dist}
+Release: 51%{?dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X Hardware Support
@@ -82,6 +82,9 @@
%{_mandir}/man4/radeon.4*
%changelog
+* Tue Nov 18 2008 Dave Airlie <airlied at redhat.com> 6.9.0-51
+- radeon - even better space checks + prefer glitches + debug over exiting
+
* Tue Nov 18 2008 Dave Airlie <airlied at redhat.com> 6.9.0-50
- radeon - don't fail at integer division
More information about the fedora-extras-commits
mailing list