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:

committed by
Marge Bot

parent
0489df9a51
commit
b6f201b173
13
meson.build
13
meson.build
@@ -2145,7 +2145,6 @@ if host_machine.cpu_family() == 'x86_64' and cc.get_id() == 'gcc'
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
with_dri3_modifiers = false
|
|
||||||
with_dri3_explicit_sync = false
|
with_dri3_explicit_sync = false
|
||||||
with_xcb_keysyms = false
|
with_xcb_keysyms = false
|
||||||
if with_platform_x11
|
if with_platform_x11
|
||||||
@@ -2182,13 +2181,8 @@ if with_platform_x11
|
|||||||
if with_dri_platform == 'drm'
|
if with_dri_platform == 'drm'
|
||||||
dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8', required : with_x11_dri2)
|
dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8', required : with_x11_dri2)
|
||||||
|
|
||||||
dep_xcb_dri3 = dependency('xcb-dri3')
|
dep_xcb_dri3 = dependency('xcb-dri3', version : '>= 1.13')
|
||||||
dep_xcb_present = dependency('xcb-present')
|
dep_xcb_present = dependency('xcb-present', version : '>= 1.13')
|
||||||
# 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
|
|
||||||
if (dep_xcb_dri3.version().version_compare('>= 1.17') and
|
if (dep_xcb_dri3.version().version_compare('>= 1.17') and
|
||||||
dep_xcb_present.version().version_compare('>= 1.17'))
|
dep_xcb_present.version().version_compare('>= 1.17'))
|
||||||
with_dri3_explicit_sync = true
|
with_dri3_explicit_sync = true
|
||||||
@@ -2232,9 +2226,6 @@ endif
|
|||||||
if with_x11_dri2
|
if with_x11_dri2
|
||||||
pre_args += '-DHAVE_X11_DRI2'
|
pre_args += '-DHAVE_X11_DRI2'
|
||||||
endif
|
endif
|
||||||
if with_dri3_modifiers
|
|
||||||
pre_args += '-DHAVE_DRI3_MODIFIERS'
|
|
||||||
endif
|
|
||||||
if with_dri3_explicit_sync
|
if with_dri3_explicit_sync
|
||||||
pre_args += '-DHAVE_DRI3_EXPLICIT_SYNC'
|
pre_args += '-DHAVE_DRI3_EXPLICIT_SYNC'
|
||||||
endif
|
endif
|
||||||
|
@@ -1787,7 +1787,7 @@ dri2_x11_check_multibuffers(_EGLDisplay *disp)
|
|||||||
{
|
{
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
bool err;
|
bool err;
|
||||||
dri2_dpy->multibuffers_available = x11_dri3_check_multibuffer(dri2_dpy->conn, &err, &dri2_dpy->explicit_modifiers);
|
dri2_dpy->multibuffers_available = x11_dri3_check_multibuffer(dri2_dpy->conn, &err, &dri2_dpy->explicit_modifiers);
|
||||||
|
|
||||||
|
@@ -331,7 +331,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
|
|||||||
return &dri2_img->base;
|
return &dri2_img->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
static _EGLImage *
|
static _EGLImage *
|
||||||
dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx,
|
dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx,
|
||||||
EGLClientBuffer buffer,
|
EGLClientBuffer buffer,
|
||||||
@@ -390,13 +390,13 @@ static _EGLImage *
|
|||||||
dri3_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
|
dri3_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
|
||||||
EGLClientBuffer buffer, const EGLint *attr_list)
|
EGLClientBuffer buffer, const EGLint *attr_list)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case EGL_NATIVE_PIXMAP_KHR:
|
case EGL_NATIVE_PIXMAP_KHR:
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (dri2_dpy->multibuffers_available)
|
if (dri2_dpy->multibuffers_available)
|
||||||
return dri3_create_image_khr_pixmap_from_buffers(disp, ctx, buffer,
|
return dri3_create_image_khr_pixmap_from_buffers(disp, ctx, buffer,
|
||||||
attr_list);
|
attr_list);
|
||||||
|
@@ -512,7 +512,7 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
|
|||||||
/* If the server tells us that our allocation is suboptimal, we
|
/* If the server tells us that our allocation is suboptimal, we
|
||||||
* reallocate once.
|
* reallocate once.
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (ce->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY &&
|
if (ce->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY &&
|
||||||
draw->last_present_mode != ce->mode) {
|
draw->last_present_mode != ce->mode) {
|
||||||
for (int b = 0; b < ARRAY_SIZE(draw->buffers); b++) {
|
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)
|
if (draw->cur_blit_source != -1)
|
||||||
options |= XCB_PRESENT_OPTION_COPY;
|
options |= XCB_PRESENT_OPTION_COPY;
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (draw->multiplanes_available)
|
if (draw->multiplanes_available)
|
||||||
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
|
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
|
||||||
#endif
|
#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
|
static bool
|
||||||
has_supported_modifier(struct loader_dri3_drawable *draw, unsigned int format,
|
has_supported_modifier(struct loader_dri3_drawable *draw, unsigned int format,
|
||||||
uint64_t *modifiers, uint32_t count)
|
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;
|
goto no_image;
|
||||||
|
|
||||||
if (draw->dri_screen_render_gpu == draw->dri_screen_display_gpu) {
|
if (draw->dri_screen_render_gpu == draw->dri_screen_display_gpu) {
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (draw->multiplanes_available) {
|
if (draw->multiplanes_available) {
|
||||||
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie;
|
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie;
|
||||||
xcb_dri3_get_supported_modifiers_reply_t *mod_reply;
|
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);
|
pixmap = xcb_generate_id(draw->conn);
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (draw->multiplanes_available &&
|
if (draw->multiplanes_available &&
|
||||||
buffer->modifier != DRM_FORMAT_MOD_INVALID) {
|
buffer->modifier != DRM_FORMAT_MOD_INVALID) {
|
||||||
xcb_dri3_pixmap_from_buffers(draw->conn,
|
xcb_dri3_pixmap_from_buffers(draw->conn,
|
||||||
@@ -1805,7 +1805,7 @@ loader_dri3_create_image(xcb_connection_t *c,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
__DRIimage *
|
__DRIimage *
|
||||||
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
|
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
|
||||||
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply,
|
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)
|
int *width, int *height, void *loader_data)
|
||||||
{
|
{
|
||||||
__DRIimage *image;
|
__DRIimage *image;
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (multiplanes_available) {
|
if (multiplanes_available) {
|
||||||
xcb_dri3_buffers_from_pixmap_cookie_t bps_cookie;
|
xcb_dri3_buffers_from_pixmap_cookie_t bps_cookie;
|
||||||
xcb_dri3_buffers_from_pixmap_reply_t *bps_reply;
|
xcb_dri3_buffers_from_pixmap_reply_t *bps_reply;
|
||||||
|
@@ -256,7 +256,7 @@ loader_dri3_create_image(xcb_connection_t *c,
|
|||||||
__DRIscreen *dri_screen,
|
__DRIscreen *dri_screen,
|
||||||
void *loaderPrivate);
|
void *loaderPrivate);
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
PUBLIC __DRIimage *
|
PUBLIC __DRIimage *
|
||||||
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
|
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
|
||||||
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply,
|
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply,
|
||||||
|
@@ -189,7 +189,7 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
|
|||||||
pdraw->base.drawable = drawable;
|
pdraw->base.drawable = drawable;
|
||||||
pdraw->base.psc = &psc->base;
|
pdraw->base.psc = &psc->base;
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
has_multibuffer = base->display->has_multibuffer;
|
has_multibuffer = base->display->has_multibuffer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -2825,7 +2825,7 @@ wsi_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice,
|
|||||||
if (!crtc)
|
if (!crtc)
|
||||||
return VK_ERROR_INITIALIZATION_FAILED;
|
return VK_ERROR_INITIALIZATION_FAILED;
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
xcb_randr_lease_t lease = xcb_generate_id(connection);
|
xcb_randr_lease_t lease = xcb_generate_id(connection);
|
||||||
xcb_randr_create_lease_cookie_t cl_c =
|
xcb_randr_create_lease_cookie_t cl_c =
|
||||||
xcb_randr_create_lease(connection, root, lease, 1, 1,
|
xcb_randr_create_lease(connection, root, lease, 1, 1,
|
||||||
|
@@ -293,7 +293,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wsi_conn->has_dri3 = dri3_reply->present != 0;
|
wsi_conn->has_dri3 = dri3_reply->present != 0;
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (wsi_conn->has_dri3) {
|
if (wsi_conn->has_dri3) {
|
||||||
xcb_dri3_query_version_cookie_t ver_cookie;
|
xcb_dri3_query_version_cookie_t ver_cookie;
|
||||||
xcb_dri3_query_version_reply_t *ver_reply;
|
xcb_dri3_query_version_reply_t *ver_reply;
|
||||||
@@ -309,7 +309,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wsi_conn->has_present = pres_reply->present != 0;
|
wsi_conn->has_present = pres_reply->present != 0;
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (wsi_conn->has_present) {
|
if (wsi_conn->has_present) {
|
||||||
xcb_present_query_version_cookie_t ver_cookie;
|
xcb_present_query_version_cookie_t ver_cookie;
|
||||||
xcb_present_query_version_reply_t *ver_reply;
|
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;
|
struct x11_swapchain *chain = (struct x11_swapchain *)wsi_chain;
|
||||||
return &chain->images[image_index].base;
|
return &chain->images[image_index].base;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
static bool
|
static bool
|
||||||
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain);
|
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain);
|
||||||
#endif
|
#endif
|
||||||
@@ -1339,7 +1339,7 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
|
|||||||
*/
|
*/
|
||||||
chain->copy_is_suboptimal = true;
|
chain->copy_is_suboptimal = true;
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
case XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY:
|
case XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY:
|
||||||
/* The winsys is now trying to flip directly and cannot due to our
|
/* The winsys is now trying to flip directly and cannot due to our
|
||||||
* configuration. Request the user reallocate.
|
* 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)
|
&& chain->has_async_may_tear)
|
||||||
options |= XCB_PRESENT_OPTION_ASYNC_MAY_TEAR;
|
options |= XCB_PRESENT_OPTION_ASYNC_MAY_TEAR;
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
|
||||||
if (chain->has_dri3_modifiers)
|
if (chain->has_dri3_modifiers)
|
||||||
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
|
options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
|
||||||
#endif
|
|
||||||
|
|
||||||
xshmfence_reset(image->shm_fence);
|
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);
|
image->pixmap = xcb_generate_id(chain->conn);
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
|
||||||
if (image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
|
if (image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
|
||||||
/* If the image has a modifier, we must have DRI3 v1.2. */
|
/* If the image has a modifier, we must have DRI3 v1.2. */
|
||||||
assert(chain->has_dri3_modifiers);
|
assert(chain->has_dri3_modifiers);
|
||||||
@@ -2136,9 +2133,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
|
|||||||
chain->depth, bpp,
|
chain->depth, bpp,
|
||||||
image->base.drm_modifier,
|
image->base.drm_modifier,
|
||||||
fds);
|
fds);
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
/* Without passing modifiers, we can't have multi-plane RGB images. */
|
/* Without passing modifiers, we can't have multi-plane RGB images. */
|
||||||
assert(image->base.num_planes == 1);
|
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)
|
if (!wsi_conn->has_dri3_modifiers)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
xcb_generic_error_t *error = NULL;
|
xcb_generic_error_t *error = NULL;
|
||||||
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie =
|
xcb_dri3_get_supported_modifiers_cookie_t mod_cookie =
|
||||||
xcb_dri3_get_supported_modifiers(conn, window, depth, bpp);
|
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:
|
out:
|
||||||
*num_tranches_in = 0;
|
*num_tranches_in = 0;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
static bool
|
static bool
|
||||||
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain)
|
wsi_x11_swapchain_query_dri3_modifiers_changed(struct x11_swapchain *chain)
|
||||||
{
|
{
|
||||||
|
@@ -84,7 +84,7 @@ x11_dri3_open(xcb_connection_t *conn,
|
|||||||
#define DRI3_SUPPORTED_MAJOR 1
|
#define DRI3_SUPPORTED_MAJOR 1
|
||||||
#define PRESENT_SUPPORTED_MAJOR 1
|
#define PRESENT_SUPPORTED_MAJOR 1
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
#define DRI3_SUPPORTED_MINOR 2
|
#define DRI3_SUPPORTED_MINOR 2
|
||||||
#define PRESENT_SUPPORTED_MINOR 2
|
#define PRESENT_SUPPORTED_MINOR 2
|
||||||
#else
|
#else
|
||||||
@@ -139,7 +139,7 @@ x11_dri3_check_multibuffer(xcb_connection_t *c, bool *err, bool *explicit_modifi
|
|||||||
int presentMinor = present_reply->minor_version;
|
int presentMinor = present_reply->minor_version;
|
||||||
free(present_reply);
|
free(present_reply);
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_X11_DRM
|
||||||
if (presentMajor > 1 || (presentMajor == 1 && presentMinor >= 2)) {
|
if (presentMajor > 1 || (presentMajor == 1 && presentMinor >= 2)) {
|
||||||
*explicit_modifiers = dri3Major > 1 || (dri3Major == 1 && dri3Minor >= 2);
|
*explicit_modifiers = dri3Major > 1 || (dri3Major == 1 && dri3Minor >= 2);
|
||||||
if (dri3Major >= 1)
|
if (dri3Major >= 1)
|
||||||
|
Reference in New Issue
Block a user