Commit Graph

1056 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 8c79078c1c glamor: unexport glamor_egl_fd_from_pixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:17 +02:00
Enrico Weigelt, metux IT consult ccfc13e133 glamor: unexport glamor_egl_fd_name_from_pixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:13 +02:00
Enrico Weigelt, metux IT consult 4a702483a0 glamor: unexport glamor_egl_fds_from_pixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:10 +02:00
Enrico Weigelt, metux IT consult 1bcd8166a0 glamor: unexport glamor_enable_dri3()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:07 +02:00
Enrico Weigelt, metux IT consult fca8571a1a glamor: unexport glamor_pixmap_exchange_fbos()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:04 +02:00
Enrico Weigelt, metux IT consult d0d4ced9d3 glamor: unexport glamor_set_glvnd_vendor()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:01 +02:00
Enrico Weigelt, metux IT consult c62b68fdf7 glamor: unexport glamor_set_pixmap_type()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:24:57 +02:00
Enrico Weigelt, metux IT consult 999ed88818 glamor: unexport glamor_set_pixmap_texture()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:24:54 +02:00
Enrico Weigelt, metux IT consult caec5ae78b glamor: make glamor_destroy_gc() static
Only needed inside glamor_core.c, no external callers, so it can be static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:24:49 +02:00
Enrico Weigelt, metux IT consult eb173d9a56 glamor: drop glamor_egl_create_textured_screen()
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:24:46 +02:00
Enrico Weigelt, metux IT consult 3c0c56c4bf glamor: drop glamor_egl_create_textured_screen_ext() macro
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:24:43 +02:00
Enrico Weigelt, metux IT consult bef5470f02 glamor: drop glamor_get_glvnd_vendor()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:24:40 +02:00
Jan Engelhardt 530e80375e glamor: explicitly draw endpoints of line segments
The OpenGL 4.6 specification §14.5.1 "Basic Line Rasterization"
figure 14.2 says:

"""A diamond shaped region of height 1 is placed around each fragment
center; those regions that the line segment **exits** cause
rasterization to produce corresponding fragments."""

As the line does not necessarily exit the last diamond,
it is necessary to explicitly paint a pixel at line ends.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1434
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1755>
2025-02-24 20:39:12 +00:00
Enrico Weigelt, metux IT consult eafec5836a glamor: don't need NULL check before free()
free() is safe against NULL arguments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1818>
2025-02-23 17:32:49 +00:00
Enrico Weigelt, metux IT consult c46e645bad glamor: use explicit field initializers for XF86ModuleData
Even though the order of these fields shouldn't change anytime
soon, it's still better programming style to name'em explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1788>
2025-02-17 19:41:29 +00:00
Enrico Weigelt, metux IT consult 7a0f8301c5 glamor: 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.

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/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Enrico Weigelt, metux IT consult ef62929f58 treewide: NULL-protect ScreenRec->DestroyPixmap() calls
Right now, we're assuming that even when deep nesting involved, the proc
vector is always set to a valid function. One the one hand it requires
extra dummy procs in some cases, OTOH it's making upcoming refactoring
of the code flow unnecessarily complex.

The big plot (of subsequent commits) is splitting out the extension's
(and possibly subsystem's) special logic out of the wrapping chain and
let them be executed independently from the DDX/drivers - when applicable
even only when the pixmap is really destroyed (not just unref'ed).
(At some later point, it might even become be actually a valid situation
that DestroyPixmap vector really being NULL.)

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1709>
2025-02-06 23:02:06 +00:00
Pierre-Eric Pelloux-Prayer 5397854877 glamor: reject configs using unsupported rgbBits size
The supported color depths is a hardcoded list for now, so we
need to honor the value exposed there otherwise we'll get
inconsistencies between what glXGetFBConfigs and XListDepths
report to applications.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1764>
2025-01-21 09:16:52 +00:00
Pierre-Eric Pelloux-Prayer 83b13387ab glamor: use gbm_format_for_depth instead of open-coding it
This way glamor_back_pixmap_from_fd deals with the same depth
values as glamor_pixmap_from_fds.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1764>
2025-01-21 09:16:52 +00:00
Pierre-Eric Pelloux-Prayer 87afcc7699 glamor: return the result of gbm_format_for_depth
This way the caller knows if the conversion failed.
While at it, check for width/height at the same time.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1764>
2025-01-21 09:16:52 +00:00
Enrico Weigelt, metux IT consult a917f6a8a8 drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Enrico Weigelt, metux IT consult 646831cda2 include: dixfontstr.h: drop silent dependency on libxfont2
This header includes libxfont2.h, but the dependency isn't stated anywhere,
causing some drivers to FTBS (when libxont2.h is in non-standard location).

Since this header doesn't seem to need including libxfont2.h at all, just
stop including it, instead of adding yet another dependency to server SDK.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1610>
2024-09-01 17:45:13 +00:00
Enrico Weigelt, metux IT consult f26f17c66a treewide: mark pGC->ops->CopyArea() calls not using result as void
We alread have several of these calls, that aren't interested in result value,
explicitly casting to void. Fixing this up for the remaining ones.

This is helpful for the human reader as well as quality analysis tools.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1648>
2024-08-26 03:44:23 +00:00
Nicolas Dufresne 39c8a6f367 glamor: xv: Rewrite UYVY shader to match NV12/I420 CSC
This rewrites the shader so that we use the same (more flexible) CSC as
we have for I420 and NV12. This also fixes the reverse of odd/even which
caused chroma shift.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1633>
2024-08-01 10:51:20 +03:00
Konstantin eb26f32368 glamor: xv: fix UYVY alignment
UYVY videos should be aligned by 2 to avoid breakups in the shader

Fixes: 832b392f7 - glamor: xv: enable UYVY acceleration
Suggested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1633>
2024-08-01 10:48:25 +03:00
Konstantin 75f56b7923 glamor: check BPP by render_format.
Check actual BPP by render_format in upload_boxes, not by drawable BPP.

It is required when we used different BPP formats for storing and
rendering (for example, in the case of UYVY).

The problem of UYVY size lies inside method of glamor downloading boxes.

When we set GLAMOR_CREATE_FORMAT_CBCR, it actually uses 16-bit GL and
Pixman formats, but before this change in glamor_download_boxes, that
function deduces GL and Pixman formats from BPP, which is wrong in this
case (will be deduced to 32).

When GL and Pixman format BPP is identical to drawable BPP, this change
does nothing, but when it is different - it will prioritize Pixman
format, not the format deduced from BPP.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1730
Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1633>
2024-08-01 10:48:11 +03:00
Olivier Fourdan 34ea020344 glamor: Fix possible double-free
If glamor_link_glsl_prog() fails, we may jump to the failed code path
which frees the variable vs_prog_string and fs_prog_string.

But those variables were already freed just before, so in that case we
end up freeing the memory twice.

Simply move the free at the end of the success code path so we are sure
to free the values only once, either in the successful of failed code
paths.

Fixes: 2906ee5e4 - glamor: Fix leak in glamor_build_program()
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1629>
2024-07-29 13:49:27 +00:00
Enrico Weigelt, metux IT consult dec57e5796 treewide: replace xnfstrdup() calls by XNFstrdup()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:34 +00:00
Enrico Weigelt, metux IT consult c55ddd072b treewide: replace xnfalloc() calls to XNFalloc()
This has been nothing but an alias for two decades now (somewhere in R6.6),
so there doesn't seem to be any practical need for this indirection.

The macro still needs to remain, as long as (external) drivers still using it.

Fixes: ded6147bfb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26 23:41:33 +00:00
Enrico Weigelt, metux IT consult b30edf326b fix missing includes of <X11/Xfuncproto.h>
Several places using _X_ATTRIBUTE_PRINTF macro from X11/Xfuncproto.h
but missing to include it, so it depends on other headers whether it's
included by mere accident, which quickly causes trouble if include order
changes. Cleaning that up by adding explicit include statements.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1580>
2024-07-20 17:18:38 +00:00
Alan Coopersmith 522f469fe9 Move sizeof to second argument in calloc calls
Clears -Wcalloc-transposed-args warnings from gcc 14.1, such as:

../dix/main.c:165:42: warning: ‘calloc’ sizes specified with ‘sizeof’ in the
 earlier argument and not in the later argument [-Wcalloc-transposed-args]
  165 |             serverClient = calloc(sizeof(ClientRec), 1);
      |                                          ^~~~~~~~~
../dix/main.c:165:42: note: earlier argument should specify number of
 elements, later size of each element

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1606>
2024-07-19 23:45:21 +00:00
Michel Dänzer 08113b8923 xwayland/glamor: Handle depth 15 in gbm_format_for_depth
Prevents Xwayland with glamor from logging

 unexpected depth: 15

to stderr many times when running

 rendercheck -t blend -o clear

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1507>
2024-04-25 17:17:55 +02:00
Balló György 007e98b186 glamor: Fallback to software rendering on GLSL link failure
Instead of thowing fatal error on GLSL link failure, fall back to software
rendering. This allows using Glamor on systems with limited hardware resources
(such as i915).

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1173>
2024-04-11 12:01:14 +00:00
Enrico Weigelt, metux IT consult 368055d3f1 render: move private definitions out of public glyphstr.h
Public module API headers don't need / shouldn't to contain anything that
isn't part of the API (non-exported functions, etc).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1287>
2024-03-03 22:54:16 +00:00
Enrico Weigelt, metux IT consult e343a52fcf glamor: drop duplicate _X_EXPORT from .c source
These are already defined in glamor.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1274>
2024-03-03 22:34:26 +00:00
Enrico Weigelt, metux IT consult 113ffdf85c glamor: glamor_debug.h: drop unused AbortServer() declaration
This really looks like a leftover from b861aad8e2.

In any case, if that function shall become part of extension/driver API,
it should be declared with _X_EXPORT in some suitable header file - locally
declaring extern really isn't a good idea and just an invitation for subtle bugs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1265>
2024-03-03 22:29:52 +00:00
Michel Dänzer e5a3f3e84d glamor: Fall back for mixed depth 24/32 in glamor_set_alu
For ALUs which may leave the alpha channel at values other than 1.0.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1615

v2:
* List safe ALUs instead of unsafe ones
2024-01-11 10:03:10 +00:00
Michel Dänzer 8f66c15694 glamor: Make glamor_set_alu take a DrawablePtr
Preparation for the following commit, no functional change intended.
2024-01-11 10:03:10 +00:00
Michel Dänzer d1bbf82d72 glamor: Don't override source alpha to 1.0 if it's used for blending
It caused an incorrect result of the blend operation.

Use glColorMask to prevent non-1.0 alpha channel values in a depth 32
pixmap backing an effective depth 24 window. For blending operations,
the expectation is that the destination drawable contains valid pixel
values, so the alpha channel should already be 1.0.

Fixes: d1f142891e ("glamor: Ignore destination alpha as necessary for composite operation")
Issue: https://gitlab.gnome.org/GNOME/mutter/-/issues/3104
2024-01-10 08:56:26 +00:00
Ville Syrjälä 2bf0f9e113 glamor: Enable dmabuf_capable by default on Intel hardware
With the potential modeset vs. modifiers issue covered by
commit 899c87af1f ("modesetting: unflip before any setcrtc() calls")
we can safely enable modifiers by default, at least on Intel
hardware where we know that things work properly.

I suppose the one open question is whether everything will work
correctly with wonky multi-GPU setups? I don't have one to test
myself.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2023-12-19 02:52:26 +02:00
msizanoen1 e2eeaab2a4 glamor: Use render node for glamor device path where possible
On certain system deployments, /dev/dri/card* nodes aren't directly
accessible to the currently logged in user, but the display server only
access it by asking systemd-logind to open the device for it. This
causes the X server to fail when trying to re-open the card* device
directly, causing all use of DRI3 to fail.

Fix this by using the render device path instead where possible.
2023-12-17 17:45:06 +00:00
Alexey 4cf8922270 Fixed mirrored glyphs on big-endian machines 2023-12-17 16:44:45 +00:00
Yuriy Vasilev c170056111 glamor: xv: add rgb565
This commit adds RGB565 format to XVideo with reuse of RGBA32 shader

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Yuriy Vasilev <uuvasiliev@yandex.ru>
2023-11-29 21:18:29 +00:00
Yuriy Vasilev 15412e78c8 glamor: xv: add rgba32 format
This commit adds RGBA32 format to XVideo along with shader for handling it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Yuriy Vasilev <uuvasiliev@yandex.ru>
2023-11-29 21:18:29 +00:00
Konstantin 832b392f70 glamor: xv: enable UYVY acceleration
This commit adds UYVY format in XVideo for Glamor
along with shader support.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-11-29 21:18:29 +00:00
Konstantin ffd7151b10 glamor: xv: prepare to one-plane formats
As a preparation to one-plane formats (for example, UYVY), second
texture definition is moved inside a format switch, and all allocations
now also done inside a texture switch.
No functional change.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-11-29 21:18:29 +00:00
Konstantin 81ef43dd4a glamor: xv: reuse ports and shaders when possible
Xv currently calls glamor_xv_free_port_data at the end of every putImage.
This leads to shader recompilation for every frame, which is a huge performance loss.
This commit changes behaviour of glamor_xv_free_port_data, and its now is called only
if width, height or format is changed for xv port.

Shader management also done in a port now, because if shaders will be
stored in core glamor and try to be reused, this can lead to a bug if we
try to play 2 videos with different formats simultaneously.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-11-29 21:18:29 +00:00
Konstantin a8270fc5f0 glamor: xv: do not force a version on XV shaders
There is a no need to force a low version for XV shaders, it will
work on higher version too.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-11-29 21:18:29 +00:00
Konstantin 10d7fa53f8 Revert "glamor/glxprov: Stop exposing non-db(-capable) configs"
The recent commit a563f530 - "glamor/glxprov: Stop exposing non-db
(-capable) configs" was aiming at reducing the number of advertised
visuals for optimizing GLX initialization.

Unfortunately, GL applications which rely exclusively on single-buffered
visuals will fail to find a suitable visual with this.

Revert the commit to expose the single-buffered visuals and restore the
compatibility with applications which rely on single-buffered configs.

This reverts commit a563f530f6

Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-11-14 17:44:47 +03:00
Konstantin Pugin 8252b110f3 Xephyr: use glamor glx provider
Xephyr now gained an ability to use glamor glx provider.
Unfortunately, without DRI3, we end up with same llvmpipe as before

Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
2023-11-07 18:20:48 +03:00