summaryrefslogtreecommitdiff
path: root/src/i830_memory.c
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2009-07-24 10:39:05 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2009-07-24 10:39:05 +0800
commit7dc95b4f1dfecbeb7e9f4a0c35fda32d020be8fe (patch)
tree559b862598c63d066dcc12ef728f514b53c33743 /src/i830_memory.c
parent12c5aeca7a3db92d3522d00f5daf338d522e2176 (diff)
XvMC: pin XvMC buffers under KMS.
Under KMS, the buffer allocated by i830_allocate_memory isn't pinned anymore. However currently 915 XvMC needs static offsets. Fixes bug #22872
Diffstat (limited to 'src/i830_memory.c')
-rw-r--r--src/i830_memory.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/i830_memory.c b/src/i830_memory.c
index cc9d376d..d3c9299a 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1652,6 +1652,8 @@ Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name,
i830_memory **buffer, unsigned long size,
int flags)
{
+ I830Ptr pI830 = I830PTR(pScrn);
+
*buffer = i830_allocate_memory(pScrn, name, size, PITCH_NONE,
GTT_PAGE_SIZE, flags, TILE_NONE);
@@ -1661,11 +1663,31 @@ Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name,
return FALSE;
}
- if (!i830_bind_memory(pScrn, *buffer))
- return FALSE;
+ if (pI830->use_drm_mode && (*buffer)->bo) {
+ if (drm_intel_bo_pin((*buffer)->bo, GTT_PAGE_SIZE)) {
+ i830_free_memory(pScrn, *buffer);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to bind XvMC buffer bo!\n");
+ return FALSE;
+ }
+
+ (*buffer)->offset = (*buffer)->bo->offset;
+ }
return TRUE;
}
+
+void
+i830_free_xvmc_buffer(ScrnInfoPtr pScrn, i830_memory *buffer)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+
+ if (pI830->use_drm_mode && buffer->bo)
+ drm_intel_bo_unpin(buffer->bo);
+
+ i830_free_memory(pScrn, buffer);
+}
+
#endif
void