From: Emil Velikov <emil.veli...@collabora.com> Follow the kernel approach and provide static inline stubs, when the respective guard is not set. This gives us two big advantages: - keeps the pre-processor guards out of the code - we won't get compilation/link issues when doing incremental builds while toggling DRI3/other
Here we must ensure to include only the respective sources. Otherwise we'll get duplicate conflicting symbols. Signed-off-by: Emil Velikov <emil.veli...@collabora.com> --- XXX: Split out the st/va and st/vdpau changes to separate commit(s) ? --- src/gallium/auxiliary/Makefile.am | 14 ++++++++++++++ src/gallium/auxiliary/Makefile.sources | 10 +++++++--- src/gallium/auxiliary/vl/vl_winsys.h | 17 +++++++++++++++-- src/gallium/state_trackers/va/context.c | 2 -- src/gallium/state_trackers/vdpau/device.c | 2 -- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am index c49c265..1b40515 100644 --- a/src/gallium/auxiliary/Makefile.am +++ b/src/gallium/auxiliary/Makefile.am @@ -85,6 +85,11 @@ libgalliumvlwinsys_la_CFLAGS = \ libgalliumvlwinsys_la_SOURCES = \ $(VL_WINSYS_SOURCES) +if HAVE_PLATFORM_X11 + +libgalliumvlwinsys_la_SOURCES += \ + $(VL_WINSYS_DRI_SOURCES) + if HAVE_DRI3 libgalliumvlwinsys_la_SOURCES += \ @@ -92,6 +97,15 @@ libgalliumvlwinsys_la_SOURCES += \ endif +if HAVE_PLATFORM_DRM + +libgalliumvlwinsys_la_SOURCES += \ + $(VL_WINSYS_DRM_SOURCES) + +endif + +endif + endif endif diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 5d4fe30..667e24b 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -348,18 +348,22 @@ VL_SOURCES := \ vl/vl_video_buffer.c \ vl/vl_video_buffer.h \ vl/vl_vlc.h \ - vl/vl_winsys.h \ vl/vl_zscan.c \ vl/vl_zscan.h # XXX: Nuke this as our dri targets no longer depend on VL. VL_WINSYS_SOURCES := \ - vl/vl_winsys_dri.c \ - vl/vl_winsys_drm.c + vl/vl_winsys.h + +VL_WINSYS_DRI_SOURCES := \ + vl/vl_winsys_dri.c VL_WINSYS_DRI3_SOURCES := \ vl/vl_winsys_dri3.c +VL_WINSYS_DRM_SOURCES := \ + vl/vl_winsys_drm.c + VL_STUB_SOURCES := \ vl/vl_stubs.c diff --git a/src/gallium/auxiliary/vl/vl_winsys.h b/src/gallium/auxiliary/vl/vl_winsys.h index f6ee36c..e7f9b08 100644 --- a/src/gallium/auxiliary/vl/vl_winsys.h +++ b/src/gallium/auxiliary/vl/vl_winsys.h @@ -65,15 +65,28 @@ struct vl_screen struct pipe_loader_device *dev; }; +#if defined(HAVE_PLATFORM_DRM) struct vl_screen * -vl_dri2_screen_create(Display *display, int screen); +vl_drm_screen_create(int fd); +#else +static inline struct vl_screen * +vl_drm_screen_create(int fd) { return NULL; ) +#endif +#if defined(HAVE_PLATFORM_X11) struct vl_screen * -vl_drm_screen_create(int fd); +vl_dri2_screen_create(Display *display, int screen); +#else +static inline struct vl_screen * +vl_dri2_screen_create(Display *display, int screen) { return NULL; ) +#endif #if defined(HAVE_DRI3) struct vl_screen * vl_dri3_screen_create(Display *display, int screen); +#else +static inline struct vl_screen * +vl_dri3_screen_create(Display *display, int screen) { return NULL; ) #endif #endif diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c index 1ff19a8..be6f836 100644 --- a/src/gallium/state_trackers/va/context.c +++ b/src/gallium/state_trackers/va/context.c @@ -121,9 +121,7 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx) FREE(drv); return VA_STATUS_ERROR_UNIMPLEMENTED; #endif -#if defined(HAVE_DRI3) drv->vscreen = vl_dri3_screen_create(ctx->native_dpy, ctx->x11_screen); -#endif if (!drv->vscreen) drv->vscreen = vl_dri2_screen_create(ctx->native_dpy, ctx->x11_screen); break; diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c index 81b7582..7724024 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -63,9 +63,7 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, pipe_reference_init(&dev->reference, 1); -#if defined(HAVE_DRI3) dev->vscreen = vl_dri3_screen_create(display, screen); -#endif if (!dev->vscreen) dev->vscreen = vl_dri2_screen_create(display, screen); if (!dev->vscreen) { -- 2.10.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev