diff --git a/src/gallium/auxiliary/vl/vl_winsys.h b/src/gallium/auxiliary/vl/vl_winsys.h index 0e14725a422..6b7cd92416a 100644 --- a/src/gallium/auxiliary/vl/vl_winsys.h +++ b/src/gallium/auxiliary/vl/vl_winsys.h @@ -99,12 +99,12 @@ vl_dri2_screen_create(void *display, int screen) { return NULL; }; struct vl_screen * vl_dri3_screen_create(Display *display, int screen); struct vl_screen * -vl_kopper_screen_create(Display *display, int screen); +vl_kopper_screen_create_x11(Display *display, int screen); #else static inline struct vl_screen * vl_dri3_screen_create(void *display, int screen) { return NULL; }; static inline struct vl_screen * -vl_kopper_screen_create(void *display, int screen) { return NULL; }; +vl_kopper_screen_create_x11(void *display, int screen) { return NULL; }; #endif #ifdef _WIN32 diff --git a/src/gallium/auxiliary/vl/vl_winsys_kopper.c b/src/gallium/auxiliary/vl/vl_winsys_kopper.c index b393fb0d49b..903c5e760a4 100644 --- a/src/gallium/auxiliary/vl/vl_winsys_kopper.c +++ b/src/gallium/auxiliary/vl/vl_winsys_kopper.c @@ -26,26 +26,30 @@ #include "pipe-loader/pipe_loader.h" #include "pipe/p_screen.h" -#include #include "util/u_memory.h" #include "vl/vl_winsys.h" #include "loader.h" -#include "x11/loader_x11.h" #include "pipe-loader/pipe_loader.h" #include "vl/vl_compositor.h" -#include "gallium/drivers/zink/zink_kopper.h" +#if defined(HAVE_X11_PLATFORM) && defined(HAVE_LIBDRM) +#include #include +#include "x11/loader_x11.h" +#include "gallium/drivers/zink/zink_kopper.h" +#endif struct vl_kopper_screen { struct vl_screen base; struct pipe_context *pipe; +#if defined(HAVE_X11_PLATFORM) && defined(HAVE_LIBDRM) xcb_connection_t *conn; bool is_different_gpu; - int screen; int fd; struct u_rect dirty_area; struct pipe_resource *drawable_texture; +#endif + int screen; }; static void @@ -63,6 +67,27 @@ vl_screen_destroy(struct vl_screen *vscreen) FREE(vscreen); } +static void +vl_kopper_screen_destroy(struct vl_screen *vscreen) +{ + if (vscreen == NULL) + return; + + struct vl_kopper_screen *scrn = (struct vl_kopper_screen *) vscreen; + +#if defined(HAVE_X11_PLATFORM) && defined(HAVE_LIBDRM) + close(scrn->fd); + if (scrn->drawable_texture) + pipe_resource_reference(&scrn->drawable_texture, NULL); +#endif + + if (scrn->pipe) + scrn->pipe->destroy(scrn->pipe); + + vl_screen_destroy(&scrn->base); +} + +#if defined(HAVE_X11_PLATFORM) && defined(HAVE_LIBDRM) static void * vl_kopper_get_private(struct vl_screen *vscreen) { @@ -76,24 +101,6 @@ vl_kopper_get_dirty_area(struct vl_screen *vscreen) return &scrn->dirty_area; } -static void -vl_kopper_screen_destroy(struct vl_screen *vscreen) -{ - if (vscreen == NULL) - return; - - struct vl_kopper_screen *scrn = (struct vl_kopper_screen *) vscreen; - - close(scrn->fd); - if (scrn->drawable_texture) - pipe_resource_reference(&scrn->drawable_texture, NULL); - - if (scrn->pipe) - scrn->pipe->destroy(scrn->pipe); - - vl_screen_destroy(&scrn->base); -} - static struct pipe_resource * vl_kopper_texture_from_drawable(struct vl_screen *vscreen, void *d) { @@ -154,7 +161,7 @@ vl_kopper_texture_from_drawable(struct vl_screen *vscreen, void *d) } struct vl_screen * -vl_kopper_screen_create(Display *display, int screen) +vl_kopper_screen_create_x11(Display *display, int screen) { xcb_get_geometry_cookie_t geom_cookie; xcb_get_geometry_reply_t *geom_reply; @@ -222,3 +229,4 @@ error: return NULL; } +#endif