[PATCH] Allocate Xv buffers to GTT.
Pauli Nieminen
suokkos at gmail.com
Wed Feb 10 12:44:48 PST 2010
KMS doesn't have acceleration for upload to vram. memcpy/memmove to VRAM
directly is very slow (40M/s in benchmark) which causes visible problems
to video.
Allocating video buffer in GTT will give good performance (350-450M/s)
for memmove operation. This is nice performance boost for Xv under KMS.
There is still posibility to improve if adding BLITBLT transfer to VRAM
which would handle tiling and endian swapping.
Signed-off-by: Pauli Nieminen <suokkos at gmail.com>
---
src/radeon.h | 3 ++-
src/radeon_crtc.c | 2 +-
src/radeon_cursor.c | 2 +-
src/radeon_legacy_memory.c | 5 +++--
src/radeon_textured_video.c | 9 ++++++---
src/radeon_video.c | 8 +++++---
6 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/radeon.h b/src/radeon.h
index 2138b4a..4e6f09a 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -1325,7 +1325,8 @@ extern uint32_t
radeon_legacy_allocate_memory(ScrnInfoPtr pScrn,
void **mem_struct,
int size,
- int align);
+ int align,
+ int domain);
extern void
radeon_legacy_free_memory(ScrnInfoPtr pScrn,
void *mem_struct);
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index 556b461..8384af1 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -564,7 +564,7 @@ radeon_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height)
* setter for offscreen area locking in EXA currently. So, we just
* allocate offscreen memory and fake up a pixmap header for it.
*/
- rotate_offset = radeon_legacy_allocate_memory(pScrn, &radeon_crtc->crtc_rotate_mem, size, align);
+ rotate_offset = radeon_legacy_allocate_memory(pScrn, &radeon_crtc->crtc_rotate_mem, size, align, 0);
if (rotate_offset == 0)
return NULL;
diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index 2e60710..4425f2c 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -420,7 +420,7 @@ Bool RADEONCursorInit(ScreenPtr pScreen)
int align = IS_AVIVO_VARIANT ? 4096 : 256;
radeon_crtc->cursor_offset =
- radeon_legacy_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align);
+ radeon_legacy_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align, 0);
if (radeon_crtc->cursor_offset == 0)
return FALSE;
diff --git a/src/radeon_legacy_memory.c b/src/radeon_legacy_memory.c
index 02b95ed..bdf8ca2 100644
--- a/src/radeon_legacy_memory.c
+++ b/src/radeon_legacy_memory.c
@@ -15,7 +15,8 @@ uint32_t
radeon_legacy_allocate_memory(ScrnInfoPtr pScrn,
void **mem_struct,
int size,
- int align)
+ int align,
+ int domain)
{
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
RADEONInfoPtr info = RADEONPTR(pScrn);
@@ -25,7 +26,7 @@ radeon_legacy_allocate_memory(ScrnInfoPtr pScrn,
if (info->cs) {
struct radeon_bo *video_bo;
- video_bo = radeon_bo_open(info->bufmgr, 0, size, 4096, 0, 0);
+ video_bo = radeon_bo_open(info->bufmgr, 0, size, 4096, domain, 0);
*mem_struct = video_bo;
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index fdc077e..fcd3844 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -318,14 +318,16 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
if (pPriv->video_memory == NULL) {
pPriv->video_offset = radeon_legacy_allocate_memory(pScrn,
&pPriv->video_memory,
- size, hw_align + 1);
+ size, hw_align + 1,
+ RADEON_GEM_DOMAIN_GTT);
if (pPriv->video_offset == 0)
return BadAlloc;
if (info->cs) {
pPriv->src_bo[0] = pPriv->video_memory;
radeon_legacy_allocate_memory(pScrn, (void*)&pPriv->src_bo[1], size,
- hw_align + 1);
+ hw_align + 1,
+ RADEON_GEM_DOMAIN_GTT);
}
}
@@ -709,7 +711,8 @@ Bool radeon_load_bicubic_texture(ScrnInfoPtr pScrn)
/* Bicubic filter loading */
info->bicubic_offset = radeon_legacy_allocate_memory(pScrn,
&info->bicubic_memory,
- sizeof(bicubic_tex_512), 64);
+ sizeof(bicubic_tex_512), 64,
+ 0);
if (info->bicubic_offset == 0)
return FALSE;
diff --git a/src/radeon_video.c b/src/radeon_video.c
index b1b3f15..01f422c 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -2949,7 +2949,8 @@ RADEONPutImage(
}
pPriv->video_offset = radeon_legacy_allocate_memory(pScrn, &pPriv->video_memory,
(pPriv->doubleBuffer ?
- (new_size * 2) : new_size), 64);
+ (new_size * 2) : new_size), 64,
+ RADEON_GEM_DOMAIN_GTT);
if (pPriv->video_offset == 0)
return BadAlloc;
@@ -3179,7 +3180,7 @@ RADEONAllocateSurface(
pitch = ((w << 1) + 15) & ~15;
size = pitch * h;
- offset = radeon_legacy_allocate_memory(pScrn, &surface_memory, size, 64);
+ offset = radeon_legacy_allocate_memory(pScrn, &surface_memory, size, 64, 0);
if (offset == 0)
return BadAlloc;
@@ -3517,7 +3518,8 @@ RADEONPutVideo(
pPriv->video_offset = radeon_legacy_allocate_memory(pScrn, &pPriv->video_memory,
(pPriv->doubleBuffer ?
- (new_size * 2) : new_size), 64);
+ (new_size * 2) : new_size), 64,
+ RADEON_GEM_DOMAIN_GTT);
if (pPriv->video_offset == 0)
return BadAlloc;
--
1.6.3.3
More information about the xorg-driver-ati
mailing list