diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-07-14 14:05:13 -0400 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2009-07-14 14:05:13 -0400 |
commit | 5473eeeb45468fd200fec49a8506281628a5e4b5 (patch) | |
tree | 03fe2eb2dc8d6c60f229855f57567c11108bdb19 /src/radeon_textured_video.c | |
parent | 0485f27bc3d75cb6ab320e8164dbe6ea2713c78e (diff) |
R3/4/5xx: only upload the bicubic texture once
Upload the bicubic texture once during textured video init
rather than once per frame. Suggested by Michel Daenzer on
IRC.
Diffstat (limited to 'src/radeon_textured_video.c')
-rw-r--r-- | src/radeon_textured_video.c | 89 |
1 files changed, 56 insertions, 33 deletions
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c index 617f359f..d034c336 100644 --- a/src/radeon_textured_video.c +++ b/src/radeon_textured_video.c @@ -332,16 +332,10 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn, } /* Bicubic filter loading */ - if (pPriv->bicubic_memory == NULL && pPriv->bicubic_enabled) { - pPriv->bicubic_offset = radeon_legacy_allocate_memory(pScrn, - &pPriv->bicubic_memory, - sizeof(bicubic_tex_512), 64); - pPriv->bicubic_src_offset = pPriv->bicubic_offset; - if (pPriv->bicubic_offset == 0) - pPriv->bicubic_enabled = FALSE; - - if (info->cs) - pPriv->bicubic_bo = pPriv->bicubic_memory; + if (pPriv->bicubic_enabled) { + if (info->bicubic_offset == 0) + pPriv->bicubic_enabled = FALSE; + pPriv->bicubic_src_offset = info->bicubic_offset; } if (pDraw->type == DRAWABLE_WINDOW) @@ -375,9 +369,9 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn, int ret; radeon_bo_wait(pPriv->src_bo); ret = radeon_bo_map(pPriv->src_bo, 1); - if (ret) + if (ret) return BadAlloc; - + pPriv->src_addr = pPriv->src_bo->ptr; } else { pPriv->src_addr = (uint8_t *)(info->FB + pPriv->video_offset); @@ -448,27 +442,6 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn, break; } - /* Upload bicubic filter tex */ - if (pPriv->bicubic_enabled) { - if (info->ChipFamily < CHIP_FAMILY_R600) { - uint8_t *bicubic_addr; - int ret; - if (info->cs) { - radeon_bo_wait(pPriv->bicubic_bo); - ret = radeon_bo_map(pPriv->bicubic_bo, 1); - if (ret) - return BadAlloc; - - bicubic_addr = pPriv->bicubic_bo->ptr; - } else - bicubic_addr = (uint8_t *)(info->FB + pPriv->bicubic_offset); - - RADEONCopyData(pScrn, (uint8_t *)bicubic_tex_512, bicubic_addr, 1024, 1024, 1, 512, 2); - if (info->cs) - radeon_bo_unmap(pPriv->bicubic_bo); - } - } - /* update cliplist */ if (!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) { REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes); @@ -698,6 +671,53 @@ RADEONSetTexPortAttribute(ScrnInfoPtr pScrn, return Success; } +static Bool radeon_load_bicubic_texture(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + /* Bicubic filter loading */ + info->bicubic_offset = radeon_legacy_allocate_memory(pScrn, + &info->bicubic_memory, + sizeof(bicubic_tex_512), 64); + if (info->bicubic_offset == 0) + return FALSE; + + if (info->cs) + info->bicubic_bo = info->bicubic_memory; + + /* Upload bicubic filter tex */ + if (info->ChipFamily < CHIP_FAMILY_R600) { + 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; + + bicubic_addr = info->bicubic_bo->ptr; + } else + bicubic_addr = (uint8_t *)(info->FB + info->bicubic_offset); + + RADEONCopyData(pScrn, (uint8_t *)bicubic_tex_512, bicubic_addr, 1024, 1024, 1, 512, 2); + if (info->cs) + radeon_bo_unmap(info->bicubic_bo); + } + return TRUE; +} + +/* XXX */ +static void radeon_unload_bicubic_texture(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + if (info->bicubic_memory != NULL) { + radeon_legacy_free_memory(pScrn, info->bicubic_memory); + info->bicubic_memory = NULL; + } + +} + XF86VideoAdaptorPtr RADEONSetupImageTexturedVideo(ScreenPtr pScreen) { @@ -795,6 +815,9 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen) adapt->pPortPrivates[i].ptr = (pointer) (pPriv); } + if (IS_R500_3D || IS_R300_3D) + radeon_load_bicubic_texture(pScrn); + return adapt; } |