From 0ea487fdff982a1c42be67663aa6c5a07e4fa2a5 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 4 Apr 2014 17:55:53 +0200 Subject: [PATCH] [x11-drivers/xf86-video-vmware] drop, no longer needed --- x11-drivers/xf86-video-vmware/Manifest | 1 - ...001-vmwgfx-update-for-XA-API-changes.patch | 187 -- ...-Avoid-HW-operations-when-not-master.patch | 240 --- ...-textured-video-completely-on-top-of.patch | 196 -- ...-Get-rid-of-device-specific-DMA-code.patch | 240 --- ...anges-of-DamageUnregister-API-in-1.1.patch | 43 - ...compilation-warnings-and-indentation.patch | 165 -- ...-vmwgfx-Support-also-XA-version-1-v2.patch | 170 -- .../files/0008-vmwgfx-Remove-stray-1.patch | 27 - ...-Get-rid-of-device-specific-DMA-code.patch | 245 --- ...010-vmwgfx-Really-allow-XA-version-2.patch | 30 - ...Fix-compile-breakage-on-XA-version-1.patch | 30 - ...frastructure-to-be-able-to-run-hoste.patch | 1055 ----------- .../0013-vmwgfx-Add-support-for-XMir-v2.patch | 672 ------- ...0014-vmwgfx-Add-support-for-XWayland.patch | 254 --- .../0015-vmwgfx-Enable-direct-dmas.patch | 33 - ...-Block-DMA-to-prime-surfaces-for-now.patch | 109 -- ...vmware-Fix-build-errors-and-warnings.patch | 103 -- ...-Require-libdrm-2.4.38-to-build-XMir.patch | 111 -- ...ways-allocate-shared-hardware-surfac.patch | 45 - .../files/xatracker-v2-fixes.patch | 1583 ----------------- x11-drivers/xf86-video-vmware/metadata.xml | 9 - .../xf86-video-vmware-13.0.1.ebuild | 20 - 23 files changed, 5568 deletions(-) delete mode 100644 x11-drivers/xf86-video-vmware/Manifest delete mode 100644 x11-drivers/xf86-video-vmware/files/0001-vmwgfx-update-for-XA-API-changes.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0002-vmwgfx-Avoid-HW-operations-when-not-master.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0003-vmwgfx-Implement-textured-video-completely-on-top-of.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0004-vmwgfx-Get-rid-of-device-specific-DMA-code.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0005-vmwgfx-handle-changes-of-DamageUnregister-API-in-1.1.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0006-vmwgfx-Fix-some-compilation-warnings-and-indentation.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0007-vmwgfx-Support-also-XA-version-1-v2.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0008-vmwgfx-Remove-stray-1.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0009-Revert-vmwgfx-Get-rid-of-device-specific-DMA-code.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0010-vmwgfx-Really-allow-XA-version-2.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0011-vmwgfx-Fix-compile-breakage-on-XA-version-1.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0012-vmwgfx-Add-an-infrastructure-to-be-able-to-run-hoste.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0013-vmwgfx-Add-support-for-XMir-v2.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0014-vmwgfx-Add-support-for-XWayland.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0015-vmwgfx-Enable-direct-dmas.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0016-vmwgfx-Block-DMA-to-prime-surfaces-for-now.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0017-vmware-Fix-build-errors-and-warnings.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0018-vmware-Require-libdrm-2.4.38-to-build-XMir.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/0019-vmware-vmwgfx-Always-allocate-shared-hardware-surfac.patch delete mode 100644 x11-drivers/xf86-video-vmware/files/xatracker-v2-fixes.patch delete mode 100644 x11-drivers/xf86-video-vmware/metadata.xml delete mode 100644 x11-drivers/xf86-video-vmware/xf86-video-vmware-13.0.1.ebuild diff --git a/x11-drivers/xf86-video-vmware/Manifest b/x11-drivers/xf86-video-vmware/Manifest deleted file mode 100644 index d7bf10e0c..000000000 --- a/x11-drivers/xf86-video-vmware/Manifest +++ /dev/null @@ -1 +0,0 @@ -DIST xf86-video-vmware-13.0.1.tar.bz2 432401 SHA256 802dda415c22412edad6c3df44fe18a06e91d0f8456d9a58bac0d340fdf8fe3d SHA512 2faf5fd524dffd2cd89a8b5a06b5470acbc51c3ee4f48bafc425b8e9c7c76d294201651cfb8c1d104c313885108e22abb6da736de1f3dbcf134a0926158ed147 WHIRLPOOL c52cb2a65f243a3cbe70da5f007aa0af97cf32e576b8bb6a400374d775edaab78ccf9ac341f94fc4bd95a2cf58672adce4462b079d889338f0b5ea93a8cd4252 diff --git a/x11-drivers/xf86-video-vmware/files/0001-vmwgfx-update-for-XA-API-changes.patch b/x11-drivers/xf86-video-vmware/files/0001-vmwgfx-update-for-XA-API-changes.patch deleted file mode 100644 index 2694172f2..000000000 --- a/x11-drivers/xf86-video-vmware/files/0001-vmwgfx-update-for-XA-API-changes.patch +++ /dev/null @@ -1,187 +0,0 @@ -From 0945bea5fc32eacb7bf42639efbd45dcd43e7ab5 Mon Sep 17 00:00:00 2001 -From: Rob Clark -Date: Mon, 10 Jun 2013 13:31:31 -0400 -Subject: [PATCH 01/19] vmwgfx: update for XA API changes - -Signed-off-by: Rob Clark -Signed-off-by: Jakob Bornecrantz -Reviewed-by: Jakob Bornecrantz -Tested-by: Jakob Bornecrantz ---- - configure.ac | 2 +- - vmwgfx/vmwgfx_dri2.c | 5 +++-- - vmwgfx/vmwgfx_driver.c | 3 ++- - vmwgfx/vmwgfx_saa.c | 20 ++++++++++++++------ - vmwgfx/vmwgfx_tex_video.c | 5 +++-- - 5 files changed, 23 insertions(+), 12 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 0631bcc..dccfb27 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -118,7 +118,7 @@ if test x$BUILD_VMWGFX = xyes; then - PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no]) - fi - if test x$BUILD_VMWGFX = xyes; then -- PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],[],[BUILD_VMWGFX=no]) -+ PKG_CHECK_MODULES([XATRACKER], [xatracker >= 2.0.0],[],[BUILD_VMWGFX=no]) - fi - - DRIVER_NAME=vmware -diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c -index 7de0772..2f007f0 100644 ---- a/vmwgfx/vmwgfx_dri2.c -+++ b/vmwgfx/vmwgfx_dri2.c -@@ -201,7 +201,8 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - } - - private->srf = srf; -- if (xa_surface_handle(srf, &buffer->name, &buffer->pitch) != 0) -+ if (xa_surface_handle(srf, xa_handle_type_shared, -+ &buffer->name, &buffer->pitch) != 0) - return FALSE; - - buffer->cpp = xa_format_depth(xa_surface_format(srf)) / 8; -@@ -222,7 +223,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(private->pPixmap); - - if (--private->refcount == 0 && srf) { -- xa_surface_destroy(srf); -+ xa_surface_unref(srf); - } - - /* -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index 7863ba2..3002285 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -617,7 +617,8 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd, - return FALSE; - } - -- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) { -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) { - LogMessage(X_ERROR, "Could not get present surface handle.\n"); - return FALSE; - } -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 63df3a1..ed3c1ee 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -140,7 +140,7 @@ vmwgfx_pixmap_free_storage(struct vmwgfx_saa_pixmap *vpix) - vpix->malloc = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_SURFACE) && vpix->hw) { -- xa_surface_destroy(vpix->hw); -+ xa_surface_unref(vpix->hw); - vpix->hw = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_GMR) && vpix->gmr) { -@@ -286,7 +286,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - if (vpix->gmr && vsaa->can_optimize_dma) { - uint32_t handle, dummy; - -- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) - goto out_err; - if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, - to_hw) != 0) -@@ -305,6 +306,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - (int) to_hw, - (struct xa_box *) REGION_RECTS(reg), - REGION_NUM_RECTS(reg)); -+ if (to_hw) -+ xa_context_flush(vsaa->xa_ctx); - if (vpix->gmr) - vmwgfx_dmabuf_unmap(vpix->gmr); - if (ret) -@@ -441,7 +444,7 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa, - &spix->dirty_hw)) - return FALSE; - -- xa_surface_destroy(vpix->hw); -+ xa_surface_unref(vpix->hw); - vpix->hw = NULL; - - /* -@@ -683,7 +686,8 @@ vmwgfx_present_prepare(struct vmwgfx_saa *vsaa, - - (void) pScreen; - if (src_vpix == dst_vpix || !src_vpix->hw || -- xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0) -+ xa_surface_handle(src_vpix->hw, xa_handle_type_shared, -+ &vsaa->src_handle, &dummy) != 0) - return FALSE; - - REGION_NULL(pScreen, &vsaa->present_region); -@@ -784,7 +788,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa, - return TRUE; - - out_no_damage: -- xa_surface_destroy(hw); -+ xa_surface_unref(hw); - return FALSE; - } - -@@ -929,6 +933,7 @@ vmwgfx_copy_prepare(struct saa_driver *driver, - - if (!vmwgfx_hw_validate(src_pixmap, src_reg)) { - xa_copy_done(vsaa->xa_ctx); -+ xa_context_flush(vsaa->xa_ctx); - return FALSE; - } - -@@ -1029,6 +1034,7 @@ vmwgfx_copy_done(struct saa_driver *driver) - return; - } - xa_copy_done(vsaa->xa_ctx); -+ xa_context_flush(vsaa->xa_ctx); - } - - static Bool -@@ -1175,6 +1181,7 @@ vmwgfx_composite_done(struct saa_driver *driver) - struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver); - - xa_composite_done(vsaa->xa_ctx); -+ xa_context_flush(vsaa->xa_ctx); - } - - static void -@@ -1436,7 +1443,8 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry *entry) - */ - if (!vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT, 0, NULL)) - goto out_err; -- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) - goto out_err; - depth = xa_format_depth(xa_surface_format(vpix->hw)); - -diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c -index 449266b..2971ed7 100644 ---- a/vmwgfx/vmwgfx_tex_video.c -+++ b/vmwgfx/vmwgfx_tex_video.c -@@ -199,7 +199,7 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown) - - for (i=0; i<3; ++i) { - if (priv->yuv[i]) { -- xa_surface_destroy(priv->yuv[i]); -+ xa_surface_unref(priv->yuv[i]); - priv->yuv[i] = NULL; - } - for (j=0; j<2; ++j) { -@@ -539,7 +539,8 @@ copy_packed_data(ScrnInfoPtr pScrn, - REGION_RESET(pScrn->pScreen, ®, &box); - } - -- if (xa_surface_handle(srf, &handle, &stride) != 0) { -+ if (xa_surface_handle(srf, xa_handle_type_shared, -+ &handle, &stride) != 0) { - ret = BadAlloc; - break; - } --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0002-vmwgfx-Avoid-HW-operations-when-not-master.patch b/x11-drivers/xf86-video-vmware/files/0002-vmwgfx-Avoid-HW-operations-when-not-master.patch deleted file mode 100644 index b19b325a5..000000000 --- a/x11-drivers/xf86-video-vmware/files/0002-vmwgfx-Avoid-HW-operations-when-not-master.patch +++ /dev/null @@ -1,240 +0,0 @@ -From 835ce4698f916ba080f4132988fd4caf898e0b1e Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 26 Sep 2013 01:25:33 -0700 -Subject: [PATCH 02/19] vmwgfx: Avoid HW operations when not master - -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. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_dri2.c | 13 +++++++++++++ - vmwgfx/vmwgfx_driver.c | 3 +++ - vmwgfx/vmwgfx_saa.c | 44 +++++++++++++++++++++++++++++++++++++++++++- - vmwgfx/vmwgfx_saa.h | 8 ++++++++ - vmwgfx/vmwgfx_saa_priv.h | 2 ++ - vmwgfx/vmwgfx_xa_surface.c | 6 ++++++ - 6 files changed, 75 insertions(+), 1 deletion(-) - -diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c -index 2f007f0..57f2d9d 100644 ---- a/vmwgfx/vmwgfx_dri2.c -+++ b/vmwgfx/vmwgfx_dri2.c -@@ -138,6 +138,8 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - return TRUE; - case DRI2BufferStencil: - case DRI2BufferDepthStencil: -+ if (!pScrn->vtSema) -+ return FALSE; - - depth = (format) ? vmwgfx_zs_format_to_depth(format) : 32; - -@@ -155,6 +157,9 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - - break; - case DRI2BufferDepth: -+ if (!pScrn->vtSema) -+ return FALSE; -+ - depth = (format) ? vmwgfx_z_format_to_depth(format) : - pDraw->bitsPerPixel; - -@@ -291,6 +296,14 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, - DrawablePtr dst_draw; - RegionPtr myClip; - GCPtr gc; -+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); -+ -+ /* -+ * This is a fragile protection against HW operations when not master. -+ * Needs to be blocked higher up in the dri2 code. -+ */ -+ if (!pScrn->vtSema) -+ return; - - /* - * In driCreateBuffers we dewrap windows into the -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index 3002285..eeaea4b 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -1116,6 +1116,7 @@ drv_leave_vt(VT_FUNC_ARGS_DECL) - - vmwgfx_cursor_bypass(ms->fd, 0, 0); - vmwgfx_disable_scanout(pScrn); -+ vmwgfx_saa_drop_master(pScrn->pScreen); - - if (drmDropMaster(ms->fd)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, -@@ -1136,6 +1137,8 @@ drv_enter_vt(VT_FUNC_ARGS_DECL) - if (!drv_set_master(pScrn)) - return FALSE; - -+ vmwgfx_saa_set_master(pScrn->pScreen); -+ - if (!xf86SetDesiredModes(pScrn)) - return FALSE; - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index ed3c1ee..5534ca3 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -423,6 +423,7 @@ vmwgfx_create_pixmap(struct saa_driver *driver, struct saa_pixmap *spix, - - WSBMINITLISTHEAD(&vpix->sync_x_head); - WSBMINITLISTHEAD(&vpix->scanout_list); -+ WSBMINITLISTHEAD(&vpix->pixmap_list); - - return TRUE; - } -@@ -499,6 +500,7 @@ vmwgfx_destroy_pixmap(struct saa_driver *driver, PixmapPtr pixmap) - */ - - vmwgfx_pixmap_remove_present(vpix); -+ WSBMLISTDELINIT(&vpix->pixmap_list); - WSBMLISTDELINIT(&vpix->sync_x_head); - - if (vpix->hw_is_dri2_fronts) -@@ -627,6 +629,8 @@ vmwgfx_modify_pixmap_header (PixmapPtr pixmap, int w, int h, int depth, - int bpp, int devkind, void *pixdata) - { - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -+ ScreenPtr pScreen = pixmap->drawable.pScreen; -+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); - unsigned int old_height; - unsigned int old_width; - unsigned int old_pitch; -@@ -670,6 +674,8 @@ vmwgfx_modify_pixmap_header (PixmapPtr pixmap, int w, int h, int depth, - - vmwgfx_pix_resize(pixmap, old_pitch, old_height, old_width); - vmwgfx_pixmap_free_storage(vpix); -+ WSBMLISTADDTAIL(&vpix->pixmap_list, &vsaa->pixmaps); -+ - return TRUE; - - out_no_modify: -@@ -860,7 +866,7 @@ vmwgfx_copy_prepare(struct saa_driver *driver, - Bool has_valid_hw; - - if (!vsaa->xat || !SAA_PM_IS_SOLID(&dst_pixmap->drawable, plane_mask) || -- alu != GXcopy) -+ alu != GXcopy || !vsaa->is_master) - return FALSE; - - src_vpix = vmwgfx_saa_pixmap(src_pixmap); -@@ -1057,6 +1063,9 @@ vmwgfx_composite_prepare(struct saa_driver *driver, CARD8 op, - RegionRec empty; - struct xa_composite *xa_comp; - -+ if (!vsaa->is_master) -+ return FALSE; -+ - REGION_NULL(pScreen, &empty); - - /* -@@ -1367,7 +1376,9 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->use_present_opt = direct_presents; - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; -+ vsaa->is_master = TRUE; - WSBMINITLISTHEAD(&vsaa->sync_x_list); -+ WSBMINITLISTHEAD(&vsaa->pixmaps); - - vsaa->driver = vmwgfx_saa_driver; - vsaa->vcomp = vmwgfx_alloc_composite(); -@@ -1518,3 +1529,34 @@ vmwgfx_scanout_unref(struct vmwgfx_screen_entry *entry) - entry->pixmap = NULL; - pixmap->drawable.pScreen->DestroyPixmap(pixmap); - } -+ -+void -+vmwgfx_saa_set_master(ScreenPtr pScreen) -+{ -+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); -+ -+ vsaa->is_master = TRUE; -+} -+ -+void -+vmwgfx_saa_drop_master(ScreenPtr pScreen) -+{ -+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); -+ struct _WsbmListHead *list; -+ struct vmwgfx_saa_pixmap *vpix; -+ struct saa_pixmap *spix; -+ -+ WSBMLISTFOREACH(list, &vsaa->pixmaps) { -+ vpix = WSBMLISTENTRY(list, struct vmwgfx_saa_pixmap, pixmap_list); -+ spix = &vpix->base; -+ -+ if (!vpix->hw) -+ continue; -+ -+ (void) vmwgfx_download_from_hw(&vsaa->driver, spix->pixmap, -+ &spix->dirty_hw); -+ REGION_EMPTY(draw->pScreen, &spix->dirty_hw); -+ } -+ -+ vsaa->is_master = FALSE; -+} -diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h -index bb8ec96..d8aa3d3 100644 ---- a/vmwgfx/vmwgfx_saa.h -+++ b/vmwgfx/vmwgfx_saa.h -@@ -54,6 +54,7 @@ struct vmwgfx_saa_pixmap { - int hw_is_dri2_fronts; - struct _WsbmListHead sync_x_head; - struct _WsbmListHead scanout_list; -+ struct _WsbmListHead pixmap_list; - - uint32_t xa_flags; - uint32_t staging_add_flags; -@@ -107,4 +108,11 @@ Bool - vmwgfx_hw_accel_validate(PixmapPtr pixmap, unsigned int depth, - uint32_t add_flags, uint32_t remove_flags, - RegionPtr region); -+ -+void -+vmwgfx_saa_set_master(ScreenPtr pScreen); -+ -+void -+vmwgfx_saa_drop_master(ScreenPtr pScreen); -+ - #endif -diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h -index 5f46dee..16583b0 100644 ---- a/vmwgfx/vmwgfx_saa_priv.h -+++ b/vmwgfx/vmwgfx_saa_priv.h -@@ -54,8 +54,10 @@ struct vmwgfx_saa { - Bool use_present_opt; - Bool only_hw_presents; - Bool rendercheck; -+ Bool is_master; - void (*present_flush) (ScreenPtr pScreen); - struct _WsbmListHead sync_x_list; -+ struct _WsbmListHead pixmaps; - struct vmwgfx_composite *vcomp; - }; - -diff --git a/vmwgfx/vmwgfx_xa_surface.c b/vmwgfx/vmwgfx_xa_surface.c -index 8b30e45..2f23c57 100644 ---- a/vmwgfx/vmwgfx_xa_surface.c -+++ b/vmwgfx/vmwgfx_xa_surface.c -@@ -362,6 +362,12 @@ vmwgfx_hw_accel_validate(PixmapPtr pixmap, unsigned int depth, - Bool - vmwgfx_hw_dri2_validate(PixmapPtr pixmap, unsigned int depth) - { -+ struct vmwgfx_saa *vsaa = -+ to_vmwgfx_saa(saa_get_driver(pixmap->drawable.pScreen)); -+ -+ if (!vsaa->is_master) -+ return FALSE; -+ - return (vmwgfx_hw_dri2_stage(pixmap, depth) && - vmwgfx_hw_commit(pixmap) && - vmwgfx_hw_validate(pixmap, NULL)); --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0003-vmwgfx-Implement-textured-video-completely-on-top-of.patch b/x11-drivers/xf86-video-vmware/files/0003-vmwgfx-Implement-textured-video-completely-on-top-of.patch deleted file mode 100644 index a26253129..000000000 --- a/x11-drivers/xf86-video-vmware/files/0003-vmwgfx-Implement-textured-video-completely-on-top-of.patch +++ /dev/null @@ -1,196 +0,0 @@ -From 7192acf9f0bf8e7176ab0b803b861a858623f709 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 19 Sep 2012 20:36:57 +0200 -Subject: [PATCH 03/19] 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 -Reviewed-by: Zack Rusin ---- - 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.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0004-vmwgfx-Get-rid-of-device-specific-DMA-code.patch b/x11-drivers/xf86-video-vmware/files/0004-vmwgfx-Get-rid-of-device-specific-DMA-code.patch deleted file mode 100644 index 0a7b11acf..000000000 --- a/x11-drivers/xf86-video-vmware/files/0004-vmwgfx-Get-rid-of-device-specific-DMA-code.patch +++ /dev/null @@ -1,240 +0,0 @@ -From 45b2457516a9db4bd1d60fbb24a1efbe2d9dd932 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 19 Sep 2012 21:50:40 +0200 -Subject: [PATCH 04/19] vmwgfx: Get rid of device-specific DMA code - -It's rarely used and things seem to work well enough on top of XA. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Zack Rusin ---- - vmwgfx/vmwgfx_drmi.c | 103 ----------------------------------------------- - vmwgfx/vmwgfx_drmi.h | 5 --- - vmwgfx/vmwgfx_saa.c | 53 ++++++++++++------------ - vmwgfx/vmwgfx_saa_priv.h | 1 - - 4 files changed, 26 insertions(+), 136 deletions(-) - -diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c -index 496a16b..1e23f4a 100644 ---- a/vmwgfx/vmwgfx_drmi.c -+++ b/vmwgfx/vmwgfx_drmi.c -@@ -284,109 +284,6 @@ vmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf) - } - - int --vmwgfx_dma(unsigned int host_x, unsigned int host_y, -- RegionPtr region, struct vmwgfx_dmabuf *buf, -- uint32_t buf_pitch, uint32_t surface_handle, int to_surface) --{ -- BoxPtr clips = REGION_RECTS(region); -- unsigned int num_clips = REGION_NUM_RECTS(region); -- struct drm_vmw_execbuf_arg arg; -- struct drm_vmw_fence_rep rep; -- int ret; -- unsigned int size; -- unsigned i; -- SVGA3dCopyBox *cb; -- SVGA3dCmdSurfaceDMASuffix *suffix; -- SVGA3dCmdSurfaceDMA *body; -- struct vmwgfx_int_dmabuf *ibuf = vmwgfx_int_dmabuf(buf); -- -- struct { -- SVGA3dCmdHeader header; -- SVGA3dCmdSurfaceDMA body; -- SVGA3dCopyBox cb; -- } *cmd; -- -- if (num_clips == 0) -- return 0; -- -- size = sizeof(*cmd) + (num_clips - 1) * sizeof(cmd->cb) + -- sizeof(*suffix); -- cmd = malloc(size); -- if (!cmd) -- return -1; -- -- cmd->header.id = SVGA_3D_CMD_SURFACE_DMA; -- cmd->header.size = sizeof(cmd->body) + num_clips * sizeof(cmd->cb) + -- sizeof(*suffix); -- cb = &cmd->cb; -- -- suffix = (SVGA3dCmdSurfaceDMASuffix *) &cb[num_clips]; -- suffix->suffixSize = sizeof(*suffix); -- suffix->maximumOffset = (uint32_t) -1; -- suffix->flags.discard = 0; -- suffix->flags.unsynchronized = 0; -- suffix->flags.reserved = 0; -- -- body = &cmd->body; -- body->guest.ptr.gmrId = buf->gmr_id; -- body->guest.ptr.offset = buf->gmr_offset; -- body->guest.pitch = buf_pitch; -- body->host.sid = surface_handle; -- body->host.face = 0; -- body->host.mipmap = 0; -- -- body->transfer = (to_surface ? SVGA3D_WRITE_HOST_VRAM : -- SVGA3D_READ_HOST_VRAM); -- -- -- for (i=0; i < num_clips; i++, cb++, clips++) { -- cb->x = (uint16_t) clips->x1 + host_x; -- cb->y = (uint16_t) clips->y1 + host_y; -- cb->z = 0; -- cb->srcx = (uint16_t) clips->x1; -- cb->srcy = (uint16_t) clips->y1; -- cb->srcz = 0; -- cb->w = (uint16_t) (clips->x2 - clips->x1); -- cb->h = (uint16_t) (clips->y2 - clips->y1); -- cb->d = 1; --#if 0 -- LogMessage(X_INFO, "DMA! x: %u y: %u srcx: %u srcy: %u w: %u h: %u %s\n", -- cb->x, cb->y, cb->srcx, cb->srcy, cb->w, cb->h, -- to_surface ? "to" : "from"); --#endif -- -- } -- -- memset(&arg, 0, sizeof(arg)); -- memset(&rep, 0, sizeof(rep)); -- -- rep.error = -EFAULT; -- arg.fence_rep = ((to_surface) ? 0UL : (unsigned long)&rep); -- arg.commands = (unsigned long)cmd; -- arg.command_size = size; -- arg.throttle_us = 0; -- arg.version = DRM_VMW_EXECBUF_VERSION; -- -- ret = drmCommandWrite(ibuf->drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg)); -- if (ret) { -- LogMessage(X_ERROR, "DMA error %s.\n", strerror(-ret)); -- } -- -- free(cmd); -- -- if (rep.error == 0) { -- ret = vmwgfx_fence_wait(ibuf->drm_fd, rep.handle, TRUE); -- if (ret) { -- LogMessage(X_ERROR, "DMA from host fence wait error %s.\n", -- strerror(-ret)); -- vmwgfx_fence_unref(ibuf->drm_fd, rep.handle); -- } -- } -- -- return 0; --} -- --int - vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out) - { - struct drm_vmw_getparam_arg gp_arg; -diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h -index 2435009..fff728a 100644 ---- a/vmwgfx/vmwgfx_drmi.h -+++ b/vmwgfx/vmwgfx_drmi.h -@@ -60,11 +60,6 @@ extern void - vmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf); - - extern int --vmwgfx_dma(unsigned int host_x, unsigned int host_y, -- RegionPtr region, struct vmwgfx_dmabuf *buf, -- uint32_t buf_pitch, uint32_t surface_handle, int to_surface); -- --extern int - vmwgfx_num_streams(int drm_fd, uint32_t *ntot, uint32_t *nfree); - - extern int -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 5534ca3..fd80682 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -279,40 +279,40 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - Bool to_hw) - { - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -+ void *data = vpix->malloc; -+ int ret; - - if (!vpix->hw || (!vpix->gmr && !vpix->malloc)) - return TRUE; - -- if (vpix->gmr && vsaa->can_optimize_dma) { -- uint32_t handle, dummy; - -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) -- goto out_err; -- if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, -- to_hw) != 0) -+ if (vpix->gmr) { -+ data = vmwgfx_dmabuf_map(vpix->gmr); -+ if (!data) - goto out_err; -- } else { -- void *data = vpix->malloc; -- int ret; -+ } - -- if (vpix->gmr) { -- data = vmwgfx_dmabuf_map(vpix->gmr); -- if (!data) -- goto out_err; -- } -+ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -+ (int) to_hw, -+ (struct xa_box *) REGION_RECTS(reg), -+ REGION_NUM_RECTS(reg)); -+ if (vpix->gmr) -+ vmwgfx_dmabuf_unmap(vpix->gmr); -+ -+ if (ret) -+ goto out_err; -+ -+ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -+ (int) to_hw, -+ (struct xa_box *) REGION_RECTS(reg), -+ REGION_NUM_RECTS(reg)); -+ if (to_hw) -+ xa_context_flush(vsaa->xa_ctx); -+ if (vpix->gmr) -+ vmwgfx_dmabuf_unmap(vpix->gmr); -+ if (ret) -+ goto out_err; - -- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -- (int) to_hw, -- (struct xa_box *) REGION_RECTS(reg), -- REGION_NUM_RECTS(reg)); -- if (to_hw) -- xa_context_flush(vsaa->xa_ctx); -- if (vpix->gmr) -- vmwgfx_dmabuf_unmap(vpix->gmr); -- if (ret) -- goto out_err; -- } - return TRUE; - out_err: - LogMessage(X_ERROR, "DMA %s surface failed.\n", -@@ -1372,7 +1372,6 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->xa_ctx = xa_context_default(xat); - vsaa->drm_fd = drm_fd; - vsaa->present_flush = present_flush; -- vsaa->can_optimize_dma = FALSE; - vsaa->use_present_opt = direct_presents; - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; -diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h -index 16583b0..f5f45ba 100644 ---- a/vmwgfx/vmwgfx_saa_priv.h -+++ b/vmwgfx/vmwgfx_saa_priv.h -@@ -50,7 +50,6 @@ struct vmwgfx_saa { - int ydiff; - RegionRec present_region; - uint32_t src_handle; -- Bool can_optimize_dma; - Bool use_present_opt; - Bool only_hw_presents; - Bool rendercheck; --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0005-vmwgfx-handle-changes-of-DamageUnregister-API-in-1.1.patch b/x11-drivers/xf86-video-vmware/files/0005-vmwgfx-handle-changes-of-DamageUnregister-API-in-1.1.patch deleted file mode 100644 index 570d1e474..000000000 --- a/x11-drivers/xf86-video-vmware/files/0005-vmwgfx-handle-changes-of-DamageUnregister-API-in-1.1.patch +++ /dev/null @@ -1,43 +0,0 @@ -From e26dec8f5278df74a102493bf6d2d8444dab5d6d Mon Sep 17 00:00:00 2001 -From: Gaetan Nadon -Date: Mon, 28 Oct 2013 18:21:29 -0400 -Subject: [PATCH 05/19] vmwgfx: handle changes of DamageUnregister API in - 1.14.99.2 - -Fix is inspired from the intel driver. - -Reviewed-by: Jakob Bornecrantz -Signed-off-by: Gaetan Nadon -Signed-off-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_saa.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index fd80682..346e7f4 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -26,6 +26,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -76,7 +77,12 @@ vmwgfx_pixmap_remove_damage(PixmapPtr pixmap) - if (!spix->damage || vpix->hw || vpix->gmr || vpix->malloc) - return; - -+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0) -+ DamageUnregister(spix->damage); -+#else - DamageUnregister(&pixmap->drawable, spix->damage); -+#endif -+ - DamageDestroy(spix->damage); - spix->damage = NULL; - } --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0006-vmwgfx-Fix-some-compilation-warnings-and-indentation.patch b/x11-drivers/xf86-video-vmware/files/0006-vmwgfx-Fix-some-compilation-warnings-and-indentation.patch deleted file mode 100644 index 33eac1837..000000000 --- a/x11-drivers/xf86-video-vmware/files/0006-vmwgfx-Fix-some-compilation-warnings-and-indentation.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 7ac45326eccbf3bea9a4a8f95b9662a36ab58eb0 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 28 Nov 2013 02:02:20 -0800 -Subject: [PATCH 06/19] vmwgfx: Fix some compilation warnings and indentations - -Most of the compilation warnings we're seeing are due to bad xorg headers, -but fix the ones we can fix in the driver. Some indentation fixes as well. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - src/vmware_bootstrap.c | 2 -- - src/vmwarevideo.c | 4 ++-- - vmwgfx/vmwgfx_driver.c | 1 - - vmwgfx/vmwgfx_output.c | 2 +- - vmwgfx/vmwgfx_overlay.c | 4 ++-- - vmwgfx/vmwgfx_tex_video.c | 26 +++++++++++++------------- - 6 files changed, 18 insertions(+), 21 deletions(-) - -diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c -index ea5be19..bb58325 100644 ---- a/src/vmware_bootstrap.c -+++ b/src/vmware_bootstrap.c -@@ -256,7 +256,6 @@ VMwarePciProbe (DriverPtr drv, - intptr_t match_data) - { - ScrnInfoPtr scrn = NULL; -- EntityInfoPtr entity; - - scrn = xf86ConfigPciEntity(scrn, 0, entity_num, VMWAREPciChipsets, - NULL, NULL, NULL, NULL, NULL); -@@ -267,7 +266,6 @@ VMwarePciProbe (DriverPtr drv, - scrn->Probe = NULL; - } - -- entity = xf86GetEntityInfo(entity_num); - switch (DEVICE_ID(device)) { - case PCI_DEVICE_ID_VMWARE_SVGA2: - case PCI_DEVICE_ID_VMWARE_SVGA: -diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c -index 745c71f..8d7d171 100644 ---- a/src/vmwarevideo.c -+++ b/src/vmwarevideo.c -@@ -82,7 +82,7 @@ - #define VMWARE_VID_MAX_HEIGHT 2048 - - #define VMWARE_VID_NUM_ENCODINGS 1 --static XF86VideoEncodingRec vmwareVideoEncodings[] = -+static const XF86VideoEncodingRec vmwareVideoEncodings[] = - { - { - 0, -@@ -108,7 +108,7 @@ static XF86ImageRec vmwareVideoImages[] = - }; - - #define VMWARE_VID_NUM_ATTRIBUTES 2 --static XF86AttributeRec vmwareVideoAttributes[] = -+static const XF86AttributeRec vmwareVideoAttributes[] = - { - { - XvGettable | XvSettable, -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index eeaea4b..bfc07f8 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -658,7 +658,6 @@ void xorg_flush(ScreenPtr pScreen) - if (crtc->enabled) { - pixmap = crtc_get_scanout(crtc); - if (pixmap) { -- unsigned int j; - - /* - * Remove duplicates. -diff --git a/vmwgfx/vmwgfx_output.c b/vmwgfx/vmwgfx_output.c -index 4f52f1d..f9e4263 100644 ---- a/vmwgfx/vmwgfx_output.c -+++ b/vmwgfx/vmwgfx_output.c -@@ -60,7 +60,7 @@ struct output_private - Bool is_implicit; - }; - --static char *output_enum_list[] = { -+static const char *output_enum_list[] = { - "Unknown", - "VGA", - "DVI", -diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c -index 6624a10..986dd06 100644 ---- a/vmwgfx/vmwgfx_overlay.c -+++ b/vmwgfx/vmwgfx_overlay.c -@@ -84,7 +84,7 @@ typedef uint8_t uint8; - #define VMWARE_VID_MAX_HEIGHT 2048 - - #define VMWARE_VID_NUM_ENCODINGS 1 --static XF86VideoEncodingRec vmwareVideoEncodings[] = -+static const XF86VideoEncodingRec vmwareVideoEncodings[] = - { - { - 0, -@@ -110,7 +110,7 @@ static XF86ImageRec vmwareVideoImages[] = - }; - - #define VMWARE_VID_NUM_ATTRIBUTES 2 --static XF86AttributeRec vmwareVideoAttributes[] = -+static const XF86AttributeRec vmwareVideoAttributes[] = - { - { - XvGettable | XvSettable, -diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c -index a0a4f4a..3ba40ef 100644 ---- a/vmwgfx/vmwgfx_tex_video.c -+++ b/vmwgfx/vmwgfx_tex_video.c -@@ -70,11 +70,11 @@ static const float bt_709[] = { - static Atom xvBrightness, xvContrast, xvSaturation, xvHue; - - #define NUM_TEXTURED_ATTRIBUTES 4 --static XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = { -- {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, -- {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"}, -- {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}, -- {XvSettable | XvGettable, -1000, 1000, "XV_HUE"} -+static const XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = { -+ {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, -+ {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"}, -+ {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}, -+ {XvSettable | XvGettable, -1000, 1000, "XV_HUE"} - }; - - #define NUM_FORMATS 3 -@@ -82,7 +82,7 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] = { - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} - }; - --static XF86VideoEncodingRec DummyEncoding[1] = { -+static const XF86VideoEncodingRec DummyEncoding[1] = { - { - 0, - "XV_IMAGE", -@@ -416,16 +416,16 @@ copy_packed_data(ScrnInfoPtr pScrn, - switch (id) { - case FOURCC_YV12: { - int pitches[3], offsets[3]; -- unsigned char *y, *u, *v; -+ unsigned char *yp, *up, *vp; - query_image_attributes(pScrn, FOURCC_YV12, - &w, &h, pitches, offsets); - -- y = buf + offsets[0]; -- v = buf + offsets[1]; -- u = buf + offsets[2]; -- memcpy(ymap, y, w*h); -- memcpy(vmap, v, w*h/4); -- memcpy(umap, u, w*h/4); -+ yp = buf + offsets[0]; -+ vp = buf + offsets[1]; -+ up = buf + offsets[2]; -+ memcpy(ymap, yp, w*h); -+ memcpy(vmap, vp, w*h/4); -+ memcpy(umap, up, w*h/4); - break; - } - case FOURCC_UYVY: --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0007-vmwgfx-Support-also-XA-version-1-v2.patch b/x11-drivers/xf86-video-vmware/files/0007-vmwgfx-Support-also-XA-version-1-v2.patch deleted file mode 100644 index e31d86010..000000000 --- a/x11-drivers/xf86-video-vmware/files/0007-vmwgfx-Support-also-XA-version-1-v2.patch +++ /dev/null @@ -1,170 +0,0 @@ -From a40cbd7b4fa19219849b4b0a48f07538772c3e22 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 5 Dec 2013 02:58:47 -0800 -Subject: [PATCH 07/19] vmwgfx: Support also XA version 1 v2 - -We need to support also XA version 1, since we want to be backwards -compatible with older mesa releases. -Unfortunately, the intended way of detecting XA major version at -compile-time was broken on mesa 10 so we need a workaround that tests -for XA version 2 at config time. - -v2: Update the test for XA version 2. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - configure.ac | 10 +++++++++- - vmwgfx/vmwgfx_dri2.c | 5 ++--- - vmwgfx/vmwgfx_driver.c | 3 +-- - vmwgfx/vmwgfx_saa.c | 12 +++++------- - vmwgfx/vmwgfx_saa.h | 12 ++++++++++++ - vmwgfx/vmwgfx_tex_video.c | 2 +- - 6 files changed, 30 insertions(+), 14 deletions(-) - -diff --git a/configure.ac b/configure.ac -index dccfb27..123356c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -118,7 +118,15 @@ if test x$BUILD_VMWGFX = xyes; then - PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no]) - fi - if test x$BUILD_VMWGFX = xyes; then -- PKG_CHECK_MODULES([XATRACKER], [xatracker >= 2.0.0],[],[BUILD_VMWGFX=no]) -+# -+# Early versions of mesa 10 forgot to bump the XA major version number in -+# the xa_tracker.h header -+# -+ PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0], -+ [PKG_CHECK_EXISTS([xatracker = 2.0.0], -+ [AC_DEFINE([HAVE_XA_2], 1, -+ [Has version 2 of XA])])], -+ [],[BUILD_VMWGFX=no]) - fi - - DRIVER_NAME=vmware -diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c -index 57f2d9d..4c74a6b 100644 ---- a/vmwgfx/vmwgfx_dri2.c -+++ b/vmwgfx/vmwgfx_dri2.c -@@ -206,8 +206,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - } - - private->srf = srf; -- if (xa_surface_handle(srf, xa_handle_type_shared, -- &buffer->name, &buffer->pitch) != 0) -+ if (_xa_surface_handle(srf, &buffer->name, &buffer->pitch) != 0) - return FALSE; - - buffer->cpp = xa_format_depth(xa_surface_format(srf)) / 8; -@@ -228,7 +227,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(private->pPixmap); - - if (--private->refcount == 0 && srf) { -- xa_surface_unref(srf); -+ xa_surface_destroy(srf); - } - - /* -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index bfc07f8..6301c29 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -617,8 +617,7 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd, - return FALSE; - } - -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) { -+ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) { - LogMessage(X_ERROR, "Could not get present surface handle.\n"); - return FALSE; - } -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 346e7f4..1459933 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -146,7 +146,7 @@ vmwgfx_pixmap_free_storage(struct vmwgfx_saa_pixmap *vpix) - vpix->malloc = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_SURFACE) && vpix->hw) { -- xa_surface_unref(vpix->hw); -+ xa_surface_destroy(vpix->hw); - vpix->hw = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_GMR) && vpix->gmr) { -@@ -451,7 +451,7 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa, - &spix->dirty_hw)) - return FALSE; - -- xa_surface_unref(vpix->hw); -+ xa_surface_destroy(vpix->hw); - vpix->hw = NULL; - - /* -@@ -698,8 +698,7 @@ vmwgfx_present_prepare(struct vmwgfx_saa *vsaa, - - (void) pScreen; - if (src_vpix == dst_vpix || !src_vpix->hw || -- xa_surface_handle(src_vpix->hw, xa_handle_type_shared, -- &vsaa->src_handle, &dummy) != 0) -+ _xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0) - return FALSE; - - REGION_NULL(pScreen, &vsaa->present_region); -@@ -800,7 +799,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa, - return TRUE; - - out_no_damage: -- xa_surface_unref(hw); -+ xa_surface_destroy(hw); - return FALSE; - } - -@@ -1459,8 +1458,7 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry *entry) - */ - if (!vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT, 0, NULL)) - goto out_err; -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) -+ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) - goto out_err; - depth = xa_format_depth(xa_surface_format(vpix->hw)); - -diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h -index d8aa3d3..5e1f40c 100644 ---- a/vmwgfx/vmwgfx_saa.h -+++ b/vmwgfx/vmwgfx_saa.h -@@ -115,4 +115,16 @@ vmwgfx_saa_set_master(ScreenPtr pScreen); - void - vmwgfx_saa_drop_master(ScreenPtr pScreen); - -+#if (XA_TRACKER_VERSION_MAJOR <= 1) && !defined(HAVE_XA_2) -+ -+#define _xa_surface_handle(_a, _b, _c) xa_surface_handle(_a, _b, _c) -+#define xa_context_flush(_a) -+ -+#else -+ -+#define xa_surface_destroy(_a) xa_surface_unref(_a) -+#define _xa_surface_handle(_a, _b, _c) \ -+ xa_surface_handle(_a, xa_handle_type_shared, _b, _c) -+ -+#endif /* (XA_TRACKER_VERSION_MAJOR <= 1) */ - #endif -diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c -index 3ba40ef..9fd8f22 100644 ---- a/vmwgfx/vmwgfx_tex_video.c -+++ b/vmwgfx/vmwgfx_tex_video.c -@@ -199,7 +199,7 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown) - for (i=0; i<3; ++i) { - for (j=0; j<2; ++j) { - if (priv->yuv[i]) { -- xa_surface_unref(priv->yuv[j][i]); -+ xa_surface_destroy(priv->yuv[j][i]); - priv->yuv[j][i] = NULL; - } - } --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0008-vmwgfx-Remove-stray-1.patch b/x11-drivers/xf86-video-vmware/files/0008-vmwgfx-Remove-stray-1.patch deleted file mode 100644 index 68b535e2f..000000000 --- a/x11-drivers/xf86-video-vmware/files/0008-vmwgfx-Remove-stray-1.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c36cbcefb8526944141eb431e1e736dc4485a36e Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 9 Dec 2013 00:19:55 -0800 -Subject: [PATCH 08/19] vmwgfx: Remove stray 1 - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_saa.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 1459933..28819c1 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -1230,7 +1230,7 @@ vmwgfx_operation_complete(struct saa_driver *driver, - */ - - if (vpix->hw && vpix->hw_is_dri2_fronts) { -- if (1 && pScrn->vtSema && -+ if (pScrn->vtSema && - vmwgfx_upload_to_hw(driver, pixmap, &spix->dirty_shadow)) { - - REGION_EMPTY(vsaa->pScreen, &spix->dirty_shadow); --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0009-Revert-vmwgfx-Get-rid-of-device-specific-DMA-code.patch b/x11-drivers/xf86-video-vmware/files/0009-Revert-vmwgfx-Get-rid-of-device-specific-DMA-code.patch deleted file mode 100644 index bafe55c7f..000000000 --- a/x11-drivers/xf86-video-vmware/files/0009-Revert-vmwgfx-Get-rid-of-device-specific-DMA-code.patch +++ /dev/null @@ -1,245 +0,0 @@ -From 4af6062ce281a7f4aaa50985fe757e9569208ee1 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 11 Dec 2013 04:59:49 -0800 -Subject: [PATCH 09/19] Revert "vmwgfx: Get rid of device-specific DMA code" - -This reverts commit 45b2457516a9db4bd1d60fbb24a1efbe2d9dd932. - -Reverting this because using direct DMA for shared pixmaps should -boost performance. It should be usable both in a composited environment -and when running hosted. Need to retest the DMA flaws I saw before disabling -this code. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_drmi.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++ - vmwgfx/vmwgfx_drmi.h | 5 +++ - vmwgfx/vmwgfx_saa.c | 53 ++++++++++++------------ - vmwgfx/vmwgfx_saa_priv.h | 1 + - 4 files changed, 136 insertions(+), 26 deletions(-) - -diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c -index 1e23f4a..496a16b 100644 ---- a/vmwgfx/vmwgfx_drmi.c -+++ b/vmwgfx/vmwgfx_drmi.c -@@ -284,6 +284,109 @@ vmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf) - } - - int -+vmwgfx_dma(unsigned int host_x, unsigned int host_y, -+ RegionPtr region, struct vmwgfx_dmabuf *buf, -+ uint32_t buf_pitch, uint32_t surface_handle, int to_surface) -+{ -+ BoxPtr clips = REGION_RECTS(region); -+ unsigned int num_clips = REGION_NUM_RECTS(region); -+ struct drm_vmw_execbuf_arg arg; -+ struct drm_vmw_fence_rep rep; -+ int ret; -+ unsigned int size; -+ unsigned i; -+ SVGA3dCopyBox *cb; -+ SVGA3dCmdSurfaceDMASuffix *suffix; -+ SVGA3dCmdSurfaceDMA *body; -+ struct vmwgfx_int_dmabuf *ibuf = vmwgfx_int_dmabuf(buf); -+ -+ struct { -+ SVGA3dCmdHeader header; -+ SVGA3dCmdSurfaceDMA body; -+ SVGA3dCopyBox cb; -+ } *cmd; -+ -+ if (num_clips == 0) -+ return 0; -+ -+ size = sizeof(*cmd) + (num_clips - 1) * sizeof(cmd->cb) + -+ sizeof(*suffix); -+ cmd = malloc(size); -+ if (!cmd) -+ return -1; -+ -+ cmd->header.id = SVGA_3D_CMD_SURFACE_DMA; -+ cmd->header.size = sizeof(cmd->body) + num_clips * sizeof(cmd->cb) + -+ sizeof(*suffix); -+ cb = &cmd->cb; -+ -+ suffix = (SVGA3dCmdSurfaceDMASuffix *) &cb[num_clips]; -+ suffix->suffixSize = sizeof(*suffix); -+ suffix->maximumOffset = (uint32_t) -1; -+ suffix->flags.discard = 0; -+ suffix->flags.unsynchronized = 0; -+ suffix->flags.reserved = 0; -+ -+ body = &cmd->body; -+ body->guest.ptr.gmrId = buf->gmr_id; -+ body->guest.ptr.offset = buf->gmr_offset; -+ body->guest.pitch = buf_pitch; -+ body->host.sid = surface_handle; -+ body->host.face = 0; -+ body->host.mipmap = 0; -+ -+ body->transfer = (to_surface ? SVGA3D_WRITE_HOST_VRAM : -+ SVGA3D_READ_HOST_VRAM); -+ -+ -+ for (i=0; i < num_clips; i++, cb++, clips++) { -+ cb->x = (uint16_t) clips->x1 + host_x; -+ cb->y = (uint16_t) clips->y1 + host_y; -+ cb->z = 0; -+ cb->srcx = (uint16_t) clips->x1; -+ cb->srcy = (uint16_t) clips->y1; -+ cb->srcz = 0; -+ cb->w = (uint16_t) (clips->x2 - clips->x1); -+ cb->h = (uint16_t) (clips->y2 - clips->y1); -+ cb->d = 1; -+#if 0 -+ LogMessage(X_INFO, "DMA! x: %u y: %u srcx: %u srcy: %u w: %u h: %u %s\n", -+ cb->x, cb->y, cb->srcx, cb->srcy, cb->w, cb->h, -+ to_surface ? "to" : "from"); -+#endif -+ -+ } -+ -+ memset(&arg, 0, sizeof(arg)); -+ memset(&rep, 0, sizeof(rep)); -+ -+ rep.error = -EFAULT; -+ arg.fence_rep = ((to_surface) ? 0UL : (unsigned long)&rep); -+ arg.commands = (unsigned long)cmd; -+ arg.command_size = size; -+ arg.throttle_us = 0; -+ arg.version = DRM_VMW_EXECBUF_VERSION; -+ -+ ret = drmCommandWrite(ibuf->drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg)); -+ if (ret) { -+ LogMessage(X_ERROR, "DMA error %s.\n", strerror(-ret)); -+ } -+ -+ free(cmd); -+ -+ if (rep.error == 0) { -+ ret = vmwgfx_fence_wait(ibuf->drm_fd, rep.handle, TRUE); -+ if (ret) { -+ LogMessage(X_ERROR, "DMA from host fence wait error %s.\n", -+ strerror(-ret)); -+ vmwgfx_fence_unref(ibuf->drm_fd, rep.handle); -+ } -+ } -+ -+ return 0; -+} -+ -+int - vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out) - { - struct drm_vmw_getparam_arg gp_arg; -diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h -index fff728a..2435009 100644 ---- a/vmwgfx/vmwgfx_drmi.h -+++ b/vmwgfx/vmwgfx_drmi.h -@@ -60,6 +60,11 @@ extern void - vmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf); - - extern int -+vmwgfx_dma(unsigned int host_x, unsigned int host_y, -+ RegionPtr region, struct vmwgfx_dmabuf *buf, -+ uint32_t buf_pitch, uint32_t surface_handle, int to_surface); -+ -+extern int - vmwgfx_num_streams(int drm_fd, uint32_t *ntot, uint32_t *nfree); - - extern int -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 28819c1..96275a5 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -285,40 +285,40 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - Bool to_hw) - { - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -- void *data = vpix->malloc; -- int ret; - - if (!vpix->hw || (!vpix->gmr && !vpix->malloc)) - return TRUE; - -+ if (vpix->gmr && vsaa->can_optimize_dma) { -+ uint32_t handle, dummy; - -- if (vpix->gmr) { -- data = vmwgfx_dmabuf_map(vpix->gmr); -- if (!data) -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) - goto out_err; -- } -- -- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -- (int) to_hw, -- (struct xa_box *) REGION_RECTS(reg), -- REGION_NUM_RECTS(reg)); -- if (vpix->gmr) -- vmwgfx_dmabuf_unmap(vpix->gmr); -- -- if (ret) -- goto out_err; -+ if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, -+ to_hw) != 0) -+ goto out_err; -+ } else { -+ void *data = vpix->malloc; -+ int ret; - -- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -- (int) to_hw, -- (struct xa_box *) REGION_RECTS(reg), -- REGION_NUM_RECTS(reg)); -- if (to_hw) -- xa_context_flush(vsaa->xa_ctx); -- if (vpix->gmr) -- vmwgfx_dmabuf_unmap(vpix->gmr); -- if (ret) -- goto out_err; -+ if (vpix->gmr) { -+ data = vmwgfx_dmabuf_map(vpix->gmr); -+ if (!data) -+ goto out_err; -+ } - -+ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -+ (int) to_hw, -+ (struct xa_box *) REGION_RECTS(reg), -+ REGION_NUM_RECTS(reg)); -+ if (to_hw) -+ xa_context_flush(vsaa->xa_ctx); -+ if (vpix->gmr) -+ vmwgfx_dmabuf_unmap(vpix->gmr); -+ if (ret) -+ goto out_err; -+ } - return TRUE; - out_err: - LogMessage(X_ERROR, "DMA %s surface failed.\n", -@@ -1377,6 +1377,7 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->xa_ctx = xa_context_default(xat); - vsaa->drm_fd = drm_fd; - vsaa->present_flush = present_flush; -+ vsaa->can_optimize_dma = FALSE; - vsaa->use_present_opt = direct_presents; - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; -diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h -index f5f45ba..16583b0 100644 ---- a/vmwgfx/vmwgfx_saa_priv.h -+++ b/vmwgfx/vmwgfx_saa_priv.h -@@ -50,6 +50,7 @@ struct vmwgfx_saa { - int ydiff; - RegionRec present_region; - uint32_t src_handle; -+ Bool can_optimize_dma; - Bool use_present_opt; - Bool only_hw_presents; - Bool rendercheck; --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0010-vmwgfx-Really-allow-XA-version-2.patch b/x11-drivers/xf86-video-vmware/files/0010-vmwgfx-Really-allow-XA-version-2.patch deleted file mode 100644 index 3532acf66..000000000 --- a/x11-drivers/xf86-video-vmware/files/0010-vmwgfx-Really-allow-XA-version-2.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 93228f3dd3355a25583d22dbb96791678b93be3e Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 11 Dec 2013 06:54:02 -0800 -Subject: [PATCH 10/19] vmwgfx: Really allow XA version 2. - -When XA starts to correctly advertise version 2, we didn't allow it. -Fix this. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_driver.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index 6301c29..4e28097 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -79,7 +79,7 @@ typedef uint8_t uint8; - - #define XA_VERSION_MINOR_REQUIRED 0 - #define XA_VERSION_MAJOR_REQUIRED 1 --#define XA_VERSION_MAJOR_COMPAT 1 -+#define XA_VERSION_MAJOR_COMPAT 2 - - #define DRM_VERSION_MAJOR_REQUIRED 2 - #define DRM_VERSION_MINOR_REQUIRED 3 --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0011-vmwgfx-Fix-compile-breakage-on-XA-version-1.patch b/x11-drivers/xf86-video-vmware/files/0011-vmwgfx-Fix-compile-breakage-on-XA-version-1.patch deleted file mode 100644 index ed6a9922d..000000000 --- a/x11-drivers/xf86-video-vmware/files/0011-vmwgfx-Fix-compile-breakage-on-XA-version-1.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f45a551e9b70ccec8f92df02747d4e2af299cf8c Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 16 Dec 2013 10:38:21 +0100 -Subject: [PATCH 11/19] vmwgfx: Fix compile breakage on XA version 1. - -A recent revert brought back code that assumed XA version 2. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: trivial ---- - vmwgfx/vmwgfx_saa.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 96275a5..e76bd09 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -292,8 +292,7 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - if (vpix->gmr && vsaa->can_optimize_dma) { - uint32_t handle, dummy; - -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) -+ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) - goto out_err; - if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, - to_hw) != 0) --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0012-vmwgfx-Add-an-infrastructure-to-be-able-to-run-hoste.patch b/x11-drivers/xf86-video-vmware/files/0012-vmwgfx-Add-an-infrastructure-to-be-able-to-run-hoste.patch deleted file mode 100644 index 8c4f1bf98..000000000 --- a/x11-drivers/xf86-video-vmware/files/0012-vmwgfx-Add-an-infrastructure-to-be-able-to-run-hoste.patch +++ /dev/null @@ -1,1055 +0,0 @@ -From c8e1c498431b1f8758f62c94131c302cf3d07b39 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 16 Dec 2013 06:05:35 -0800 -Subject: [PATCH 12/19] vmwgfx: Add an infrastructure to be able to run hosted - under a compositor v2 - -Figure out what's needed both for XMir and XWayland and make a common -driver structure out of it. - -v2: Added a lot of comments. No code change. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Brian Paul -Reviewed-by: Jakob Bornecrantz ---- - src/vmware_bootstrap.c | 19 ++- - src/vmware_bootstrap.h | 2 + - vmwgfx/Makefile.am | 3 + - vmwgfx/vmwgfx_dri2.c | 37 ++++++ - vmwgfx/vmwgfx_driver.c | 307 +++++++++++++++++++++++++++----------------- - vmwgfx/vmwgfx_driver.h | 4 + - vmwgfx/vmwgfx_hosted.c | 64 +++++++++ - vmwgfx/vmwgfx_hosted.h | 257 ++++++++++++++++++++++++++++++++++++ - vmwgfx/vmwgfx_hosted_priv.h | 34 +++++ - vmwgfx/vmwgfx_overlay.c | 4 + - 10 files changed, 610 insertions(+), 121 deletions(-) - create mode 100644 vmwgfx/vmwgfx_hosted.c - create mode 100644 vmwgfx/vmwgfx_hosted.h - create mode 100644 vmwgfx/vmwgfx_hosted_priv.h - -diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c -index bb58325..57f8ae9 100644 ---- a/src/vmware_bootstrap.c -+++ b/src/vmware_bootstrap.c -@@ -199,6 +199,12 @@ OptionInfoPtr VMWARECopyOptions(void) - return options; - } - -+/* -+ * Also in vmwgfx_hosted.h, which we don't include. -+ */ -+void * -+vmwgfx_hosted_detect(void); -+ - static Bool - VMwarePreinitStub(ScrnInfoPtr pScrn, int flags) - { -@@ -220,6 +226,11 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags) - if ((*pScrn->PreInit)(pScrn, flags)) - return TRUE; - -+ /* -+ * Can't run legacy hosted -+ */ -+ if (vmwgfx_hosted_detect()) -+ return FALSE; - #else - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Driver was compiled without KMS- and 3D support.\n"); -@@ -413,15 +424,19 @@ VMWareDriverFunc(ScrnInfoPtr pScrn, - xorgDriverFuncOp op, - pointer data) - { -- CARD32 *flag; -+ uint32_t *flag; - xorgRRModeMM *modemm; - - switch (op) { - case GET_REQUIRED_HW_INTERFACES: -- flag = (CARD32 *)data; -+ flag = (uint32_t *)data; - - if (flag) { -+#ifdef BUILD_VMWGFX -+ vmwgfx_modify_flags(flag); -+#else - *flag = HW_IO | HW_MMIO; -+#endif - } - return TRUE; - case RR_GET_MODE_MM: -diff --git a/src/vmware_bootstrap.h b/src/vmware_bootstrap.h -index f72d298..b71d3cd 100644 ---- a/src/vmware_bootstrap.h -+++ b/src/vmware_bootstrap.h -@@ -52,6 +52,8 @@ vmwlegacy_hookup(ScrnInfoPtr pScrn); - #ifdef BUILD_VMWGFX - void - vmwgfx_hookup(ScrnInfoPtr pScrn); -+void -+vmwgfx_modify_flags(uint32_t *flags); - #endif /* defined(BUILD_VMWGFX) */ - - #ifdef XFree86LOADER -diff --git a/vmwgfx/Makefile.am b/vmwgfx/Makefile.am -index 269d870..2b0380b 100644 ---- a/vmwgfx/Makefile.am -+++ b/vmwgfx/Makefile.am -@@ -25,5 +25,8 @@ libvmwgfx_la_SOURCES = \ - vmwgfx_ctrl.h \ - vmwgfx_xa_composite.c \ - vmwgfx_xa_surface.c \ -+ vmwgfx_hosted.c \ -+ vmwgfx_hosted.h \ -+ vmwgfx_hosted_priv.h \ - wsbm_util.h - endif -diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c -index 4c74a6b..9e0bc71 100644 ---- a/vmwgfx/vmwgfx_dri2.c -+++ b/vmwgfx/vmwgfx_dri2.c -@@ -43,6 +43,7 @@ - #include "vmwgfx_saa.h" - #include "wsbm_util.h" - #include -+#include "vmwgfx_hosted.h" - - #define VMWGFX_FD_PATH_LEN 80 - -@@ -381,6 +382,27 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, - FreeScratchGC(gc); - } - -+#if (DRI2INFOREC_VERSION >= 8 && DRI2INFOREC_VERSION < 10) -+static int vmw_dri_auth_magic2(ScreenPtr pScreen, uint32_t magic) -+{ -+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); -+ modesettingPtr ms = modesettingPTR(pScrn); -+ -+ return vmwgfx_hosted_dri_auth(ms->hdriver, ms->hosted, NULL, magic); -+} -+#endif -+ -+#if (DRI2INFOREC_VERSION >= 10) -+static int vmw_dri_auth_magic3(ClientPtr client, ScreenPtr pScreen, -+ uint32_t magic) -+{ -+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); -+ modesettingPtr ms = modesettingPTR(pScrn); -+ -+ return vmwgfx_hosted_dri_auth(ms->hdriver, ms->hosted, client, magic); -+} -+#endif -+ - Bool - xorg_dri2_init(ScreenPtr pScreen) - { -@@ -391,6 +413,8 @@ xorg_dri2_init(ScreenPtr pScreen) - char fdPath[VMWGFX_FD_PATH_LEN]; - ssize_t numChar; - -+ memset(&dri2info, 0, sizeof(dri2info)); -+ - if (xf86LoaderCheckSymbol("DRI2Version")) { - DRI2Version(&major, &minor); - } else { -@@ -427,6 +451,19 @@ xorg_dri2_init(ScreenPtr pScreen) - dri2info.CopyRegion = dri2_copy_region; - dri2info.Wait = NULL; - -+#if (DRI2INFOREC_VERSION >= 8 && DRI2INFOREC_VERSION < 10) -+ if (vmwgfx_is_hosted(ms->hdriver)) { -+ dri2info.version = 8; -+ dri2info.AuthMagic2 = vmw_dri_auth_magic2; -+ } -+#endif -+#if (DRI2INFOREC_VERSION >= 10) -+ if (vmwgfx_is_hosted(ms->hdriver)) { -+ dri2info.version = 10; -+ dri2info.AuthMagic3 = vmw_dri_auth_magic3; -+ } -+#endif -+ - return DRI2ScreenInit(pScreen, &dri2info); - } - -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index 4e28097..dc05b86 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -60,6 +60,7 @@ - #include "vmwgfx_saa.h" - #include "../src/vmware_bootstrap.h" - #include "../src/vmware_common.h" -+#include "vmwgfx_hosted.h" - - /* - * We can't incude svga_types.h due to conflicting types for Bool. -@@ -128,6 +129,12 @@ vmwgfx_hookup(ScrnInfoPtr pScrn) - pScrn->ValidMode = drv_valid_mode; - } - -+void -+vmwgfx_modify_flags(CARD32 *flags) -+{ -+ *flags &= ~(HW_IO); -+ vmwgfx_hosted_modify_flags(flags); -+} - /* - * Internal function definitions - */ -@@ -243,18 +250,22 @@ drv_init_drm(ScrnInfoPtr pScrn) - - /* deal with server regeneration */ - if (ms->fd < 0) { -- char *BusID; - -- BusID = malloc(64); -- sprintf(BusID, "PCI:%d:%d:%d", -- ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), -- ms->PciInfo->dev, ms->PciInfo->func -- ); -+ ms->fd = vmwgfx_hosted_drm_fd(ms->hdriver, ms->hosted, ms->PciInfo); -+ -+ if (ms->fd < 0) { - -+ char bus_id[64]; - -- ms->fd = drmOpen("vmwgfx", BusID); -- ms->isMaster = TRUE; -- free(BusID); -+ snprintf(bus_id, sizeof(bus_id), "PCI:%d:%d:%d", -+ ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), -+ ms->PciInfo->dev, ms->PciInfo->func -+ ); -+ -+ ms->fd = drmOpen("vmwgfx", bus_id); -+ ms->isMaster = TRUE; -+ -+ } - - if (ms->fd >= 0) { - drmVersionPtr ver = drmGetVersion(ms->fd); -@@ -333,14 +344,103 @@ vmwgfx_set_topology(ScrnInfoPtr pScrn, const char *topology, const char *info) - return FALSE; - } - -+ -+static Bool -+vmwgfx_pre_init_mode(ScrnInfoPtr pScrn, int flags) -+{ -+ modesettingPtr ms = modesettingPTR(pScrn); -+ Bool ret = TRUE; -+ -+ ms->from_dp = (xf86GetOptValBool(ms->Options, OPTION_DIRECT_PRESENTS, -+ &ms->direct_presents)) ? -+ X_CONFIG : X_DEFAULT; -+ -+ ms->from_hwp = (xf86GetOptValBool(ms->Options, OPTION_HW_PRESENTS, -+ &ms->only_hw_presents)) ? -+ X_CONFIG : X_DEFAULT; -+ -+ /* Allocate an xf86CrtcConfig */ -+ xf86CrtcConfigInit(pScrn, &crtc_config_funcs); -+ -+ /* get max width and height */ -+ { -+ drmModeResPtr res; -+ int max_width, max_height; -+ -+ res = drmModeGetResources(ms->fd); -+ max_width = res->max_width; -+ max_height = res->max_height; -+ -+ xf86CrtcSetSizeRange(pScrn, res->min_width, -+ res->min_height, max_width, max_height); -+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, -+ "Min width %d, Max Width %d.\n", -+ res->min_width, max_width); -+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, -+ "Min height %d, Max Height %d.\n", -+ res->min_height, max_height); -+ drmModeFreeResources(res); -+ } -+ -+ ms->SWCursor = FALSE; -+ if (!xf86ReturnOptValBool(ms->Options, OPTION_HW_CURSOR, TRUE)) { -+ ms->SWCursor = TRUE; -+ } -+ -+ if (xf86IsOptionSet(ms->Options, OPTION_GUI_LAYOUT)) { -+ char *topology = -+ xf86GetOptValString(ms->Options, OPTION_GUI_LAYOUT); -+ -+ ret = FALSE; -+ if (topology) { -+ ret = vmwgfx_set_topology(pScrn, topology, "gui"); -+ free(topology); -+ } -+ -+ } else if (xf86IsOptionSet(ms->Options, OPTION_STATIC_XINERAMA)) { -+ char *topology = -+ xf86GetOptValString(ms->Options, OPTION_STATIC_XINERAMA); -+ -+ ret = FALSE; -+ if (topology) { -+ ret = vmwgfx_set_topology(pScrn, topology, "static Xinerama"); -+ free(topology); -+ } -+ } -+ -+ if (!ret) -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Falied parsing or setting " -+ "gui topology from config file.\n"); -+ -+ xorg_crtc_init(pScrn); -+ xorg_output_init(pScrn); -+ -+ if (!xf86InitialConfiguration(pScrn, TRUE)) { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); -+ goto out_modes; -+ } -+ -+ if (pScrn->modes == NULL) { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No available modes.\n"); -+ goto out_modes; -+ } -+ -+ pScrn->currentMode = pScrn->modes; -+ -+ return TRUE; -+ -+ out_modes: -+ return FALSE; -+} -+ - static Bool - drv_pre_init(ScrnInfoPtr pScrn, int flags) - { - modesettingPtr ms; - rgb defaultWeight = { 0, 0, 0 }; -+ Gamma zeros = { 0.0, 0.0, 0.0 }; - EntityInfoPtr pEnt; - uint64_t cap; -- Bool ret = TRUE; - - if (pScrn->numEntities != 1) - return FALSE; -@@ -374,9 +474,31 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) - ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index); - xf86SetPrimInitDone(pScrn->entityList[0]); - -+ ms->hdriver = vmwgfx_hosted_detect(); -+ ms->hosted = vmwgfx_hosted_create(ms->hdriver, pScrn); -+ if (ms->hdriver && !ms->hosted) { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, -+ "Failed to set up compositor hosted environment.\n"); -+ goto out_err_bus; -+ } -+ -+ pScrn->monitor = pScrn->confScreen->monitor; -+ pScrn->progClock = TRUE; -+ pScrn->rgbBits = 8; -+ -+ if (!xf86SetDepthBpp -+ (pScrn, 0, 0, 0, -+ PreferConvert24to32 | SupportConvert24to32 | Support32bppFb)) { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set depth and bpp.\n"); -+ goto out_err_bus; -+ } -+ -+ if (!vmwgfx_hosted_pre_init(ms->hdriver, ms->hosted, flags)) -+ goto out_err_bus; -+ - ms->fd = -1; - if (!drv_init_drm(pScrn)) -- goto out_err_bus; -+ goto out_no_drm; - - if (ms->drm_major != DRM_VERSION_MAJOR_REQUIRED || - ms->drm_minor < DRM_VERSION_MINOR_REQUIRED) { -@@ -397,17 +519,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) - - ms->check_fb_size = (vmwgfx_max_fb_size(ms->fd, &ms->max_fb_size) == 0); - -- pScrn->monitor = pScrn->confScreen->monitor; -- pScrn->progClock = TRUE; -- pScrn->rgbBits = 8; -- -- if (!xf86SetDepthBpp -- (pScrn, 0, 0, 0, -- PreferConvert24to32 | SupportConvert24to32 | Support32bppFb)) { -- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set depth and bpp.\n"); -- goto out_depth; -- } -- - if (vmwgfx_get_param(ms->fd, DRM_VMW_PARAM_HW_CAPS, &cap) != 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to detect device " - "screen object capability.\n"); -@@ -460,98 +571,23 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) - X_CONFIG : X_PROBED; - - ms->direct_presents = FALSE; -- ms->from_dp = xf86GetOptValBool(ms->Options, OPTION_DIRECT_PRESENTS, -- &ms->direct_presents) ? -- X_CONFIG : X_DEFAULT; -- - ms->only_hw_presents = FALSE; -- ms->from_hwp = xf86GetOptValBool(ms->Options, OPTION_HW_PRESENTS, -- &ms->only_hw_presents) ? -- X_CONFIG : X_DEFAULT; -- -- /* Allocate an xf86CrtcConfig */ -- xf86CrtcConfigInit(pScrn, &crtc_config_funcs); -- -- /* get max width and height */ -- { -- drmModeResPtr res; -- int max_width, max_height; -- -- res = drmModeGetResources(ms->fd); -- max_width = res->max_width; -- max_height = res->max_height; -- -- xf86CrtcSetSizeRange(pScrn, res->min_width, -- res->min_height, max_width, max_height); -- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, -- "Min width %d, Max Width %d.\n", -- res->min_width, max_width); -- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, -- "Min height %d, Max Height %d.\n", -- res->min_height, max_height); -- drmModeFreeResources(res); -- } -- -- -- if (!xf86ReturnOptValBool(ms->Options, OPTION_HW_CURSOR, TRUE)) { -- ms->SWCursor = TRUE; -- } -- -- if (xf86IsOptionSet(ms->Options, OPTION_GUI_LAYOUT)) { -- char *topology = -- xf86GetOptValString(ms->Options, OPTION_GUI_LAYOUT); -- -- ret = FALSE; -- if (topology) { -- ret = vmwgfx_set_topology(pScrn, topology, "gui"); -- free(topology); -- } -- -- } else if (xf86IsOptionSet(ms->Options, OPTION_STATIC_XINERAMA)) { -- char *topology = -- xf86GetOptValString(ms->Options, OPTION_STATIC_XINERAMA); -- -- ret = FALSE; -- if (topology) { -- ret = vmwgfx_set_topology(pScrn, topology, "static Xinerama"); -- free(topology); -- } -- } -- -- if (!ret) -- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Falied parsing or setting " -- "gui topology from config file.\n"); -- -- xorg_crtc_init(pScrn); -- xorg_output_init(pScrn); -- -- if (!xf86InitialConfiguration(pScrn, TRUE)) { -- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); -- goto out_modes; -- } -- -- /* -- * If the driver can do gamma correction, it should call xf86SetGamma() here. -- */ -- { -- Gamma zeros = { 0.0, 0.0, 0.0 }; -- -- if (!xf86SetGamma(pScrn, zeros)) { -- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set gamma.\n"); -+ ms->SWCursor = TRUE; -+ if (!vmwgfx_is_hosted(ms->hdriver)) { -+ if (!vmwgfx_pre_init_mode(pScrn, flags)) - goto out_modes; -- } -+ } else { -+ ms->from_dp = X_CONFIG; -+ ms->from_hwp = X_CONFIG; - } - -- if (pScrn->modes == NULL) { -- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No available modes.\n"); -+ xf86SetDpi(pScrn, 0, 0); -+ -+ if (!xf86SetGamma(pScrn, zeros)) { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set gamma.\n"); - goto out_modes; - } - -- pScrn->currentMode = pScrn->modes; -- -- /* Set display resolution */ -- xf86SetDpi(pScrn, 0, 0); -- - /* Load the required sub modules */ - if (!xf86LoadSubModule(pScrn, "fb")) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to load fb module.\n"); -@@ -569,7 +605,10 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) - free(ms->Options); - out_depth: - out_drm_version: -- close(ms->fd); -+ if (!vmwgfx_is_hosted(ms->hdriver)) -+ close(ms->fd); -+ out_no_drm: -+ vmwgfx_hosted_destroy(ms->hdriver, ms->hosted); - out_err_bus: - drv_free_rec(pScrn); - return FALSE; -@@ -715,8 +754,10 @@ static void drv_block_handler(BLOCKHANDLER_ARGS_DECL) - pScreen->BlockHandler(BLOCKHANDLER_ARGS); - vmwgfx_swap(ms, pScreen, BlockHandler); - -- vmwgfx_flush_dri2(pScreen); -- xorg_flush(pScreen); -+ if (vmwgfx_is_hosted(ms->hdriver)) -+ vmwgfx_hosted_post_damage(ms->hdriver, ms->hosted); -+ else -+ xorg_flush(pScreen); - } - - static Bool -@@ -742,7 +783,8 @@ drv_set_master(ScrnInfoPtr pScrn) - { - modesettingPtr ms = modesettingPTR(pScrn); - -- if (!ms->isMaster && drmSetMaster(ms->fd) != 0) { -+ if (!vmwgfx_is_hosted(ms->hdriver) && !ms->isMaster && -+ drmSetMaster(ms->fd) != 0) { - if (errno == EINVAL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "drmSetMaster failed: 2.6.29 or newer kernel required for " -@@ -996,6 +1038,12 @@ drv_screen_init(SCREEN_INIT_ARGS_DECL) - } - } - -+ if (vmwgfx_is_hosted(ms->hdriver) && !ms->xat) { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, -+ "Can't run hosted without XA. Giving up.\n"); -+ return FALSE; -+ } -+ - if (!vmwgfx_saa_init(pScreen, ms->fd, ms->xat, &xorg_flush, - ms->direct_presents, - ms->only_hw_presents, -@@ -1039,6 +1087,12 @@ drv_screen_init(SCREEN_INIT_ARGS_DECL) - xf86SetSilkenMouse(pScreen); - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - -+ if (!vmwgfx_hosted_screen_init(ms->hdriver, ms->hosted, pScreen)) { -+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, -+ "Failed hosted Screen init. Giving up.\n"); -+ return FALSE; -+ } -+ - /* Need to extend HWcursor support to handle mask interleave */ - if (!ms->SWCursor) { - xf86_cursors_init(pScreen, 64, 64, -@@ -1087,9 +1141,17 @@ static void - drv_adjust_frame(ADJUST_FRAME_ARGS_DECL) - { - SCRN_INFO_PTR(arg); -- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); -- xf86OutputPtr output = config->output[config->compat_output]; -- xf86CrtcPtr crtc = output->crtc; -+ modesettingPtr ms = modesettingPTR(pScrn); -+ xf86CrtcConfigPtr config; -+ xf86OutputPtr output; -+ xf86CrtcPtr crtc; -+ -+ if (vmwgfx_is_hosted(ms->hdriver)) -+ return; -+ -+ config = XF86_CRTC_CONFIG_PTR(pScrn); -+ output = config->output[config->compat_output]; -+ crtc = output->crtc; - - if (crtc && crtc->enabled) { - // crtc->funcs->set_mode_major(crtc, pScrn->currentMode, -@@ -1103,6 +1165,9 @@ static void - drv_free_screen(FREE_SCREEN_ARGS_DECL) - { - SCRN_INFO_PTR(arg); -+ modesettingPtr ms = modesettingPTR(pScrn); -+ -+ vmwgfx_hosted_destroy(ms->hdriver, ms->hosted); - drv_free_rec(pScrn); - } - -@@ -1112,14 +1177,16 @@ drv_leave_vt(VT_FUNC_ARGS_DECL) - SCRN_INFO_PTR(arg); - modesettingPtr ms = modesettingPTR(pScrn); - -- vmwgfx_cursor_bypass(ms->fd, 0, 0); -- vmwgfx_disable_scanout(pScrn); -+ if (!vmwgfx_is_hosted(ms->hdriver)) { -+ vmwgfx_cursor_bypass(ms->fd, 0, 0); -+ vmwgfx_disable_scanout(pScrn); -+ } -+ - vmwgfx_saa_drop_master(pScrn->pScreen); - -- if (drmDropMaster(ms->fd)) -+ if (!vmwgfx_is_hosted(ms->hdriver) && drmDropMaster(ms->fd)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "drmDropMaster failed: %s\n", strerror(errno)); -- - ms->isMaster = FALSE; - pScrn->vtSema = FALSE; - } -@@ -1131,13 +1198,14 @@ static Bool - drv_enter_vt(VT_FUNC_ARGS_DECL) - { - SCRN_INFO_PTR(arg); -+ modesettingPtr ms = modesettingPTR(pScrn); - - if (!drv_set_master(pScrn)) - return FALSE; - - vmwgfx_saa_set_master(pScrn->pScreen); - -- if (!xf86SetDesiredModes(pScrn)) -+ if (!vmwgfx_is_hosted(ms->hdriver) && !xf86SetDesiredModes(pScrn)) - return FALSE; - - return TRUE; -@@ -1174,6 +1242,7 @@ drv_close_screen(CLOSE_SCREEN_ARGS_DECL) - vmwgfx_unwrap(ms, pScrn, LeaveVT); - vmwgfx_unwrap(ms, pScrn, AdjustFrame); - vmwgfx_unwrap(ms, pScreen, CloseScreen); -+ vmwgfx_hosted_screen_close(ms->hdriver, ms->hosted); - vmwgfx_unwrap(ms, pScreen, BlockHandler); - vmwgfx_unwrap(ms, pScreen, CreateScreenResources); - -diff --git a/vmwgfx/vmwgfx_driver.h b/vmwgfx/vmwgfx_driver.h -index f78a85f..c044a81 100644 ---- a/vmwgfx/vmwgfx_driver.h -+++ b/vmwgfx/vmwgfx_driver.h -@@ -82,6 +82,8 @@ enum xorg_throttling_reason { - THROTTLE_SWAP - }; - -+struct vmwgfx_hosted; -+ - typedef struct _modesettingRec - { - /* drm */ -@@ -131,6 +133,8 @@ typedef struct _modesettingRec - size_t max_fb_size; - - struct xa_tracker *xat; -+ const struct vmwgfx_hosted_driver *hdriver; -+ struct vmwgfx_hosted *hosted; - #ifdef DRI2 - Bool dri2_available; - char dri2_device_name[VMWGFX_DRI_DEVICE_LEN]; -diff --git a/vmwgfx/vmwgfx_hosted.c b/vmwgfx/vmwgfx_hosted.c -new file mode 100644 -index 0000000..b42d962 ---- /dev/null -+++ b/vmwgfx/vmwgfx_hosted.c -@@ -0,0 +1,64 @@ -+/* -+ * Copyright 2013 VMWare, Inc. -+ * All Rights Reserved. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sub license, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial portions -+ * of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ * -+ * Author: Thomas Hellstrom -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "vmwgfx_hosted.h" -+#include "vmwgfx_hosted_priv.h" -+ -+/* -+ * Hook up hosted environments here. -+ */ -+ -+/** -+ * vmwgfx_hosted_detect - Check whether we are hosted -+ * -+ * Check whether we are hosted by a compositor and -+ * in that case return a pointer to a valid struct vmwgfx_hosted_driver. -+ * If not hosted, return NULL. -+ */ -+const struct vmwgfx_hosted_driver * -+vmwgfx_hosted_detect(void) -+{ -+ return NULL; -+} -+ -+/** -+ * vmwgfx_hosted_modify_flags - Modify driver flags if hosted. -+ * -+ * @flag: Pointer to the flag argument given to the vmware driver's -+ * DriverFunc function, when operation is GET_REQUIRED_HW_INTERFACES. -+ * -+ * Checks whether we are running hosted, and in that case modifies -+ * the flag according to the hosted environment's requirements. -+ */ -+void -+vmwgfx_hosted_modify_flags(uint32_t *flags) -+{ -+} -diff --git a/vmwgfx/vmwgfx_hosted.h b/vmwgfx/vmwgfx_hosted.h -new file mode 100644 -index 0000000..8f3b243 ---- /dev/null -+++ b/vmwgfx/vmwgfx_hosted.h -@@ -0,0 +1,257 @@ -+/* -+ * Copyright 2013 VMWare, Inc. -+ * All Rights Reserved. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sub license, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial portions -+ * of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ * -+ * Author: Thomas Hellstrom -+ */ -+ -+#ifndef _VMWGFX_HOSTED_H -+#define _VMWGFX_HOSTED_H -+ -+#include -+#include -+ -+ -+/** -+ * struct vmwgfx_hosted - hosting environment private information. -+ * -+ * This struct is completely opaque to callers and should be defined -+ * by the hosting environment. -+ */ -+struct vmwgfx_hosted; -+ -+/** -+ * struct vmwgfx-hosted-driver - Driver for environments that we can run -+ * hosted under. -+ * -+ * @create: Initialize and create an opaque struct vmwgfx_hosted with -+ * environment private information. Should return NULL on failure. -+ * @destroy: Undo what's done in @create. -+ * @drm_fd: Return a file descriptor opened to DRM. -+ * @pre_init: Callback from vmwgfx preInit. -+ * @screen_init: Callback from vmwgfx screenInit. -+ * @screen_close: Callback from vmwgfx screenClose. -+ * @post_damage: Callback from vmwgfx blockHandler. This callback should -+ * instruct the hosting environment about damaged windows. -+ * @dri_auth: Authenticate a dri client. -+ */ -+struct vmwgfx_hosted_driver { -+ struct vmwgfx_hosted *(*create)(ScrnInfoPtr); -+ void (*destroy)(struct vmwgfx_hosted *); -+ int (*drm_fd)(struct vmwgfx_hosted *, const struct pci_device *); -+ Bool (*pre_init)(struct vmwgfx_hosted *, int); -+ Bool (*screen_init)(struct vmwgfx_hosted *, ScreenPtr); -+ void (*screen_close)(struct vmwgfx_hosted *); -+ void (*post_damage)(struct vmwgfx_hosted *); -+ int (*dri_auth)(struct vmwgfx_hosted *, ClientPtr client, uint32_t magic); -+}; -+ -+extern const struct vmwgfx_hosted_driver *vmwgfx_hosted_detect(void); -+extern void vmwgfx_hosted_modify_flags(uint32_t *flags); -+ -+/** -+ * vmwgfx_is_hosted - Check whether we're running hosted. -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * -+ */ -+static inline Bool -+vmwgfx_is_hosted(const struct vmwgfx_hosted_driver *driver) -+{ -+ return (driver != NULL); -+} -+ -+/** -+ * vmwgfx_hosted_create - Set up and initialize a struct vmwgfx_hosted -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @pScrn: Pointer to a ScrnInfo structure, that has not been populated yet. -+ * -+ * Convenience wrapper around the hosted_driver function. -+ */ -+static inline struct vmwgfx_hosted* -+vmwgfx_hosted_create(const struct vmwgfx_hosted_driver *driver, -+ ScrnInfoPtr pScrn) -+{ -+ if (!vmwgfx_is_hosted(driver)) -+ return NULL; -+ -+ return driver->create(pScrn); -+} -+ -+/** -+ * vmwgfx_hosted_destroy - free a struct vmwgfx_hosted and take down -+ * hosted environment. -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @hosted: Pointer to a struct vmwgfx_hosted, as returned by -+ * vmwgfx_hosted_create() -+ * -+ * Convenience wrapper around the hosted_driver function. -+ */ -+static inline void -+vmwgfx_hosted_destroy(const struct vmwgfx_hosted_driver *driver, -+ struct vmwgfx_hosted *hosted) -+{ -+ if (!vmwgfx_is_hosted(driver)) -+ return; -+ -+ driver->destroy(hosted); -+} -+ -+/** -+ * vmwgfx_hosted_drm_fd - Return a drm file descriptor -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @hosted: Pointer to a struct vmwgfx_hosted, as returned by -+ * vmwgfx_hosted_create() -+ * @pci: Pointer to a valid struct pci_device, describing our device. -+ * -+ * Convenience wrapper around the hosted_driver function. Returns an -+ * invalid file descriptor if we're not hosted. -+ */ -+static inline int -+vmwgfx_hosted_drm_fd(const struct vmwgfx_hosted_driver *driver, -+ struct vmwgfx_hosted *hosted, -+ const struct pci_device *pci) -+{ -+ if (!vmwgfx_is_hosted(driver)) -+ return -1; -+ -+ return driver->drm_fd(hosted, pci); -+} -+ -+/** -+ * vmwgfx_hosted_pre_init - Initiate preInit callback. -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @hosted: Pointer to a struct vmwgfx_hosted, as returned by -+ * vmwgfx_hosted_create() -+ * @flags: Flags passed to the vmwgfx preInit function -+ * -+ * Convenience wrapper around the hosted_driver function. Returns TRUE -+ * (success) if not hosted. -+ */ -+static inline Bool -+vmwgfx_hosted_pre_init(const struct vmwgfx_hosted_driver *driver, -+ struct vmwgfx_hosted *hosted, int flags) -+{ -+ if (!vmwgfx_is_hosted(driver)) -+ return TRUE; -+ -+ return driver->pre_init(hosted, flags); -+} -+ -+/** -+ * vmwgfx_hosted_screen_init - Initiate screenInit callback. -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @hosted: Pointer to a struct vmwgfx_hosted, as returned by -+ * vmwgfx_hosted_create() -+ * @pScreen: ScreenPtr identifying the screen we're setting up. -+ * -+ * Convenience wrapper around the hosted_driver function. Returns TRUE -+ * (success) if not hosted. -+ */ -+static inline Bool -+vmwgfx_hosted_screen_init(const struct vmwgfx_hosted_driver *driver, -+ struct vmwgfx_hosted *hosted, ScreenPtr pScreen) -+{ -+ if (!vmwgfx_is_hosted(driver)) -+ return TRUE; -+ -+ return driver->screen_init(hosted, pScreen); -+} -+ -+/** -+ * vmwgfx_hosted_screen_close - Initiate screenClose callback. -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @hosted: Pointer to a struct vmwgfx_hosted, as returned by -+ * vmwgfx_hosted_create() -+ * -+ * Convenience wrapper around the hosted_driver function. -+ * Does nothing if not hosted. -+ */ -+static inline void -+vmwgfx_hosted_screen_close(const struct vmwgfx_hosted_driver *driver, -+ struct vmwgfx_hosted *hosted) -+{ -+ if (!vmwgfx_is_hosted(driver)) -+ return; -+ -+ driver->screen_close(hosted); -+} -+ -+/** -+ * vmwgfx_hosted_post_damage - Inform the hosting environment about -+ * recent rendering -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @hosted: Pointer to a struct vmwgfx_hosted, as returned by -+ * vmwgfx_hosted_create() -+ * -+ * Convenience wrapper around the hosted_driver function. -+ * Does nothing if not hosted. -+ */ -+static inline void -+vmwgfx_hosted_post_damage(const struct vmwgfx_hosted_driver *driver, -+ struct vmwgfx_hosted *hosted) -+{ -+ if (!vmwgfx_is_hosted(driver)) -+ return; -+ -+ driver->post_damage(hosted); -+} -+ -+/** -+ * vmwgfx_hosted_dri_auth - Ask the hosting environment to authenticate a -+ * dri client. -+ * -+ * @driver: Pointer to a struct vmwgfx_hosted_driver as returned by -+ * vmwgfx_hosted_detect() -+ * @hosted: Pointer to a struct vmwgfx_hosted, as returned by -+ * vmwgfx_hosted_create() -+ * @client: The client to be authenticated -+ * @magic: The drm magic used for authentication -+ * -+ * Convenience wrapper around the hosted_driver function. -+ * Does nothing if not hosted. -+ */ -+static inline int -+vmwgfx_hosted_dri_auth(const struct vmwgfx_hosted_driver *driver, -+ struct vmwgfx_hosted *hosted, -+ ClientPtr client, -+ uint32_t magic) -+{ -+ return driver->dri_auth(hosted, client, magic); -+} -+#endif /* _VMWGFX_HOSTED_H */ -diff --git a/vmwgfx/vmwgfx_hosted_priv.h b/vmwgfx/vmwgfx_hosted_priv.h -new file mode 100644 -index 0000000..05ded25 ---- /dev/null -+++ b/vmwgfx/vmwgfx_hosted_priv.h -@@ -0,0 +1,34 @@ -+/* -+ * Copyright 2013 VMWare, Inc. -+ * All Rights Reserved. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sub license, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial portions -+ * of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ * -+ * Author: Thomas Hellstrom -+ */ -+ -+#ifndef _VMWGFX_HOSTED_PRIV_H_ -+#define _VMWGFX_HOSTED_PRIV_H_ -+ -+#include -+#include "vmwgfx_hosted.h" -+ -+#endif -diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c -index 986dd06..c8c6bb9 100644 ---- a/vmwgfx/vmwgfx_overlay.c -+++ b/vmwgfx/vmwgfx_overlay.c -@@ -64,6 +64,7 @@ typedef uint8_t uint8; - #include "vmwgfx_drm.h" - #include "vmwgfx_drmi.h" - #include "vmwgfx_driver.h" -+#include "vmwgfx_hosted.h" - - #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - -@@ -287,6 +288,9 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn) - DevUnion *dev_unions; - uint32_t ntot, nfree; - -+ if (vmwgfx_is_hosted(ms->hdriver)) -+ return NULL; -+ - if (vmwgfx_num_streams(ms->fd, &ntot, &nfree) != 0) { - debug_printf("No stream ioctl support\n"); - return NULL; --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0013-vmwgfx-Add-support-for-XMir-v2.patch b/x11-drivers/xf86-video-vmware/files/0013-vmwgfx-Add-support-for-XMir-v2.patch deleted file mode 100644 index 74d60ec29..000000000 --- a/x11-drivers/xf86-video-vmware/files/0013-vmwgfx-Add-support-for-XMir-v2.patch +++ /dev/null @@ -1,672 +0,0 @@ -From c020923597d3bc30dffa89ba0a47f3b9517dd5fb Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 16 Dec 2013 06:13:25 -0800 -Subject: [PATCH 13/19] vmwgfx: Add support for XMir v2. - -Use the hosted infrastructure to add support for XMir. -Helpers go in vmwgfx_saa.c. - -v2: Added comments for the helpers, and added a -vmwgfx_flush_dri2 to be executed when coming back from vt switch. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Brian Paul -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/Makefile.am | 1 + - vmwgfx/vmwgfx_drmi.c | 39 +++++++- - vmwgfx/vmwgfx_drmi.h | 8 +- - vmwgfx/vmwgfx_hosted.c | 5 +- - vmwgfx/vmwgfx_hosted.h | 1 + - vmwgfx/vmwgfx_hosted_priv.h | 3 + - vmwgfx/vmwgfx_saa.c | 213 ++++++++++++++++++++++++++++++++++++++++---- - vmwgfx/vmwgfx_saa.h | 5 ++ - vmwgfx/vmwgfx_xmir.c | 178 ++++++++++++++++++++++++++++++++++++ - 9 files changed, 433 insertions(+), 20 deletions(-) - create mode 100644 vmwgfx/vmwgfx_xmir.c - -diff --git a/vmwgfx/Makefile.am b/vmwgfx/Makefile.am -index 2b0380b..41833a1 100644 ---- a/vmwgfx/Makefile.am -+++ b/vmwgfx/Makefile.am -@@ -28,5 +28,6 @@ libvmwgfx_la_SOURCES = \ - vmwgfx_hosted.c \ - vmwgfx_hosted.h \ - vmwgfx_hosted_priv.h \ -+ vmwgfx_xmir.c \ - wsbm_util.h - endif -diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c -index 496a16b..d926019 100644 ---- a/vmwgfx/vmwgfx_drmi.c -+++ b/vmwgfx/vmwgfx_drmi.c -@@ -284,7 +284,7 @@ vmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf) - } - - int --vmwgfx_dma(unsigned int host_x, unsigned int host_y, -+vmwgfx_dma(int host_x, int host_y, - RegionPtr region, struct vmwgfx_dmabuf *buf, - uint32_t buf_pitch, uint32_t surface_handle, int to_surface) - { -@@ -500,3 +500,40 @@ vmwgfx_max_fb_size(int drm_fd, size_t *size) - - return 0; - } -+ -+/** -+ * vmwgfx_prime_fd_to_handle - Return a TTM handle to a prime object -+ * -+ * @drm_fd: File descriptor for the drm connection. -+ * @prime_fd: File descriptor identifying the prime object. -+ * @handle: Pointer to returned TTM handle. -+ * -+ * Takes a reference on the underlying object and returns a TTM handle to it. -+ */ -+int -+vmwgfx_prime_fd_to_handle(int drm_fd, int prime_fd, uint32_t *handle) -+{ -+ *handle = 0; -+ -+ return drmPrimeFDToHandle(drm_fd, prime_fd, handle); -+} -+ -+/** -+ * vmwgfx_prime_release_handle - Release a reference on a TTM object -+ * -+ * @drm_fd: File descriptor for the drm connection. -+ * @handle: TTM handle as returned by vmwgfx_prime_fd_to_handle. -+ * -+ * Releases the reference obtained by vmwgfx_prime_fd_to_handle(). -+ */ -+void -+vmwgfx_prime_release_handle(int drm_fd, uint32_t handle) -+{ -+ struct drm_vmw_surface_arg s_arg; -+ -+ memset(&s_arg, 0, sizeof(s_arg)); -+ s_arg.sid = handle; -+ -+ (void) drmCommandWrite(drm_fd, DRM_VMW_UNREF_SURFACE, &s_arg, -+ sizeof(s_arg)); -+} -diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h -index 2435009..1494485 100644 ---- a/vmwgfx/vmwgfx_drmi.h -+++ b/vmwgfx/vmwgfx_drmi.h -@@ -60,7 +60,7 @@ extern void - vmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf); - - extern int --vmwgfx_dma(unsigned int host_x, unsigned int host_y, -+vmwgfx_dma(int host_x, int host_y, - RegionPtr region, struct vmwgfx_dmabuf *buf, - uint32_t buf_pitch, uint32_t surface_handle, int to_surface); - -@@ -84,4 +84,10 @@ vmwgfx_update_gui_layout(int drm_fd, unsigned int num_rects, - struct drm_vmw_rect *rects); - int - vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out); -+ -+int -+vmwgfx_prime_fd_to_handle(int drm_fd, int prime_fd, uint32_t *handle); -+ -+void -+vmwgfx_prime_release_handle(int drm_fd, uint32_t handle); - #endif -diff --git a/vmwgfx/vmwgfx_hosted.c b/vmwgfx/vmwgfx_hosted.c -index b42d962..018b88b 100644 ---- a/vmwgfx/vmwgfx_hosted.c -+++ b/vmwgfx/vmwgfx_hosted.c -@@ -46,7 +46,9 @@ - const struct vmwgfx_hosted_driver * - vmwgfx_hosted_detect(void) - { -- return NULL; -+ const struct vmwgfx_hosted_driver *tmp = vmwgfx_xmir_detect(); -+ -+ return tmp; - } - - /** -@@ -61,4 +63,5 @@ vmwgfx_hosted_detect(void) - void - vmwgfx_hosted_modify_flags(uint32_t *flags) - { -+ vmwgfx_xmir_modify_flags(flags); - } -diff --git a/vmwgfx/vmwgfx_hosted.h b/vmwgfx/vmwgfx_hosted.h -index 8f3b243..78dc7cd 100644 ---- a/vmwgfx/vmwgfx_hosted.h -+++ b/vmwgfx/vmwgfx_hosted.h -@@ -23,6 +23,7 @@ - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Author: Thomas Hellstrom -+ * Note: "Hosted" is a term stolen from the xf86-video-intel driver. - */ - - #ifndef _VMWGFX_HOSTED_H -diff --git a/vmwgfx/vmwgfx_hosted_priv.h b/vmwgfx/vmwgfx_hosted_priv.h -index 05ded25..c81f5ee 100644 ---- a/vmwgfx/vmwgfx_hosted_priv.h -+++ b/vmwgfx/vmwgfx_hosted_priv.h -@@ -31,4 +31,7 @@ - #include - #include "vmwgfx_hosted.h" - -+extern const struct vmwgfx_hosted_driver *vmwgfx_xmir_detect(void); -+extern void vmwgfx_xmir_modify_flags(uint32_t *flags); -+ - #endif -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index e76bd09..c8b4df1 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -282,32 +282,44 @@ static Bool - vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - PixmapPtr pixmap, - RegionPtr reg, -- Bool to_hw) -+ Bool to_hw, -+ int dx, -+ int dy, -+ struct xa_surface *srf) - { - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); - -- if (!vpix->hw || (!vpix->gmr && !vpix->malloc)) -+ if (!srf) -+ srf = vpix->hw; -+ -+ if (!srf || (!vpix->gmr && !vpix->malloc)) - return TRUE; - - if (vpix->gmr && vsaa->can_optimize_dma) { - uint32_t handle, dummy; - -- if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) -+ if (_xa_surface_handle(srf, &handle, &dummy) != 0) - goto out_err; -- if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, -+ if (vmwgfx_dma(dx, dy, reg, vpix->gmr, pixmap->devKind, handle, - to_hw) != 0) - goto out_err; - } else { -- void *data = vpix->malloc; -+ uint8_t *data = (uint8_t *) vpix->malloc; - int ret; - - if (vpix->gmr) { -- data = vmwgfx_dmabuf_map(vpix->gmr); -+ data = (uint8_t *) vmwgfx_dmabuf_map(vpix->gmr); - if (!data) - goto out_err; - } - -- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -+ if (dx || dy) { -+ REGION_TRANSLATE(pScreen, reg, dx, dy); -+ data -= ((dx * pixmap->drawable.bitsPerPixel + 7)/8 + -+ dy * pixmap->devKind); -+ } -+ -+ ret = xa_surface_dma(vsaa->xa_ctx, srf, data, pixmap->devKind, - (int) to_hw, - (struct xa_box *) REGION_RECTS(reg), - REGION_NUM_RECTS(reg)); -@@ -315,6 +327,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - xa_context_flush(vsaa->xa_ctx); - if (vpix->gmr) - vmwgfx_dmabuf_unmap(vpix->gmr); -+ if (dx || dy) -+ REGION_TRANSLATE(pScreen, reg, -dx, -dy); - if (ret) - goto out_err; - } -@@ -353,7 +367,7 @@ vmwgfx_download_from_hw(struct saa_driver *driver, PixmapPtr pixmap, - if (!vmwgfx_pixmap_create_sw(vsaa, pixmap)) - goto out_err; - -- if (!vmwgfx_saa_dma(vsaa, pixmap, readback, FALSE)) -+ if (!vmwgfx_saa_dma(vsaa, pixmap, readback, FALSE, 0, 0, NULL)) - goto out_err; - REGION_SUBTRACT(vsaa->pScreen, &spix->dirty_hw, &spix->dirty_hw, readback); - REGION_UNINIT(vsaa->pScreen, &intersection); -@@ -368,7 +382,8 @@ static Bool - vmwgfx_upload_to_hw(struct saa_driver *driver, PixmapPtr pixmap, - RegionPtr upload) - { -- return vmwgfx_saa_dma(to_vmwgfx_saa(driver), pixmap, upload, TRUE); -+ return vmwgfx_saa_dma(to_vmwgfx_saa(driver), pixmap, upload, TRUE, -+ 0, 0, NULL); - } - - static void -@@ -753,6 +768,33 @@ vmwgfx_check_hw_contents(struct vmwgfx_saa *vsaa, - REGION_UNINIT(vsaa->pScreen, &intersection); - } - -+/** -+ * vmwgfx_prefer_gmr: Prefer a dma buffer over malloced memory for software -+ * rendered storage -+ * -+ * @vsaa: Pointer to a struct vmwgfx_saa accelerator. -+ * @pixmap: Pointer to pixmap whose storage preference we want to alter. -+ * -+ * If possible, alter the storage or future storage of the software contents -+ * of this pixmap to be in a DMA buffer rather than in malloced memory. -+ * This function should be called when it's likely that frequent DMA operations -+ * will occur between a surface and the memory holding the software -+ * contents. -+ */ -+static void -+vmwgfx_prefer_gmr(struct vmwgfx_saa *vsaa, PixmapPtr pixmap) -+{ -+ struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -+ -+ if (vsaa->can_optimize_dma) { -+ if (vpix->malloc) { -+ (void) vmwgfx_pixmap_create_gmr(vsaa, pixmap); -+ } else if (vpix->backing & VMWGFX_PIX_MALLOC) { -+ vpix->backing |= VMWGFX_PIX_GMR; -+ vpix->backing &= ~VMWGFX_PIX_MALLOC; -+ } -+ } -+} - - Bool - vmwgfx_create_hw(struct vmwgfx_saa *vsaa, -@@ -786,15 +828,16 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa, - if (!vmwgfx_pixmap_add_damage(pixmap)) - goto out_no_damage; - -- /* -- * Even if we don't have a GMR yet, indicate that when needed it -- * should be created. -- */ -- - vpix->hw = hw; - vpix->backing |= VMWGFX_PIX_SURFACE; - vmwgfx_pixmap_free_storage(vpix); - -+ /* -+ * If there is a HW surface, make sure that the shadow is -+ * (or will be) a GMR, provided we can do fast DMAs from / to it. -+ */ -+ vmwgfx_prefer_gmr(vsaa, pixmap); -+ - return TRUE; - - out_no_damage: -@@ -1226,10 +1269,14 @@ vmwgfx_operation_complete(struct saa_driver *driver, - * executed at glxWaitX(). Currently glxWaitX() is broken, so - * we flush immediately, unless we're VT-switched away, in which - * case a flush would deadlock in the kernel. -+ * -+ * For pixmaps for which vpix->hw_is_hosted is true, we can explicitly -+ * inform the compositor when contents has changed, so for those pixmaps -+ * we defer the upload until the compositor is informed, by putting -+ * them on the sync_x_list. Note that hw_is_dri2_fronts take precedence. - */ -- -- if (vpix->hw && vpix->hw_is_dri2_fronts) { -- if (pScrn->vtSema && -+ if (vpix->hw && (vpix->hw_is_dri2_fronts || vpix->hw_is_hosted)) { -+ if (pScrn->vtSema && vpix->hw_is_dri2_fronts && - vmwgfx_upload_to_hw(driver, pixmap, &spix->dirty_shadow)) { - - REGION_EMPTY(vsaa->pScreen, &spix->dirty_shadow); -@@ -1539,6 +1586,7 @@ vmwgfx_saa_set_master(ScreenPtr pScreen) - struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); - - vsaa->is_master = TRUE; -+ vmwgfx_flush_dri2(pScreen); - } - - void -@@ -1563,3 +1611,134 @@ vmwgfx_saa_drop_master(ScreenPtr pScreen) - - vsaa->is_master = FALSE; - } -+ -+/* -+ * ************************************************************************* -+ * Helpers for hosted. -+ */ -+ -+#if (XA_TRACKER_VERSION_MAJOR >= 2) -+ -+/** -+ * vmwgfx_saa_copy_to_surface - Copy Drawable contents to an external surface. -+ * -+ * @pDraw: Pointer to source drawable. -+ * @surface_fd: Prime file descriptor of external surface to copy to. -+ * @dst_box: BoxRec describing the destination bounding box. -+ * @region: Region of drawable to copy. Note: The code assumes that the -+ * region is relative to the drawable origin, not the underlying pixmap -+ * origin. -+ * -+ * Copies the contents (both software- and accelerated contents) to an -+ * external surface. -+ */ -+Bool -+vmwgfx_saa_copy_to_surface(DrawablePtr pDraw, uint32_t surface_fd, -+ const BoxRec *dst_box, RegionPtr region) -+{ -+ ScreenPtr pScreen = pDraw->pScreen; -+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); -+ PixmapPtr src; -+ struct saa_pixmap *spix; -+ struct vmwgfx_saa_pixmap *vpix; -+ const BoxRec *box; -+ int n; -+ int sx, sy, dx, dy; -+ struct xa_surface *dst; -+ uint32_t handle; -+ Bool ret = TRUE; -+ RegionRec intersection; -+ RegionPtr copy_region = region; -+ -+ if (vmwgfx_prime_fd_to_handle(vsaa->drm_fd, surface_fd, &handle) < 0) -+ return FALSE; -+ -+ dst = xa_surface_from_handle(vsaa->xat, pDraw->width, pDraw->height, -+ pDraw->depth, xa_type_argb, -+ xa_format_unknown, -+ XA_FLAG_SHARED | XA_FLAG_RENDER_TARGET, -+ handle, -+ (pDraw->width * pDraw->bitsPerPixel + 7) / 8); -+ -+ if (!dst) { -+ ret = FALSE; -+ goto out_no_surface; -+ } -+ -+ /* -+ * Assume damage region is relative to the source window. -+ */ -+ src = saa_get_pixmap(pDraw, &sx, &sy); -+ sx += pDraw->x; -+ sy += pDraw->y; -+ if (sx || sy) -+ REGION_TRANSLATE(pScreen, region, sx, sy); -+ -+ dx = dst_box->x1 - sx; -+ dy = dst_box->y1 - sy; -+ -+ spix = saa_get_saa_pixmap(src); -+ vpix = to_vmwgfx_saa_pixmap(spix); -+ -+ /* -+ * Make sure software contents of the source pixmap is henceforth put -+ * in a GMR to avoid the extra copy in the xa DMA. -+ */ -+ vmwgfx_prefer_gmr(vsaa, src); -+ -+ /* -+ * Determine the intersection between software contents and region to copy. -+ * XXX: First check that the software contents is compatible with the -+ * external surface format, before applying this optimization. -+ */ -+ REGION_NULL(pScreen, &intersection); -+ if (!vpix->hw) -+ REGION_COPY(pScreen, &intersection, region); -+ else if (spix->damage && REGION_NOTEMPTY(pScreen, &spix->dirty_shadow)) -+ REGION_INTERSECT(pScreen, &intersection, region, &spix->dirty_shadow); -+ -+ /* -+ * DMA software contents directly into the destination. Then subtract -+ * the region we've DMA'd from the region to copy. -+ */ -+ if (REGION_NOTEMPTY(pScreen, &intersection)) { -+ if (vmwgfx_saa_dma(vsaa, src, &intersection, TRUE, dx, dy, dst)) { -+ REGION_SUBTRACT(pScreen, &intersection, region, &intersection); -+ copy_region = &intersection; -+ } -+ } -+ -+ if (!REGION_NOTEMPTY(pScreen, copy_region)) -+ goto out_no_copy; -+ -+ /* -+ * Copy Hardware contents to the destination -+ */ -+ box = REGION_RECTS(copy_region); -+ n = REGION_NUM_RECTS(copy_region); -+ -+ if (xa_copy_prepare(vsaa->xa_ctx, dst, vpix->hw) != XA_ERR_NONE) { -+ ret = FALSE; -+ goto out_no_copy; -+ } -+ -+ while(n--) { -+ xa_copy(vsaa->xa_ctx, box->x1 + dx, box->y1 + dy, box->x1, box->y1, -+ box->x2 - box->x1, box->y2 - box->y1); -+ box++; -+ } -+ -+ xa_copy_done(vsaa->xa_ctx); -+ xa_context_flush(vsaa->xa_ctx); -+ -+ out_no_copy: -+ REGION_UNINIT(pScreen, &intersection); -+ if (sx || sy) -+ REGION_TRANSLATE(pScreen, region, -sx, -sy); -+ xa_surface_unref(dst); -+ out_no_surface: -+ vmwgfx_prime_release_handle(vsaa->drm_fd, handle); -+ -+ return ret; -+} -+#endif -diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h -index 5e1f40c..55f0ded 100644 ---- a/vmwgfx/vmwgfx_saa.h -+++ b/vmwgfx/vmwgfx_saa.h -@@ -52,6 +52,7 @@ struct vmwgfx_saa_pixmap { - struct xa_surface *hw; - uint32_t fb_id; - int hw_is_dri2_fronts; -+ Bool hw_is_hosted; - struct _WsbmListHead sync_x_head; - struct _WsbmListHead scanout_list; - struct _WsbmListHead pixmap_list; -@@ -115,6 +116,10 @@ vmwgfx_saa_set_master(ScreenPtr pScreen); - void - vmwgfx_saa_drop_master(ScreenPtr pScreen); - -+Bool -+vmwgfx_saa_copy_to_surface(DrawablePtr pDraw, uint32_t surface_fd, -+ const BoxRec *dst_box, RegionPtr region); -+ - #if (XA_TRACKER_VERSION_MAJOR <= 1) && !defined(HAVE_XA_2) - - #define _xa_surface_handle(_a, _b, _c) xa_surface_handle(_a, _b, _c) -diff --git a/vmwgfx/vmwgfx_xmir.c b/vmwgfx/vmwgfx_xmir.c -new file mode 100644 -index 0000000..e0ff6a4 ---- /dev/null -+++ b/vmwgfx/vmwgfx_xmir.c -@@ -0,0 +1,178 @@ -+/* -+ * Copyright 2013 VMWare, Inc. -+ * All Rights Reserved. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sub license, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial portions -+ * of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ * -+ * Author: Thomas Hellstrom -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "vmwgfx_hosted_priv.h" -+#include -+ -+#if XMIR && (XA_TRACKER_VERSION_MAJOR >= 2) -+ -+#include "vmwgfx_hosted.h" -+#include "vmwgfx_saa.h" -+#include -+#include -+ -+struct vmwgfx_hosted { -+ xmir_screen *xmir; -+ ScrnInfoPtr pScrn; -+ ScreenPtr pScreen; -+}; -+ -+static void -+vmwgfx_xmir_copy_to_mir(xmir_window *xmir_win, RegionPtr region); -+ -+static xmir_driver vmwgfx_xmir_driver = { -+ XMIR_DRIVER_VERSION, -+ vmwgfx_xmir_copy_to_mir -+}; -+ -+static struct vmwgfx_hosted * -+vmwgfx_xmir_create(ScrnInfoPtr pScrn) -+{ -+ struct vmwgfx_hosted *hosted; -+ -+ hosted = calloc(1, sizeof(*hosted)); -+ if (!hosted) -+ return NULL; -+ -+ hosted->xmir = xmir_screen_create(pScrn); -+ if (!hosted->xmir) { -+ free(hosted); -+ return NULL; -+ } -+ -+ hosted->pScrn = pScrn; -+ return hosted; -+} -+ -+static void -+vmwgfx_xmir_destroy(struct vmwgfx_hosted *hosted) -+{ -+ xmir_screen_destroy(hosted->xmir); -+ free(hosted); -+} -+ -+static Bool -+vmwgfx_xmir_pre_init(struct vmwgfx_hosted *hosted, int flags) -+{ -+ return xmir_screen_pre_init(hosted->pScrn, hosted->xmir, -+ &vmwgfx_xmir_driver); -+} -+ -+static int -+vmwgfx_xmir_drm_fd(struct vmwgfx_hosted *hosted, const struct pci_device *pci) -+{ -+ char bus_id[20]; -+ -+ snprintf(bus_id, sizeof(bus_id), "pci:%04x:%02x:%02x.%d", -+ pci->domain, pci->bus, pci->dev, pci->func); -+ return xmir_get_drm_fd(bus_id); -+} -+ -+static Bool -+vmwgfx_xmir_screen_init(struct vmwgfx_hosted *hosted, ScreenPtr pScreen) -+{ -+ if (!xmir_screen_init(pScreen, hosted->xmir)) -+ return FALSE; -+ -+ hosted->pScreen = pScreen; -+ -+ return TRUE; -+} -+ -+static void -+vmwgfx_xmir_screen_close(struct vmwgfx_hosted *hosted) -+{ -+ if (hosted->pScreen) -+ xmir_screen_close(hosted->pScreen, hosted->xmir); -+ -+ hosted->pScreen = NULL; -+} -+ -+static void -+vmwgfx_xmir_post_damage(struct vmwgfx_hosted *hosted) -+{ -+ xmir_screen_for_each_damaged_window(hosted->xmir, vmwgfx_xmir_copy_to_mir); -+} -+ -+static int -+vmwgfx_xmir_dri_auth(struct vmwgfx_hosted *hosted, ClientPtr client, -+ uint32_t magic) -+{ -+ return xmir_auth_drm_magic(hosted->xmir, magic); -+} -+ -+static void -+vmwgfx_xmir_copy_to_mir(xmir_window *xmir_win, RegionPtr region) -+{ -+ DrawablePtr pDraw = (DrawablePtr) xmir_window_to_windowptr(xmir_win); -+ const BoxRec *dst_box = xmir_window_get_drawable_region(xmir_win); -+ -+ if (vmwgfx_saa_copy_to_surface(pDraw, xmir_window_get_fd(xmir_win), -+ dst_box, region)) -+ xmir_submit_rendering_for_window(xmir_win, region); -+} -+ -+static const struct vmwgfx_hosted_driver vmwgfx_hosted_xmir_driver = { -+ .create = vmwgfx_xmir_create, -+ .destroy = vmwgfx_xmir_destroy, -+ .drm_fd = vmwgfx_xmir_drm_fd, -+ .pre_init = vmwgfx_xmir_pre_init, -+ .screen_init = vmwgfx_xmir_screen_init, -+ .screen_close = vmwgfx_xmir_screen_close, -+ .post_damage = vmwgfx_xmir_post_damage, -+ .dri_auth = vmwgfx_xmir_dri_auth -+}; -+ -+const struct vmwgfx_hosted_driver * -+vmwgfx_xmir_detect(void) -+{ -+ return (xorgMir) ? &vmwgfx_hosted_xmir_driver : NULL; -+} -+ -+void vmwgfx_xmir_modify_flags(uint32_t *flags) -+{ -+ if (xorgMir) -+ *flags |= HW_SKIP_CONSOLE; -+} -+ -+#else -+ -+const struct vmwgfx_hosted_driver * -+vmwgfx_xmir_detect(void) -+{ -+ return NULL; -+} -+ -+void -+vmwgfx_xmir_modify_flags(uint32_t *flags) -+{ -+} -+#endif --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0014-vmwgfx-Add-support-for-XWayland.patch b/x11-drivers/xf86-video-vmware/files/0014-vmwgfx-Add-support-for-XWayland.patch deleted file mode 100644 index 5c2f473de..000000000 --- a/x11-drivers/xf86-video-vmware/files/0014-vmwgfx-Add-support-for-XWayland.patch +++ /dev/null @@ -1,254 +0,0 @@ -From fd636e39a3f32a6dcd107c370513d8cb9aae26c2 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 16 Dec 2013 06:21:09 -0800 -Subject: [PATCH 14/19] vmwgfx: Add support for XWayland - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Brian Paul -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/Makefile.am | 1 + - vmwgfx/vmwgfx_hosted.c | 4 + - vmwgfx/vmwgfx_hosted_priv.h | 3 + - vmwgfx/vmwgfx_xwayland.c | 186 ++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 194 insertions(+) - create mode 100644 vmwgfx/vmwgfx_xwayland.c - -diff --git a/vmwgfx/Makefile.am b/vmwgfx/Makefile.am -index 41833a1..81b9e08 100644 ---- a/vmwgfx/Makefile.am -+++ b/vmwgfx/Makefile.am -@@ -29,5 +29,6 @@ libvmwgfx_la_SOURCES = \ - vmwgfx_hosted.h \ - vmwgfx_hosted_priv.h \ - vmwgfx_xmir.c \ -+ vmwgfx_xwayland.c \ - wsbm_util.h - endif -diff --git a/vmwgfx/vmwgfx_hosted.c b/vmwgfx/vmwgfx_hosted.c -index 018b88b..9b41f3e 100644 ---- a/vmwgfx/vmwgfx_hosted.c -+++ b/vmwgfx/vmwgfx_hosted.c -@@ -48,6 +48,9 @@ vmwgfx_hosted_detect(void) - { - const struct vmwgfx_hosted_driver *tmp = vmwgfx_xmir_detect(); - -+ if (!tmp) -+ tmp = vmwgfx_xwl_detect(); -+ - return tmp; - } - -@@ -64,4 +67,5 @@ void - vmwgfx_hosted_modify_flags(uint32_t *flags) - { - vmwgfx_xmir_modify_flags(flags); -+ vmwgfx_xwl_modify_flags(flags); - } -diff --git a/vmwgfx/vmwgfx_hosted_priv.h b/vmwgfx/vmwgfx_hosted_priv.h -index c81f5ee..2668e55 100644 ---- a/vmwgfx/vmwgfx_hosted_priv.h -+++ b/vmwgfx/vmwgfx_hosted_priv.h -@@ -34,4 +34,7 @@ - extern const struct vmwgfx_hosted_driver *vmwgfx_xmir_detect(void); - extern void vmwgfx_xmir_modify_flags(uint32_t *flags); - -+extern const struct vmwgfx_hosted_driver *vmwgfx_xwl_detect(void); -+extern void vmwgfx_xwl_modify_flags(uint32_t *flags); -+ - #endif -diff --git a/vmwgfx/vmwgfx_xwayland.c b/vmwgfx/vmwgfx_xwayland.c -new file mode 100644 -index 0000000..a16a7c4 ---- /dev/null -+++ b/vmwgfx/vmwgfx_xwayland.c -@@ -0,0 +1,186 @@ -+/* -+ * Copyright 2013 VMWare, Inc. -+ * All Rights Reserved. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sub license, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial portions -+ * of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ * -+ * Author: Thomas Hellstrom -+ * Author: Jakob Bornecrantz -+ */ -+ -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+ -+#include "vmwgfx_hosted_priv.h" -+ -+#ifdef XORG_WAYLAND -+ -+#include "vmwgfx_hosted.h" -+#include "vmwgfx_saa.h" -+#include -+#include -+ -+struct vmwgfx_hosted { -+ struct xwl_screen *xwl; -+ ScrnInfoPtr pScrn; -+ ScreenPtr pScreen; -+}; -+ -+static int -+vmwgfx_create_window_buffer(struct xwl_window *xwl_window, -+ PixmapPtr pixmap) -+{ -+ struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -+ uint32_t name, pitch; -+ -+ if (!vmwgfx_hw_dri2_validate(pixmap, 0)) -+ return BadDrawable; -+ -+ /* -+ * Pixmaps with hw_is_hosted == TRUE are put on a flush list when -+ * they've seen software rendering. When vmwgfx_flush_dri2 is called -+ * on these pixmaps, software contents are flushed to the hardware -+ * surface. -+ */ -+ vpix->hw_is_hosted = TRUE; -+ if (xa_surface_handle(vpix->hw, &name, &pitch) != XA_ERR_NONE) -+ return BadDrawable; -+ -+ return xwl_create_window_buffer_drm(xwl_window, pixmap, name); -+} -+ -+static struct xwl_driver vmwgfx_xwl_driver = { -+ .version = 2, -+ .use_drm = 1, -+ .create_window_buffer = vmwgfx_create_window_buffer -+}; -+ -+static struct vmwgfx_hosted * -+vmwgfx_xwl_create(ScrnInfoPtr pScrn) -+{ -+ struct vmwgfx_hosted *hosted; -+ -+ hosted = calloc(1, sizeof(*hosted)); -+ if (!hosted) -+ return NULL; -+ -+ hosted->xwl = xwl_screen_create(); -+ if (!hosted->xwl) { -+ free(hosted); -+ return NULL; -+ } -+ -+ hosted->pScrn = pScrn; -+ return hosted; -+} -+ -+static void -+vmwgfx_xwl_destroy(struct vmwgfx_hosted *hosted) -+{ -+ xwl_screen_destroy(hosted->xwl); -+ free(hosted); -+} -+ -+static Bool -+vmwgfx_xwl_pre_init(struct vmwgfx_hosted *hosted, int flags) -+{ -+ return xwl_screen_pre_init(hosted->pScrn, hosted->xwl, 0, -+ &vmwgfx_xwl_driver); -+} -+ -+static int -+vmwgfx_xwl_drm_fd(struct vmwgfx_hosted *hosted, const struct pci_device *pci) -+{ -+ return xwl_screen_get_drm_fd(hosted->xwl); -+} -+ -+static Bool -+vmwgfx_xwl_screen_init(struct vmwgfx_hosted *hosted, ScreenPtr pScreen) -+{ -+ if (xwl_screen_init(hosted->xwl, pScreen)) -+ return FALSE; -+ -+ hosted->pScreen = pScreen; -+ -+ return TRUE; -+} -+ -+static void -+vmwgfx_xwl_screen_close(struct vmwgfx_hosted *hosted) -+{ -+ if (hosted->pScreen) -+ xwl_screen_close(hosted->xwl); -+ -+ hosted->pScreen = NULL; -+} -+ -+static void -+vmwgfx_xwl_post_damage(struct vmwgfx_hosted *hosted) -+{ -+ vmwgfx_flush_dri2(hosted->pScreen); -+ xwl_screen_post_damage(hosted->xwl); -+} -+ -+static int -+vmwgfx_xwl_dri_auth(struct vmwgfx_hosted *hosted, ClientPtr client, -+ uint32_t magic) -+{ -+ return xwl_drm_authenticate(client, hosted->xwl, magic); -+} -+ -+static const struct vmwgfx_hosted_driver vmwgfx_hosted_xwl_driver = { -+ .create = vmwgfx_xwl_create, -+ .destroy = vmwgfx_xwl_destroy, -+ .drm_fd = vmwgfx_xwl_drm_fd, -+ .pre_init = vmwgfx_xwl_pre_init, -+ .screen_init = vmwgfx_xwl_screen_init, -+ .screen_close = vmwgfx_xwl_screen_close, -+ .post_damage = vmwgfx_xwl_post_damage, -+ .dri_auth = vmwgfx_xwl_dri_auth -+}; -+ -+const struct vmwgfx_hosted_driver * -+vmwgfx_xwl_detect(void) -+{ -+ return (xorgWayland) ? &vmwgfx_hosted_xwl_driver : NULL; -+} -+ -+void -+vmwgfx_xwl_modify_flags(uint32_t *flags) -+{ -+ if (xorgWayland) -+ *flags |= HW_SKIP_CONSOLE | HW_WAYLAND; -+} -+ -+#else -+ -+const struct vmwgfx_hosted_driver * -+vmwgfx_xwl_detect(void) -+{ -+ return NULL; -+} -+ -+void -+vmwgfx_xwl_modify_flags(uint32_t *flags) -+{ -+} -+#endif --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0015-vmwgfx-Enable-direct-dmas.patch b/x11-drivers/xf86-video-vmware/files/0015-vmwgfx-Enable-direct-dmas.patch deleted file mode 100644 index 734757d70..000000000 --- a/x11-drivers/xf86-video-vmware/files/0015-vmwgfx-Enable-direct-dmas.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 97ce302ddd6e86397ea56ea9089b9549af73c3ac Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 6 Jan 2014 12:37:36 +0100 -Subject: [PATCH 15/19] vmwgfx: Enable direct dmas - -Enable direct dmas instead of using the xa-provided dma functionality. -This saves a bounce-buffer software copy of all dma'd contents. - -This also implies that all drawables with mixed software / hardware contents -will use a kernel buffer for software rendering. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Brian Paul ---- - vmwgfx/vmwgfx_saa.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index c8b4df1..c323c5f 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -1423,7 +1423,7 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->xa_ctx = xa_context_default(xat); - vsaa->drm_fd = drm_fd; - vsaa->present_flush = present_flush; -- vsaa->can_optimize_dma = FALSE; -+ vsaa->can_optimize_dma = TRUE; - vsaa->use_present_opt = direct_presents; - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0016-vmwgfx-Block-DMA-to-prime-surfaces-for-now.patch b/x11-drivers/xf86-video-vmware/files/0016-vmwgfx-Block-DMA-to-prime-surfaces-for-now.patch deleted file mode 100644 index 20b61f21b..000000000 --- a/x11-drivers/xf86-video-vmware/files/0016-vmwgfx-Block-DMA-to-prime-surfaces-for-now.patch +++ /dev/null @@ -1,109 +0,0 @@ -From f37684e7169b9c0ab23ff748d5acacb65fad82f7 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Tue, 7 Jan 2014 17:55:49 +0100 -Subject: [PATCH 16/19] vmwgfx: Block DMA to prime surfaces for now - -Since there is currently no _good_ way to get the surface format of a -prime surface, we block DMA to these surfaces; we don't know if our -software data is compatible with the surface format. - -This patch also makes sure that there is a hardware surface backing the -drawable we copy from. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Brian Paul -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_saa.c | 40 ++++++++++++++++++++++++---------------- - vmwgfx/vmwgfx_saa_priv.h | 1 + - 2 files changed, 25 insertions(+), 16 deletions(-) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index c323c5f..cb55849 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -1428,6 +1428,7 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; - vsaa->is_master = TRUE; -+ vsaa->known_prime_format = FALSE; - WSBMINITLISTHEAD(&vsaa->sync_x_list); - WSBMINITLISTHEAD(&vsaa->pixmaps); - -@@ -1688,23 +1689,24 @@ vmwgfx_saa_copy_to_surface(DrawablePtr pDraw, uint32_t surface_fd, - - /* - * Determine the intersection between software contents and region to copy. -- * XXX: First check that the software contents is compatible with the -- * external surface format, before applying this optimization. - */ -- REGION_NULL(pScreen, &intersection); -- if (!vpix->hw) -- REGION_COPY(pScreen, &intersection, region); -- else if (spix->damage && REGION_NOTEMPTY(pScreen, &spix->dirty_shadow)) -- REGION_INTERSECT(pScreen, &intersection, region, &spix->dirty_shadow); - -- /* -- * DMA software contents directly into the destination. Then subtract -- * the region we've DMA'd from the region to copy. -- */ -- if (REGION_NOTEMPTY(pScreen, &intersection)) { -- if (vmwgfx_saa_dma(vsaa, src, &intersection, TRUE, dx, dy, dst)) { -- REGION_SUBTRACT(pScreen, &intersection, region, &intersection); -- copy_region = &intersection; -+ if (vsaa->known_prime_format) { -+ REGION_NULL(pScreen, &intersection); -+ if (!vpix->hw) -+ REGION_COPY(pScreen, &intersection, region); -+ else if (spix->damage && REGION_NOTEMPTY(pScreen, &spix->dirty_shadow)) -+ REGION_INTERSECT(pScreen, &intersection, region, &spix->dirty_shadow); -+ -+ /* -+ * DMA software contents directly into the destination. Then subtract -+ * the region we've DMA'd from the region to copy. -+ */ -+ if (REGION_NOTEMPTY(pScreen, &intersection)) { -+ if (vmwgfx_saa_dma(vsaa, src, &intersection, TRUE, dx, dy, dst)) { -+ REGION_SUBTRACT(pScreen, &intersection, region, &intersection); -+ copy_region = &intersection; -+ } - } - } - -@@ -1717,6 +1719,11 @@ vmwgfx_saa_copy_to_surface(DrawablePtr pDraw, uint32_t surface_fd, - box = REGION_RECTS(copy_region); - n = REGION_NUM_RECTS(copy_region); - -+ if (!vmwgfx_hw_accel_validate(src, 0, 0, 0, copy_region)) { -+ ret = FALSE; -+ goto out_no_copy; -+ } -+ - if (xa_copy_prepare(vsaa->xa_ctx, dst, vpix->hw) != XA_ERR_NONE) { - ret = FALSE; - goto out_no_copy; -@@ -1732,7 +1739,8 @@ vmwgfx_saa_copy_to_surface(DrawablePtr pDraw, uint32_t surface_fd, - xa_context_flush(vsaa->xa_ctx); - - out_no_copy: -- REGION_UNINIT(pScreen, &intersection); -+ if (vsaa->known_prime_format) -+ REGION_UNINIT(pScreen, &intersection); - if (sx || sy) - REGION_TRANSLATE(pScreen, region, -sx, -sy); - xa_surface_unref(dst); -diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h -index 16583b0..c84827b 100644 ---- a/vmwgfx/vmwgfx_saa_priv.h -+++ b/vmwgfx/vmwgfx_saa_priv.h -@@ -55,6 +55,7 @@ struct vmwgfx_saa { - Bool only_hw_presents; - Bool rendercheck; - Bool is_master; -+ Bool known_prime_format; - void (*present_flush) (ScreenPtr pScreen); - struct _WsbmListHead sync_x_list; - struct _WsbmListHead pixmaps; --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0017-vmware-Fix-build-errors-and-warnings.patch b/x11-drivers/xf86-video-vmware/files/0017-vmware-Fix-build-errors-and-warnings.patch deleted file mode 100644 index 12368b0de..000000000 --- a/x11-drivers/xf86-video-vmware/files/0017-vmware-Fix-build-errors-and-warnings.patch +++ /dev/null @@ -1,103 +0,0 @@ -From d6b179a5addef6456325adf241eb8dcaf8e4c3d6 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 9 Jan 2014 13:28:22 +0100 -Subject: [PATCH 17/19] vmware: Fix build errors and warnings - -A previous commit and the hosted merge unfortunately brought in some build -errors / warnings on early X servers. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - src/vmware_bootstrap.c | 1 + - src/vmwarevideo.c | 4 ++-- - vmwgfx/vmwgfx_driver.c | 2 +- - vmwgfx/vmwgfx_overlay.c | 4 ++-- - vmwgfx/vmwgfx_tex_video.c | 2 +- - 5 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c -index 57f8ae9..ed6c740 100644 ---- a/src/vmware_bootstrap.c -+++ b/src/vmware_bootstrap.c -@@ -34,6 +34,7 @@ - #include "xf86Pci.h" /* pci */ - #include "vm_device_version.h" - #include "vmware_bootstrap.h" -+#include - - #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 - #include "xf86Resources.h" -diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c -index 8d7d171..745c71f 100644 ---- a/src/vmwarevideo.c -+++ b/src/vmwarevideo.c -@@ -82,7 +82,7 @@ - #define VMWARE_VID_MAX_HEIGHT 2048 - - #define VMWARE_VID_NUM_ENCODINGS 1 --static const XF86VideoEncodingRec vmwareVideoEncodings[] = -+static XF86VideoEncodingRec vmwareVideoEncodings[] = - { - { - 0, -@@ -108,7 +108,7 @@ static XF86ImageRec vmwareVideoImages[] = - }; - - #define VMWARE_VID_NUM_ATTRIBUTES 2 --static const XF86AttributeRec vmwareVideoAttributes[] = -+static XF86AttributeRec vmwareVideoAttributes[] = - { - { - XvGettable | XvSettable, -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index dc05b86..2d38d2a 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -130,7 +130,7 @@ vmwgfx_hookup(ScrnInfoPtr pScrn) - } - - void --vmwgfx_modify_flags(CARD32 *flags) -+vmwgfx_modify_flags(uint32_t *flags) - { - *flags &= ~(HW_IO); - vmwgfx_hosted_modify_flags(flags); -diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c -index c8c6bb9..2c0d7fa 100644 ---- a/vmwgfx/vmwgfx_overlay.c -+++ b/vmwgfx/vmwgfx_overlay.c -@@ -85,7 +85,7 @@ typedef uint8_t uint8; - #define VMWARE_VID_MAX_HEIGHT 2048 - - #define VMWARE_VID_NUM_ENCODINGS 1 --static const XF86VideoEncodingRec vmwareVideoEncodings[] = -+static XF86VideoEncodingRec vmwareVideoEncodings[] = - { - { - 0, -@@ -111,7 +111,7 @@ static XF86ImageRec vmwareVideoImages[] = - }; - - #define VMWARE_VID_NUM_ATTRIBUTES 2 --static const XF86AttributeRec vmwareVideoAttributes[] = -+static XF86AttributeRec vmwareVideoAttributes[] = - { - { - XvGettable | XvSettable, -diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c -index 9fd8f22..0803a99 100644 ---- a/vmwgfx/vmwgfx_tex_video.c -+++ b/vmwgfx/vmwgfx_tex_video.c -@@ -82,7 +82,7 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] = { - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} - }; - --static const XF86VideoEncodingRec DummyEncoding[1] = { -+static XF86VideoEncodingRec DummyEncoding[1] = { - { - 0, - "XV_IMAGE", --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0018-vmware-Require-libdrm-2.4.38-to-build-XMir.patch b/x11-drivers/xf86-video-vmware/files/0018-vmware-Require-libdrm-2.4.38-to-build-XMir.patch deleted file mode 100644 index efbd9cf68..000000000 --- a/x11-drivers/xf86-video-vmware/files/0018-vmware-Require-libdrm-2.4.38-to-build-XMir.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 31bff9f7f3d9a68fd1449532e8ab50065de63857 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 9 Jan 2014 13:53:59 +0100 -Subject: [PATCH 18/19] vmware: Require libdrm 2.4.38 to build XMir. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - configure.ac | 6 ++++++ - vmwgfx/vmwgfx_drmi.c | 2 ++ - vmwgfx/vmwgfx_drmi.h | 2 ++ - vmwgfx/vmwgfx_saa.c | 2 +- - vmwgfx/vmwgfx_saa.h | 2 ++ - vmwgfx/vmwgfx_xmir.c | 2 +- - 6 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 123356c..3e8d541 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -127,6 +127,12 @@ if test x$BUILD_VMWGFX = xyes; then - [AC_DEFINE([HAVE_XA_2], 1, - [Has version 2 of XA])])], - [],[BUILD_VMWGFX=no]) -+# -+# Check for prime. -+# -+ PKG_CHECK_EXISTS([libdrm >= 2.4.38], -+ [AC_DEFINE([HAVE_LIBDRM_2_4_38], 1, -+ [Has version 2.4.38 or greater of libdrm])]) - fi - - DRIVER_NAME=vmware -diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c -index d926019..b6fb56d 100644 ---- a/vmwgfx/vmwgfx_drmi.c -+++ b/vmwgfx/vmwgfx_drmi.c -@@ -501,6 +501,7 @@ vmwgfx_max_fb_size(int drm_fd, size_t *size) - return 0; - } - -+#ifdef HAVE_LIBDRM_2_4_38 - /** - * vmwgfx_prime_fd_to_handle - Return a TTM handle to a prime object - * -@@ -537,3 +538,4 @@ vmwgfx_prime_release_handle(int drm_fd, uint32_t handle) - (void) drmCommandWrite(drm_fd, DRM_VMW_UNREF_SURFACE, &s_arg, - sizeof(s_arg)); - } -+#endif /* HAVE_LIBDRM_2_4_38 */ -diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h -index 1494485..3168088 100644 ---- a/vmwgfx/vmwgfx_drmi.h -+++ b/vmwgfx/vmwgfx_drmi.h -@@ -85,9 +85,11 @@ vmwgfx_update_gui_layout(int drm_fd, unsigned int num_rects, - int - vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out); - -+#ifdef HAVE_LIBDRM_2_4_38 - int - vmwgfx_prime_fd_to_handle(int drm_fd, int prime_fd, uint32_t *handle); - - void - vmwgfx_prime_release_handle(int drm_fd, uint32_t handle); -+#endif /* HAVE_LIBDRM_2_4_38 */ - #endif -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index cb55849..8c97618 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -1618,7 +1618,7 @@ vmwgfx_saa_drop_master(ScreenPtr pScreen) - * Helpers for hosted. - */ - --#if (XA_TRACKER_VERSION_MAJOR >= 2) -+#if (XA_TRACKER_VERSION_MAJOR >= 2) && defined(HAVE_LIBDRM_2_4_38) - - /** - * vmwgfx_saa_copy_to_surface - Copy Drawable contents to an external surface. -diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h -index 55f0ded..921fabd 100644 ---- a/vmwgfx/vmwgfx_saa.h -+++ b/vmwgfx/vmwgfx_saa.h -@@ -116,9 +116,11 @@ vmwgfx_saa_set_master(ScreenPtr pScreen); - void - vmwgfx_saa_drop_master(ScreenPtr pScreen); - -+#if (XA_TRACKER_VERSION_MAJOR >= 2) && defined(HAVE_LIBDRM_2_4_38) - Bool - vmwgfx_saa_copy_to_surface(DrawablePtr pDraw, uint32_t surface_fd, - const BoxRec *dst_box, RegionPtr region); -+#endif /* (XA_TRACKER_VERSION_MAJOR >= 2) && defined(HAVE_LIBDRM_2_4_38) */ - - #if (XA_TRACKER_VERSION_MAJOR <= 1) && !defined(HAVE_XA_2) - -diff --git a/vmwgfx/vmwgfx_xmir.c b/vmwgfx/vmwgfx_xmir.c -index e0ff6a4..ede6753 100644 ---- a/vmwgfx/vmwgfx_xmir.c -+++ b/vmwgfx/vmwgfx_xmir.c -@@ -32,7 +32,7 @@ - #include "vmwgfx_hosted_priv.h" - #include - --#if XMIR && (XA_TRACKER_VERSION_MAJOR >= 2) -+#if XMIR && (XA_TRACKER_VERSION_MAJOR >= 2) && defined(HAVE_LIBDRM_2_4_38) - - #include "vmwgfx_hosted.h" - #include "vmwgfx_saa.h" --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/0019-vmware-vmwgfx-Always-allocate-shared-hardware-surfac.patch b/x11-drivers/xf86-video-vmware/files/0019-vmware-vmwgfx-Always-allocate-shared-hardware-surfac.patch deleted file mode 100644 index 5ecd9b6d2..000000000 --- a/x11-drivers/xf86-video-vmware/files/0019-vmware-vmwgfx-Always-allocate-shared-hardware-surfac.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8da981712f62050076cff53e1b40ed1e307fcca8 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 15 Jan 2014 11:04:05 +0100 -Subject: [PATCH 19/19] vmware/vmwgfx: Always allocate shared hardware - surfaces. - -Hardware surfaces are all likely to be shared at some point, and we *really* -don't want to change a hardware surface that is bound as a drm framebuffer. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_saa.c | 2 +- - vmwgfx/vmwgfx_xa_surface.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 8c97618..b56b05f 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -811,7 +811,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa, - return TRUE; - - new_flags = (vpix->xa_flags & ~vpix->staging_remove_flags) | -- vpix->staging_add_flags; -+ vpix->staging_add_flags | XA_FLAG_SHARED; - - hw = xa_surface_create(vsaa->xat, - pixmap->drawable.width, -diff --git a/vmwgfx/vmwgfx_xa_surface.c b/vmwgfx/vmwgfx_xa_surface.c -index 2f23c57..189bfdc 100644 ---- a/vmwgfx/vmwgfx_xa_surface.c -+++ b/vmwgfx/vmwgfx_xa_surface.c -@@ -318,7 +318,7 @@ vmwgfx_hw_commit(PixmapPtr pixmap) - uint32_t new_flags; - - new_flags = (vpix->xa_flags & ~vpix->staging_remove_flags) | -- vpix->staging_add_flags; -+ vpix->staging_add_flags | XA_FLAG_SHARED; - - if (vpix->staging_format != xa_surface_format(vpix->hw)) - LogMessage(X_INFO, "Changing hardware format.\n"); --- -1.8.5.3 - diff --git a/x11-drivers/xf86-video-vmware/files/xatracker-v2-fixes.patch b/x11-drivers/xf86-video-vmware/files/xatracker-v2-fixes.patch deleted file mode 100644 index 9b8ed54a5..000000000 --- a/x11-drivers/xf86-video-vmware/files/xatracker-v2-fixes.patch +++ /dev/null @@ -1,1583 +0,0 @@ -From 0945bea5fc32eacb7bf42639efbd45dcd43e7ab5 Mon Sep 17 00:00:00 2001 -From: Rob Clark -Date: Mon, 10 Jun 2013 13:31:31 -0400 -Subject: [PATCH 01/11] vmwgfx: update for XA API changes - -Signed-off-by: Rob Clark -Signed-off-by: Jakob Bornecrantz -Reviewed-by: Jakob Bornecrantz -Tested-by: Jakob Bornecrantz ---- - configure.ac | 2 +- - vmwgfx/vmwgfx_dri2.c | 5 +++-- - vmwgfx/vmwgfx_driver.c | 3 ++- - vmwgfx/vmwgfx_saa.c | 20 ++++++++++++++------ - vmwgfx/vmwgfx_tex_video.c | 5 +++-- - 5 files changed, 23 insertions(+), 12 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 0631bcc..dccfb27 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -118,7 +118,7 @@ if test x$BUILD_VMWGFX = xyes; then - PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no]) - fi - if test x$BUILD_VMWGFX = xyes; then -- PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0],[],[BUILD_VMWGFX=no]) -+ PKG_CHECK_MODULES([XATRACKER], [xatracker >= 2.0.0],[],[BUILD_VMWGFX=no]) - fi - - DRIVER_NAME=vmware -diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c -index 7de0772..2f007f0 100644 ---- a/vmwgfx/vmwgfx_dri2.c -+++ b/vmwgfx/vmwgfx_dri2.c -@@ -201,7 +201,8 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - } - - private->srf = srf; -- if (xa_surface_handle(srf, &buffer->name, &buffer->pitch) != 0) -+ if (xa_surface_handle(srf, xa_handle_type_shared, -+ &buffer->name, &buffer->pitch) != 0) - return FALSE; - - buffer->cpp = xa_format_depth(xa_surface_format(srf)) / 8; -@@ -222,7 +223,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(private->pPixmap); - - if (--private->refcount == 0 && srf) { -- xa_surface_destroy(srf); -+ xa_surface_unref(srf); - } - - /* -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index 7863ba2..3002285 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -617,7 +617,8 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd, - return FALSE; - } - -- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) { -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) { - LogMessage(X_ERROR, "Could not get present surface handle.\n"); - return FALSE; - } -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 63df3a1..ed3c1ee 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -140,7 +140,7 @@ vmwgfx_pixmap_free_storage(struct vmwgfx_saa_pixmap *vpix) - vpix->malloc = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_SURFACE) && vpix->hw) { -- xa_surface_destroy(vpix->hw); -+ xa_surface_unref(vpix->hw); - vpix->hw = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_GMR) && vpix->gmr) { -@@ -286,7 +286,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - if (vpix->gmr && vsaa->can_optimize_dma) { - uint32_t handle, dummy; - -- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) - goto out_err; - if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, - to_hw) != 0) -@@ -305,6 +306,8 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - (int) to_hw, - (struct xa_box *) REGION_RECTS(reg), - REGION_NUM_RECTS(reg)); -+ if (to_hw) -+ xa_context_flush(vsaa->xa_ctx); - if (vpix->gmr) - vmwgfx_dmabuf_unmap(vpix->gmr); - if (ret) -@@ -441,7 +444,7 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa, - &spix->dirty_hw)) - return FALSE; - -- xa_surface_destroy(vpix->hw); -+ xa_surface_unref(vpix->hw); - vpix->hw = NULL; - - /* -@@ -683,7 +686,8 @@ vmwgfx_present_prepare(struct vmwgfx_saa *vsaa, - - (void) pScreen; - if (src_vpix == dst_vpix || !src_vpix->hw || -- xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0) -+ xa_surface_handle(src_vpix->hw, xa_handle_type_shared, -+ &vsaa->src_handle, &dummy) != 0) - return FALSE; - - REGION_NULL(pScreen, &vsaa->present_region); -@@ -784,7 +788,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa, - return TRUE; - - out_no_damage: -- xa_surface_destroy(hw); -+ xa_surface_unref(hw); - return FALSE; - } - -@@ -929,6 +933,7 @@ vmwgfx_copy_prepare(struct saa_driver *driver, - - if (!vmwgfx_hw_validate(src_pixmap, src_reg)) { - xa_copy_done(vsaa->xa_ctx); -+ xa_context_flush(vsaa->xa_ctx); - return FALSE; - } - -@@ -1029,6 +1034,7 @@ vmwgfx_copy_done(struct saa_driver *driver) - return; - } - xa_copy_done(vsaa->xa_ctx); -+ xa_context_flush(vsaa->xa_ctx); - } - - static Bool -@@ -1175,6 +1181,7 @@ vmwgfx_composite_done(struct saa_driver *driver) - struct vmwgfx_saa *vsaa = to_vmwgfx_saa(driver); - - xa_composite_done(vsaa->xa_ctx); -+ xa_context_flush(vsaa->xa_ctx); - } - - static void -@@ -1436,7 +1443,8 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry *entry) - */ - if (!vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT, 0, NULL)) - goto out_err; -- if (xa_surface_handle(vpix->hw, &handle, &dummy) != 0) -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) - goto out_err; - depth = xa_format_depth(xa_surface_format(vpix->hw)); - -diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c -index 449266b..2971ed7 100644 ---- a/vmwgfx/vmwgfx_tex_video.c -+++ b/vmwgfx/vmwgfx_tex_video.c -@@ -199,7 +199,7 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown) - - for (i=0; i<3; ++i) { - if (priv->yuv[i]) { -- xa_surface_destroy(priv->yuv[i]); -+ xa_surface_unref(priv->yuv[i]); - priv->yuv[i] = NULL; - } - for (j=0; j<2; ++j) { -@@ -539,7 +539,8 @@ copy_packed_data(ScrnInfoPtr pScrn, - REGION_RESET(pScrn->pScreen, ®, &box); - } - -- if (xa_surface_handle(srf, &handle, &stride) != 0) { -+ if (xa_surface_handle(srf, xa_handle_type_shared, -+ &handle, &stride) != 0) { - ret = BadAlloc; - break; - } --- -1.8.5.1 - - -From 835ce4698f916ba080f4132988fd4caf898e0b1e Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 26 Sep 2013 01:25:33 -0700 -Subject: [PATCH 02/11] vmwgfx: Avoid HW operations when not master - -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. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_dri2.c | 13 +++++++++++++ - vmwgfx/vmwgfx_driver.c | 3 +++ - vmwgfx/vmwgfx_saa.c | 44 +++++++++++++++++++++++++++++++++++++++++++- - vmwgfx/vmwgfx_saa.h | 8 ++++++++ - vmwgfx/vmwgfx_saa_priv.h | 2 ++ - vmwgfx/vmwgfx_xa_surface.c | 6 ++++++ - 6 files changed, 75 insertions(+), 1 deletion(-) - -diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c -index 2f007f0..57f2d9d 100644 ---- a/vmwgfx/vmwgfx_dri2.c -+++ b/vmwgfx/vmwgfx_dri2.c -@@ -138,6 +138,8 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - return TRUE; - case DRI2BufferStencil: - case DRI2BufferDepthStencil: -+ if (!pScrn->vtSema) -+ return FALSE; - - depth = (format) ? vmwgfx_zs_format_to_depth(format) : 32; - -@@ -155,6 +157,9 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - - break; - case DRI2BufferDepth: -+ if (!pScrn->vtSema) -+ return FALSE; -+ - depth = (format) ? vmwgfx_z_format_to_depth(format) : - pDraw->bitsPerPixel; - -@@ -291,6 +296,14 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, - DrawablePtr dst_draw; - RegionPtr myClip; - GCPtr gc; -+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); -+ -+ /* -+ * This is a fragile protection against HW operations when not master. -+ * Needs to be blocked higher up in the dri2 code. -+ */ -+ if (!pScrn->vtSema) -+ return; - - /* - * In driCreateBuffers we dewrap windows into the -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index 3002285..eeaea4b 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -1116,6 +1116,7 @@ drv_leave_vt(VT_FUNC_ARGS_DECL) - - vmwgfx_cursor_bypass(ms->fd, 0, 0); - vmwgfx_disable_scanout(pScrn); -+ vmwgfx_saa_drop_master(pScrn->pScreen); - - if (drmDropMaster(ms->fd)) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, -@@ -1136,6 +1137,8 @@ drv_enter_vt(VT_FUNC_ARGS_DECL) - if (!drv_set_master(pScrn)) - return FALSE; - -+ vmwgfx_saa_set_master(pScrn->pScreen); -+ - if (!xf86SetDesiredModes(pScrn)) - return FALSE; - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index ed3c1ee..5534ca3 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -423,6 +423,7 @@ vmwgfx_create_pixmap(struct saa_driver *driver, struct saa_pixmap *spix, - - WSBMINITLISTHEAD(&vpix->sync_x_head); - WSBMINITLISTHEAD(&vpix->scanout_list); -+ WSBMINITLISTHEAD(&vpix->pixmap_list); - - return TRUE; - } -@@ -499,6 +500,7 @@ vmwgfx_destroy_pixmap(struct saa_driver *driver, PixmapPtr pixmap) - */ - - vmwgfx_pixmap_remove_present(vpix); -+ WSBMLISTDELINIT(&vpix->pixmap_list); - WSBMLISTDELINIT(&vpix->sync_x_head); - - if (vpix->hw_is_dri2_fronts) -@@ -627,6 +629,8 @@ vmwgfx_modify_pixmap_header (PixmapPtr pixmap, int w, int h, int depth, - int bpp, int devkind, void *pixdata) - { - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -+ ScreenPtr pScreen = pixmap->drawable.pScreen; -+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); - unsigned int old_height; - unsigned int old_width; - unsigned int old_pitch; -@@ -670,6 +674,8 @@ vmwgfx_modify_pixmap_header (PixmapPtr pixmap, int w, int h, int depth, - - vmwgfx_pix_resize(pixmap, old_pitch, old_height, old_width); - vmwgfx_pixmap_free_storage(vpix); -+ WSBMLISTADDTAIL(&vpix->pixmap_list, &vsaa->pixmaps); -+ - return TRUE; - - out_no_modify: -@@ -860,7 +866,7 @@ vmwgfx_copy_prepare(struct saa_driver *driver, - Bool has_valid_hw; - - if (!vsaa->xat || !SAA_PM_IS_SOLID(&dst_pixmap->drawable, plane_mask) || -- alu != GXcopy) -+ alu != GXcopy || !vsaa->is_master) - return FALSE; - - src_vpix = vmwgfx_saa_pixmap(src_pixmap); -@@ -1057,6 +1063,9 @@ vmwgfx_composite_prepare(struct saa_driver *driver, CARD8 op, - RegionRec empty; - struct xa_composite *xa_comp; - -+ if (!vsaa->is_master) -+ return FALSE; -+ - REGION_NULL(pScreen, &empty); - - /* -@@ -1367,7 +1376,9 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->use_present_opt = direct_presents; - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; -+ vsaa->is_master = TRUE; - WSBMINITLISTHEAD(&vsaa->sync_x_list); -+ WSBMINITLISTHEAD(&vsaa->pixmaps); - - vsaa->driver = vmwgfx_saa_driver; - vsaa->vcomp = vmwgfx_alloc_composite(); -@@ -1518,3 +1529,34 @@ vmwgfx_scanout_unref(struct vmwgfx_screen_entry *entry) - entry->pixmap = NULL; - pixmap->drawable.pScreen->DestroyPixmap(pixmap); - } -+ -+void -+vmwgfx_saa_set_master(ScreenPtr pScreen) -+{ -+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); -+ -+ vsaa->is_master = TRUE; -+} -+ -+void -+vmwgfx_saa_drop_master(ScreenPtr pScreen) -+{ -+ struct vmwgfx_saa *vsaa = to_vmwgfx_saa(saa_get_driver(pScreen)); -+ struct _WsbmListHead *list; -+ struct vmwgfx_saa_pixmap *vpix; -+ struct saa_pixmap *spix; -+ -+ WSBMLISTFOREACH(list, &vsaa->pixmaps) { -+ vpix = WSBMLISTENTRY(list, struct vmwgfx_saa_pixmap, pixmap_list); -+ spix = &vpix->base; -+ -+ if (!vpix->hw) -+ continue; -+ -+ (void) vmwgfx_download_from_hw(&vsaa->driver, spix->pixmap, -+ &spix->dirty_hw); -+ REGION_EMPTY(draw->pScreen, &spix->dirty_hw); -+ } -+ -+ vsaa->is_master = FALSE; -+} -diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h -index bb8ec96..d8aa3d3 100644 ---- a/vmwgfx/vmwgfx_saa.h -+++ b/vmwgfx/vmwgfx_saa.h -@@ -54,6 +54,7 @@ struct vmwgfx_saa_pixmap { - int hw_is_dri2_fronts; - struct _WsbmListHead sync_x_head; - struct _WsbmListHead scanout_list; -+ struct _WsbmListHead pixmap_list; - - uint32_t xa_flags; - uint32_t staging_add_flags; -@@ -107,4 +108,11 @@ Bool - vmwgfx_hw_accel_validate(PixmapPtr pixmap, unsigned int depth, - uint32_t add_flags, uint32_t remove_flags, - RegionPtr region); -+ -+void -+vmwgfx_saa_set_master(ScreenPtr pScreen); -+ -+void -+vmwgfx_saa_drop_master(ScreenPtr pScreen); -+ - #endif -diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h -index 5f46dee..16583b0 100644 ---- a/vmwgfx/vmwgfx_saa_priv.h -+++ b/vmwgfx/vmwgfx_saa_priv.h -@@ -54,8 +54,10 @@ struct vmwgfx_saa { - Bool use_present_opt; - Bool only_hw_presents; - Bool rendercheck; -+ Bool is_master; - void (*present_flush) (ScreenPtr pScreen); - struct _WsbmListHead sync_x_list; -+ struct _WsbmListHead pixmaps; - struct vmwgfx_composite *vcomp; - }; - -diff --git a/vmwgfx/vmwgfx_xa_surface.c b/vmwgfx/vmwgfx_xa_surface.c -index 8b30e45..2f23c57 100644 ---- a/vmwgfx/vmwgfx_xa_surface.c -+++ b/vmwgfx/vmwgfx_xa_surface.c -@@ -362,6 +362,12 @@ vmwgfx_hw_accel_validate(PixmapPtr pixmap, unsigned int depth, - Bool - vmwgfx_hw_dri2_validate(PixmapPtr pixmap, unsigned int depth) - { -+ struct vmwgfx_saa *vsaa = -+ to_vmwgfx_saa(saa_get_driver(pixmap->drawable.pScreen)); -+ -+ if (!vsaa->is_master) -+ return FALSE; -+ - return (vmwgfx_hw_dri2_stage(pixmap, depth) && - vmwgfx_hw_commit(pixmap) && - vmwgfx_hw_validate(pixmap, NULL)); --- -1.8.5.1 - - -From 7192acf9f0bf8e7176ab0b803b861a858623f709 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 19 Sep 2012 20:36:57 +0200 -Subject: [PATCH 03/11] 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 -Reviewed-by: Zack Rusin ---- - 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.5.1 - - -From 45b2457516a9db4bd1d60fbb24a1efbe2d9dd932 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 19 Sep 2012 21:50:40 +0200 -Subject: [PATCH 04/11] vmwgfx: Get rid of device-specific DMA code - -It's rarely used and things seem to work well enough on top of XA. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Zack Rusin ---- - vmwgfx/vmwgfx_drmi.c | 103 ----------------------------------------------- - vmwgfx/vmwgfx_drmi.h | 5 --- - vmwgfx/vmwgfx_saa.c | 53 ++++++++++++------------ - vmwgfx/vmwgfx_saa_priv.h | 1 - - 4 files changed, 26 insertions(+), 136 deletions(-) - -diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c -index 496a16b..1e23f4a 100644 ---- a/vmwgfx/vmwgfx_drmi.c -+++ b/vmwgfx/vmwgfx_drmi.c -@@ -284,109 +284,6 @@ vmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf) - } - - int --vmwgfx_dma(unsigned int host_x, unsigned int host_y, -- RegionPtr region, struct vmwgfx_dmabuf *buf, -- uint32_t buf_pitch, uint32_t surface_handle, int to_surface) --{ -- BoxPtr clips = REGION_RECTS(region); -- unsigned int num_clips = REGION_NUM_RECTS(region); -- struct drm_vmw_execbuf_arg arg; -- struct drm_vmw_fence_rep rep; -- int ret; -- unsigned int size; -- unsigned i; -- SVGA3dCopyBox *cb; -- SVGA3dCmdSurfaceDMASuffix *suffix; -- SVGA3dCmdSurfaceDMA *body; -- struct vmwgfx_int_dmabuf *ibuf = vmwgfx_int_dmabuf(buf); -- -- struct { -- SVGA3dCmdHeader header; -- SVGA3dCmdSurfaceDMA body; -- SVGA3dCopyBox cb; -- } *cmd; -- -- if (num_clips == 0) -- return 0; -- -- size = sizeof(*cmd) + (num_clips - 1) * sizeof(cmd->cb) + -- sizeof(*suffix); -- cmd = malloc(size); -- if (!cmd) -- return -1; -- -- cmd->header.id = SVGA_3D_CMD_SURFACE_DMA; -- cmd->header.size = sizeof(cmd->body) + num_clips * sizeof(cmd->cb) + -- sizeof(*suffix); -- cb = &cmd->cb; -- -- suffix = (SVGA3dCmdSurfaceDMASuffix *) &cb[num_clips]; -- suffix->suffixSize = sizeof(*suffix); -- suffix->maximumOffset = (uint32_t) -1; -- suffix->flags.discard = 0; -- suffix->flags.unsynchronized = 0; -- suffix->flags.reserved = 0; -- -- body = &cmd->body; -- body->guest.ptr.gmrId = buf->gmr_id; -- body->guest.ptr.offset = buf->gmr_offset; -- body->guest.pitch = buf_pitch; -- body->host.sid = surface_handle; -- body->host.face = 0; -- body->host.mipmap = 0; -- -- body->transfer = (to_surface ? SVGA3D_WRITE_HOST_VRAM : -- SVGA3D_READ_HOST_VRAM); -- -- -- for (i=0; i < num_clips; i++, cb++, clips++) { -- cb->x = (uint16_t) clips->x1 + host_x; -- cb->y = (uint16_t) clips->y1 + host_y; -- cb->z = 0; -- cb->srcx = (uint16_t) clips->x1; -- cb->srcy = (uint16_t) clips->y1; -- cb->srcz = 0; -- cb->w = (uint16_t) (clips->x2 - clips->x1); -- cb->h = (uint16_t) (clips->y2 - clips->y1); -- cb->d = 1; --#if 0 -- LogMessage(X_INFO, "DMA! x: %u y: %u srcx: %u srcy: %u w: %u h: %u %s\n", -- cb->x, cb->y, cb->srcx, cb->srcy, cb->w, cb->h, -- to_surface ? "to" : "from"); --#endif -- -- } -- -- memset(&arg, 0, sizeof(arg)); -- memset(&rep, 0, sizeof(rep)); -- -- rep.error = -EFAULT; -- arg.fence_rep = ((to_surface) ? 0UL : (unsigned long)&rep); -- arg.commands = (unsigned long)cmd; -- arg.command_size = size; -- arg.throttle_us = 0; -- arg.version = DRM_VMW_EXECBUF_VERSION; -- -- ret = drmCommandWrite(ibuf->drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg)); -- if (ret) { -- LogMessage(X_ERROR, "DMA error %s.\n", strerror(-ret)); -- } -- -- free(cmd); -- -- if (rep.error == 0) { -- ret = vmwgfx_fence_wait(ibuf->drm_fd, rep.handle, TRUE); -- if (ret) { -- LogMessage(X_ERROR, "DMA from host fence wait error %s.\n", -- strerror(-ret)); -- vmwgfx_fence_unref(ibuf->drm_fd, rep.handle); -- } -- } -- -- return 0; --} -- --int - vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out) - { - struct drm_vmw_getparam_arg gp_arg; -diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h -index 2435009..fff728a 100644 ---- a/vmwgfx/vmwgfx_drmi.h -+++ b/vmwgfx/vmwgfx_drmi.h -@@ -60,11 +60,6 @@ extern void - vmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf); - - extern int --vmwgfx_dma(unsigned int host_x, unsigned int host_y, -- RegionPtr region, struct vmwgfx_dmabuf *buf, -- uint32_t buf_pitch, uint32_t surface_handle, int to_surface); -- --extern int - vmwgfx_num_streams(int drm_fd, uint32_t *ntot, uint32_t *nfree); - - extern int -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 5534ca3..fd80682 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -279,40 +279,40 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - Bool to_hw) - { - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -+ void *data = vpix->malloc; -+ int ret; - - if (!vpix->hw || (!vpix->gmr && !vpix->malloc)) - return TRUE; - -- if (vpix->gmr && vsaa->can_optimize_dma) { -- uint32_t handle, dummy; - -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) -- goto out_err; -- if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, -- to_hw) != 0) -+ if (vpix->gmr) { -+ data = vmwgfx_dmabuf_map(vpix->gmr); -+ if (!data) - goto out_err; -- } else { -- void *data = vpix->malloc; -- int ret; -+ } - -- if (vpix->gmr) { -- data = vmwgfx_dmabuf_map(vpix->gmr); -- if (!data) -- goto out_err; -- } -+ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -+ (int) to_hw, -+ (struct xa_box *) REGION_RECTS(reg), -+ REGION_NUM_RECTS(reg)); -+ if (vpix->gmr) -+ vmwgfx_dmabuf_unmap(vpix->gmr); -+ -+ if (ret) -+ goto out_err; -+ -+ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -+ (int) to_hw, -+ (struct xa_box *) REGION_RECTS(reg), -+ REGION_NUM_RECTS(reg)); -+ if (to_hw) -+ xa_context_flush(vsaa->xa_ctx); -+ if (vpix->gmr) -+ vmwgfx_dmabuf_unmap(vpix->gmr); -+ if (ret) -+ goto out_err; - -- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -- (int) to_hw, -- (struct xa_box *) REGION_RECTS(reg), -- REGION_NUM_RECTS(reg)); -- if (to_hw) -- xa_context_flush(vsaa->xa_ctx); -- if (vpix->gmr) -- vmwgfx_dmabuf_unmap(vpix->gmr); -- if (ret) -- goto out_err; -- } - return TRUE; - out_err: - LogMessage(X_ERROR, "DMA %s surface failed.\n", -@@ -1372,7 +1372,6 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->xa_ctx = xa_context_default(xat); - vsaa->drm_fd = drm_fd; - vsaa->present_flush = present_flush; -- vsaa->can_optimize_dma = FALSE; - vsaa->use_present_opt = direct_presents; - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; -diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h -index 16583b0..f5f45ba 100644 ---- a/vmwgfx/vmwgfx_saa_priv.h -+++ b/vmwgfx/vmwgfx_saa_priv.h -@@ -50,7 +50,6 @@ struct vmwgfx_saa { - int ydiff; - RegionRec present_region; - uint32_t src_handle; -- Bool can_optimize_dma; - Bool use_present_opt; - Bool only_hw_presents; - Bool rendercheck; --- -1.8.5.1 - - -From e26dec8f5278df74a102493bf6d2d8444dab5d6d Mon Sep 17 00:00:00 2001 -From: Gaetan Nadon -Date: Mon, 28 Oct 2013 18:21:29 -0400 -Subject: [PATCH 05/11] vmwgfx: handle changes of DamageUnregister API in - 1.14.99.2 - -Fix is inspired from the intel driver. - -Reviewed-by: Jakob Bornecrantz -Signed-off-by: Gaetan Nadon -Signed-off-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_saa.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index fd80682..346e7f4 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -26,6 +26,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -76,7 +77,12 @@ vmwgfx_pixmap_remove_damage(PixmapPtr pixmap) - if (!spix->damage || vpix->hw || vpix->gmr || vpix->malloc) - return; - -+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0) -+ DamageUnregister(spix->damage); -+#else - DamageUnregister(&pixmap->drawable, spix->damage); -+#endif -+ - DamageDestroy(spix->damage); - spix->damage = NULL; - } --- -1.8.5.1 - - -From 7ac45326eccbf3bea9a4a8f95b9662a36ab58eb0 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 28 Nov 2013 02:02:20 -0800 -Subject: [PATCH 06/11] vmwgfx: Fix some compilation warnings and indentations - -Most of the compilation warnings we're seeing are due to bad xorg headers, -but fix the ones we can fix in the driver. Some indentation fixes as well. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - src/vmware_bootstrap.c | 2 -- - src/vmwarevideo.c | 4 ++-- - vmwgfx/vmwgfx_driver.c | 1 - - vmwgfx/vmwgfx_output.c | 2 +- - vmwgfx/vmwgfx_overlay.c | 4 ++-- - vmwgfx/vmwgfx_tex_video.c | 26 +++++++++++++------------- - 6 files changed, 18 insertions(+), 21 deletions(-) - -diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c -index ea5be19..bb58325 100644 ---- a/src/vmware_bootstrap.c -+++ b/src/vmware_bootstrap.c -@@ -256,7 +256,6 @@ VMwarePciProbe (DriverPtr drv, - intptr_t match_data) - { - ScrnInfoPtr scrn = NULL; -- EntityInfoPtr entity; - - scrn = xf86ConfigPciEntity(scrn, 0, entity_num, VMWAREPciChipsets, - NULL, NULL, NULL, NULL, NULL); -@@ -267,7 +266,6 @@ VMwarePciProbe (DriverPtr drv, - scrn->Probe = NULL; - } - -- entity = xf86GetEntityInfo(entity_num); - switch (DEVICE_ID(device)) { - case PCI_DEVICE_ID_VMWARE_SVGA2: - case PCI_DEVICE_ID_VMWARE_SVGA: -diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c -index 745c71f..8d7d171 100644 ---- a/src/vmwarevideo.c -+++ b/src/vmwarevideo.c -@@ -82,7 +82,7 @@ - #define VMWARE_VID_MAX_HEIGHT 2048 - - #define VMWARE_VID_NUM_ENCODINGS 1 --static XF86VideoEncodingRec vmwareVideoEncodings[] = -+static const XF86VideoEncodingRec vmwareVideoEncodings[] = - { - { - 0, -@@ -108,7 +108,7 @@ static XF86ImageRec vmwareVideoImages[] = - }; - - #define VMWARE_VID_NUM_ATTRIBUTES 2 --static XF86AttributeRec vmwareVideoAttributes[] = -+static const XF86AttributeRec vmwareVideoAttributes[] = - { - { - XvGettable | XvSettable, -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index eeaea4b..bfc07f8 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -658,7 +658,6 @@ void xorg_flush(ScreenPtr pScreen) - if (crtc->enabled) { - pixmap = crtc_get_scanout(crtc); - if (pixmap) { -- unsigned int j; - - /* - * Remove duplicates. -diff --git a/vmwgfx/vmwgfx_output.c b/vmwgfx/vmwgfx_output.c -index 4f52f1d..f9e4263 100644 ---- a/vmwgfx/vmwgfx_output.c -+++ b/vmwgfx/vmwgfx_output.c -@@ -60,7 +60,7 @@ struct output_private - Bool is_implicit; - }; - --static char *output_enum_list[] = { -+static const char *output_enum_list[] = { - "Unknown", - "VGA", - "DVI", -diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c -index 6624a10..986dd06 100644 ---- a/vmwgfx/vmwgfx_overlay.c -+++ b/vmwgfx/vmwgfx_overlay.c -@@ -84,7 +84,7 @@ typedef uint8_t uint8; - #define VMWARE_VID_MAX_HEIGHT 2048 - - #define VMWARE_VID_NUM_ENCODINGS 1 --static XF86VideoEncodingRec vmwareVideoEncodings[] = -+static const XF86VideoEncodingRec vmwareVideoEncodings[] = - { - { - 0, -@@ -110,7 +110,7 @@ static XF86ImageRec vmwareVideoImages[] = - }; - - #define VMWARE_VID_NUM_ATTRIBUTES 2 --static XF86AttributeRec vmwareVideoAttributes[] = -+static const XF86AttributeRec vmwareVideoAttributes[] = - { - { - XvGettable | XvSettable, -diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c -index a0a4f4a..3ba40ef 100644 ---- a/vmwgfx/vmwgfx_tex_video.c -+++ b/vmwgfx/vmwgfx_tex_video.c -@@ -70,11 +70,11 @@ static const float bt_709[] = { - static Atom xvBrightness, xvContrast, xvSaturation, xvHue; - - #define NUM_TEXTURED_ATTRIBUTES 4 --static XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = { -- {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, -- {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"}, -- {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}, -- {XvSettable | XvGettable, -1000, 1000, "XV_HUE"} -+static const XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = { -+ {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, -+ {XvSettable | XvGettable, -1000, 1000, "XV_CONTRAST"}, -+ {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"}, -+ {XvSettable | XvGettable, -1000, 1000, "XV_HUE"} - }; - - #define NUM_FORMATS 3 -@@ -82,7 +82,7 @@ static XF86VideoFormatRec Formats[NUM_FORMATS] = { - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} - }; - --static XF86VideoEncodingRec DummyEncoding[1] = { -+static const XF86VideoEncodingRec DummyEncoding[1] = { - { - 0, - "XV_IMAGE", -@@ -416,16 +416,16 @@ copy_packed_data(ScrnInfoPtr pScrn, - switch (id) { - case FOURCC_YV12: { - int pitches[3], offsets[3]; -- unsigned char *y, *u, *v; -+ unsigned char *yp, *up, *vp; - query_image_attributes(pScrn, FOURCC_YV12, - &w, &h, pitches, offsets); - -- y = buf + offsets[0]; -- v = buf + offsets[1]; -- u = buf + offsets[2]; -- memcpy(ymap, y, w*h); -- memcpy(vmap, v, w*h/4); -- memcpy(umap, u, w*h/4); -+ yp = buf + offsets[0]; -+ vp = buf + offsets[1]; -+ up = buf + offsets[2]; -+ memcpy(ymap, yp, w*h); -+ memcpy(vmap, vp, w*h/4); -+ memcpy(umap, up, w*h/4); - break; - } - case FOURCC_UYVY: --- -1.8.5.1 - - -From a40cbd7b4fa19219849b4b0a48f07538772c3e22 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Thu, 5 Dec 2013 02:58:47 -0800 -Subject: [PATCH 07/11] vmwgfx: Support also XA version 1 v2 - -We need to support also XA version 1, since we want to be backwards -compatible with older mesa releases. -Unfortunately, the intended way of detecting XA major version at -compile-time was broken on mesa 10 so we need a workaround that tests -for XA version 2 at config time. - -v2: Update the test for XA version 2. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - configure.ac | 10 +++++++++- - vmwgfx/vmwgfx_dri2.c | 5 ++--- - vmwgfx/vmwgfx_driver.c | 3 +-- - vmwgfx/vmwgfx_saa.c | 12 +++++------- - vmwgfx/vmwgfx_saa.h | 12 ++++++++++++ - vmwgfx/vmwgfx_tex_video.c | 2 +- - 6 files changed, 30 insertions(+), 14 deletions(-) - -diff --git a/configure.ac b/configure.ac -index dccfb27..123356c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -118,7 +118,15 @@ if test x$BUILD_VMWGFX = xyes; then - PKG_CHECK_MODULES([LIBDRM], [libdrm],[],[BUILD_VMWGFX=no]) - fi - if test x$BUILD_VMWGFX = xyes; then -- PKG_CHECK_MODULES([XATRACKER], [xatracker >= 2.0.0],[],[BUILD_VMWGFX=no]) -+# -+# Early versions of mesa 10 forgot to bump the XA major version number in -+# the xa_tracker.h header -+# -+ PKG_CHECK_MODULES([XATRACKER], [xatracker >= 0.4.0], -+ [PKG_CHECK_EXISTS([xatracker = 2.0.0], -+ [AC_DEFINE([HAVE_XA_2], 1, -+ [Has version 2 of XA])])], -+ [],[BUILD_VMWGFX=no]) - fi - - DRIVER_NAME=vmware -diff --git a/vmwgfx/vmwgfx_dri2.c b/vmwgfx/vmwgfx_dri2.c -index 57f2d9d..4c74a6b 100644 ---- a/vmwgfx/vmwgfx_dri2.c -+++ b/vmwgfx/vmwgfx_dri2.c -@@ -206,8 +206,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for - } - - private->srf = srf; -- if (xa_surface_handle(srf, xa_handle_type_shared, -- &buffer->name, &buffer->pitch) != 0) -+ if (_xa_surface_handle(srf, &buffer->name, &buffer->pitch) != 0) - return FALSE; - - buffer->cpp = xa_format_depth(xa_surface_format(srf)) / 8; -@@ -228,7 +227,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(private->pPixmap); - - if (--private->refcount == 0 && srf) { -- xa_surface_unref(srf); -+ xa_surface_destroy(srf); - } - - /* -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index bfc07f8..6301c29 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -617,8 +617,7 @@ vmwgfx_scanout_present(ScreenPtr pScreen, int drm_fd, - return FALSE; - } - -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) { -+ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) { - LogMessage(X_ERROR, "Could not get present surface handle.\n"); - return FALSE; - } -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 346e7f4..1459933 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -146,7 +146,7 @@ vmwgfx_pixmap_free_storage(struct vmwgfx_saa_pixmap *vpix) - vpix->malloc = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_SURFACE) && vpix->hw) { -- xa_surface_unref(vpix->hw); -+ xa_surface_destroy(vpix->hw); - vpix->hw = NULL; - } - if (!(vpix->backing & VMWGFX_PIX_GMR) && vpix->gmr) { -@@ -451,7 +451,7 @@ vmwgfx_hw_kill(struct vmwgfx_saa *vsaa, - &spix->dirty_hw)) - return FALSE; - -- xa_surface_unref(vpix->hw); -+ xa_surface_destroy(vpix->hw); - vpix->hw = NULL; - - /* -@@ -698,8 +698,7 @@ vmwgfx_present_prepare(struct vmwgfx_saa *vsaa, - - (void) pScreen; - if (src_vpix == dst_vpix || !src_vpix->hw || -- xa_surface_handle(src_vpix->hw, xa_handle_type_shared, -- &vsaa->src_handle, &dummy) != 0) -+ _xa_surface_handle(src_vpix->hw, &vsaa->src_handle, &dummy) != 0) - return FALSE; - - REGION_NULL(pScreen, &vsaa->present_region); -@@ -800,7 +799,7 @@ vmwgfx_create_hw(struct vmwgfx_saa *vsaa, - return TRUE; - - out_no_damage: -- xa_surface_unref(hw); -+ xa_surface_destroy(hw); - return FALSE; - } - -@@ -1459,8 +1458,7 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry *entry) - */ - if (!vmwgfx_hw_accel_validate(pixmap, 0, XA_FLAG_SCANOUT, 0, NULL)) - goto out_err; -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) -+ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) - goto out_err; - depth = xa_format_depth(xa_surface_format(vpix->hw)); - -diff --git a/vmwgfx/vmwgfx_saa.h b/vmwgfx/vmwgfx_saa.h -index d8aa3d3..5e1f40c 100644 ---- a/vmwgfx/vmwgfx_saa.h -+++ b/vmwgfx/vmwgfx_saa.h -@@ -115,4 +115,16 @@ vmwgfx_saa_set_master(ScreenPtr pScreen); - void - vmwgfx_saa_drop_master(ScreenPtr pScreen); - -+#if (XA_TRACKER_VERSION_MAJOR <= 1) && !defined(HAVE_XA_2) -+ -+#define _xa_surface_handle(_a, _b, _c) xa_surface_handle(_a, _b, _c) -+#define xa_context_flush(_a) -+ -+#else -+ -+#define xa_surface_destroy(_a) xa_surface_unref(_a) -+#define _xa_surface_handle(_a, _b, _c) \ -+ xa_surface_handle(_a, xa_handle_type_shared, _b, _c) -+ -+#endif /* (XA_TRACKER_VERSION_MAJOR <= 1) */ - #endif -diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c -index 3ba40ef..9fd8f22 100644 ---- a/vmwgfx/vmwgfx_tex_video.c -+++ b/vmwgfx/vmwgfx_tex_video.c -@@ -199,7 +199,7 @@ stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown) - for (i=0; i<3; ++i) { - for (j=0; j<2; ++j) { - if (priv->yuv[i]) { -- xa_surface_unref(priv->yuv[j][i]); -+ xa_surface_destroy(priv->yuv[j][i]); - priv->yuv[j][i] = NULL; - } - } --- -1.8.5.1 - - -From c36cbcefb8526944141eb431e1e736dc4485a36e Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 9 Dec 2013 00:19:55 -0800 -Subject: [PATCH 08/11] vmwgfx: Remove stray 1 - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_saa.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 1459933..28819c1 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -1230,7 +1230,7 @@ vmwgfx_operation_complete(struct saa_driver *driver, - */ - - if (vpix->hw && vpix->hw_is_dri2_fronts) { -- if (1 && pScrn->vtSema && -+ if (pScrn->vtSema && - vmwgfx_upload_to_hw(driver, pixmap, &spix->dirty_shadow)) { - - REGION_EMPTY(vsaa->pScreen, &spix->dirty_shadow); --- -1.8.5.1 - - -From 4af6062ce281a7f4aaa50985fe757e9569208ee1 Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 11 Dec 2013 04:59:49 -0800 -Subject: [PATCH 09/11] Revert "vmwgfx: Get rid of device-specific DMA code" - -This reverts commit 45b2457516a9db4bd1d60fbb24a1efbe2d9dd932. - -Reverting this because using direct DMA for shared pixmaps should -boost performance. It should be usable both in a composited environment -and when running hosted. Need to retest the DMA flaws I saw before disabling -this code. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_drmi.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++ - vmwgfx/vmwgfx_drmi.h | 5 +++ - vmwgfx/vmwgfx_saa.c | 53 ++++++++++++------------ - vmwgfx/vmwgfx_saa_priv.h | 1 + - 4 files changed, 136 insertions(+), 26 deletions(-) - -diff --git a/vmwgfx/vmwgfx_drmi.c b/vmwgfx/vmwgfx_drmi.c -index 1e23f4a..496a16b 100644 ---- a/vmwgfx/vmwgfx_drmi.c -+++ b/vmwgfx/vmwgfx_drmi.c -@@ -284,6 +284,109 @@ vmwgfx_dmabuf_destroy(struct vmwgfx_dmabuf *buf) - } - - int -+vmwgfx_dma(unsigned int host_x, unsigned int host_y, -+ RegionPtr region, struct vmwgfx_dmabuf *buf, -+ uint32_t buf_pitch, uint32_t surface_handle, int to_surface) -+{ -+ BoxPtr clips = REGION_RECTS(region); -+ unsigned int num_clips = REGION_NUM_RECTS(region); -+ struct drm_vmw_execbuf_arg arg; -+ struct drm_vmw_fence_rep rep; -+ int ret; -+ unsigned int size; -+ unsigned i; -+ SVGA3dCopyBox *cb; -+ SVGA3dCmdSurfaceDMASuffix *suffix; -+ SVGA3dCmdSurfaceDMA *body; -+ struct vmwgfx_int_dmabuf *ibuf = vmwgfx_int_dmabuf(buf); -+ -+ struct { -+ SVGA3dCmdHeader header; -+ SVGA3dCmdSurfaceDMA body; -+ SVGA3dCopyBox cb; -+ } *cmd; -+ -+ if (num_clips == 0) -+ return 0; -+ -+ size = sizeof(*cmd) + (num_clips - 1) * sizeof(cmd->cb) + -+ sizeof(*suffix); -+ cmd = malloc(size); -+ if (!cmd) -+ return -1; -+ -+ cmd->header.id = SVGA_3D_CMD_SURFACE_DMA; -+ cmd->header.size = sizeof(cmd->body) + num_clips * sizeof(cmd->cb) + -+ sizeof(*suffix); -+ cb = &cmd->cb; -+ -+ suffix = (SVGA3dCmdSurfaceDMASuffix *) &cb[num_clips]; -+ suffix->suffixSize = sizeof(*suffix); -+ suffix->maximumOffset = (uint32_t) -1; -+ suffix->flags.discard = 0; -+ suffix->flags.unsynchronized = 0; -+ suffix->flags.reserved = 0; -+ -+ body = &cmd->body; -+ body->guest.ptr.gmrId = buf->gmr_id; -+ body->guest.ptr.offset = buf->gmr_offset; -+ body->guest.pitch = buf_pitch; -+ body->host.sid = surface_handle; -+ body->host.face = 0; -+ body->host.mipmap = 0; -+ -+ body->transfer = (to_surface ? SVGA3D_WRITE_HOST_VRAM : -+ SVGA3D_READ_HOST_VRAM); -+ -+ -+ for (i=0; i < num_clips; i++, cb++, clips++) { -+ cb->x = (uint16_t) clips->x1 + host_x; -+ cb->y = (uint16_t) clips->y1 + host_y; -+ cb->z = 0; -+ cb->srcx = (uint16_t) clips->x1; -+ cb->srcy = (uint16_t) clips->y1; -+ cb->srcz = 0; -+ cb->w = (uint16_t) (clips->x2 - clips->x1); -+ cb->h = (uint16_t) (clips->y2 - clips->y1); -+ cb->d = 1; -+#if 0 -+ LogMessage(X_INFO, "DMA! x: %u y: %u srcx: %u srcy: %u w: %u h: %u %s\n", -+ cb->x, cb->y, cb->srcx, cb->srcy, cb->w, cb->h, -+ to_surface ? "to" : "from"); -+#endif -+ -+ } -+ -+ memset(&arg, 0, sizeof(arg)); -+ memset(&rep, 0, sizeof(rep)); -+ -+ rep.error = -EFAULT; -+ arg.fence_rep = ((to_surface) ? 0UL : (unsigned long)&rep); -+ arg.commands = (unsigned long)cmd; -+ arg.command_size = size; -+ arg.throttle_us = 0; -+ arg.version = DRM_VMW_EXECBUF_VERSION; -+ -+ ret = drmCommandWrite(ibuf->drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg)); -+ if (ret) { -+ LogMessage(X_ERROR, "DMA error %s.\n", strerror(-ret)); -+ } -+ -+ free(cmd); -+ -+ if (rep.error == 0) { -+ ret = vmwgfx_fence_wait(ibuf->drm_fd, rep.handle, TRUE); -+ if (ret) { -+ LogMessage(X_ERROR, "DMA from host fence wait error %s.\n", -+ strerror(-ret)); -+ vmwgfx_fence_unref(ibuf->drm_fd, rep.handle); -+ } -+ } -+ -+ return 0; -+} -+ -+int - vmwgfx_get_param(int drm_fd, uint32_t param, uint64_t *out) - { - struct drm_vmw_getparam_arg gp_arg; -diff --git a/vmwgfx/vmwgfx_drmi.h b/vmwgfx/vmwgfx_drmi.h -index fff728a..2435009 100644 ---- a/vmwgfx/vmwgfx_drmi.h -+++ b/vmwgfx/vmwgfx_drmi.h -@@ -60,6 +60,11 @@ extern void - vmwgfx_dmabuf_unmap(struct vmwgfx_dmabuf *buf); - - extern int -+vmwgfx_dma(unsigned int host_x, unsigned int host_y, -+ RegionPtr region, struct vmwgfx_dmabuf *buf, -+ uint32_t buf_pitch, uint32_t surface_handle, int to_surface); -+ -+extern int - vmwgfx_num_streams(int drm_fd, uint32_t *ntot, uint32_t *nfree); - - extern int -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 28819c1..96275a5 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -285,40 +285,40 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - Bool to_hw) - { - struct vmwgfx_saa_pixmap *vpix = vmwgfx_saa_pixmap(pixmap); -- void *data = vpix->malloc; -- int ret; - - if (!vpix->hw || (!vpix->gmr && !vpix->malloc)) - return TRUE; - -+ if (vpix->gmr && vsaa->can_optimize_dma) { -+ uint32_t handle, dummy; - -- if (vpix->gmr) { -- data = vmwgfx_dmabuf_map(vpix->gmr); -- if (!data) -+ if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -+ &handle, &dummy) != 0) - goto out_err; -- } -- -- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -- (int) to_hw, -- (struct xa_box *) REGION_RECTS(reg), -- REGION_NUM_RECTS(reg)); -- if (vpix->gmr) -- vmwgfx_dmabuf_unmap(vpix->gmr); -- -- if (ret) -- goto out_err; -+ if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, -+ to_hw) != 0) -+ goto out_err; -+ } else { -+ void *data = vpix->malloc; -+ int ret; - -- ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -- (int) to_hw, -- (struct xa_box *) REGION_RECTS(reg), -- REGION_NUM_RECTS(reg)); -- if (to_hw) -- xa_context_flush(vsaa->xa_ctx); -- if (vpix->gmr) -- vmwgfx_dmabuf_unmap(vpix->gmr); -- if (ret) -- goto out_err; -+ if (vpix->gmr) { -+ data = vmwgfx_dmabuf_map(vpix->gmr); -+ if (!data) -+ goto out_err; -+ } - -+ ret = xa_surface_dma(vsaa->xa_ctx, vpix->hw, data, pixmap->devKind, -+ (int) to_hw, -+ (struct xa_box *) REGION_RECTS(reg), -+ REGION_NUM_RECTS(reg)); -+ if (to_hw) -+ xa_context_flush(vsaa->xa_ctx); -+ if (vpix->gmr) -+ vmwgfx_dmabuf_unmap(vpix->gmr); -+ if (ret) -+ goto out_err; -+ } - return TRUE; - out_err: - LogMessage(X_ERROR, "DMA %s surface failed.\n", -@@ -1377,6 +1377,7 @@ vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat, - vsaa->xa_ctx = xa_context_default(xat); - vsaa->drm_fd = drm_fd; - vsaa->present_flush = present_flush; -+ vsaa->can_optimize_dma = FALSE; - vsaa->use_present_opt = direct_presents; - vsaa->only_hw_presents = only_hw_presents; - vsaa->rendercheck = rendercheck; -diff --git a/vmwgfx/vmwgfx_saa_priv.h b/vmwgfx/vmwgfx_saa_priv.h -index f5f45ba..16583b0 100644 ---- a/vmwgfx/vmwgfx_saa_priv.h -+++ b/vmwgfx/vmwgfx_saa_priv.h -@@ -50,6 +50,7 @@ struct vmwgfx_saa { - int ydiff; - RegionRec present_region; - uint32_t src_handle; -+ Bool can_optimize_dma; - Bool use_present_opt; - Bool only_hw_presents; - Bool rendercheck; --- -1.8.5.1 - - -From 93228f3dd3355a25583d22dbb96791678b93be3e Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Wed, 11 Dec 2013 06:54:02 -0800 -Subject: [PATCH 10/11] vmwgfx: Really allow XA version 2. - -When XA starts to correctly advertise version 2, we didn't allow it. -Fix this. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: Jakob Bornecrantz ---- - vmwgfx/vmwgfx_driver.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c -index 6301c29..4e28097 100644 ---- a/vmwgfx/vmwgfx_driver.c -+++ b/vmwgfx/vmwgfx_driver.c -@@ -79,7 +79,7 @@ typedef uint8_t uint8; - - #define XA_VERSION_MINOR_REQUIRED 0 - #define XA_VERSION_MAJOR_REQUIRED 1 --#define XA_VERSION_MAJOR_COMPAT 1 -+#define XA_VERSION_MAJOR_COMPAT 2 - - #define DRM_VERSION_MAJOR_REQUIRED 2 - #define DRM_VERSION_MINOR_REQUIRED 3 --- -1.8.5.1 - - -From f45a551e9b70ccec8f92df02747d4e2af299cf8c Mon Sep 17 00:00:00 2001 -From: Thomas Hellstrom -Date: Mon, 16 Dec 2013 10:38:21 +0100 -Subject: [PATCH 11/11] vmwgfx: Fix compile breakage on XA version 1. - -A recent revert brought back code that assumed XA version 2. - -Signed-off-by: Thomas Hellstrom -Reviewed-by: trivial ---- - vmwgfx/vmwgfx_saa.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c -index 96275a5..e76bd09 100644 ---- a/vmwgfx/vmwgfx_saa.c -+++ b/vmwgfx/vmwgfx_saa.c -@@ -292,8 +292,7 @@ vmwgfx_saa_dma(struct vmwgfx_saa *vsaa, - if (vpix->gmr && vsaa->can_optimize_dma) { - uint32_t handle, dummy; - -- if (xa_surface_handle(vpix->hw, xa_handle_type_shared, -- &handle, &dummy) != 0) -+ if (_xa_surface_handle(vpix->hw, &handle, &dummy) != 0) - goto out_err; - if (vmwgfx_dma(0, 0, reg, vpix->gmr, pixmap->devKind, handle, - to_hw) != 0) --- -1.8.5.1 - diff --git a/x11-drivers/xf86-video-vmware/metadata.xml b/x11-drivers/xf86-video-vmware/metadata.xml deleted file mode 100644 index 8a4ab6d16..000000000 --- a/x11-drivers/xf86-video-vmware/metadata.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - x11 - - dev-zero@gentoo.org - Tiziano Müller - - diff --git a/x11-drivers/xf86-video-vmware/xf86-video-vmware-13.0.1.ebuild b/x11-drivers/xf86-video-vmware/xf86-video-vmware-13.0.1.ebuild deleted file mode 100644 index f4da2df55..000000000 --- a/x11-drivers/xf86-video-vmware/xf86-video-vmware-13.0.1.ebuild +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -EAPI=5 - -XORG_DRI=always -inherit xorg-2 - -DESCRIPTION="VMware SVGA video driver" -KEYWORDS="~amd64 ~x86 ~x86-fbsd" -IUSE="" - -RDEPEND="x11-libs/libdrm[libkms,video_cards_vmware] - >=media-libs/mesa-10[xa]" -DEPEND="${RDEPEND}" - -PATCHES=( - "${FILESDIR}"/0*.patch -)