>>>>> "Pauli" == Pauli Nieminen <[email protected]> writes:
Pauli> KMS doesn't have acceleration for upload to Pauli> vram. memcpy/memmove to VRAM directly is very slow (40M/s in Pauli> benchmark) which causes visible problems to video. Pauli> Allocating video buffer in GTT will give good performance Pauli> (350-450M/s) for memmove operation. This is nice performance Pauli> boost for Xv under KMS. Pauli> There is still posibility to improve if adding BLITBLT transfer Pauli> to VRAM which would handle tiling and endian swapping. Just a comment on the code. Instead of using the updated radeon_legacy_allocate_memory() call with 0 as the last arg, please use a more descriptive #define instead, so that it's obvious what's happening. Or better yet, split it off into a new helper function called radeon_legacy_mem_alloc_gtt() which calls the other function with the proper value. Pauli> Signed-off-by: Pauli Nieminen <[email protected]> Pauli> --- Pauli> src/radeon.h | 3 ++- Pauli> src/radeon_crtc.c | 2 +- Pauli> src/radeon_cursor.c | 2 +- Pauli> src/radeon_legacy_memory.c | 5 +++-- Pauli> src/radeon_textured_video.c | 9 ++++++--- Pauli> src/radeon_video.c | 8 +++++--- Pauli> 6 files changed, 18 insertions(+), 11 deletions(-) Pauli> diff --git a/src/radeon.h b/src/radeon.h Pauli> index 2138b4a..4e6f09a 100644 Pauli> --- a/src/radeon.h Pauli> +++ b/src/radeon.h Pauli> @@ -1325,7 +1325,8 @@ extern uint32_t Pauli> radeon_legacy_allocate_memory(ScrnInfoPtr pScrn, Pauli> void **mem_struct, Pauli> int size, Pauli> - int align); Pauli> + int align, Pauli> + int domain); Pauli> extern void Pauli> radeon_legacy_free_memory(ScrnInfoPtr pScrn, Pauli> void *mem_struct); Pauli> diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c Pauli> index 556b461..8384af1 100644 Pauli> --- a/src/radeon_crtc.c Pauli> +++ b/src/radeon_crtc.c Pauli> @@ -564,7 +564,7 @@ radeon_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height) Pauli> * setter for offscreen area locking in EXA currently. So, we just Pauli> * allocate offscreen memory and fake up a pixmap header for it. Pauli> */ Pauli> - rotate_offset = radeon_legacy_allocate_memory(pScrn, &radeon_crtc->crtc_rotate_mem, size, align); Pauli> + rotate_offset = radeon_legacy_allocate_memory(pScrn, &radeon_crtc->crtc_rotate_mem, size, align, 0); Right here! Put in the actual RADEON_GEM_DOMAIN_GTT, not zero. Pauli> if (rotate_offset == 0) Pauli> return NULL; Pauli> diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c Pauli> index 2e60710..4425f2c 100644 Pauli> --- a/src/radeon_cursor.c Pauli> +++ b/src/radeon_cursor.c Pauli> @@ -420,7 +420,7 @@ Bool RADEONCursorInit(ScreenPtr pScreen) Pauli> int align = IS_AVIVO_VARIANT ? 4096 : 256; radeon_crtc-> cursor_offset = Pauli> - radeon_legacy_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align); Pauli> + radeon_legacy_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align, 0); Same here. RADEON_GEM_DOMAIN_GTT, not 0. Pauli> if (radeon_crtc->cursor_offset == 0) Pauli> return FALSE; Pauli> diff --git a/src/radeon_legacy_memory.c b/src/radeon_legacy_memory.c Pauli> index 02b95ed..bdf8ca2 100644 Pauli> --- a/src/radeon_legacy_memory.c Pauli> +++ b/src/radeon_legacy_memory.c Pauli> @@ -15,7 +15,8 @@ uint32_t Pauli> radeon_legacy_allocate_memory(ScrnInfoPtr pScrn, Pauli> void **mem_struct, Pauli> int size, Pauli> - int align) Pauli> + int align, Pauli> + int domain) Pauli> { Pauli> ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; Pauli> RADEONInfoPtr info = RADEONPTR(pScrn); Pauli> @@ -25,7 +26,7 @@ radeon_legacy_allocate_memory(ScrnInfoPtr pScrn, Pauli> if (info->cs) { Pauli> struct radeon_bo *video_bo; Pauli> - video_bo = radeon_bo_open(info->bufmgr, 0, size, 4096, 0, 0); Pauli> + video_bo = radeon_bo_open(info->bufmgr, 0, size, 4096, domain, 0); Pauli> *mem_struct = video_bo; Pauli> diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c Pauli> index fdc077e..fcd3844 100644 Pauli> --- a/src/radeon_textured_video.c Pauli> +++ b/src/radeon_textured_video.c Pauli> @@ -318,14 +318,16 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn, Pauli> if (pPriv->video_memory == NULL) { pPriv-> video_offset = radeon_legacy_allocate_memory(pScrn, Pauli> &pPriv->video_memory, Pauli> - size, hw_align + 1); Pauli> + size, hw_align + 1, Pauli> + RADEON_GEM_DOMAIN_GTT); Pauli> if (pPriv->video_offset == 0) Pauli> return BadAlloc; Pauli> if (info->cs) { pPriv-> src_bo[0] = pPriv->video_memory; Pauli> radeon_legacy_allocate_memory(pScrn, (void*)&pPriv->src_bo[1], size, Pauli> - hw_align + 1); Pauli> + hw_align + 1, Pauli> + RADEON_GEM_DOMAIN_GTT); Pauli> } Pauli> } Pauli> @@ -709,7 +711,8 @@ Bool radeon_load_bicubic_texture(ScrnInfoPtr pScrn) Pauli> /* Bicubic filter loading */ info-> bicubic_offset = radeon_legacy_allocate_memory(pScrn, Pauli> &info->bicubic_memory, Pauli> - sizeof(bicubic_tex_512), 64); Pauli> + sizeof(bicubic_tex_512), 64, Pauli> + 0); Pauli> if (info->bicubic_offset == 0) Pauli> return FALSE; Pauli> diff --git a/src/radeon_video.c b/src/radeon_video.c Pauli> index b1b3f15..01f422c 100644 Pauli> --- a/src/radeon_video.c Pauli> +++ b/src/radeon_video.c Pauli> @@ -2949,7 +2949,8 @@ RADEONPutImage( Pauli> } pPriv-> video_offset = radeon_legacy_allocate_memory(pScrn, &pPriv->video_memory, Pauli> (pPriv->doubleBuffer ? Pauli> - (new_size * 2) : new_size), 64); Pauli> + (new_size * 2) : new_size), 64, Pauli> + RADEON_GEM_DOMAIN_GTT); Pauli> if (pPriv->video_offset == 0) Pauli> return BadAlloc; Pauli> @@ -3179,7 +3180,7 @@ RADEONAllocateSurface( Pauli> pitch = ((w << 1) + 15) & ~15; Pauli> size = pitch * h; Pauli> - offset = radeon_legacy_allocate_memory(pScrn, &surface_memory, size, 64); Pauli> + offset = radeon_legacy_allocate_memory(pScrn, &surface_memory, size, 64, 0); Pauli> if (offset == 0) Pauli> return BadAlloc; Pauli> @@ -3517,7 +3518,8 @@ RADEONPutVideo( pPriv-> video_offset = radeon_legacy_allocate_memory(pScrn, &pPriv->video_memory, Pauli> (pPriv->doubleBuffer ? Pauli> - (new_size * 2) : new_size), 64); Pauli> + (new_size * 2) : new_size), 64, Pauli> + RADEON_GEM_DOMAIN_GTT); Pauli> if (pPriv->video_offset == 0) Pauli> return BadAlloc; Pauli> -- Pauli> 1.6.3.3 Pauli> _______________________________________________ Pauli> xorg-driver-ati mailing list Pauli> [email protected] Pauli> http://lists.x.org/mailman/listinfo/xorg-driver-ati _______________________________________________ xorg-driver-ati mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-driver-ati
