[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-vmware: Changes to 'upstream-unstable'



 configure.ac               |    4 +-
 saa/saa.c                  |    2 -
 saa/saa_unaccel.c          |   44 +++++++++++++++++++++++--------
 src/vmware.c               |    8 ++---
 src/vmware_bootstrap.c     |   62 ++++++++++++++++++++++++++++++++++++++++++---
 src/vmwarevideo.c          |   16 +++++++++--
 vmwgfx/vmwgfx_crtc.c       |   22 +++++++++++++++
 vmwgfx/vmwgfx_driver.c     |   37 ++++++++++++++++++++++----
 vmwgfx/vmwgfx_driver.h     |    2 +
 vmwgfx/vmwgfx_overlay.c    |   29 +++++++++++++--------
 vmwgfx/vmwgfx_saa.c        |   17 +++++++-----
 vmwgfx/vmwgfx_saa_priv.h   |   11 +++++++
 vmwgfx/vmwgfx_xa_surface.c |   61 +++++++++++++++++++++++++++++++++++++++-----
 vmwgfx/vmwgfx_xmir.c       |    6 ++++
 vmwgfx/vmwgfx_xwayland.c   |    2 -
 15 files changed, 267 insertions(+), 56 deletions(-)

New commits:
commit 891ee48e4c1baa2643eda048b4207f8263a37dca
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Mon Jan 19 11:23:50 2015 +0100

    vmware: Bump version number for release
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/configure.ac b/configure.ac
index be40ed7..97f2f85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-vmware],
-        [13.0.2],
+        [13.1.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-vmware])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 79289b0ffc553ded902eea7b8b9803b098f340e3
Author: Adam Jackson <ajax@redhat.com>
Date:   Thu Dec 4 10:35:04 2014 -0500

    saa: Adapt to GC client clip changes in xserver 1.17
    
    1.17 always stores the client clip as a region, so there's no longer a
    clientClipType member to look at.  Change the code to just inspect
    whether the clientClip is non-null, since that works both before and
    after 1.17.
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/saa/saa.c b/saa/saa.c
index f2d68e9..be9520e 100644
--- a/saa/saa.c
+++ b/saa/saa.c
@@ -349,7 +349,7 @@ saa_gc_reads_destination(DrawablePtr pDrawable, GCPtr pGC)
 {
     return ((pGC->alu != GXcopy && pGC->alu != GXclear && pGC->alu != GXset &&
 	     pGC->alu != GXcopyInverted) || pGC->fillStyle == FillStippled ||
-	    pGC->clientClipType != CT_NONE ||
+	    pGC->clientClip != NULL ||
 	    !SAA_PM_IS_SOLID(pDrawable, pGC->planemask));
 }
 

commit 4664412d7a5266d2b392957406b34abc5db95e48
Author: Stefan Dirsch <sndirsch@suse.de>
Date:   Tue Oct 7 11:29:32 2014 +0200

    xf86xv.h cannot be included without first including xorg-server.h.
    
    Without this the build fails on systems with the latest glibc,
    throwing this error:
    
    In file included from /usr/include/string.h:634:0,
                     from /usr/include/xorg/os.h:53,
                     from /usr/include/xorg/misc.h:115,
                     from /usr/include/xorg/screenint.h:50,
                     from /usr/include/xorg/scrnintstr.h:50,
                     from /usr/include/xorg/xvdix.h:55,
                     from /usr/include/xorg/xf86xv.h:32,
                     from vmwgfx_overlay.c:38:
    /usr/include/xorg/os.h:579:1: error: expected identifier or '(' before '__extension__'
    strndup(const char *str, size_t n);
    
    This is caused by HAVE_STRNDUP not being set (it is set from xorg-server.h),
    causing os.h to redefine it.
    
    Signed-off-by: Stefan Dirsch <sndirsch@suse.de>
    Reviewed-by: Daniel Stone <daniels@collabora.com>
    Acked-by: Thomas Hellstrom <thellstrom@vmware.com>

diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c
index ef1d541..2b05b0e 100644
--- a/vmwgfx/vmwgfx_overlay.c
+++ b/vmwgfx/vmwgfx_overlay.c
@@ -35,6 +35,7 @@
  */
 
 
+#include "xorg-server.h"
 #include "xf86xv.h"
 #include "fourcc.h"
 #define debug_printf(...)

commit 8e1c4e5bd521ec2d4f1a21da432f110c606b3fde
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Mon Sep 22 12:09:13 2014 +0200

    vmware/saa: Fix saa_check_poly_fill_rect_noreadback v2
    
    We were not clipping the dirty region correctly, Fix this.
    Also actually do what the comment in the function says: If there are more than
    an ad-hoc number of rectangles to read back, then revert to the default
    saa_check_poly_fill_rect function that reads back the whole damage region.
    
    v2: Fix commit log message.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Sinclair Yeh <syeh@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/saa/saa_unaccel.c b/saa/saa_unaccel.c
index 08a64b0..cff0587 100644
--- a/saa/saa_unaccel.c
+++ b/saa/saa_unaccel.c
@@ -421,17 +421,20 @@ saa_check_poly_fill_rect_noreadback(DrawablePtr pDrawable, GCPtr pGC,
     if (!region)
 	goto out_no_region;
 
-    REGION_TRANSLATE(pGC->pScreen, region, xoff + pDrawable->x,
-		     yoff + pDrawable->y);
-
+    REGION_TRANSLATE(pGC->pScreen, region, pDrawable->x, pDrawable->y);
+    REGION_INTERSECT(pGC->pScreen, region, fbGetCompositeClip(pGC), region);
+    REGION_TRANSLATE(pGC->pScreen, region, xoff, yoff);
 
     access = SAA_ACCESS_W;
     if (saa_gc_reads_destination(pDrawable, pGC)) {
 	/*
 	 * We need to do a readback anyway. In case of more than an
-	 * ad hoc number of say 10 rectangles, we might as well do a
+	 * ad hoc number of say 4 rectangles, we might as well do a
 	 * readback of the whole damage area to avoid fragmentation.
 	 */
+	if (REGION_NUM_RECTS(region) > 4)
+	    goto out_no_access;
+
 	access |= SAA_ACCESS_R;
 	ret = saa_prepare_access_pixmap(pPixmap, access, region);
     } else
@@ -451,13 +454,8 @@ saa_check_poly_fill_rect_noreadback(DrawablePtr pDrawable, GCPtr pGC,
     saa_finish_access_pixmap(pPixmap, access);
 
     if (spix->damage) {
-	/*
-	 * Not sure why the region can be larger than the pending damage region
-	 * at this point, (happens on clipped-away drawables). To avoid potential
-	 * rendering problems, we clip to the pending damage region.
-	 */
-	REGION_INTERSECT(pGC->pScreen, region, region, saa_pix_damage_pending(spix));
-
+	REGION_INTERSECT(pGC->pScreen, region, region,
+			 saa_pix_damage_pending(spix));
 	saa_pixmap_dirty(pPixmap, FALSE, region);
     }
 

commit c23fd33d8ce8491891255d93c04e053bf333bd4e
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Mon Sep 22 11:43:02 2014 +0200

    vmware/saa: Fix saa_check_copy_window dirty region v3
    
    The saa_check_copy_window could dirty regions that were never touched, since
    we were using the X server provided damage region rather than the more
    detailed region actually copied. This would have been OK if we had first done
    a read-back of the region to be dirtied, but since we want to avoid that,
    instead compute the detailed destination region and use that for dirtying.
    
    This fixes rendering glitches seen with motif applications.
    
    v2: Fix whitespace error.
    v3: Move dirty region computation.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Sinclair Yeh <syeh@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/saa/saa_unaccel.c b/saa/saa_unaccel.c
index e2bf3ac..08a64b0 100644
--- a/saa/saa_unaccel.c
+++ b/saa/saa_unaccel.c
@@ -617,10 +617,32 @@ saa_check_copy_window(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 	goto out_no_access;;
 
     if (saa_prepare_access_pixmap(pPixmap, SAA_ACCESS_W, NULL)) {
+	struct saa_pixmap *spix;
+	RegionRec rgnDst;
+
+	REGION_NULL(pScreen, &rgnDst);
+	REGION_COPY(pScreen, &rgnDst, prgnSrc);
+
 	saa_swap(sscreen, pScreen, CopyWindow);
 	pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
 	saa_swap(sscreen, pScreen, CopyWindow);
-	saa_fad_write(pDrawable, SAA_ACCESS_W);
+	saa_finish_access_pixmap(pPixmap, SAA_ACCESS_W);
+
+	spix = saa_get_saa_pixmap(pPixmap);
+	if (spix->damage) {
+	    int dx, dy;
+
+	    dx = ptOldOrg.x - pWin->drawable.x;
+	    dy = ptOldOrg.y - pWin->drawable.y;
+	    REGION_TRANSLATE(pScreen, &rgnDst, -dx, -dy);
+	    REGION_INTERSECT(pSreen, &rgnDst, &pWin->borderClip, &rgnDst);
+	    REGION_TRANSLATE(pScreen, &rgnDst, xoff, yoff);
+
+	    REGION_INTERSECT(pScreen, &rgnDst, &rgnDst,
+			     saa_pix_damage_pending(spix));
+	    saa_pixmap_dirty(pPixmap, FALSE, &rgnDst);
+	}
+	REGION_UNINIT(pScreen, &rgnDst);
     }
     saa_fad_read(pDrawable);
  out_no_access:

commit f86434ac69bd288c7fba65d178c22a91a0f4f6c2
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Mon Sep 15 15:13:53 2014 +0200

    Revert "vmware/saa: Disable the noreadback polyfillrect optimization"
    
    This reverts commit 88c487cb19aaf2882d582f7f887a52935ef8d92e.
    
    While the commit made the rendering artefacts less frequent, they didn't
    disappear completely and are likely caused by something else, so revert this
    commit.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Acked-by: Sinclair Yeh <syeh@vmware.com>

diff --git a/saa/saa_unaccel.c b/saa/saa_unaccel.c
index deaeb8b..e2bf3ac 100644
--- a/saa/saa_unaccel.c
+++ b/saa/saa_unaccel.c
@@ -396,7 +396,6 @@ saa_check_poly_arc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * pArcs)
  * region fragmentation. In any case, this greatly improves on the performance of
  * shaped windows on top of accelerated contents, for example unscaled OSD in xine.
  */
-#if 0
 static Bool
 saa_check_poly_fill_rect_noreadback(DrawablePtr pDrawable, GCPtr pGC,
 				    int nrect, xRectangle *prect)
@@ -477,7 +476,7 @@ saa_check_poly_fill_rect_noreadback(DrawablePtr pDrawable, GCPtr pGC,
 
     return FALSE;
 }
-#endif
+
 void
 saa_check_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC,
 			 int nrect, xRectangle * prect)
@@ -488,17 +487,8 @@ saa_check_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC,
 
     SAA_FALLBACK(("to %p (%c)\n", pDrawable, saa_drawable_loc(pDrawable)));
 
-
-    /*
-     * Disable saa_check_poly_fill_rect_noreadback as it causes rendering
-     * artefacts with some motif applications. There seems to be some
-     * confusion with the damage area.
-     */
-
-#if 0
     if (saa_check_poly_fill_rect_noreadback(pDrawable, pGC, nrect, prect))
 	return;
-#endif
 
     sscreen->fallback_count++;
 

commit 8545a166931617af0d2a9ca8175fd8b11c67e246
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Tue Sep 9 01:59:07 2014 -0700

    vmware/vmwgfx: Fix cursor problem with multimon
    
    In a multimon environment, the cursor would sometimes disappear on the
    newly enabled screen. Fix this.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/vmwgfx/vmwgfx_crtc.c b/vmwgfx/vmwgfx_crtc.c
index 4f9cdda..dad8815 100644
--- a/vmwgfx/vmwgfx_crtc.c
+++ b/vmwgfx/vmwgfx_crtc.c
@@ -213,6 +213,15 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
     crtc->active = TRUE;
 #endif
 
+    /*
+     * Strictly, this needs to be done only once per configuration change,
+     * not once per crtc, but there's no better place to put this. Since
+     * Intel wrote the crtc code, let's do what the xf86-video-intel driver
+     * does.
+     */
+    if (pScreen)
+	xf86_reload_cursors(pScreen);
+
     return TRUE;
 }
 

commit 32562129750077a23f26f2e69adc8403eb24bf3f
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Sep 3 07:08:41 2014 -0700

    vmware/vmwgfx: Don't add pixmaps to the pixmap list if they're already on it
    
    This could cause loops through the list to spin indefinitely.
    This would most likely occur at VT switches.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/vmwgfx/vmwgfx_saa.c b/vmwgfx/vmwgfx_saa.c
index b9204c6..bca3d93 100644
--- a/vmwgfx/vmwgfx_saa.c
+++ b/vmwgfx/vmwgfx_saa.c
@@ -694,7 +694,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);
+    if (WSBMLISTEMPTY(&vpix->pixmap_list))
+	WSBMLISTADDTAIL(&vpix->pixmap_list, &vsaa->pixmaps);
 
     return TRUE;
 

commit 8b6316a312689d83ca8f8de939698bc137206f58
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Thu Aug 28 15:32:45 2014 +0200

    vmware/legacy: Fix overlay related compile breakage on earlier X servers
    
    Introduced by commit:
    vmware/legacy: Apply same fix to auto colrkey fill
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c
index 816f1ca..634af69 100644
--- a/src/vmwarevideo.c
+++ b/src/vmwarevideo.c
@@ -58,6 +58,10 @@
      ((GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) == 1) && \
       (GET_ABI_MINOR(ABI_VIDEODRV_VERSION) >= 2)))
 
+#if HAVE_FILLKEYHELPERDRAWABLE
+#include <damage.h>
+#endif
+
 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
 
 /*

commit 8a47e9a45036005d46a60cf8df366baffcb9a8d1
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Thu Aug 28 13:43:03 2014 +0200

    vmware: Fix bootstrap related compile errors on earlier X servers
    
    Introduced by commit
    Add support for XSERVER_PLATFORM_BUS
    
    Note that the vmware DriverRec declaration can be cleaned up
    considerably using C99 designated initializers. Perhaps something for
    the next release...
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c
index 1635876..d7ab070 100644
--- a/src/vmware_bootstrap.c
+++ b/src/vmware_bootstrap.c
@@ -30,7 +30,6 @@
 #endif
 
 #include "xf86.h"
-#include <xorgVersion.h>
 #include "compiler.h"
 #include "xf86Pci.h"		/* pci */
 #include "vm_device_version.h"
@@ -497,7 +496,7 @@ VMWareDriverFunc(ScrnInfoPtr pScrn,
 			      pScrn->yDpi / 2) / pScrn->yDpi;
       }
       return TRUE;
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,902,0)
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 18
    case SUPPORTS_SERVER_FDS:
       return TRUE;
 #endif
@@ -523,6 +522,7 @@ _X_EXPORT DriverRec vmware = {
 #if VMWARE_DRIVER_FUNC
     VMWareDriverFunc,
 #endif
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 4
 #if XSERVER_LIBPCIACCESS
     VMwareDeviceMatch,
     VMwarePciProbe,
@@ -530,11 +530,14 @@ _X_EXPORT DriverRec vmware = {
     NULL,
     NULL,
 #endif
+#endif
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 13
 #ifdef XSERVER_PLATFORM_BUS
     VMwarePlatformProbe,
 #else
     NULL,
 #endif
+#endif
 };
 
 

commit f5d8c8f1fe2de727018600f471b6a8829fe492ad
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Aug 20 13:02:58 2014 +0200

    vmware: Clear the PITCHLOCK register if available before modeset
    
    In some situations the fbdev driver may have set this register before legacy
    driver startup causing a weird-looking desktop. Make sure this register
    is cleared on each modeset.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmware.c b/src/vmware.c
index 17434ab..12f12ed 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -375,7 +375,8 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
 #ifdef ACCELERATE_OPS
     pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES);
 #else
-    pVMWARE->vmwareCapability = 0;
+    pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES) &
+	SVGA_CAP_PITCHLOCK;
 #endif
 
     pVMWARE->bitsPerPixel = vmwareReadReg(pVMWARE,
@@ -858,6 +859,8 @@ VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool rebuildPixmap)
         return FALSE;
     pScrn->vtSema = TRUE;
 
+    if (pVMWARE->vmwareCapability & SVGA_CAP_PITCHLOCK)
+	vmwareWriteReg(pVMWARE, SVGA_REG_PITCHLOCK, 0);
     vmwareReg->svga_reg_enable = 1;
     vmwareReg->svga_reg_width = max(mode->HDisplay, pScrn->virtualX);
     vmwareReg->svga_reg_height = max(mode->VDisplay, pScrn->virtualY);

commit b1697434348799b0808a6c9e9a899394075b980c
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Thu Aug 14 16:42:05 2014 +0200

    vmware/legacy: Fix out of bound array indexing
    
    Spotted by coverity.
    
    Reported-by: Adam Jackson <ajax@redhat.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c
index 261e579..816f1ca 100644
--- a/src/vmwarevideo.c
+++ b/src/vmwarevideo.c
@@ -837,7 +837,7 @@ vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
     cmdSetRegs.body.streamId = pVid->streamId;
 
     items = cmdSetRegs.body.items;
-    for (i = SVGA_VIDEO_ENABLED; i < SVGA_VIDEO_NUM_REGS; i++) {
+    for (i = SVGA_VIDEO_ENABLED; i < SVGA_VIDEO_DATA_GMRID; i++) {
         items[i].regId = i;
     }
 

commit 0825d98744b20a20af7bd81d347334ab4a1de015
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Sat Aug 9 00:19:17 2014 +0200

    vmware/vmwgfx: Fix compilation issue on older X servers
    
    Introduced in 268307 "Add support for server managed fds"
    
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index 03103a8..2925227 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -491,8 +491,10 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
 	goto out_err_bus;
     }
 
+#ifdef XSERVER_PLATFORM_BUS
     if (pEnt->location.type == BUS_PLATFORM)
         ms->platform_dev = pEnt->location.id.plat;
+#endif
 
     xf86SetPrimInitDone(pScrn->entityList[0]);
 

commit 0a212afefd8670a1823c9b6474de8bf26d33bdeb
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Fri Aug 8 21:37:38 2014 +0200

    vmware/legacy: Fix uninitialized values in video commands
    
    Fixed bug where video stopped working on systems that didn't have the new kms
    enabled kernel driver installed. Found on CentOS 6.4.
    
    After updating the register header SVGA_VIDEO_NUM_REGS value got upped by two
    in order to support GMR and Screen Objects. Since this path is mostly used
    on older hosts that may not support them, don't send them at all.
    
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c
index a82110d..261e579 100644
--- a/src/vmwarevideo.c
+++ b/src/vmwarevideo.c
@@ -794,7 +794,8 @@ vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
     struct PACKED _body {
         uint32 escape;
         uint32 streamId;
-        struct _item items[SVGA_VIDEO_NUM_REGS];
+        /* Old hosts can not handle more then these regs */
+        struct _item items[SVGA_VIDEO_DATA_GMRID];
     };
 
     struct PACKED _cmdSetRegs {

commit 0a596fd0c92fdcf73071869a59029263a2596018
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Wed Jul 2 14:21:45 2014 +0200

    vmware/vmwgfx: Fix an error path segfault
    
    Part of freedesktop.org bugzilla bug #80645
    If taking a scanout reference on a pixmap fails, the
    struct vmwgfx_screen_entry::pixmap pointer must be set to NULL, otherwise
    the driver will incorrectly attempt to remove the scanout reference in the
    error path, causing a segfault.
    
    This problem is seen in the above-mentioned bug, but it is not the root
    cause of the problem. With this patch applied, the server will terminate
    cleanly instead of segfaulting.
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/vmwgfx/vmwgfx_crtc.c b/vmwgfx/vmwgfx_crtc.c
index 5fce5f7..4f9cdda 100644
--- a/vmwgfx/vmwgfx_crtc.c
+++ b/vmwgfx/vmwgfx_crtc.c
@@ -193,6 +193,7 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	crtcp->entry.pixmap = pixmap;
 	crtcp->scanout_id = vmwgfx_scanout_ref(&crtcp->entry);
 	if (crtcp->scanout_id == -1) {
+	    crtcp->entry.pixmap = NULL;
 	    LogMessage(X_ERROR, "Failed to convert pixmap to scanout.\n");
 	    return FALSE;
 	}

commit 4e378a730d2d2deffc915af2a3d013d2a994a1b0
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Wed May 21 11:52:29 2014 +0200

    vmware/legacy: Apply same fix to auto colorkey fill
    
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
    Reviewed-by: Thomas Hellström <thellstrom@vmware.com>

diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c
index 745c71f..a82110d 100644
--- a/src/vmwarevideo.c
+++ b/src/vmwarevideo.c
@@ -687,7 +687,12 @@ vmwareVideoInitStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid,
 	int nBoxes = REGION_NUM_RECTS(&pVid->clipBoxes);
 
 #if HAVE_FILLKEYHELPERDRAWABLE
-	xf86XVFillKeyHelperDrawable(draw, pVid->colorKey, clipBoxes);
+	if (draw->type == DRAWABLE_WINDOW) {
+	    xf86XVFillKeyHelperDrawable(draw, pVid->colorKey, clipBoxes);
+	    DamageDamageRegion(draw, clipBoxes);
+	} else {
+	    xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes);
+        }
 #else
         xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes);
 #endif

commit 82c9b0c1d34459c568d004521e3f35a69f5d7ae3
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Wed May 21 11:51:46 2014 +0200

    vmware/vmwgfx: Fix auto colorkey fill usage
    
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
    Reviewed-by: Thomas Hellström <thellstrom@vmware.com>

diff --git a/vmwgfx/vmwgfx_overlay.c b/vmwgfx/vmwgfx_overlay.c
index 2c0d7fa..ef1d541 100644
--- a/vmwgfx/vmwgfx_overlay.c
+++ b/vmwgfx/vmwgfx_overlay.c
@@ -162,7 +162,7 @@ struct vmwgfx_overlay_port
     int (*play)(ScrnInfoPtr, struct vmwgfx_overlay_port *,
                 short, short, short, short, short,
                 short, short, short, int, unsigned char*,
-                short, short, RegionPtr);
+                short, short, RegionPtr, DrawablePtr);
 
     /* values to go into the SVGAOverlayUnit */
     uint32 streamId;
@@ -217,13 +217,15 @@ static int vmw_video_port_init(ScrnInfoPtr pScrn,
                                short drw_y, short src_w, short src_h,
                                short drw_w, short drw_h, int format,
                                unsigned char *buf, short width,
-                               short height, RegionPtr clipBoxes);
+                               short height, RegionPtr clipBoxes,
+                               DrawablePtr pDraw);
 static int vmw_video_port_play(ScrnInfoPtr pScrn, struct vmwgfx_overlay_port *port,
                                short src_x, short src_y, short drw_x,
                                short drw_y, short src_w, short src_h,
                                short drw_w, short drw_h, int format,
                                unsigned char *buf, short width,
-                               short height, RegionPtr clipBoxes);
+                               short height, RegionPtr clipBoxes,
+                               DrawablePtr pDraw);
 static void vmw_video_port_cleanup(ScrnInfoPtr pScrn, struct vmwgfx_overlay_port *port);
 
 static int vmw_video_buffer_alloc(int drm_fd, int size,
@@ -380,7 +382,7 @@ vmw_video_port_init(ScrnInfoPtr pScrn, struct vmwgfx_overlay_port *port,
                     short drw_y, short src_w, short src_h,
                     short drw_w, short drw_h, int format,
                     unsigned char *buf, short width,
-                    short height, RegionPtr clipBoxes)
+                    short height, RegionPtr clipBoxes, DrawablePtr pDraw)
 {
     unsigned short w, h;
     int i, ret;
@@ -412,7 +414,7 @@ vmw_video_port_init(ScrnInfoPtr pScrn, struct vmwgfx_overlay_port *port,
     REGION_NULL(pScrn->pScreen, &port->clipBoxes);
     port->play = vmw_video_port_play;
     return port->play(pScrn, port, src_x, src_y, drw_x, drw_y, src_w, src_h,
-                      drw_w, drw_h, format, buf, width, height, clipBoxes);
+                      drw_w, drw_h, format, buf, width, height, clipBoxes, pDraw);
 
   out_no_buffer:
     while(i-- != 0) {
@@ -448,7 +450,7 @@ vmw_video_port_play(ScrnInfoPtr pScrn, struct vmwgfx_overlay_port *port,
                     short drw_y, short src_w, short src_h,
                     short drw_w, short drw_h, int format,
                     unsigned char *buf, short width,
-                    short height, RegionPtr clipBoxes)
+                    short height, RegionPtr clipBoxes, DrawablePtr pDraw)
 {
     struct drm_vmw_control_stream_arg arg;
     unsigned short w, h;
@@ -468,7 +470,7 @@ vmw_video_port_play(ScrnInfoPtr pScrn, struct vmwgfx_overlay_port *port,
         vmw_xv_stop_video(pScrn, port, TRUE);
         return port->play(pScrn, port, src_x, src_y, drw_x, drw_y, src_w,
                           src_h, drw_w, drw_h, format, buf, width, height,
-                          clipBoxes);
+                          clipBoxes, pDraw);
     }
 
     memcpy(port->bufs[port->currBuf].data, buf, port->size);
@@ -502,8 +504,14 @@ vmw_video_port_play(ScrnInfoPtr pScrn, struct vmwgfx_overlay_port *port,
      */
     if (!REGION_EQUAL(pScrn->pScreen, &port->clipBoxes, clipBoxes)) {
         REGION_COPY(pScrn->pScreen, &port->clipBoxes, clipBoxes);
-        if (port->isAutoPaintColorkey)
-            xf86XVFillKeyHelper(pScrn->pScreen, port->colorKey, clipBoxes);
+        if (port->isAutoPaintColorkey) {
+            if (pDraw->type == DRAWABLE_WINDOW) {
+                xf86XVFillKeyHelperDrawable(pDraw, port->colorKey, clipBoxes);
+                DamageDamageRegion(pDraw, clipBoxes);
+            } else {
+                xf86XVFillKeyHelper(pScrn->pScreen, port->colorKey, clipBoxes);
+            }
+        }
     }
 
     xorg_flush(pScrn->pScreen);
@@ -667,7 +675,7 @@ vmw_xv_put_image(ScrnInfoPtr pScrn, short src_x, short src_y,
 		 width, height);
 
     return port->play(pScrn, port, src_x, src_y, drw_x, drw_y, src_w, src_h,
-                      drw_w, drw_h, format, buf, width, height, clipBoxes);
+                      drw_w, drw_h, format, buf, width, height, clipBoxes, dst);
 }
 
 

commit 43e043868fbd74e28cd392a3665b36abdfe87de0
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Wed May 21 11:54:48 2014 +0200

    vmware/vmwgfx: A bit more error logging when handling cursors
    
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
    Reviewed-by: Thomas Hellström <thellstrom@vmware.com>

diff --git a/vmwgfx/vmwgfx_crtc.c b/vmwgfx/vmwgfx_crtc.c
index 3bc3b21..5fce5f7 100644
--- a/vmwgfx/vmwgfx_crtc.c
+++ b/vmwgfx/vmwgfx_crtc.c
@@ -300,8 +300,11 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image)
     if (!crtcp->cursor_bo) {
 	size_t size = 64*64*4;
         crtcp->cursor_bo = vmwgfx_dmabuf_alloc(ms->fd, size);
-	if (!crtcp->cursor_bo)
+	if (!crtcp->cursor_bo) {
+	    xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
+		       "Failed to create a dmabuf for cursor.\n");
 	    return;
+	}
 	crtcp->cursor_handle = crtcp->cursor_bo->handle;
     }
 
@@ -309,6 +312,9 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image)
     if (ptr) {
 	memcpy(ptr, image, 64*64*4);
 	vmwgfx_dmabuf_unmap(crtcp->cursor_bo);
+    } else {
+	xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
+		   "Failed to map cursor dmabuf.\n");
     }
 
     if (crtc->cursor_shown)

commit aa7309254808e27a4ac5d3dc674be179646280b5
Author: Jakob Bornecrantz <jakob@vmware.com>
Date:   Wed May 21 11:54:24 2014 +0200

    vmware/vmwgfx: Don't move cursors without images
    
    Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
    Reviewed-by: Thomas Hellström <thellstrom@vmware.com>

diff --git a/vmwgfx/vmwgfx_crtc.c b/vmwgfx/vmwgfx_crtc.c
index fec04c0..3bc3b21 100644
--- a/vmwgfx/vmwgfx_crtc.c
+++ b/vmwgfx/vmwgfx_crtc.c
@@ -276,6 +276,10 @@ crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
     modesettingPtr ms = modesettingPTR(crtc->scrn);
     struct crtc_private *crtcp = crtc->driver_private;
 
+    /* Seems like newer X servers try to move cursors without images */
+    if (!crtcp->cursor_bo)
+	return;
+
     drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y);
 }
 

commit e8d6facf34adf1c601a3afd0a984ce90ad8fe059
Author: Thomas Hellstrom <thellstrom@vmware.com>
Date:   Tue May 20 06:29:19 2014 -0700

    vmware/vmwgfx: Fix xwayland build on newer XA versions
    
    Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/vmwgfx/vmwgfx_xwayland.c b/vmwgfx/vmwgfx_xwayland.c
index a16a7c4..5e25666 100644
--- a/vmwgfx/vmwgfx_xwayland.c
+++ b/vmwgfx/vmwgfx_xwayland.c
@@ -62,7 +62,7 @@ vmwgfx_create_window_buffer(struct xwl_window *xwl_window,
      * surface.
      */
     vpix->hw_is_hosted = TRUE;
-    if (xa_surface_handle(vpix->hw, &name, &pitch) != XA_ERR_NONE)
+    if (_xa_surface_handle(vpix->hw, &name, &pitch) != XA_ERR_NONE)
 	return BadDrawable;
 
     return xwl_create_window_buffer_drm(xwl_window, pixmap, name);

commit 268307e85c06be27345a6808bcf2b3c9887bf8bc
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Tue May 6 16:33:21 2014 +0200

    Add support for server managed fds
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c
index b30cf2b..1635876 100644
--- a/src/vmware_bootstrap.c
+++ b/src/vmware_bootstrap.c
@@ -30,6 +30,7 @@
 #endif
 
 #include "xf86.h"
+#include <xorgVersion.h>
 #include "compiler.h"
 #include "xf86Pci.h"		/* pci */
 #include "vm_device_version.h"
@@ -496,6 +497,10 @@ VMWareDriverFunc(ScrnInfoPtr pScrn,
 			      pScrn->yDpi / 2) / pScrn->yDpi;
       }
       return TRUE;
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,902,0)
+   case SUPPORTS_SERVER_FDS:
+      return TRUE;
+#endif
    default:
       return FALSE;
    }
diff --git a/vmwgfx/vmwgfx_driver.c b/vmwgfx/vmwgfx_driver.c
index 7e5dc4e..03103a8 100644
--- a/vmwgfx/vmwgfx_driver.c
+++ b/vmwgfx/vmwgfx_driver.c
@@ -54,6 +54,10 @@
 
 #include <pciaccess.h>
 
+#ifdef XSERVER_PLATFORM_BUS
+#include "xf86platformBus.h"
+#endif
+
 #include "vmwgfx_driver.h"
 
 #include <saa.h>
@@ -243,6 +247,15 @@ static const xf86CrtcConfigFuncsRec crtc_config_funcs = {
     .resize = drv_crtc_resize
 };
 
+static Bool vmwgfx_use_server_fd(modesettingPtr ms)
+{
+#ifdef XF86_PDEV_SERVER_FD
+    return ms->platform_dev && (ms->platform_dev->flags & XF86_PDEV_SERVER_FD);
+#else
+    return FALSE;
+#endif
+}
+
 static Bool
 drv_init_drm(ScrnInfoPtr pScrn)
 {
@@ -253,6 +266,12 @@ drv_init_drm(ScrnInfoPtr pScrn)
 
 	ms->fd = vmwgfx_hosted_drm_fd(ms->hdriver, ms->hosted, ms->PciInfo);
 
+#ifdef ODEV_ATTRIB_FD
+	if (ms->fd < 0 && vmwgfx_use_server_fd(ms))
+	    ms->fd = xf86_get_platform_device_int_attrib(ms->platform_dev,
+	                                                 ODEV_ATTRIB_FD, -1);
+#endif
+
 	if (ms->fd < 0) {
 
 	    char bus_id[64];
@@ -472,6 +491,9 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
 	goto out_err_bus;
     }
 
+    if (pEnt->location.type == BUS_PLATFORM)
+        ms->platform_dev = pEnt->location.id.plat;
+
     xf86SetPrimInitDone(pScrn->entityList[0]);
 
     ms->hdriver = vmwgfx_hosted_detect();
@@ -605,7 +627,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
     free(ms->Options);
   out_depth:
   out_drm_version:
-    if (!vmwgfx_is_hosted(ms->hdriver))
+    if (!vmwgfx_is_hosted(ms->hdriver) && !vmwgfx_use_server_fd(ms))
 	close(ms->fd);
   out_no_drm:
     vmwgfx_hosted_destroy(ms->hdriver, ms->hosted);
@@ -783,8 +805,8 @@ drv_set_master(ScrnInfoPtr pScrn)
 {
     modesettingPtr ms = modesettingPTR(pScrn);
 
-    if (!vmwgfx_is_hosted(ms->hdriver) && !ms->isMaster &&
-	drmSetMaster(ms->fd) != 0) {
+    if (!vmwgfx_is_hosted(ms->hdriver) && !vmwgfx_use_server_fd(ms) &&
+            !ms->isMaster && drmSetMaster(ms->fd) != 0) {
 	if (errno == EINVAL) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		       "drmSetMaster failed: 2.6.29 or newer kernel required for "
@@ -1184,7 +1206,8 @@ drv_leave_vt(VT_FUNC_ARGS_DECL)
 
     vmwgfx_saa_drop_master(pScrn->pScreen);
 
-    if (!vmwgfx_is_hosted(ms->hdriver) && drmDropMaster(ms->fd))
+    if (!vmwgfx_is_hosted(ms->hdriver) && !vmwgfx_use_server_fd(ms) &&
+            drmDropMaster(ms->fd))
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		   "drmDropMaster failed: %s\n", strerror(errno));
     ms->isMaster = FALSE;
diff --git a/vmwgfx/vmwgfx_driver.h b/vmwgfx/vmwgfx_driver.h
index c044a81..31dfc0f 100644
--- a/vmwgfx/vmwgfx_driver.h
+++ b/vmwgfx/vmwgfx_driver.h
@@ -83,6 +83,7 @@ enum xorg_throttling_reason {
 };
 
 struct vmwgfx_hosted;
+struct xf86_platform_device;
 
 typedef struct _modesettingRec
 {
@@ -98,6 +99,7 @@ typedef struct _modesettingRec
     int Chipset;
     EntityInfoPtr pEnt;
     struct pci_device *PciInfo;
+    struct xf86_platform_device *platform_dev;
 
     /* Accel */
     Bool accelerate_render;

commit 675fe58eee8acdb302c3501236b86a3289991053
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Tue May 6 16:00:50 2014 +0200

    Add support for XSERVER_PLATFORM_BUS
    
    This is a preparation patch for adding support for server managed fds.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>

diff --git a/src/vmware.c b/src/vmware.c
index 6b74e14..17434ab 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -310,9 +310,6 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
     pVMWARE->pvtSema = &pScrn->vtSema;
 
     pVMWARE->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
-    if (pVMWARE->pEnt->location.type != BUS_PCI) {
-        return FALSE;
-    }
     pVMWARE->PciInfo = xf86GetPciInfoForEntity(pVMWARE->pEnt->index);
     if (pVMWARE->PciInfo == NULL) {
         return FALSE;
diff --git a/src/vmware_bootstrap.c b/src/vmware_bootstrap.c
index ed6c740..b30cf2b 100644
--- a/src/vmware_bootstrap.c
+++ b/src/vmware_bootstrap.c
@@ -50,6 +50,10 @@
 #include <xf86_libc.h>
 #endif
 
+#ifdef XSERVER_PLATFORM_BUS
+#include "xf86platformBus.h"
+#endif
+
 #ifdef HaveDriverFuncs
 #define VMWARE_DRIVER_FUNC HaveDriverFuncs
 #else
@@ -247,9 +251,6 @@ VMwarePreinitStub(ScrnInfoPtr pScrn, int flags)
     vmwlegacy_hookup(pScrn);
 
     pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
-    if (pEnt->location.type != BUS_PCI)
-        return FALSE;
-
     pciInfo = xf86GetPciInfoForEntity(pEnt->index);
     if (pciInfo == NULL)
         return FALSE;
@@ -407,6 +408,45 @@ VMWAREProbe(DriverPtr drv, int flags)
 }
 #endif
 
+#ifdef XSERVER_PLATFORM_BUS
+static Bool
+VMwarePlatformProbe(DriverPtr drv, int entity, int flags,


Reply to: