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 <gbm.h>
          |          ^~~~~~~
    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 <daniels@collabora.com>
dev
Daniel Stone 5 years ago
parent 04eebc7f07
commit 4b8b60ebfd
  1. 2
      remoting/meson.build
  2. 10
      remoting/remoting-plugin.c

@ -10,7 +10,7 @@ if get_option('remoting')
'gstreamer-app-1.0', 'gstreamer-video-1.0', 'gstreamer-app-1.0', 'gstreamer-video-1.0',
'gobject-2.0', 'glib-2.0' 'gobject-2.0', 'glib-2.0'
] ]
deps_remoting = [ dep_libweston_private ] deps_remoting = [ dep_libweston_private, dep_libdrm_headers ]
foreach depname : depnames foreach depname : depnames
dep = dependency(depname, required: false) dep = dependency(depname, required: false)
if not dep.found() if not dep.found()

@ -36,12 +36,12 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <gbm.h>
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/allocators/gstdmabuf.h> #include <gst/allocators/gstdmabuf.h>
#include <gst/app/gstappsrc.h> #include <gst/app/gstappsrc.h>
#include <gst/video/gstvideometa.h> #include <gst/video/gstvideometa.h>
#include <drm_fourcc.h>
#include "remoting-plugin.h" #include "remoting-plugin.h"
#include <libweston/backend-drm.h> #include <libweston/backend-drm.h>
@ -69,6 +69,8 @@ struct remoted_gstpipe {
/* supported gbm format list */ /* supported gbm format list */
struct remoted_output_support_gbm_format { 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; uint32_t gbm_format;
const char *gst_format_string; const char *gst_format_string;
GstVideoFormat gst_video_format; GstVideoFormat gst_video_format;
@ -76,15 +78,15 @@ struct remoted_output_support_gbm_format {
static const struct remoted_output_support_gbm_format supported_formats[] = { 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_format_string = "BGRx",
.gst_video_format = GST_VIDEO_FORMAT_BGRx, .gst_video_format = GST_VIDEO_FORMAT_BGRx,
}, { }, {
.gbm_format = GBM_FORMAT_RGB565, .gbm_format = DRM_FORMAT_RGB565,
.gst_format_string = "RGB16", .gst_format_string = "RGB16",
.gst_video_format = GST_VIDEO_FORMAT_RGB16, .gst_video_format = GST_VIDEO_FORMAT_RGB16,
}, { }, {
.gbm_format = GBM_FORMAT_XRGB2101010, .gbm_format = DRM_FORMAT_XRGB2101010,
.gst_format_string = "r210", .gst_format_string = "r210",
.gst_video_format = GST_VIDEO_FORMAT_r210, .gst_video_format = GST_VIDEO_FORMAT_r210,
} }

Loading…
Cancel
Save