Commit Graph

1160 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
1f611b8852 glamor: replace DDXPoint by xPoint
DDXPoint is just an alias to xPoint

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-02-10 15:59:20 +01:00
stefan11111
5adae6c3b3 kdrive/fbdev: Don't try to accelerate rendering with glamor with a sw driver
It will likely be slower that unaccelerated rendering.
Command-line flags were added for overriding this.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-02-09 19:27:22 +01:00
stefan11111
b7bf58922f modesetting: Check for GLAMOR instead of GLAMOR_HAS_GBM
Now gbm required for the modesetting driver.
`GLAMOR_HAS_GBM` is defined even if glamor isn't built.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-02-09 14:19:16 +01:00
stefan11111
162fda3bd6 kdrive/fbdev: Get glx working through glamor egl on Xfbdev
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-21 10:23:23 +01:00
stefan11111
ba16aca944 glamor/glamor_egl.c: Remove some whitespaces
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-21 10:11:05 +01:00
stefan11111
dc55d361d8 glamor/glamor_egl.c: Report skipping all modifiers as failure
If `glamor_get_modifiers` returns no modifiers, but succeeds, it means
that modifiers are implicit and chosen by the driver
(e.g. when allocating gbm buffers)

If we strip all modifiers however, it means that from the list
of modifiers we queried, we can use none.
This means that it would be an error to, for example,
create a gbm bo, create an image from it and try to
render into it.

We should treat this case as a failure.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 13:48:39 +01:00
stefan11111
e2c99a2e93 glamor/glamor_egl.c: Fix misplaced #endif
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-07 11:05:30 +01:00
stefan11111
186e269a9d glamor/glamor_egl.c: Skip modifiers that do not result in images
that can be rendered to

According to https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt ,
there is an interface that allows us to detect if a given format modifier is supported.

For example, nvidia uses this to report that pitch-linear images can't be
rendered to.

Since we are only interested in formats that we can actually render to,
we should strip these formats from the modifier list.

See:
https://github.com/elFarto/nvidia-vaapi-driver/issues/15#issuecomment-1015827050
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1444#note_2450902

v2: Faster and simpler filter thanks to @algrid

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-05 14:18:08 +01:00
Enrico Weigelt, metux IT consult
19ee44b607 treewide: drop including <dix-config.h> from private includes
All .c sources must include <dix-config.h> at the very first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-04 19:50:44 +01:00
stefan11111
d64fc9b668 glamor/glamor_egl.c: Set *formats to NULL after free()
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
4b65fdd356 glamor: avoid double free in glamor_make_pixmap_exportable()
Reported by gcc 15.1:

../glamor/glamor_egl.c:320:9:
 warning: double-‘free’ of ‘modifiers’ [CWE-415] [-Wanalyzer-double-free]
[...]
           │  732 |│        free(*modifiers);
           │      |│        ~~~~~~~~~~~~~~~~
           │      |│        |
           │      |└───────>(25) ...to here
           │      |         (26) first ‘free’ here
[...]
    │  320 |         free(modifiers);
    │      |         ~~~~~~~~~~~~~~~
    │      |         |
    │      |         (28) ⚠️

  second ‘free’ here; first ‘free’ was at (26)

Fixes: cef12efc15 ("glamor: Implement GetSupportedModifiers")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
4db6ede54d glamor: avoid null dereference in glamor_composite_clipped_region()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_render.c:1577:21:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
5d7ec3493c glamor: avoid null dereference in glamor_dash_setup()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_dash.c:152:10:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00
stefan11111
b0050ee830 glamor: fix memory leak in error path
Found in 84cf20e6dd by Alanc

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
bf24ecb95b glamor: silence false positive in glamor_validate_gc()
We know that if gc->tileIsPixel is false, then gc->tile.pixmap must be
a valid pixmap, but gcc's static analyzer doesn't and needs to be told.

Silences false positive reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_core.c:205:19:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: default avatarAlan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
d228cfd194 glamor: handle allocation failure in glamor_create_pixmap()
Reported by gcc 15.1:

../glamor/glamor.c: In function ‘glamor_create_pixmap’:
../glamor/glamor.c:233:23: warning: potential null pointer dereference
 [-Wnull-dereference]
  233 |     pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
      |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../glamor/glamor.c:228:26: warning: potential null pointer dereference
 [-Wnull-dereference]
  228 |     pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00
Alan Coopersmith
794c8e04a1 glamor: handle potential NULL return from GetPictureScreenIfSet()
Unlike GetPictureScreen(), GetPictureScreenIfSet() checks if the
private key is registered, and returns NULL if it is not.

Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:
xwayland-24.1.6/redhat-linux-build/../glamor/glamor.c:926:5:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ps’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-27 12:03:27 +01:00
Mike Gelfand
683573df26 glamor: move include guards up to wrap the whole file
See: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
Signed-off-by: Mike Gelfand <mikedld@mikedld.com>
2025-11-21 15:20:11 +01:00
Enrico Weigelt, metux IT consult
95499a9525 dix: unexport enableIndirectGLX
Still needs to be _X_EXPORT'ed for internal modules, but
not supposed to be visible to external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:25:41 +01:00
Enrico Weigelt, metux IT consult
5c592210e7 glamor: drop special internal server reset support
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:23:32 +01:00
Chase
fcbb2bafce treewide: replace __FUNCTION__ by __func__
prefer C99 standard over non-standard legacy symbols

Signed-off-by: Chase <chinkle3@illinois.edu>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-18 13:29:47 +01:00
Enrico Weigelt, metux IT consult
5f8edd4560 glamor: fix parameter indentions on asprintf() calls
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 19:19:06 +01:00
Enrico Weigelt, metux IT consult
226211f7a7 glamor: replace XNFasprintf() by asprintf()
Just use standard libc functions instead of own (incomplete)
implementations.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 19:19:06 +01:00
Enrico Weigelt, metux IT consult
0c7799b916 glamor: replace XNFvasprintf() by vasprintf()
No need for carrying around our own (incomplete) implementation
of a standard libc function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 09:31:10 +01:00
stefan11111
23fd2bd19f glamor: Set *num_formats to NULL in glamor_get_formats if we don't have any formats.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-06 15:55:16 +01:00
stefan11111
6073de4461 glamor: fix Option "GlxVendorLibrary"
The old code tried to use a screen pointer that was uninitialized and set to NULL.
This caused it to segfault when this option was set.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-04 15:08:28 +01:00
stefan11111
09d35f1e0d glamor: use GBM_BO_USE_RENDERING for importing gbm bo's
Inspired by 421ce458f1

Glamor should use GBM_BO_USE_RENDERING, since they are image buffers.
This change is mostly cosmetic, as mesa doesn't do anything with
this flag, other than a sanity check.
See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14130

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-11-03 17:25:52 +01:00
Enrico Weigelt, metux IT consult
f2ce732ef5 treewide: 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-09-25 14:28:06 +02:00
Enrico Weigelt, metux IT consult
8fb8ce515e treewide: 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-09-23 18:20:09 +02:00
Enrico Weigelt, metux IT consult
72083eb117 glamor: don't use anonymous structs and unions in glamor_composite_shader
Anonymous structs and unions are a GNUism, violating C standard, thus
better not using it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 14:14:48 +02:00
Enrico Weigelt, metux IT consult
34c3a9c7e2 treewide: fix serverGeneration int type mismatch
The global (exported) serverGeneration field is `unsigned long`, while
many other places copy it and compare it two other integer types, eg.
plain `int` (which is signed). Even if it's unlikely ever reaching such
high number of generations that it will ever make trouble, it's still
a good idea to clean this up and use the same type everywhere.

For clearity, introducing a typedef `x_server_generation_t` which is
used everywhere, instead of raw `unsigned long`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:52:03 +02:00
Enrico Weigelt, metux IT consult
f66ee7277e treewide: replace PICT_yuv2 by PIXMAN_yuy2
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
dbe4339fd7 treewide: replace PICT_a4b4g4r4 by PIXMAN_a4b4g4r4
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
5d96eba31b treewide: replace PICT_x4b4g4r4 by PIXMAN_x4b4g4r4
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
c2a4f0033c treewide: replace PICT_a4r4g4b4 by PIXMAN_a4r4g4b4
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
4295cf6817 treewide: replace PICT_x4r4g4b4 by PIXMAN_x4r4g4b4
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
840a4ceabe treewide: replace PICT_a1r5g5b5 by PIXMAN_a1r5g5b5
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
889ded74be treewide: replace PICT_a1b5g5r5 by PIXMAN_a1b5g5r5
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
a23fdf9d2f treewide: replace PICT_x1b5g5r5 by PIXMAN_x1b5g5r5
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
19df33aa7a treewide: replace PICT_b5g6r5 by PIXMAN_b5g6r5
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
cadf94d6c8 treewide: replace PICT_a2b10g10r10 by PIXMAN_a2b10g10r10
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
1687c9a20f treewide: replace PICT_a2r10g10b10 by PIXMAN_a2r10g10b10
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
ca7e24d2a7 treewide: replace PICT_a8b8g8r8 by PIXMAN_a8b8g8r8
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
fea686a1fc treewide: replace PICT_x8b8g8r8 by PIXMAN_x8b8g8r8
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
522a2d4280 treewide: replace PICT_x2r10g10b10 by PIXMAN_x2r10g10b10
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
aba79cbfca treewide: replace PICT_x2b10g10r10 by PIXMAN_x2b10g10r10
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
8cb07602ff treewide: replace PICT_x1r5g5b5 by PIXMAN_x1r5g5b5
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
4ce30fdb6b treewide: replace PICT_a8 by PIXMAN_a8
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
c113bc77ae treewide: replace PICT_a1 by PIXMAN_a1
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-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
b736739892 treewide: replace PICT_r5g6b5 by PIXMAN_r5g6b5
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-11 20:23:43 +02:00