From 4b8b60ebfd399a6641cdd138ebbcf7b1045f0daf Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 11 Nov 2019 09:40:27 +0000 Subject: [PATCH] remoting: Use DRM FourCC formats instead of GBM formats The remoting plugin currently has a set_gbm_format() hook, which accepts GBM_FORMAT_* tokens from the host to set as a supported format. GBM_FORMAT_* values are strictly aliased with DRM_FORMAT_*. In order to avoid an extra unnecessary dependency from the remoting plugin on GBM, switch to using the formats from libdrm instead. This fixes a compile error seen when the remoting plugin is enabled: ../remoting/remoting-plugin.c:39:10: fatal error: gbm.h: No such file or directory 39 | #include | ^~~~~~~ compilation terminated. The error was caused by not having any dependency at all on GBM from the remoting backend, which is fixed here by adding a new dependency on the libdrm headers for drm_fourcc.h. Signed-off-by: Daniel Stone --- remoting/meson.build | 2 +- remoting/remoting-plugin.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/remoting/meson.build b/remoting/meson.build index 8b96f122..ed7ff479 100644 --- a/remoting/meson.build +++ b/remoting/meson.build @@ -10,7 +10,7 @@ if get_option('remoting') 'gstreamer-app-1.0', 'gstreamer-video-1.0', 'gobject-2.0', 'glib-2.0' ] - deps_remoting = [ dep_libweston_private ] + deps_remoting = [ dep_libweston_private, dep_libdrm_headers ] foreach depname : depnames dep = dependency(depname, required: false) if not dep.found() diff --git a/remoting/remoting-plugin.c b/remoting/remoting-plugin.c index c05977eb..8b82572a 100644 --- a/remoting/remoting-plugin.c +++ b/remoting/remoting-plugin.c @@ -36,12 +36,12 @@ #include #include #include -#include #include #include #include #include +#include #include "remoting-plugin.h" #include @@ -69,6 +69,8 @@ struct remoted_gstpipe { /* supported gbm format list */ struct remoted_output_support_gbm_format { + /* GBM_FORMAT_* tokens are strictly aliased with DRM_FORMAT_*, so we + * use the latter to avoid a dependency on GBM */ uint32_t gbm_format; const char *gst_format_string; GstVideoFormat gst_video_format; @@ -76,15 +78,15 @@ struct remoted_output_support_gbm_format { static const struct remoted_output_support_gbm_format supported_formats[] = { { - .gbm_format = GBM_FORMAT_XRGB8888, + .gbm_format = DRM_FORMAT_XRGB8888, .gst_format_string = "BGRx", .gst_video_format = GST_VIDEO_FORMAT_BGRx, }, { - .gbm_format = GBM_FORMAT_RGB565, + .gbm_format = DRM_FORMAT_RGB565, .gst_format_string = "RGB16", .gst_video_format = GST_VIDEO_FORMAT_RGB16, }, { - .gbm_format = GBM_FORMAT_XRGB2101010, + .gbm_format = DRM_FORMAT_XRGB2101010, .gst_format_string = "r210", .gst_video_format = GST_VIDEO_FORMAT_r210, }