diff options
author | Dave Airlie <airlied@redhat.com> | 2009-07-06 14:45:07 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-07-06 15:11:15 +1000 |
commit | d78d50591851d14543f0935d051a59ef29751bbc (patch) | |
tree | 973a85b4d6df847813a50e9dcb4f2fe94e689bc7 /src/radeon_exa_render.c | |
parent | e1200cb89218930d01330ba0114e013438655cce (diff) |
radeon: port to new space checking in libdrm interface
This uses a new libdrm interface which shares code with mesa.
It also fixes the bo to flush when full instead of never flushing.
It survives gtkperf -a here which the driver didn't before now
Diffstat (limited to 'src/radeon_exa_render.c')
-rw-r--r-- | src/radeon_exa_render.c | 85 |
1 files changed, 26 insertions, 59 deletions
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 60c40a23..1e07408d 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -557,9 +557,7 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op, uint32_t pp_cntl, blendcntl, cblend, ablend; int pixel_shift; struct radeon_exa_pixmap_priv *driver_priv; - int retry_count = 0; - struct radeon_cs_space_check bos[3]; - int i, ret; + int ret; ACCEL_PREAMBLE(); TRACE; @@ -589,28 +587,21 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op, /* switch to 3D before doing buffer space checks as it may flush */ RADEON_SWITCH_TO_3D(); - retry: + if (info->cs) { - - i = 0; - radeon_add_pixmap(bos, i++, pSrc, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_cs_space_reset_bos(info->cs); + + radeon_add_pixmap(info->cs, pSrc, + RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); if (pMask) - radeon_add_pixmap(bos, i++, pMask, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_add_pixmap(info->cs, pMask, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - radeon_add_pixmap(bos, i++, pDst, 0, RADEON_GEM_DOMAIN_VRAM); + radeon_add_pixmap(info->cs, pDst, 0, RADEON_GEM_DOMAIN_VRAM); - ret = radeon_cs_space_check(info->cs, bos, i); - if (ret == RADEON_CS_SPACE_OP_TO_BIG) { + ret = radeon_cs_space_check(info->cs); + if (ret) RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n")); - } - if (ret == RADEON_CS_SPACE_FLUSH) { - radeon_cs_flush_indirect(pScrn); - retry_count++; - if (retry_count == 2) - RADEON_FALLBACK(("Not enough Video RAM for src\n")); - goto retry; - } } if (!RADEONSetupSourceTile(pSrcPicture, pSrc, FALSE, TRUE)) @@ -914,9 +905,7 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture, uint32_t pp_cntl, blendcntl, cblend, ablend, colorpitch; int pixel_shift; struct radeon_exa_pixmap_priv *driver_priv; - int retry_count = 0; - struct radeon_cs_space_check bos[3]; - int i, ret; + int ret; ACCEL_PREAMBLE(); TRACE; @@ -947,29 +936,20 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture, /* switch to 3D before doing buffer space checks as it may flush */ RADEON_SWITCH_TO_3D(); - retry: if (info->cs) { - - i = 0; - radeon_add_pixmap(bos, i++, pSrc, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_cs_space_reset_bos(info->cs); + radeon_add_pixmap(info->cs, pSrc, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); if (pMask) - radeon_add_pixmap(bos, i++, pMask, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_add_pixmap(info->cs, pMask, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - radeon_add_pixmap(bos, i++, pDst, 0, RADEON_GEM_DOMAIN_VRAM); + radeon_add_pixmap(info->cs, pDst, 0, RADEON_GEM_DOMAIN_VRAM); - ret = radeon_cs_space_check(info->cs, bos, i); - if (ret == RADEON_CS_SPACE_OP_TO_BIG) { - RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n")); - } - if (ret == RADEON_CS_SPACE_FLUSH) { - radeon_cs_flush_indirect(pScrn); - retry_count++; - if (retry_count == 2) - RADEON_FALLBACK(("Not enough Video RAM for src\n")); - goto retry; - } + ret = radeon_cs_space_check(info->cs); + if (ret) + RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n")); } + if (!RADEONSetupSourceTile(pSrcPicture, pSrc, FALSE, TRUE)) return FALSE; @@ -1404,10 +1384,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture, uint32_t mask_color, mask_alpha; int pixel_shift; int ret; - int retry_count = 0; struct radeon_exa_pixmap_priv *driver_priv; - struct radeon_cs_space_check bos[3]; - int i; ACCEL_PREAMBLE(); TRACE; @@ -1436,29 +1413,19 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture, /* have to execute switch before doing buffer sizing check as it flushes */ RADEON_SWITCH_TO_3D(); - retry: + if (info->cs) { - - i = 0; - driver_priv = exaGetPixmapDriverPrivate(pSrc); - radeon_add_pixmap(bos, i++, pSrc, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_cs_space_reset_bos(info->cs); + radeon_add_pixmap(info->cs, pSrc, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); if (pMask) - radeon_add_pixmap(bos, i++, pMask, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); + radeon_add_pixmap(info->cs, pMask, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); - radeon_add_pixmap(bos, i++, pDst, 0, RADEON_GEM_DOMAIN_VRAM); + radeon_add_pixmap(info->cs, pDst, 0, RADEON_GEM_DOMAIN_VRAM); - ret = radeon_cs_space_check(info->cs, bos, i); - if (ret == RADEON_CS_SPACE_OP_TO_BIG) { + ret = radeon_cs_space_check(info->cs); + if (ret) RADEON_FALLBACK(("Not enough RAM to hw accel composite operation\n")); - } - if (ret == RADEON_CS_SPACE_FLUSH) { - radeon_cs_flush_indirect(pScrn); - retry_count++; - if (retry_count == 2) - RADEON_FALLBACK(("Not enough Video RAM - this really shouldn't happen\nm")); - goto retry; - } } if (!RADEONSetupSourceTile(pSrcPicture, pSrc, TRUE, FALSE)) |