[PATCH] Allocate Xv buffers to GTT.
Pauli Nieminen
suokkos at gmail.com
Mon Feb 15 03:40:37 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.
Signed-off-by: Pauli Nieminen <suokkos at gmail.com>
---
src/radeon.h | 3 ++-
src/radeon_crtc.c | 3 ++-
src/radeon_cursor.c | 3 ++-
src/radeon_legacy_memory.c | 5 +++--
src/radeon_textured_video.c | 9 ++++++---
src/radeon_video.c | 9 ++++++---
6 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/radeon.h b/src/radeon.h
index 59c2282..f9c78ab 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -1331,7 +1331,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..764839c 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -564,7 +564,8 @@ 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, RADEON_GEM_DOMAIN_VRAM);
if (rotate_offset == 0)
return NULL;
diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index 2e60710..4a171ff 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -420,7 +420,8 @@ 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, RADEON_GEM_DOMAIN_VRAM);
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..29910d0 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,
+ RADEON_GEM_DOMAIN_VRAM);
if (info->bicubic_offset == 0)
return FALSE;
diff --git a/src/radeon_video.c b/src/radeon_video.c
index d7700fa..92f65a6 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,8 @@ 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,
+ RADEON_GEM_DOMAIN_GTT);
if (offset == 0)
return BadAlloc;
@@ -3517,7 +3519,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