summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-03-02 21:53:21 +0100
committerOwain G. Ainsworth <oga@openbsd.org>2010-05-16 19:59:16 +0100
commit71c875286686f28044672632d46802bc26db3ee5 (patch)
treeef52af17c88ce3aa55e2770138f6547c1808cdf1
parente431267ec0b8433cdffdcf4bfdf25f09b699796c (diff)
i915 XvMC: switch corrdata buffer to drm_intel_bo
It works! v2: Correlation data needs to be in the render cache! Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Carl Worth <cworth@cworth.org> (cherry picked from commit b7f79bfd40db3ed17d7a79750d007b57d7ed157a) Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
-rw-r--r--src/xvmc/i915_xvmc.c51
-rw-r--r--src/xvmc/i915_xvmc.h3
2 files changed, 20 insertions, 34 deletions
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c
index 65d2d3e1..ee1a1c56 100644
--- a/src/xvmc/i915_xvmc.c
+++ b/src/xvmc/i915_xvmc.c
@@ -494,7 +494,11 @@ static void i915_mc_static_indirect_state_set(XvMCContext * context,
buffer_info->corr.dw1.tiled_surface = 0;
buffer_info->corr.dw1.walk = 0;
buffer_info->corr.dw1.pitch = 0;
- buffer_info->corr.dw2.base_address = (pI915XvMC->corrdata.offset >> 2); /* starting DWORD address */
+ buffer_info->corr.dw2.base_address = pI915XvMC->corrdata_bo->offset >> 2; /* starting DWORD address */
+ drm_intel_bo_emit_reloc(pI915XvMC->sis_bo,
+ offsetof(typeof(*buffer_info),corr.dw2),
+ pI915XvMC->corrdata_bo, 0,
+ I915_GEM_DOMAIN_RENDER, 0);
drm_intel_gem_bo_unmap_gtt(pI915XvMC->sis_bo);
}
@@ -814,26 +818,6 @@ static void i915_mc_mpeg_macroblock_2fbmv(XvMCContext * context,
intelBatchbufferData(&macroblock_2fbmv, sizeof(macroblock_2fbmv), 0);
}
-static int i915_xvmc_map_buffers(i915XvMCContext * pI915XvMC)
-{
- if (drmMap(xvmc_driver->fd,
- pI915XvMC->corrdata.handle,
- pI915XvMC->corrdata.size,
- (drmAddress *) & pI915XvMC->corrdata.map) != 0) {
- return 0;
- }
-
- return 1;
-}
-
-static void i915_xvmc_unmap_buffers(i915XvMCContext * pI915XvMC)
-{
- if (pI915XvMC->corrdata.map) {
- drmUnmap(pI915XvMC->corrdata.map, pI915XvMC->corrdata.size);
- pI915XvMC->corrdata.map = NULL;
- }
-}
-
static int i915_xvmc_alloc_one_time_buffers(i915XvMCContext *pI915XvMC)
{
pI915XvMC->ssb_bo = drm_intel_bo_alloc(xvmc_driver->bufmgr,
@@ -878,7 +862,6 @@ static void i915_release_resource(Display * display, XvMCContext * context)
return;
pI915XvMC->ref--;
- i915_xvmc_unmap_buffers(pI915XvMC);
i915_xvmc_free_one_time_buffers(pI915XvMC);
free(pI915XvMC);
@@ -917,10 +900,6 @@ static Status i915_xvmc_mc_create_context(Display * display,
pI915XvMC->ctxno = tmpComm->ctxno;
pI915XvMC->deviceID = tmpComm->deviceID;
- pI915XvMC->corrdata.handle = tmpComm->corrdata.handle;
- pI915XvMC->corrdata.offset = tmpComm->corrdata.offset;
- pI915XvMC->corrdata.size = tmpComm->corrdata.size;
-
/* Must free the private data we were passed from X */
XFree(priv_data);
priv_data = NULL;
@@ -928,9 +907,6 @@ static Status i915_xvmc_mc_create_context(Display * display,
if (!i915_xvmc_alloc_one_time_buffers(pI915XvMC))
goto free_one_time_buffers;
- if (!i915_xvmc_map_buffers(pI915XvMC))
- goto unmap_buffers;
-
/* Initialize private context values */
pI915XvMC->yStride = STRIDE(context->width);
pI915XvMC->uvStride = STRIDE(context->width >> 1);
@@ -944,8 +920,6 @@ static Status i915_xvmc_mc_create_context(Display * display,
return Success;
-unmap_buffers:
- i915_xvmc_unmap_buffers(pI915XvMC);
free_one_time_buffers:
i915_xvmc_free_one_time_buffers(pI915XvMC);
free(pI915XvMC);
@@ -1076,6 +1050,13 @@ static int i915_xvmc_alloc_render_state_buffers(i915XvMCContext *pI915XvMC)
if (!pI915XvMC->msb_bo)
return 0;
+ pI915XvMC->corrdata_bo = drm_intel_bo_alloc(xvmc_driver->bufmgr,
+ "corrdata",
+ CORRDATA_SIZE,
+ GTT_PAGE_SIZE);
+ if (!pI915XvMC->corrdata_bo)
+ return 0;
+
return 1;
}
@@ -1083,6 +1064,7 @@ static void i915_xvmc_free_render_state_buffers(i915XvMCContext *pI915XvMC)
{
drm_intel_bo_unreference(pI915XvMC->sis_bo);
drm_intel_bo_unreference(pI915XvMC->msb_bo);
+ drm_intel_bo_unreference(pI915XvMC->corrdata_bo);
}
static int i915_xvmc_mc_render_surface(Display * display, XvMCContext * context,
@@ -1186,7 +1168,8 @@ static int i915_xvmc_mc_render_surface(Display * display, XvMCContext * context,
}
LOCK_HARDWARE(intel_ctx->hw_context);
- corrdata_ptr = pI915XvMC->corrdata.map;
+ drm_intel_gem_bo_map_gtt(pI915XvMC->corrdata_bo);
+ corrdata_ptr = pI915XvMC->corrdata_bo->virtual;
corrdata_size = 0;
for (i = first_macroblock; i < (num_macroblocks + first_macroblock);
@@ -1221,7 +1204,7 @@ static int i915_xvmc_mc_render_surface(Display * display, XvMCContext * context,
corrdata_size += bspm;
- if (corrdata_size > pI915XvMC->corrdata.size) {
+ if (corrdata_size > CORRDATA_SIZE) {
XVMC_ERR("correction data buffer overflow.");
break;
}
@@ -1229,6 +1212,8 @@ static int i915_xvmc_mc_render_surface(Display * display, XvMCContext * context,
corrdata_ptr += bspm;
}
+ drm_intel_gem_bo_unmap_gtt(pI915XvMC->corrdata_bo);
+
i915_flush(1, 0);
// i915_mc_invalidate_subcontext_buffers(context, BLOCK_SIS | BLOCK_DIS | BLOCK_SSB
// | BLOCK_MSB | BLOCK_PSP | BLOCK_PSC);
diff --git a/src/xvmc/i915_xvmc.h b/src/xvmc/i915_xvmc.h
index d885612f..7c9d58ed 100644
--- a/src/xvmc/i915_xvmc.h
+++ b/src/xvmc/i915_xvmc.h
@@ -43,6 +43,7 @@
#define PCI_CHIP_Q35_G 0x29B2
#define PCI_CHIP_Q33_G 0x29D2
+#define CORRDATA_SIZE 128*GTT_PAGE_SIZE
/*
* i915XvMCContext:
* Private Context data referenced via the privData
@@ -70,7 +71,7 @@ typedef struct _i915XvMCContext {
drm_intel_bo *ssb_bo;
drm_intel_bo *psp_bo;
drm_intel_bo *psc_bo;
- intel_xvmc_drm_map_t corrdata;
+ drm_intel_bo *corrdata_bo;
} i915XvMCContext;
/*