xwayland: Fix build without DRI3 enabled
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1668 Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1523>
This commit is contained in:
parent
39c8a6f367
commit
a58352b985
|
@ -234,9 +234,9 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo,
|
||||||
xwl_pixmap->bo = bo;
|
xwl_pixmap->bo = bo;
|
||||||
xwl_pixmap->buffer = NULL;
|
xwl_pixmap->buffer = NULL;
|
||||||
xwl_pixmap->implicit_modifier = implicit_modifier;
|
xwl_pixmap->implicit_modifier = implicit_modifier;
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
|
||||||
xwl_pixmap->efd = -1;
|
xwl_pixmap->efd = -1;
|
||||||
#endif /* XWL_HAS_GLAMOR */
|
#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
|
||||||
|
|
||||||
#ifdef GBM_BO_FD_FOR_PLANE
|
#ifdef GBM_BO_FD_FOR_PLANE
|
||||||
if (xwl_gbm->dmabuf_capable) {
|
if (xwl_gbm->dmabuf_capable) {
|
||||||
|
@ -679,6 +679,7 @@ xwl_auth_state_client_callback(CallbackListPtr *pcbl, void *unused, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DRI3
|
||||||
static void
|
static void
|
||||||
sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
|
sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
|
||||||
{
|
{
|
||||||
|
@ -741,6 +742,7 @@ xwl_dri3_open_client(ClientPtr client,
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
#endif /* DRI3 */
|
||||||
|
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds,
|
glamor_pixmap_from_fds(ScreenPtr screen, CARD8 num_fds, const int *fds,
|
||||||
|
@ -981,6 +983,7 @@ xwl_glamor_dmabuf_import_sync_file(PixmapPtr pixmap, int sync_file)
|
||||||
close(sync_file);
|
close(sync_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DRI3
|
||||||
struct xwl_dri3_syncobj
|
struct xwl_dri3_syncobj
|
||||||
{
|
{
|
||||||
struct dri3_syncobj base;
|
struct dri3_syncobj base;
|
||||||
|
@ -1239,6 +1242,7 @@ static dri3_screen_info_rec xwl_dri3_info = {
|
||||||
.get_drawable_modifiers = xwl_glamor_get_drawable_modifiers,
|
.get_drawable_modifiers = xwl_glamor_get_drawable_modifiers,
|
||||||
.import_syncobj = NULL, /* need to check for kernel support */
|
.import_syncobj = NULL, /* need to check for kernel support */
|
||||||
};
|
};
|
||||||
|
#endif /* DRI3 */
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_render_node_path_for_device(const drmDevicePtr drm_device,
|
get_render_node_path_for_device(const drmDevicePtr drm_device,
|
||||||
|
@ -1768,7 +1772,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
|
||||||
}
|
}
|
||||||
/* NVIDIA driver does not support implicit sync */
|
/* NVIDIA driver does not support implicit sync */
|
||||||
xwl_gbm->implicit_sync = !strstr(egl_vendor, "NVIDIA");
|
xwl_gbm->implicit_sync = !strstr(egl_vendor, "NVIDIA");
|
||||||
|
#ifdef DRI3
|
||||||
if (xwl_gbm_supports_syncobjs(xwl_screen) &&
|
if (xwl_gbm_supports_syncobjs(xwl_screen) &&
|
||||||
epoxy_has_egl_extension(xwl_screen->egl_display,
|
epoxy_has_egl_extension(xwl_screen->egl_display,
|
||||||
"ANDROID_native_fence_sync"))
|
"ANDROID_native_fence_sync"))
|
||||||
|
@ -1779,7 +1783,7 @@ xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
|
||||||
wp_linux_drm_syncobj_manager_v1_destroy(xwl_screen->explicit_sync);
|
wp_linux_drm_syncobj_manager_v1_destroy(xwl_screen->explicit_sync);
|
||||||
xwl_screen->explicit_sync = NULL;
|
xwl_screen->explicit_sync = NULL;
|
||||||
}
|
}
|
||||||
|
#endif /* DRI3 */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
error:
|
error:
|
||||||
if (xwl_screen->egl_display != EGL_NO_DISPLAY) {
|
if (xwl_screen->egl_display != EGL_NO_DISPLAY) {
|
||||||
|
@ -1796,7 +1800,7 @@ Bool
|
||||||
xwl_glamor_gbm_init_screen(struct xwl_screen *xwl_screen)
|
xwl_glamor_gbm_init_screen(struct xwl_screen *xwl_screen)
|
||||||
{
|
{
|
||||||
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
|
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
|
||||||
|
#ifdef DRI3
|
||||||
if (xwl_gbm->supports_syncobjs) {
|
if (xwl_gbm->supports_syncobjs) {
|
||||||
xwl_dri3_info.version = 4;
|
xwl_dri3_info.version = 4;
|
||||||
xwl_dri3_info.import_syncobj = xwl_dri3_import_syncobj;
|
xwl_dri3_info.import_syncobj = xwl_dri3_import_syncobj;
|
||||||
|
@ -1806,7 +1810,7 @@ xwl_glamor_gbm_init_screen(struct xwl_screen *xwl_screen)
|
||||||
ErrorF("Failed to initialize dri3\n");
|
ErrorF("Failed to initialize dri3\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
#endif /* DRI3 */
|
||||||
if (xwl_gbm->fd_render_node)
|
if (xwl_gbm->fd_render_node)
|
||||||
goto skip_drm_auth;
|
goto skip_drm_auth;
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,7 @@ xwl_present_free_event(struct xwl_present_event *event)
|
||||||
static void
|
static void
|
||||||
xwl_present_free_idle_vblank(present_vblank_ptr vblank)
|
xwl_present_free_idle_vblank(present_vblank_ptr vblank)
|
||||||
{
|
{
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
|
||||||
if (vblank->release_syncobj) {
|
if (vblank->release_syncobj) {
|
||||||
/* transfer implicit fence to release syncobj */
|
/* transfer implicit fence to release syncobj */
|
||||||
int fence_fd = xwl_glamor_dmabuf_export_sync_file(vblank->pixmap);
|
int fence_fd = xwl_glamor_dmabuf_export_sync_file(vblank->pixmap);
|
||||||
|
@ -336,7 +336,7 @@ xwl_present_free_idle_vblank(present_vblank_ptr vblank)
|
||||||
vblank->release_point,
|
vblank->release_point,
|
||||||
fence_fd);
|
fence_fd);
|
||||||
} else
|
} else
|
||||||
#endif /* XWL_HAS_GLAMOR */
|
#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
|
||||||
present_pixmap_idle(vblank->pixmap, vblank->window,
|
present_pixmap_idle(vblank->pixmap, vblank->window,
|
||||||
vblank->serial, vblank->idle_fence);
|
vblank->serial, vblank->idle_fence);
|
||||||
xwl_present_free_event(xwl_present_event_from_vblank(vblank));
|
xwl_present_free_event(xwl_present_event_from_vblank(vblank));
|
||||||
|
@ -393,7 +393,9 @@ static void
|
||||||
xwl_present_flip_notify_vblank(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
|
xwl_present_flip_notify_vblank(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
|
||||||
{
|
{
|
||||||
WindowPtr window = vblank->window;
|
WindowPtr window = vblank->window;
|
||||||
|
#ifdef DRI3
|
||||||
struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
|
struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
|
||||||
|
#endif /* DRI3 */
|
||||||
struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window);
|
struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window);
|
||||||
uint8_t mode = PresentCompleteModeFlip;
|
uint8_t mode = PresentCompleteModeFlip;
|
||||||
|
|
||||||
|
@ -507,7 +509,7 @@ xwl_present_buffer_release(void *data)
|
||||||
|
|
||||||
vblank = &event->vblank;
|
vblank = &event->vblank;
|
||||||
|
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
|
||||||
if (vblank->release_syncobj) {
|
if (vblank->release_syncobj) {
|
||||||
/* transfer implicit fence to release syncobj */
|
/* transfer implicit fence to release syncobj */
|
||||||
int fence_fd = xwl_glamor_dmabuf_export_sync_file(vblank->pixmap);
|
int fence_fd = xwl_glamor_dmabuf_export_sync_file(vblank->pixmap);
|
||||||
|
@ -515,7 +517,7 @@ xwl_present_buffer_release(void *data)
|
||||||
vblank->release_point,
|
vblank->release_point,
|
||||||
fence_fd);
|
fence_fd);
|
||||||
} else
|
} else
|
||||||
#endif /* XWL_HAS_GLAMOR */
|
#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
|
||||||
present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
|
present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence);
|
||||||
|
|
||||||
xwl_present_window = xwl_present_window_priv(vblank->window);
|
xwl_present_window = xwl_present_window_priv(vblank->window);
|
||||||
|
@ -881,7 +883,7 @@ xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage)
|
||||||
|
|
||||||
event->pixmap = pixmap;
|
event->pixmap = pixmap;
|
||||||
|
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
|
||||||
if (vblank->acquire_syncobj && vblank->release_syncobj) {
|
if (vblank->acquire_syncobj && vblank->release_syncobj) {
|
||||||
if (xwl_window->xwl_screen->explicit_sync) {
|
if (xwl_window->xwl_screen->explicit_sync) {
|
||||||
xwl_glamor_dri3_syncobj_passthrough(xwl_window,
|
xwl_glamor_dri3_syncobj_passthrough(xwl_window,
|
||||||
|
@ -898,7 +900,7 @@ xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage)
|
||||||
xwl_glamor_dmabuf_import_sync_file(vblank->pixmap, fence_fd);
|
xwl_glamor_dmabuf_import_sync_file(vblank->pixmap, fence_fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* XWL_HAS_GLAMOR */
|
#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
|
||||||
|
|
||||||
if (implicit_sync) {
|
if (implicit_sync) {
|
||||||
xwl_pixmap_set_buffer_release_cb(pixmap, xwl_present_buffer_release, event);
|
xwl_pixmap_set_buffer_release_cb(pixmap, xwl_present_buffer_release, event);
|
||||||
|
@ -950,7 +952,7 @@ xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
|
||||||
static void
|
static void
|
||||||
xwl_present_acquire_fence_avail(int fd, int xevents, void *data)
|
xwl_present_acquire_fence_avail(int fd, int xevents, void *data)
|
||||||
{
|
{
|
||||||
|
@ -962,13 +964,13 @@ xwl_present_acquire_fence_avail(int fd, int xevents, void *data)
|
||||||
|
|
||||||
xwl_present_re_execute(vblank);
|
xwl_present_re_execute(vblank);
|
||||||
}
|
}
|
||||||
#endif /* XWL_HAS_GLAMOR */
|
#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
xwl_present_wait_acquire_fence_avail(struct xwl_screen *xwl_screen,
|
xwl_present_wait_acquire_fence_avail(struct xwl_screen *xwl_screen,
|
||||||
present_vblank_ptr vblank)
|
present_vblank_ptr vblank)
|
||||||
{
|
{
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#if defined(XWL_HAS_GLAMOR) && defined(DRI3)
|
||||||
/* If the compositor does not support explicit sync we need to wait for the
|
/* If the compositor does not support explicit sync we need to wait for the
|
||||||
* acquire fence to be submitted before flipping. */
|
* acquire fence to be submitted before flipping. */
|
||||||
if (vblank->flip && !xwl_screen->explicit_sync &&
|
if (vblank->flip && !xwl_screen->explicit_sync &&
|
||||||
|
@ -982,7 +984,7 @@ xwl_present_wait_acquire_fence_avail(struct xwl_screen *xwl_screen,
|
||||||
vblank->efd);
|
vblank->efd);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif /* XWL_HAS_GLAMOR */
|
#endif /* defined(XWL_HAS_GLAMOR) && defined(DRI3) */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue