Commit Graph

1083 Commits

Author SHA1 Message Date
notbabaisyou 7fb4ba10f2 glamor: Enable dmabuf_capable for Zink
This lets Zink take advantage of DRM modifiers on GPUs letting it properly handle tiled buffers.

Signed-off-by: notbabaisyou <though-went-some-simple@proton.me>
2025-06-27 19:23:43 +02:00
Icenowy Zheng 3e1c2d5456 glamor: Fix dual blend on GLES3
The EXT_blend_func_extended extension on ESSL always requires explicit
request to allow two FS out variables because of limitations of the ESSL
language, which is mentioned as the No.6 issue of the extension's
specification.

Fix this by adding the extension request.

The original behavior on GLES3 is slightly against the specification of
GL_EXT_blend_func_extended extension, however Mesa and older version of
PowerVR closed drivers will just ignore this issue. Newest PowerVR
closed driver will bail out on this problem, so it deems a fix now.

Fixes: ee107cd491 ("glamor: support GLES3 shaders")
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1750>
2025-06-26 15:30:56 +02:00
Enrico Weigelt, metux IT consult c8b81fdbc5 drop Xwayland
It always had it's own lifecycle (not been part of Xorg releases),
doesn't make sense to maintain a competing implementation that we
won't use anyways.

Once that's gone, we can also drop few things in core/dix that had
been added just for xwayland only.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-17 12:51:36 +02:00
Enrico Weigelt, metux IT consult d674029f1f Revert "(!1987) glamor: unexport GLAMOR_CREATE_PIXMAP_* defines"
This reverts commit 85267d38ac.

These are needed by the RDP module (www.xrdp.org).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 7752d8450d glamor: replace xallocarray() by calloc()
Only key difference that calloc(), in contrast to rellocarray(),
is zero-initializing. The overhead is hard to measure on today's
machines, and it's safer programming practise to always allocate
zero-initialized, so one can't forget to do it explicitly.

Cocci rule:

    @@
    expression COUNT;
    expression LEN;
    @@
    - xallocarray(COUNT,LEN)
    + calloc(COUNT,LEN)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult b443f4bb88 os: drop Xasprintf() and Xvasprintf()
The supported platforms already have asprintf() and vasprintf(),
so there's no need for having our own implementation anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:54:13 +02:00
Enrico Weigelt, metux IT consult 8d95320217 glamor: fix missing include of dix-config.h
This header needs to be included first, otherwise things can easily get really
messed up. The current code only works by accident, because some other header
already including it early enough - but a subtle change in include order
can easy break it.

Thus, always make sure the header is really included first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:50:32 +02:00
Enrico Weigelt, metux IT consult 900ddb69a2 glamor: use calloc() instead of malloc()
Using calloc() instead of malloc() as preventive measure, so there
never can be any hidden bugs or leaks due uninitialized memory.

The extra cost of using this compiler intrinsic should be practically
impossible to measure - in many cases a good compiler can even deduce
if certain areas really don't need to be zero'd (because they're written
to right after allocation) and create more efficient machine code.

The code pathes in question are pretty cold anyways, so it's probably
not worth even thinking about potential extra runtime costs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:49:29 +02:00
Enrico Weigelt, metux IT consult d708b28adc treewide: drop COMPOSITE symbol
It's always enabled for very long time now (at least since meson transition),
there doesn't seem to be any need to ever disable it again. So we can reduce
code complexity by removing all the ifdef's.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:47:01 +02:00
Enrico Weigelt, metux IT consult cece84fa93 glamor: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:46:44 +02:00
Enrico Weigelt, metux IT consult a6a17034f3 glamor: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:45:26 +02:00
Enrico Weigelt, metux IT consult f26090eba6 egl: drop unused CreateScreenResources pointer
This field hasn't been actually used, so no need to keep it any longer.

Fixes: 60f14d60f6
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:43:08 +02:00
Enrico Weigelt, metux IT consult b0e7326f6d fb: pict: unexport fbTriangles()
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:19 +02:00
Enrico Weigelt, metux IT consult b7b526024a glamor: fix segfault on calloc() failure
calloc() can always fail, so we need to prepared for this,
instead of just blindly segfault'ing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:31:54 +02:00
Enrico Weigelt, metux IT consult 016f62baad glamor: BUG_* checks on NULL atlas
If this happens, we really have a bug, so better spit out a warning
instead of just segfault'ing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:31:51 +02:00
Enrico Weigelt, metux IT consult b0c9e95a61 glamor: BUG_RETURN*() on pixmap private data
Usually shouldn't happen trying to accessing pixmap's glamor private
data w/o having it initialized first. But just in case there's some
subtle bug, adding extra checks, which don't cost us much.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:31:49 +02:00
Enrico Weigelt, metux IT consult faef79be75 glamor: protect from NULL return of GetPictureScreenIfSet()
GetPictureScreenIfSet() is designed that NULL can be returned.
Even though it should not happen in this particular case,
better be prepared for that, instead of just segfault'ing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:31:46 +02:00
Enrico Weigelt, metux IT consult 5fd11ec4a6 glamor: NULL-protect GLAMOR_PIXMAP_PRIV_HAS_FBO()
It could potentially be called with NULL pointer, but can't handle it,
so when that happens, it's a bug. Adding a BUG_RETURN_VAL() call here,
so it's giving us a hint where to look at.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:31:44 +02:00
Enrico Weigelt, metux IT consult 6b772096ac glamor: unexport GLAMOR_CREATE_PIXMAP_* defines
Not used by any external drivers, so no need to keep it in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:45 +02:00
Enrico Weigelt, metux IT consult b854c905b8 glamor: unexport glamor_copy_window()
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:42 +02:00
Enrico Weigelt, metux IT consult 8102744a43 glamor: unexport glamor_change_window_attributes()
Not needed 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:39 +02:00
Enrico Weigelt, metux IT consult 903cf95b71 glamor: unexport glamor_egl_screen_init()
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:36 +02:00
Enrico Weigelt, metux IT consult 800ab10249 glamor: unexport glamor_get_drawable_modifiers()
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:33 +02:00
Enrico Weigelt, metux IT consult 06447646ef glamor: unexport glamor_get_modifiers()
Not used by any external driveres, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:29 +02:00
Enrico Weigelt, metux IT consult 6f6aab87ea glamor: unexport glamor_get_formats()
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:26 +02:00
Enrico Weigelt, metux IT consult 81c1479ea9 glamor: unexport glamor_pixmap_from_fds()
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:23 +02:00
Enrico Weigelt, metux IT consult ea232c79ff glamor: unexport glamor_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:20 +02:00
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