diff --git a/src/radeon.h b/src/radeon.h
index 32bfa4e..aeea221 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -408,6 +408,11 @@ typedef struct _atomBiosHandle *atomBiosHandlePtr;
#define RADEON_POOL_GART 0
#define RADEON_POOL_VRAM 1
+
+struct radeon_exa_pixmap_priv {
+ dri_bo *bo;
+ int flags;
+};
typedef struct {
uint32_t pci_device_id;
diff --git a/src/radeon_bufmgr_gem.c b/src/radeon_bufmgr_gem.c
index db28edc..d7b5644 100644
--- a/src/radeon_bufmgr_gem.c
+++ b/src/radeon_bufmgr_gem.c
@@ -528,3 +528,10 @@ void radeon_bufmgr_emit_reloc(dri_bo *buf, uint32_t *head, uint32_t *count_p, ui
radeon_bufmgr = (struct radeon_bufmgr *)(buf->bufmgr + 1);
radeon_bufmgr->emit_reloc(buf, head, count_p, read_domains, write_domain);
}
+
+int radeon_bufmgr_gem_in_vram(dri_bo *buf)
+{
+ dri_bo_gem *gem_bo = (dri_bo_gem *)buf;
+
+ return gem_bo->in_vram;
+}
diff --git a/src/radeon_bufmgr_gem.h b/src/radeon_bufmgr_gem.h
index e2f1ca6..d67ddf6 100644
--- a/src/radeon_bufmgr_gem.h
+++ b/src/radeon_bufmgr_gem.h
@@ -11,4 +11,5 @@ void radeon_bufmgr_post_submit(dri_bufmgr *bufmgr);
void radeon_bufmgr_pin(dri_bo *buf);
void radeon_bufmgr_unpin(dri_bo *buf);
uint32_t radeon_bufmgr_get_handle(dri_bo *buf);
+int radeon_bufmgr_gem_in_vram(dir_bo *buf);
#endif
diff --git a/src/radeon_exa.c b/src/radeon_exa.c
index 555ae16..4d0a582 100644
--- a/src/radeon_exa.c
+++ b/src/radeon_exa.c
@@ -50,10 +50,6 @@
#define RADEON_PIXMAP_IS_FRONTBUFFER 1
/* quick hacks lolz */
-struct radeon_exa_pixmap_priv {
- dri_bo *bo;
- int flags;
-};
/***********************************************************************/
#define RINFO_FROM_SCREEN(pScr) ScrnInfoPtr pScrn = xf86Screens[pScr->myNum]; \
@@ -235,7 +231,8 @@ static Bool RADEONPrepareAccess(PixmapPtr pPix, int index)
if (driver_priv->bo) {
int ret;
- RADEONCPFlushIndirect(pScrn, 0);
+ if (radeon_bufmgr_gem_in_vram (driver_priv->bo))
+ RADEONCPFlushIndirect(pScrn, 0);
//radeon_bufmgr_gem_wait_rendering(driver_priv->bo);
diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
index 456cefe..8f98e92 100644
--- a/src/radeon_exa_render.c
+++ b/src/radeon_exa_render.c
@@ -1016,8 +1016,10 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
txpitch = exaGetPixmapPitch(pPix);
txoffset = exaGetPixmapOffset(pPix);
- if ((txoffset & 0x1f) != 0)
- RADEON_FALLBACK(("Bad texture offset 0x%x\n", (int)txoffset));
+ if (!info->new_cs) {
+ if ((txoffset & 0x1f) != 0)
+ RADEON_FALLBACK(("Bad texture offset 0x%x\n", (int)txoffset));
+ }
if ((txpitch & 0x1f) != 0)
RADEON_FALLBACK(("Bad texture pitch 0x%x\n", (int)txpitch));
@@ -1234,7 +1236,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
colorpitch |= dst_format;
- if ((dst_offset & 0x0f) != 0)
+ if (!info->new_cs && ((dst_offset & 0x0f) != 0))
RADEON_FALLBACK(("Bad destination offset 0x%x\n", (int)dst_offset));
if (((dst_pitch >> pixel_shift) & 0x7) != 0)
RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index 9682ad8..f93cded 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -199,10 +199,13 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
if (pPriv->video_memory == NULL) {
pPriv->video_offset = RADEONAllocateMemory(pScrn,
- &pPriv->video_memory,
- size * 2);
+ &pPriv->video_memory,
+ size * 2);
if (pPriv->video_offset == 0)
return BadAlloc;
+
+ if (info->new_cs)
+ pPriv->src_bo = pPriv->video_memory;
}
/* Bicubic filter loading */
@@ -215,6 +218,9 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
pPriv->bicubic_src_offset = pPriv->bicubic_offset + info->fbLocation + pScrn->fbOffset;
if (pPriv->bicubic_offset == 0)
pPriv->bicubic_enabled = FALSE;
+
+ if (info->new_cs)
+ pPriv->bicubic_bo = pPriv->bicubic_memory;
}
if (pDraw->type == DRAWABLE_WINDOW)
@@ -245,7 +251,14 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
pPriv->src_offset = pPriv->video_offset;
- if (info->drm_mm) {
+ if (info->new_cs) {
+ int ret;
+ ret = dri_bo_map(pPriv->src_bo, 1);
+ if (ret)
+ return BadAlloc;
+
+ pPriv->src_addr = pPriv->src_bo->virtual;
+ } else if (info->drm_mm) {
pPriv->src_addr = (uint8_t *)(info->mm.front_buffer->map + pPriv->video_offset + (top * dstPitch));
} else {
pPriv->src_addr = (uint8_t *)(info->FB + pPriv->video_offset + (top * dstPitch));
@@ -290,8 +303,24 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
}
/* Upload bicubic filter tex */
- if (pPriv->bicubic_enabled)
- RADEONCopyData(pScrn, (uint8_t *)bicubic_tex_512, (uint8_t *)(info->FB + pPriv->bicubic_offset), 1024, 1024, 1, 512, 2);
+ if (pPriv->bicubic_enabled) {
+ uint8_t *bicubic_addr;
+ int ret;
+
+ if (info->new_cs) {
+ ret = dri_bo_map(pPriv->bicubic_bo, 1);
+ if (ret)
+ return BadAlloc;
+
+ bicubic_addr = pPriv->bicubic_bo->virtual;
+ } 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->new_cs)
+ dri_bo_unmap(pPriv->bicubic_bo);
+ }
/* update cliplist */
if (!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) {
@@ -308,6 +337,8 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
pPriv->w = width;
pPriv->h = height;
+ if (info->new_cs)
+ dri_bo_unmap(pPriv->src_bo);
#ifdef XF86DRI
if (info->directRenderingEnabled || info->drm_mode_setting)
RADEONDisplayTexturedVideoCP(pScrn, pPriv);
diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
index 1e9f3b1..d3574f4 100644
--- a/src/radeon_textured_videofuncs.c
+++ b/src/radeon_textured_videofuncs.c
@@ -95,6 +95,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
{
RADEONInfoPtr info = RADEONPTR(pScrn);
PixmapPtr pPixmap = pPriv->pPixmap;
+ struct radeon_exa_pixmap_priv *driver_priv;
+ dri_bo *dst_bo;
uint32_t txformat;
uint32_t txfilter, txformat0, txformat1, txoffset, txpitch;
uint32_t dst_offset, dst_pitch, dst_format;
@@ -110,7 +112,13 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
#ifdef USE_EXA
if (info->useEXA) {
- dst_offset = exaGetPixmapOffset(pPixmap);
+ if (info->new_cs) {
+ driver_priv = exaGetPixmapDriverPrivate(pPixmap);
+ if (driver_priv)
+ dst_bo = driver_priv->bo;
+ } else {
+ dst_offset = exaGetPixmapOffset(pPixmap);
+ }
dst_pitch = exaGetPixmapPitch(pPixmap);
} else
#endif
@@ -219,8 +227,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
OUT_VIDEO_REG(R300_TX_FORMAT2_0, txpitch);
if (info->new_cs) {
- OUT_VIDEO_REG(R300_TX_OFFSET_0, txoffset);
- OUT_RELOC(info->mm.front_buffer->kernel_bo_handle, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_VIDEO_REG(R300_TX_OFFSET_0, 0);
+ OUT_RELOC(pPriv->src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
} else {
txoffset += info->fbLocation + pScrn->fbOffset;
OUT_VIDEO_REG(R300_TX_OFFSET_0, txoffset);
@@ -245,13 +253,20 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
R300_TX_MAG_FILTER_NEAREST |
(1 << R300_TX_ID_SHIFT));
- BEGIN_VIDEO(6);
+ qwords = info->new_cs ? 8 : 6;
+ BEGIN_VIDEO(qwords);
OUT_VIDEO_REG(R300_TX_FILTER0_1, txfilter);
OUT_VIDEO_REG(R300_TX_FILTER1_1, 0);
OUT_VIDEO_REG(R300_TX_FORMAT0_1, txformat0);
OUT_VIDEO_REG(R300_TX_FORMAT1_1, txformat1);
OUT_VIDEO_REG(R300_TX_FORMAT2_1, txpitch);
- OUT_VIDEO_REG(R300_TX_OFFSET_1, pPriv->bicubic_src_offset);
+
+ if (info->new_cs) {
+ OUT_VIDEO_REG(R300_TX_OFFSET_1, 0);
+ OUT_RELOC(pPriv->bicubic_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ } else {
+ OUT_VIDEO_REG(R300_TX_OFFSET_1, pPriv->bicubic_src_offset);
+ }
FINISH_VIDEO();
/* Enable tex 1 */
@@ -994,8 +1009,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
OUT_VIDEO_REG(R300_TX_ENABLE, txenable);
if (info->new_cs) {
- OUT_VIDEO_REG(R300_RB3D_COLOROFFSET0, dst_offset);
- OUT_RELOC(info->mm.front_buffer->kernel_bo_handle, 0, RADEON_GEM_DOMAIN_VRAM);
+ OUT_VIDEO_REG(R300_RB3D_COLOROFFSET0, 0);
+ OUT_RELOC(dst_bo, 0, RADEON_GEM_DOMAIN_VRAM);
} else {
dst_offset += info->fbLocation + pScrn->fbOffset;
OUT_VIDEO_REG(R300_RB3D_COLOROFFSET0, dst_offset);
diff --git a/src/radeon_video.c b/src/radeon_video.c
index a7ea788..d708bf8 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -2180,7 +2180,7 @@ RADEONCopyData(
#ifdef XF86DRI
- if ( info->directRenderingEnabled && info->DMAForXv )
+ if ( info->directRenderingEnabled && info->DMAForXv && !info->new_cs )
{
uint8_t *buf;
uint32_t bufPitch, dstPitchOff;
@@ -2443,6 +2443,20 @@ RADEONAllocateMemory(
int offset = 0;
pScreen = screenInfo.screens[pScrn->scrnIndex];
+
+ if (info->new_cs) {
+ dri_bo *video_bo;
+
+ video_bo = dri_bo_alloc(info->bufmgr, "xv pixmap", size, 4096);
+
+ *mem_struct = video_bo;
+
+ if (!video_bo)
+ return 0;
+
+ return (uint32_t)-1;
+
+ }
#ifdef USE_EXA
if (info->useEXA) {
ExaOffscreenArea *area = *mem_struct;
@@ -2516,6 +2530,11 @@ RADEONFreeMemory(
){
RADEONInfoPtr info = RADEONPTR(pScrn);
+ if (info->new_cs) {
+ struct dri_bo *bo = mem_struct;
+ dri_bo_free(bo);
+ return;
+ }
#ifdef USE_EXA
if (info->useEXA) {
ExaOffscreenArea *area = mem_struct;
diff --git a/src/radeon_video.h b/src/radeon_video.h
index b9d900d..0687969 100644
--- a/src/radeon_video.h
+++ b/src/radeon_video.h
@@ -114,6 +114,9 @@ typedef struct {
int src_w, src_h, dst_w, dst_h;
int w, h;
int drw_x, drw_y;
+
+ dri_bo *src_bo;
+ dri_bo *bicubic_bo;
} RADEONPortPrivRec, *RADEONPortPrivPtr;
void RADEONInitI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);