Commit Graph

149 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
21ff050962 use new pixmap lifecycle api
Use server's new lifecycle API. That's an important step in order to decouple
ourselves from the old, fragile proc wrapping. Without it, the driver might not
work on newer Xservers anymore. For old Xservers adding a fallback.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-02 16:16:12 +01:00
Enrico Weigelt, metux IT consult
e8f258454b drop hacks for ancient pre-libpciaccess Xservers
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-18 14:06:08 +01:00
Enrico Weigelt, metux IT consult
64d2a73e91 drop support for ancient pre-7.1 xextproto
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-18 12:13:25 +01:00
Enrico Weigelt, metux IT consult
ea228a12f6 drop obsolete #ifdef HAVE_CONFIG_H
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-18 11:42:24 +01:00
Enrico Weigelt, metux IT consult
4dd3f86ca1 replace PictFormatShort by pixman_format_code_t
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 13:36:03 +02:00
Enrico Weigelt, metux IT consult
58511e7e14 replace PICT_TYPE_* by PIXMAN_TYPE_*
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 13:36:03 +02:00
Enrico Weigelt, metux IT consult
8e79291b74 replace PICT_FORMAT_TYPE by PIXMAN_FORMAT_TYPE
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 13:36:03 +02:00
Enrico Weigelt, metux IT consult
f104b52412 replace PICT_FORMAT_* by PIXMAN_FORMAT_*
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 13:36:03 +02:00
Enrico Weigelt, metux IT consult
d671cd96ef Use PictFormatShort instead of enum _PictFormatShort
The raw enum is being dropped from the Xserver and aliased to
pixmap_format_code_t.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 19:34:34 +02:00
Enrico Weigelt, metux IT consult
50ac338a9d use XNFcallocarray() instead of xnfcalloc macro
xnfcalloc is just an alias for XNFcallocarray() that doesn't seem to serve
any practical purpose, so it can go away once all drivers stopped using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-20 18:56:52 +02:00
Enrico Weigelt, metux IT consult
3f45b624ef drop compat with ancient xserver versions
We're relying on at least 1.18 now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-20 18:56:37 +02:00
Enrico Weigelt, metux IT consult
1aa9991347 drop compat for ancient xserver versions
We're relying on at least 1.18 now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-02-11 14:28:57 +01:00
Enrico Weigelt, metux IT consult
92cc453414 use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead - except when calling down the
chain where we had wrapped ourselves - and protecting those against NULL, so
we can move subsys-provided functions out of that chain.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-vmware/-/merge_requests/11>
2025-02-06 23:00:25 +00:00
Ian Forbes
6eba4505da Disable the kernel CRTC when DPMS Mode OFF is called
If the CRTC is supposed to be disabled we need to inform the kernel.

Fixes a bug where a secondary screen is left blank, but enabled, when
switching from two displays to one.

Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
2024-10-18 10:09:31 -05:00
Ville Skyttä
c59c5d241a Spelling fixes.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-09-29 18:04:25 -07:00
Martin Krastev
ff5637a14c Garbled XvPutImage output for FOURCC_YV12 when using 3D-accel-texture adaptor
A helper for the PutImage callback in adaptor 'XA G3D Textured Video' was not
taking into account the source data pitches for YV12 format, resulting in
garbled frames for misaligned frame widths. Issue reported by Doug Brown.
This patch is based off the patch proposed by Doug.

Repro of the original issue:
gst-launch-1.0 videotestsrc ! video/x-raw,format=YV12,width=449,height=240 ! xvimagesink

Reported-by: Doug Brown <doug@schmorgal.com>
Signed-off-by: Martin Krastev <krastevm@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2022-06-21 11:31:11 -04:00
Rudi Heitbaum
77b8183b33 vmwgfx: fix missing array notation
Fixes error identified by gcc-12.1.0 compiler

make
  CC       libvmwgfx_la-vmwgfx_tex_video.lo
vmwgfx_tex_video.c: In function 'stop_video':
vmwgfx_tex_video.c:240:20: error: the comparison will always evaluate as 'true' for the address of 'yuv' will never be NULL [-Werror=address]
  240 |                if (priv->yuv[i]) {
      |                    ^~~~
2022-05-08 03:00:10 +00:00
Martin Krastev
50ab008cb9 vmwgfx: Change header inclusion order to avoid xorg headers catching stdbool.h
libdrm commit e641e2a632d779f638ac2ba983b9fceb20b3fac4 added
stdbool.h to the library headers which conflicts with xorg headers.

Signed-off-by: Martin Krastev <krastevm@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
2021-11-30 15:48:18 -05:00
Thomas Hellstrom
5569f16a14 vmwgfx: Unify style in scanout_update and present functions
Since the functions are pretty similar, Make them look more similar in terms
of memory allocation methods and variable names

Reported-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2019-01-28 14:47:55 +01:00
Thomas Hellstrom
0a7c3570c9 vmwgfx: Limit the number of cliprects in a drm present_readback command v3
The drm present readback command number of cliprects should not exceed
DRM_MODE_FB_DIRTY_MAX_CLIPS. If that number is exceeded, split
the command up.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com> #v1
2019-01-28 14:47:55 +01:00
Thomas Hellstrom
357ce6e48c vmwgfx: Limit the number of cliprects in a drm present command v3
The drm present command number of cliprects should not exceed
DRM_MODE_FB_DIRTY_MAX_CLIPS. If that number is exceeded, split
the command up.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com> #v2
Reviewed-by: Deepak Rawat < drawat@vmware.com> #v1
2019-01-28 14:47:55 +01:00
Thomas Hellstrom
86189966c3 vmwgfx: Limit the number of cliprects in a drm dirtyfb command v3
The drm dirtyfb command would error if the number of cliprects were larger
than DRM_MODE_FB_DIRTY_MAX_CLIPS. If that number is exceeded, split the
command up.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com> #v2
Reviewed-by: Deepak Rawat <drawat@vmware.com> #v1
2019-01-28 14:47:55 +01:00
Thomas Hellstrom
ba4ef498fd vmwgfx: Don't exceed the device command size limit v3
With a huge number of DMA clip rects we could exceed the device command
buffer command size limit. Fix this by sending multiple DMA commands
when we exceed the limit.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com> #v1
2019-01-28 14:47:55 +01:00
Thomas Hellstrom
d31e8e77e1 vmwgfx: Fix invalid memory accesses in CloseScreen
Some of the CloseScreen callbacks were referencing XA objects so move the
destruction of the XA state tracker to the end of drv_close_screen to avoid
referencing freed resources.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-11-29 10:18:46 +01:00
Thomas Hellstrom
53e87117bb vmwgfx: Use libdrm to obtain the drm device node name v2
We were relying on a linux-specific way to do this. Now that the code is
used also on FreeBSD and there is functionality in libdrm to do this,
Use that functionality.

v2:
Remove unused variable warning in the !VMWGFX_LIBDRM_DEVICENAME case.

Co-authored-by: Johannes Lundberg <johalun0@gmail.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com> #v1
2018-11-29 10:17:38 +01:00
Thomas Hellstrom
0b34df288f vmwgfx: Fix a memory leak
We were leaking a pointer to a drm encoder.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2018-11-28 09:26:15 +01:00
Thomas Hellstrom
4ec3d67da8 vmwgfx: Fix XVideo memory leaks
We were not properly freeing the port privates.
In order to access those at CloseScreen time, don't free the adaptor pointers
at XV screen init, but hold on to them until CloseScreen.

Also properly free the new_adaptors pointer.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2018-11-28 09:25:39 +01:00
Thomas Hellstrom
7b163c018b Require at least XA version 2.4 to enable dri3
The XA version was bumped from 2.3 to 2.4 to signal that there were no
significant correctness or performance regressions when running dri3
compared to dri2 on the vmware driver stack.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-05-17 09:17:45 +02:00
Thomas Hellstrom
6b7dc2f930 vmwgfx: Clear the DRM mode before use
Avoid sending partially uninitialized data to the kernel.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-04-26 11:48:37 +02:00
Thomas Hellstrom
3cdeaa5db7 Fix a couple of shadowed declaration warnings
In some enviroments, "index", "y1" and "y2" are defined globally causing
warnings about shadowed declarations. Fix this.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2018-02-20 09:36:20 +01:00
Thomas Hellstrom
4ea5c4d5fa Build fixes
A couple of more build fixes for older X servers.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2018-02-20 09:35:41 +01:00
Thomas Hellstrom
1899b0896d vmwgfx: Fix server termination due to a mesa loader bug
Some versions of the Gallium loader close our drm file descriptor if
xa_tracker_create() fails (typically 2D VMs.) While this is mostly fixed
everywhere, we implement a workaround to avoid tracking down the same bug
again and again on those setups where this is not fixed in mesa.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-02-15 08:33:48 +01:00
Thomas Hellstrom
69632d06e2 vmwgfx: Fix potential libudev include and link failures
We were not including the proper include- and link flags for libudev.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-02-15 08:30:05 +01:00
Thomas Hellstrom
dc85a6da15 Fix a number of compilation warnings
There are a number of compilation warnings caused by const char pointers
being either explicitly or implicitly cast to char pointers. There
are a number of ABI differences that have hindered this so far, but
make a new attempt using the common_compat.h defines.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-02-15 08:27:30 +01:00
Thomas Hellstrom
98199b4c0a vmwgfx: Remove old XWayland and XMir drivers
Old-style XWayland and XMir aren't available anymore.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-02-15 08:26:26 +01:00
Thomas Hellstrom
943548ac76 vmwgfx: Fix compilation failure if dri3 is not available
Compilation on CentOS failed due to some code not being conditioned on
DRI3 headers being present.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
2018-02-15 08:25:57 +01:00
Thomas Hellstrom
08ad438e27 vmwgfx: Support DRI3 v2
Add server-side DRI3 support

Currently DRI3 introduces extra latency with gnome-shell for
the following reasons:
1) We enable GLX_EXT_buffer_age. Causes gnome-shell to post fullscreen damage.
2) We enable GLX_OML_sync_control. Cases additional slowdown.
Not exactly sure why.

Probably we want to implement workarounds in mesa so that we don't enable
these extensions for gnome-shell. That can be done with driconf, using some
trickery.

v2: Verify that sharing an ARGB surface as XRGB works before enabling
DRI3.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-08-21 11:33:43 +02:00
Thomas Hellstrom
c8b8b2ee4a Revert "vmware/vmwgfx: Support multiple dri driver names"
This reverts commit d5550b7f83.

The commit was intended to support video drivers, but has the side effect
that GLX thinks our driver supports more than it does.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-08-21 11:33:34 +02:00
Deepak Singh Rawat
3aff4ee5ca vmware/vmwgfx: Wrap deprecated
Deprecated with 43dbc556f3a4d743b9121d6cfc21961be4a9da56

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
2017-08-07 16:12:56 -07:00
Deepak Singh Rawat
d8c2f85013 vmware: Fix build warnings
Due to following commit in xserver there were
build warnings, as variables now declared const.

d89b42bda46d36fc0879611cc3b3566957ce36d0
e1e01d2e33c632e395d7e396f73fba8ae606b15a

Added a compat header file.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>:q
2017-08-07 15:57:56 -07:00
Sinclair Yeh
ed0fd2f282 Revert "Revert "vmware/vmwgfx: Support multiple dri driver names""
This reverts commit ea94dc5708.

Temporarily revert this for internal testing.
2017-07-13 20:27:40 +02:00
Sinclair Yeh
1388a1592c Revert "vmwgfx: Support DRI3 v2"
This reverts commit d0d5cf3e35.

Temporarily revert this for internal testing.
2017-07-13 20:27:29 +02:00
Thomas Hellstrom
d0d5cf3e35 vmwgfx: Support DRI3 v2
Add server-side DRI3 support

Currently DRI3 introduces extra latency with gnome-shell for
the following reasons:
1) We enable GLX_EXT_buffer_age. Causes gnome-shell to post fullscreen damage.
2) We enable GLX_OML_sync_control. Cases additional slowdown.
Not exactly sure why.

Probably we want to implement workarounds in mesa so that we don't enable
these extensions for gnome-shell. That can be done with driconf, using some
trickery.

v2: Verify that sharing an ARGB surface as XRGB works before enabling
DRI3.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-05-11 07:34:52 -07:00
Thomas Hellstrom
ea94dc5708 Revert "vmware/vmwgfx: Support multiple dri driver names"
This reverts commit d5550b7f83.

The commit was intended to support video drivers, but has the side effect
that GLX thinks our driver supports more than it does.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2017-05-11 07:34:19 -07:00
Thomas Hellstrom
fade4f46e8 vmware/vmwgfx: Add a missing source file for distribution
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2016-11-16 12:54:35 +07:00
Thomas Hellstrom
d5550b7f83 vmware/vmwgfx: Support multiple dri driver names
Support sending multiple driver names and dri2 INFOREC v4.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-05-30 14:01:31 +02:00
Thomas Hellstrom
5036e9d11a vmware/vmwgfx: Don't require screen objects to run
Using the vmwgfx ldu backend works just as fine except that we're limited
to implicit layout placement.

With this test on, we may end up in the odd situation that the vmwgfx kernel
module and the vwmare legacy Xorg driver are enabled simultaneously, and that
is an unsupported configuration. It will also break resolutionKMS which will
be enabled based on vmwgfx version but should be disabled since the legacy
Xorg driver runs...

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-05-30 13:59:42 +02:00
Thomas Hellstrom
57d4499cc2 vmware/vmwgfx: Disable autolayout if we detect an old resolutionset
While the autolayout feature should really avoid races both with the old
resolutionSet RandR12 code and with new compositor layout code, let's
disable the autolayout feature if someone tries to set the
layout / resolution through the vmwarectrl interface.
That's most likely an old resolutionSet.

Autolayout is turned on on each new screen generation.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2016-02-11 09:15:12 +01:00
Thomas Hellstrom
48fb82f13c vmware/vmwgfx: Read the implicit output status from KMS if available.
This information is used to switch to software cursors if we have
multiple overlapping explicit outputs and thus might need to display
two cursors simultaneously.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2016-02-11 09:15:12 +01:00
Thomas Hellstrom
a81e359d88 vmware/vmwgfx: Avoid filling the log with modeline printouts
There are specific debug options for that.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
2016-02-11 09:15:12 +01:00