egl: Added DRI3 code guards.

MacOS does not have any DRI3 libraries, these code guards hide the code paths
the fail to compile without DRI3.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28130>
This commit is contained in:
duncan.hopkins 2023-10-27 11:35:38 +01:00 committed by Marge Bot
parent 275fdf709d
commit 4477139ec2
4 changed files with 20 additions and 1 deletions

View file

@ -1586,7 +1586,7 @@ dri2_create_drawable(struct dri2_egl_display *dri2_dpy,
dri2_surf->dri_drawable = dri2_dpy->kopper->createNewDrawable(
dri2_dpy->dri_screen_render_gpu, config, loaderPrivate,
&(__DRIkopperDrawableInfo){
#ifdef HAVE_X11_PLATFORM
#if defined(HAVE_X11_PLATFORM) && defined(HAVE_DRI3)
.multiplanes_available = dri2_dpy->multibuffers_available,
#endif
.is_pixmap = dri2_surf->base.Type == EGL_PBUFFER_BIT ||

View file

@ -1231,6 +1231,7 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(display);
#ifdef HAVE_DRI3
loader_update_screen_resources(&dri2_dpy->screen_resources);
if (dri2_dpy->screen_resources.num_crtcs == 0) {
@ -1247,6 +1248,10 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
/* If there's only one active CRTC, we're done */
if (dri2_dpy->screen_resources.num_crtcs == 1)
return EGL_TRUE;
#else
*numerator = 0;
*denominator = 1;
#endif
/* In a multi-monitor setup, look at each CRTC and perform a box
* intersection between the CRTC and surface. Use the CRTC whose
@ -1269,6 +1274,7 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
return EGL_FALSE;
}
#ifdef HAVE_DRI3
int area = 0;
for (unsigned c = 0; c < dri2_dpy->screen_resources.num_crtcs; c++) {
@ -1283,6 +1289,7 @@ dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface,
area = c_area;
}
}
#endif
/* If the window is entirely off-screen, then area will still be 0.
* We defaulted to the first CRTC in the list's refresh rate, earlier.
@ -1550,9 +1557,11 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
* here will allow is to simply free the memory at dri2_terminate().
*/
dri2_dpy->driver_name = strdup(disp->Options.Zink ? "zink" : "swrast");
#ifdef HAVE_DRI3
if (disp->Options.Zink &&
!debug_get_bool_option("LIBGL_DRI3_DISABLE", false))
dri3_x11_connect(dri2_dpy);
#endif
if (!dri2_load_driver_swrast(disp))
goto cleanup;
@ -1585,8 +1594,10 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
/* FIXME: if mesa vk wsi ever checks VkPresentRegionKHR in sw mode */
disp->Extensions.EXT_swap_buffers_with_damage = !disp->Options.ForceSoftware;
#ifdef HAVE_DRI3
if (dri2_dpy->multibuffers_available)
dri2_set_WL_bind_wayland_display(disp);
#endif
}
disp->Extensions.EXT_buffer_age = EGL_TRUE;
disp->Extensions.ANGLE_sync_control_rate = EGL_TRUE;
@ -1814,8 +1825,10 @@ dri2_initialize_x11(_EGLDisplay *disp)
void
dri2_teardown_x11(struct dri2_egl_display *dri2_dpy)
{
#ifdef HAVE_DRI3
if (dri2_dpy->dri2_major >= 3)
loader_destroy_screen_resources(&dri2_dpy->screen_resources);
#endif
if (dri2_dpy->own_device)
xcb_disconnect(dri2_dpy->conn);

View file

@ -370,6 +370,7 @@ kopper_get_pixmap_buffer(struct dri_drawable *drawable,
} else
#endif
{
#ifdef HAVE_DRI3
xcb_dri3_buffer_from_pixmap_cookie_t bp_cookie;
xcb_dri3_buffer_from_pixmap_reply_t *bp_reply;
xcb_generic_error_t *error;
@ -389,6 +390,9 @@ kopper_get_pixmap_buffer(struct dri_drawable *drawable,
width = bp_reply->width;
height = bp_reply->height;
free(bp_reply);
#else
return NULL;
#endif
}
drawable->w = width;

View file

@ -995,6 +995,7 @@ driswCreateScreenDriver(int screen, struct glx_display *priv,
goto handle_error;
}
#if defined(HAVE_DRI3)
if (pdpyp->zink) {
bool err;
psc->has_multibuffer = dri3_check_multibuffer(priv->dpy, &err);
@ -1007,6 +1008,7 @@ driswCreateScreenDriver(int screen, struct glx_display *priv,
goto handle_error;
}
}
#endif
glx_config_destroy_list(psc->base.configs);
psc->base.configs = configs;