[PATCH weston] simple-dmabuf-drm: drop dependency on libdrm
Emilio Pozuelo Monfort
pochu27 at gmail.com
Wed Jul 11 11:52:45 UTC 2018
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo at collabora.co.uk>
---
clients/simple-dmabuf-drm.c | 32 +++++++++++---------------------
configure.ac | 2 +-
2 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
index 1d452183..a6c3b16d 100644
--- a/clients/simple-dmabuf-drm.c
+++ b/clients/simple-dmabuf-drm.c
@@ -42,7 +42,6 @@
#include <errno.h>
#include <gbm.h>
-#include <drm_fourcc.h>
#include <wayland-client.h>
#include "shared/zalloc.h"
@@ -130,15 +129,8 @@ fill_content(struct buffer *my_buf, uint64_t modifier)
assert(my_buf->mmap);
- if (my_buf->format == DRM_FORMAT_NV12) {
- if (modifier == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) {
- pix = (uint32_t *) my_buf->mmap;
- for (y = 0; y < my_buf->height; y++)
- memcpy(&pix[y * my_buf->width / 4],
- &nv12_tiled[my_buf->width * y / 4],
- my_buf->width);
- }
- else if (modifier == DRM_FORMAT_MOD_LINEAR) {
+ if (my_buf->format == GBM_FORMAT_NV12) {
+ if (modifier == DRM_FORMAT_MOD_LINEAR) {
uint8_t *pix8;
/* first plane: Y (2/3 of the buffer) */
for (y = 0; y < my_buf->height * 2/3; y++) {
@@ -233,8 +225,7 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer,
buffer->width = width;
switch (format) {
- case DRM_FORMAT_NV12:
- format = GBM_FORMAT_NV12;
+ case GBM_FORMAT_NV12:
/* adjust height for allocation of NV12 Y and UV planes */
buffer->height = height * 3 / 2;
buffer->bpp = 8;
@@ -287,7 +278,7 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer,
modifier >> 32,
modifier & 0xffffffff);
- if (format == DRM_FORMAT_NV12) {
+ if (format == GBM_FORMAT_NV12) {
/* add the second plane params */
zwp_linux_buffer_params_v1_add(params,
buffer->dmabuf_fd,
@@ -498,12 +489,11 @@ dmabuf_modifiers(void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf,
uint64_t modifier = ((uint64_t) modifier_hi << 32) | modifier_lo;
switch (format) {
- case DRM_FORMAT_XRGB8888:
+ case GBM_FORMAT_XRGB8888:
d->xrgb8888_format_found = 1;
break;
- case DRM_FORMAT_NV12:
+ case GBM_FORMAT_NV12:
switch (modifier) {
- case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE:
case DRM_FORMAT_MOD_LINEAR:
d->nv12_format_found = 1;
d->nv12_modifier = modifier;
@@ -596,8 +586,8 @@ create_display(int opts, int format)
wl_display_roundtrip(display->display);
- if ((format == DRM_FORMAT_XRGB8888 && !display->xrgb8888_format_found) ||
- (format == DRM_FORMAT_NV12 && !display->nv12_format_found)) {
+ if ((format == GBM_FORMAT_XRGB8888 && !display->xrgb8888_format_found) ||
+ (format == GBM_FORMAT_NV12 && !display->nv12_format_found)) {
fprintf(stderr, "requested format is not available\n");
return NULL;
}
@@ -661,9 +651,9 @@ static int
parse_import_format(const char* c)
{
if (!strcmp(c, "NV12"))
- return DRM_FORMAT_NV12;
+ return GBM_FORMAT_NV12;
else if (!strcmp(c, "XRGB"))
- return DRM_FORMAT_XRGB8888;
+ return GBM_FORMAT_XRGB8888;
else
print_usage_and_exit();
@@ -677,7 +667,7 @@ main(int argc, char **argv)
struct display *display;
struct window *window;
int opts = 0;
- int import_format = DRM_FORMAT_XRGB8888;
+ int import_format = GBM_FORMAT_XRGB8888;
int c, option_index, ret = 0;
static struct option long_options[] = {
diff --git a/configure.ac b/configure.ac
index 08a5c7b1..24378d9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -391,7 +391,7 @@ AC_ARG_ENABLE(simple-dmabuf-drm-client,
[do not build the simple dmabuf drm client]),,
enable_simple_dmabuf_drm_client="auto")
if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; then
- PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm gbm], [have_simple_dmabuf_libs=yes],
+ PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client gbm], [have_simple_dmabuf_libs=yes],
[have_simple_dmabuf_libs=no])
PKG_CHECK_MODULES(LIBDRM_PLATFORM_FREEDRENO, [libdrm_freedreno],
--
2.18.0
More information about the wayland-devel
mailing list