- U_0002-vmwgfx-Avoid-HW-operations-when-not-master.patch * Note that for DRI2, a dri2_copy_region becomes a NOP when not master. Additionally, all dri2 operations that lead to a potential kernel access will return FALSE. - U_0003-vmwgfx-Implement-textured-video-completely-on-top-of.patch * Remove device-specific hacks. This may increase resource usage a little on old hardware revisions, but we don't need separate code paths on different hardware revisions. - U_0004-vmwgfx-Get-rid-of-device-specific-DMA-code.patch * It's rarely used and things seem to work well enough on top of XA. - U_0005-vmwgfx-handle-changes-of-DamageUnregister-API-in-1.1.patch * Fix is inspired from the intel driver. OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xf86-video-vmware?expand=0&rev=21
196 lines
5.2 KiB
Diff
196 lines
5.2 KiB
Diff
From 7192acf9f0bf8e7176ab0b803b861a858623f709 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Hellstrom <thellstrom@vmware.com>
|
|
Date: Wed, 19 Sep 2012 20:36:57 +0200
|
|
Subject: [PATCH 3/5] vmwgfx: Implement textured video completely on top of XA.
|
|
|
|
Remove device-specific hacks. This may increase resource usage a little
|
|
on old hardware revisions, but we don't need separate code paths on
|
|
different hardware revisions.
|
|
|
|
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
|
|
Reviewed-by: Zack Rusin <zackr@vmware.com>
|
|
---
|
|
vmwgfx/vmwgfx_tex_video.c | 109 ++++++----------------------------------------
|
|
1 file changed, 14 insertions(+), 95 deletions(-)
|
|
|
|
diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
|
|
index 2971ed7..a0a4f4a 100644
|
|
--- a/vmwgfx/vmwgfx_tex_video.c
|
|
+++ b/vmwgfx/vmwgfx_tex_video.c
|
|
@@ -111,8 +111,7 @@ struct xorg_xv_port_priv {
|
|
int hue;
|
|
|
|
int current_set;
|
|
- struct vmwgfx_dmabuf *bounce[2][3];
|
|
- struct xa_surface *yuv[3];
|
|
+ struct xa_surface *yuv[2][3];
|
|
|
|
int drm_fd;
|
|
|
|
@@ -198,14 +197,10 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
|
|
priv->fence = NULL;
|
|
|
|
for (i=0; i<3; ++i) {
|
|
- if (priv->yuv[i]) {
|
|
- xa_surface_unref(priv->yuv[i]);
|
|
- priv->yuv[i] = NULL;
|
|
- }
|
|
for (j=0; j<2; ++j) {
|
|
- if (priv->bounce[j][i]) {
|
|
- vmwgfx_dmabuf_destroy(priv->bounce[j][i]);
|
|
- priv->bounce[0][i] = NULL;
|
|
+ if (priv->yuv[i]) {
|
|
+ xa_surface_unref(priv->yuv[j][i]);
|
|
+ priv->yuv[j][i] = NULL;
|
|
}
|
|
}
|
|
}
|
|
@@ -297,11 +292,9 @@ static int
|
|
check_yuv_surfaces(struct xorg_xv_port_priv *priv, int id,
|
|
int width, int height)
|
|
{
|
|
- struct xa_surface **yuv = priv->yuv;
|
|
- struct vmwgfx_dmabuf **bounce = priv->bounce[priv->current_set];
|
|
+ struct xa_surface **yuv = priv->yuv[priv->current_set];
|
|
int ret = 0;
|
|
int i;
|
|
- size_t size;
|
|
|
|
for (i=0; i<3; ++i) {
|
|
|
|
@@ -334,19 +327,6 @@ check_yuv_surfaces(struct xorg_xv_port_priv *priv, int id,
|
|
if (ret || !yuv[i])
|
|
return BadAlloc;
|
|
|
|
- size = width * height;
|
|
-
|
|
- if (bounce[i] && (bounce[i]->size < size ||
|
|
- bounce[i]->size > 2*size)) {
|
|
- vmwgfx_dmabuf_destroy(bounce[i]);
|
|
- bounce[i] = NULL;
|
|
- }
|
|
-
|
|
- if (!bounce[i]) {
|
|
- bounce[i] = vmwgfx_dmabuf_alloc(priv->drm_fd, size);
|
|
- if (!bounce[i])
|
|
- return BadAlloc;
|
|
- }
|
|
}
|
|
return Success;
|
|
}
|
|
@@ -413,28 +393,20 @@ copy_packed_data(ScrnInfoPtr pScrn,
|
|
unsigned short w, unsigned short h)
|
|
{
|
|
int i;
|
|
- struct vmwgfx_dmabuf **bounce = port->bounce[port->current_set];
|
|
+ struct xa_surface **yuv = port->yuv[port->current_set];
|
|
char *ymap, *vmap, *umap;
|
|
unsigned char y1, y2, u, v;
|
|
int yidx, uidx, vidx;
|
|
int y_array_size = w * h;
|
|
int ret = BadAlloc;
|
|
|
|
- /*
|
|
- * Here, we could use xa_surface_[map|unmap], but given the size of
|
|
- * the yuv textures, that could stress the xa tracker dma buffer pool,
|
|
- * particularaly with multiple videos rendering simultaneously.
|
|
- *
|
|
- * Instead, cheat and allocate vmwgfx dma buffers directly.
|
|
- */
|
|
-
|
|
- ymap = (char *)vmwgfx_dmabuf_map(bounce[0]);
|
|
+ ymap = xa_surface_map(port->r, yuv[0], XA_MAP_WRITE);
|
|
if (!ymap)
|
|
return BadAlloc;
|
|
- umap = (char *)vmwgfx_dmabuf_map(bounce[1]);
|
|
+ umap = xa_surface_map(port->r, yuv[1], XA_MAP_WRITE);
|
|
if (!umap)
|
|
goto out_no_umap;
|
|
- vmap = (char *)vmwgfx_dmabuf_map(bounce[2]);
|
|
+ vmap = xa_surface_map(port->r, yuv[2], XA_MAP_WRITE);
|
|
if (!vmap)
|
|
goto out_no_vmap;
|
|
|
|
@@ -493,65 +465,11 @@ copy_packed_data(ScrnInfoPtr pScrn,
|
|
}
|
|
|
|
ret = Success;
|
|
- vmwgfx_dmabuf_unmap(bounce[2]);
|
|
+ xa_surface_unmap(yuv[2]);
|
|
out_no_vmap:
|
|
- vmwgfx_dmabuf_unmap(bounce[1]);
|
|
+ xa_surface_unmap(yuv[1]);
|
|
out_no_umap:
|
|
- vmwgfx_dmabuf_unmap(bounce[0]);
|
|
-
|
|
- if (ret == Success) {
|
|
- struct xa_surface *srf;
|
|
- struct vmwgfx_dmabuf *buf;
|
|
- uint32_t handle;
|
|
- unsigned int stride;
|
|
- BoxRec box;
|
|
- RegionRec reg;
|
|
-
|
|
- box.x1 = 0;
|
|
- box.x2 = w;
|
|
- box.y1 = 0;
|
|
- box.y2 = h;
|
|
-
|
|
- REGION_INIT(pScrn->pScreen, ®, &box, 1);
|
|
-
|
|
- for (i=0; i<3; ++i) {
|
|
- srf = port->yuv[i];
|
|
- buf = bounce[i];
|
|
-
|
|
- if (i == 1) {
|
|
- switch(id) {
|
|
- case FOURCC_YV12:
|
|
- h /= 2;
|
|
- /* Fall through */
|
|
- case FOURCC_YUY2:
|
|
- case FOURCC_UYVY:
|
|
- w /= 2;
|
|
- break;
|
|
- default:
|
|
- break;
|
|
- }
|
|
-
|
|
- box.x1 = 0;
|
|
- box.x2 = w;
|
|
- box.y1 = 0;
|
|
- box.y2 = h;
|
|
-
|
|
- REGION_RESET(pScrn->pScreen, ®, &box);
|
|
- }
|
|
-
|
|
- if (xa_surface_handle(srf, xa_handle_type_shared,
|
|
- &handle, &stride) != 0) {
|
|
- ret = BadAlloc;
|
|
- break;
|
|
- }
|
|
-
|
|
- if (vmwgfx_dma(0, 0, ®, buf, w, handle, 1) != 0) {
|
|
- ret = BadAlloc;
|
|
- break;
|
|
- }
|
|
- }
|
|
- REGION_UNINIT(pScrn->pScreen, ®);
|
|
- }
|
|
+ xa_surface_unmap(yuv[0]);
|
|
|
|
return ret;
|
|
}
|
|
@@ -610,7 +528,8 @@ display_video(ScreenPtr pScreen, struct xorg_xv_port_priv *pPriv, int id,
|
|
(struct xa_box *)REGION_RECTS(dstRegion),
|
|
REGION_NUM_RECTS(dstRegion),
|
|
pPriv->cm,
|
|
- vpix->hw, pPriv->yuv);
|
|
+ vpix->hw,
|
|
+ pPriv->yuv[pPriv->current_set ]);
|
|
|
|
saa_pixmap_dirty(pPixmap, TRUE, dstRegion);
|
|
DamageRegionProcessPending(&pPixmap->drawable);
|
|
--
|
|
1.8.1.4
|
|
|