i965 XvMC cleanup
Remove bo pin for surface buffer access, and remove access attempt for possible unmapped framebuffer. Using xv buffer pointer to pass current xvmc surface bo handler, which is assigned to src image bo and handle that the same way as in Xv. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> [anholt: Fixed up for conflict against the XV rework. Not tested, because both mplayer and xine segfault with XVMC currently.] Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
aaedeffe00
commit
f171069608
|
|
@ -1165,10 +1165,10 @@ int is_planar_fourcc(int id)
|
|||
}
|
||||
}
|
||||
|
||||
static int xvmc_passthrough(int id, Rotation rotation)
|
||||
static int xvmc_passthrough(int id)
|
||||
{
|
||||
#ifdef INTEL_XVMC
|
||||
return id == FOURCC_XVMC && rotation == RR_Rotate_0;
|
||||
return id == FOURCC_XVMC;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
|
@ -1331,17 +1331,24 @@ i830_wait_for_scanline(ScrnInfoPtr scrn, PixmapPtr pixmap,
|
|||
|
||||
static Bool
|
||||
i830_setup_video_buffer(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv,
|
||||
int alloc_size, int id)
|
||||
int alloc_size, int id, unsigned char *buf)
|
||||
{
|
||||
intel_screen_private *intel = intel_get_screen_private(scrn);
|
||||
|
||||
/* Free the current buffer if we're going to have to reallocate */
|
||||
if (adaptor_priv->buf && adaptor_priv->buf->size < alloc_size) {
|
||||
drm_intel_bo_unreference(adaptor_priv->buf);
|
||||
adaptor_priv->buf = NULL;
|
||||
}
|
||||
|
||||
if (xvmc_passthrough(id, adaptor_priv->rotation)) {
|
||||
if (xvmc_passthrough(id)) {
|
||||
i830_free_video_buffers(adaptor_priv);
|
||||
if (IS_I965G(intel)) {
|
||||
adaptor_priv->buf =
|
||||
drm_intel_bo_gem_create_from_name(intel->bufmgr,
|
||||
"xvmc surface",
|
||||
(uintptr_t)buf);
|
||||
}
|
||||
} else {
|
||||
if (adaptor_priv->buf == NULL) {
|
||||
adaptor_priv->buf = drm_intel_bo_alloc(intel->bufmgr,
|
||||
|
|
@ -1447,7 +1454,7 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv,
|
|||
i830_dst_pitch_and_size(scrn, adaptor_priv, width, height, dstPitch,
|
||||
dstPitch2, &size, id);
|
||||
|
||||
if (!i830_setup_video_buffer(scrn, adaptor_priv, size, id))
|
||||
if (!i830_setup_video_buffer(scrn, adaptor_priv, size, id, buf))
|
||||
return FALSE;
|
||||
|
||||
/* fixup pointers */
|
||||
|
|
@ -1482,7 +1489,7 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv,
|
|||
npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
|
||||
|
||||
if (is_planar_fourcc(id)) {
|
||||
if (!xvmc_passthrough(id, adaptor_priv->rotation)) {
|
||||
if (!xvmc_passthrough(id)) {
|
||||
top &= ~1;
|
||||
nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
|
||||
I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2,
|
||||
|
|
@ -1600,14 +1607,6 @@ I830PutImage(ScrnInfoPtr scrn,
|
|||
}
|
||||
|
||||
if (IS_I965G(intel)) {
|
||||
if (xvmc_passthrough(id, adaptor_priv->rotation)) {
|
||||
/* XXX: KMS */
|
||||
adaptor_priv->YBufOffset = (uintptr_t) buf;
|
||||
adaptor_priv->UBufOffset =
|
||||
adaptor_priv->YBufOffset + height * width;
|
||||
adaptor_priv->VBufOffset =
|
||||
adaptor_priv->UBufOffset + height * width / 4;
|
||||
}
|
||||
I965DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes,
|
||||
width, height, dstPitch, x1,
|
||||
y1, x2, y2, src_w, src_h,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
#define XVMC_VLD 0x00020000
|
||||
#endif
|
||||
|
||||
static PutImageFuncPtr XvPutImage;
|
||||
static PutImageFuncPtr savedXvPutImage;
|
||||
|
||||
static int create_context(ScrnInfoPtr scrn,
|
||||
XvMCContextPtr context, int *num_privates,
|
||||
|
|
@ -156,36 +156,26 @@ static int put_image(ScrnInfoPtr scrn,
|
|||
short src_h, short drw_w, short drw_h,
|
||||
int id, unsigned char *buf, short width,
|
||||
short height, Bool sync, RegionPtr clipBoxes, pointer data,
|
||||
DrawablePtr pDraw)
|
||||
DrawablePtr drawable)
|
||||
{
|
||||
intel_screen_private *intel = intel_get_screen_private(scrn);
|
||||
struct intel_xvmc_command *cmd = (struct intel_xvmc_command *)buf;
|
||||
dri_bo *bo;
|
||||
|
||||
if (id == FOURCC_XVMC) {
|
||||
bo = intel_bo_gem_create_from_name(intel->bufmgr, "surface",
|
||||
cmd->handle);
|
||||
dri_bo_pin(bo, 0x1000);
|
||||
/* XXX: KMS */
|
||||
#if 0
|
||||
buf = intel->FbBase + bo->offset;
|
||||
#endif
|
||||
/* Pass the GEM object name through the pointer arg. */
|
||||
buf = (void *)(uintptr_t)cmd->handle;
|
||||
}
|
||||
XvPutImage(scrn, src_x, src_y, drw_x, drw_y, src_w, src_h,
|
||||
drw_w, drw_h, id, buf, width, height, sync, clipBoxes,
|
||||
data, pDraw);
|
||||
|
||||
if (id == FOURCC_XVMC) {
|
||||
dri_bo_unpin(bo);
|
||||
dri_bo_unreference(bo);
|
||||
}
|
||||
savedXvPutImage(scrn, src_x, src_y, drw_x, drw_y, src_w, src_h,
|
||||
drw_w, drw_h, id, buf,
|
||||
width, height, sync, clipBoxes,
|
||||
data, drawable);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static Bool init(ScrnInfoPtr screen_info, XF86VideoAdaptorPtr adaptor)
|
||||
{
|
||||
XvPutImage = adaptor->PutImage;
|
||||
savedXvPutImage = adaptor->PutImage;
|
||||
adaptor->PutImage = put_image;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue