diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 2773df1ef89..1533c4939d9 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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 || diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index f39927eb917..d6a3689c4f5 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -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); diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index 462a2b0dcb1..cd4f48b9a9e 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -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; diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index cbba547d7eb..47cdec8a185 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -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;