diff options
author | Leandro Ribeiro <leandro.ribeiro@collabora.com> | 2021-06-28 13:57:19 -0300 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2021-11-26 16:06:09 +0000 |
commit | 3022ad7e158cc2c387bea9a90cddca0a8631d7e0 (patch) | |
tree | 617834f9a7fae615f422a47f01d87695540a976a /src/egl/drivers/dri2/egl_dri2.h | |
parent | 42a0e5caa9f6456e254ad2402b93736909706b6e (diff) |
egl/wayland: replace EGL_DRI2_MAX_FORMATS by EGL_DRI2_NUM_FORMATS
Currently we have a weird design. We have a hardcoded array (named
dri2_wl_visuals) with all the formats that we support, which are 9.
And we also have EGL_DRI2_MAX_FORMATS, which is a constant set to 10. In
patches in which people added new formats to dri2_wl_visuals, this
constant had its value increased. This is confusing, as its name gives
the idea that we can't support more formats.
This constant is only used to define the bitset size of
dri2_egl_display::formats. And it should work just fine if we created
this bitset with the number of formats supported.
To make things clearer, replace EGL_DRI2_MAX_FORMATS by
EGL_DRI2_NUM_FORMATS, which must be equal to ARRAY_SIZE(dri2_wl_visuals)
(i.e. the number of supported formats).
In the next commits we get rid of this constant completely, as it is
prone to errors.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11248>
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.h')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 996606c4502..039863b34f3 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -89,7 +89,7 @@ struct zwp_linux_dmabuf_v1; #include "util/u_vector.h" #include "util/bitset.h" -#define EGL_DRI2_MAX_FORMATS 11 +#define EGL_DRI2_NUM_FORMATS 11 struct wl_buffer; @@ -246,7 +246,7 @@ struct dri2_egl_display struct zwp_linux_dmabuf_v1 *wl_dmabuf; struct u_vector *wl_modifiers; bool authenticated; - BITSET_DECLARE(formats, EGL_DRI2_MAX_FORMATS); + BITSET_DECLARE(formats, EGL_DRI2_NUM_FORMATS); uint32_t capabilities; char *device_name; #endif |