meson: require dri3 modifiers

the year is 2024 and we have the technology

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31044>
This commit is contained in:
Mike Blumenkrantz
2024-09-05 10:41:07 -04:00
committed by Marge Bot
parent 0489df9a51
commit b6f201b173
9 changed files with 25 additions and 39 deletions

View File

@@ -2145,7 +2145,6 @@ if host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc'
endif
endif
with_dri3_modifiers = false
with_dri3_explicit_sync = false
with_xcb_keysyms = false
if with_platform_x11
@@ -2182,13 +2181,8 @@ if with_platform_x11
if with_dri_platform == 'drm'
dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8', required : with_x11_dri2)
dep_xcb_dri3 = dependency('xcb-dri3')
dep_xcb_present = dependency('xcb-present')
# until xcb-dri3 has been around long enough to make a hard-dependency:
if (dep_xcb_dri3.version().version_compare('>= 1.13') and
dep_xcb_present.version().version_compare('>= 1.13'))
with_dri3_modifiers = true
endif
dep_xcb_dri3 = dependency('xcb-dri3', version : '>= 1.13')
dep_xcb_present = dependency('xcb-present', version : '>= 1.13')
if (dep_xcb_dri3.version().version_compare('>= 1.17') and
dep_xcb_present.version().version_compare('>= 1.17'))
with_dri3_explicit_sync = true
@@ -2232,9 +2226,6 @@ endif
if with_x11_dri2
pre_args += '-DHAVE_X11_DRI2'
endif
if with_dri3_modifiers
pre_args += '-DHAVE_DRI3_MODIFIERS'
endif
if with_dri3_explicit_sync
pre_args += '-DHAVE_DRI3_EXPLICIT_SYNC'
endif

View File

@@ -1787,7 +1787,7 @@ dri2_x11_check_multibuffers(_EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
bool err;
dri2_dpy->multibuffers_available = x11_dri3_check_multibuffer(dri2_dpy->conn, &err, &dri2_dpy->explicit_modifiers);

View File

@@ -331,7 +331,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
return &dri2_img->base;
}
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
static _EGLImage *
dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer buffer,
@@ -390,13 +390,13 @@ static _EGLImage *
dri3_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
EGLClientBuffer buffer, const EGLint *attr_list)
{
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
#endif
switch (target) {
case EGL_NATIVE_PIXMAP_KHR:
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (dri2_dpy->multibuffers_available)
return dri3_create_image_khr_pixmap_from_buffers(disp, ctx, buffer,
attr_list);

View File

@@ -512,7 +512,7 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
/* If the server tells us that our allocation is suboptimal, we
* reallocate once.
*/
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (ce->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY &&
draw->last_present_mode != ce->mode) {
for (int b = 0; b < ARRAY_SIZE(draw->buffers); b++) {
@@ -1113,7 +1113,7 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable *draw,
*/
if (draw->cur_blit_source != -1)
options |= XCB_PRESENT_OPTION_COPY;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (draw->multiplanes_available)
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
#endif
@@ -1316,7 +1316,7 @@ dri3_linear_format_for_format(struct loader_dri3_drawable *draw, uint32_t format
}
}
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
static bool
has_supported_modifier(struct loader_dri3_drawable *draw, unsigned int format,
uint64_t *modifiers, uint32_t count)
@@ -1400,7 +1400,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int fourcc,
goto no_image;
if (draw->dri_screen_render_gpu == draw->dri_screen_display_gpu) {
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (draw->multiplanes_available) {
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie;
xcb_dri3_get_supported_modifiers_reply_t *mod_reply;
@@ -1573,7 +1573,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int fourcc,
}
pixmap = xcb_generate_id(draw->conn);
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (draw->multiplanes_available &&
buffer->modifier != DRM_FORMAT_MOD_INVALID) {
xcb_dri3_pixmap_from_buffers(draw->conn,
@@ -1805,7 +1805,7 @@ loader_dri3_create_image(xcb_connection_t *c,
return ret;
}
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
__DRIimage *
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply,
@@ -1854,7 +1854,7 @@ loader_dri3_get_pixmap_buffer(xcb_connection_t *conn, xcb_drawable_t pixmap, __D
int *width, int *height, void *loader_data)
{
__DRIimage *image;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (multiplanes_available) {
xcb_dri3_buffers_from_pixmap_cookie_t bps_cookie;
xcb_dri3_buffers_from_pixmap_reply_t *bps_reply;

View File

@@ -256,7 +256,7 @@ loader_dri3_create_image(xcb_connection_t *c,
__DRIscreen *dri_screen,
void *loaderPrivate);
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
PUBLIC __DRIimage *
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply,

View File

@@ -189,7 +189,7 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
pdraw->base.drawable = drawable;
pdraw->base.psc = &psc->base;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
has_multibuffer = base->display->has_multibuffer;
#endif

View File

@@ -2825,7 +2825,7 @@ wsi_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice,
if (!crtc)
return VK_ERROR_INITIALIZATION_FAILED;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
xcb_randr_lease_t lease = xcb_generate_id(connection);
xcb_randr_create_lease_cookie_t cl_c =
xcb_randr_create_lease(connection, root, lease, 1, 1,

View File

@@ -293,7 +293,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
}
wsi_conn->has_dri3 = dri3_reply->present != 0;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (wsi_conn->has_dri3) {
xcb_dri3_query_version_cookie_t ver_cookie;
xcb_dri3_query_version_reply_t *ver_reply;
@@ -309,7 +309,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
#endif
wsi_conn->has_present = pres_reply->present != 0;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (wsi_conn->has_present) {
xcb_present_query_version_cookie_t ver_cookie;
xcb_present_query_version_reply_t *ver_reply;
@@ -1236,7 +1236,7 @@ x11_get_wsi_image(struct wsi_swapchain *wsi_chain, uint32_t image_index)
struct x11_swapchain *chain = (struct x11_swapchain *)wsi_chain;
return &chain->images[image_index].base;
}
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
static bool
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain);
#endif
@@ -1339,7 +1339,7 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
*/
chain->copy_is_suboptimal = true;
break;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
case XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY:
/* The winsys is now trying to flip directly and cannot due to our
* configuration. Request the user reallocate.
@@ -1399,10 +1399,8 @@ x11_present_to_x11_dri3(struct x11_swapchain *chain, uint32_t image_index,
&& chain->has_async_may_tear)
options |= XCB_PRESENT_OPTION_ASYNC_MAY_TEAR;
#ifdef HAVE_DRI3_MODIFIERS
if (chain->has_dri3_modifiers)
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
#endif
xshmfence_reset(image->shm_fence);
@@ -2101,7 +2099,6 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
}
image->pixmap = xcb_generate_id(chain->conn);
#ifdef HAVE_DRI3_MODIFIERS
if (image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
/* If the image has a modifier, we must have DRI3 v1.2. */
assert(chain->has_dri3_modifiers);
@@ -2136,9 +2133,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
chain->depth, bpp,
image->base.drm_modifier,
fds);
} else
#endif
{
} else {
/* Without passing modifiers, we can't have multi-plane RGB images. */
assert(image->base.num_planes == 1);
@@ -2282,7 +2277,7 @@ wsi_x11_get_dri3_modifiers(struct wsi_x11_connection *wsi_conn,
if (!wsi_conn->has_dri3_modifiers)
goto out;
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
xcb_generic_error_t *error = NULL;
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie =
xcb_dri3_get_supported_modifiers(conn, window, depth, bpp);
@@ -2346,7 +2341,7 @@ wsi_x11_get_dri3_modifiers(struct wsi_x11_connection *wsi_conn,
out:
*num_tranches_in = 0;
}
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
static bool
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain)
{

View File

@@ -84,7 +84,7 @@ x11_dri3_open(xcb_connection_t *conn,
#define DRI3_SUPPORTED_MAJOR 1
#define PRESENT_SUPPORTED_MAJOR 1
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
#define DRI3_SUPPORTED_MINOR 2
#define PRESENT_SUPPORTED_MINOR 2
#else
@@ -139,7 +139,7 @@ x11_dri3_check_multibuffer(xcb_connection_t *c, bool *err, bool *explicit_modifi
int presentMinor = present_reply->minor_version;
free(present_reply);
#ifdef HAVE_DRI3_MODIFIERS
#ifdef HAVE_X11_DRM
if (presentMajor > 1 || (presentMajor == 1 && presentMinor >= 2)) {
*explicit_modifiers = dri3Major > 1 || (dri3Major == 1 && dri3Minor >= 2);
if (dri3Major >= 1)