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>
This commit is contained in:
Daniel Stone 2019-11-11 09:40:27 +00:00
parent 04eebc7f07
commit 4b8b60ebfd
2 changed files with 7 additions and 5 deletions

View file

@ -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()

View file

@ -36,12 +36,12 @@
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <gbm.h>
#include <gst/gst.h>
#include <gst/allocators/gstdmabuf.h>
#include <gst/app/gstappsrc.h>
#include <gst/video/gstvideometa.h>
#include <drm_fourcc.h>
#include "remoting-plugin.h"
#include <libweston/backend-drm.h>
@ -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,
}