From c0a3cd8fcd113e9fbafe55a7cd0a397600c7569c Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Wed, 20 Jun 2018 17:44:57 +0200 Subject: [PATCH] Remove X11 support with vaPutSurface Using VAAPI as a video output (through vaPutSurface) is deprecated and definitely not recommended for any use case. Since we're starting to support non-X11 pipelines, remove X11 support altogether. Signed-off-by: Paul Kocialkowski --- configure.ac | 1 - src/Makefile.am | 4 ++-- src/sunxi_cedrus.c | 1 - src/surface.c | 54 ---------------------------------------------- src/surface.h | 6 ------ 5 files changed, 2 insertions(+), 64 deletions(-) diff --git a/configure.ac b/configure.ac index a46722f..a523d1f 100644 --- a/configure.ac +++ b/configure.ac @@ -62,7 +62,6 @@ AC_SUBST(LIBDRM_VERSION) dnl Check for VA-API PKG_CHECK_MODULES(LIBVA_DEPS, [libva >= va_api_version]) -PKG_CHECK_MODULES(X11_DEPS, [x11]) dnl Check for VA/DRM API PKG_CHECK_MODULES(LIBVA_DRM_DEPS, [libva-drm], diff --git a/src/Makefile.am b/src/Makefile.am index 55de506..f8a0108 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,8 @@ -AM_CPPFLAGS = -DPTHREADS $(X11_DEPS_CFLAGS) $(DRM_CFLAGS) $(LIBVA_DEPS_CFLAGS) +AM_CPPFLAGS = -DPTHREADS $(DRM_CFLAGS) $(LIBVA_DEPS_CFLAGS) backend_cflags = -Wall -fvisibility=hidden backend_ldflags = -module -avoid-version -no-undefined -Wl,--no-undefined -backend_libs = -lpthread -ldl $(DRM_LIBS) $(X11_DEPS_LIBS) $(LIBVA_DEPS_LIBS) +backend_libs = -lpthread -ldl $(DRM_LIBS) $(LIBVA_DEPS_LIBS) backend_c = sunxi_cedrus.c object_heap.c config.c surface.c context.c buffer.c \ mpeg2.c picture.c subpicture.c image.c v4l2.c media.c utils.c diff --git a/src/sunxi_cedrus.c b/src/sunxi_cedrus.c index f76cc5d..cf12801 100644 --- a/src/sunxi_cedrus.c +++ b/src/sunxi_cedrus.c @@ -99,7 +99,6 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context) vtable->vaEndPicture = SunxiCedrusEndPicture; vtable->vaSyncSurface = SunxiCedrusSyncSurface; vtable->vaQuerySurfaceStatus = SunxiCedrusQuerySurfaceStatus; - vtable->vaPutSurface = SunxiCedrusPutSurface; vtable->vaQueryImageFormats = SunxiCedrusQueryImageFormats; vtable->vaCreateImage = SunxiCedrusCreateImage; vtable->vaDeriveImage = SunxiCedrusDeriveImage; diff --git a/src/surface.c b/src/surface.c index a1a3230..aef1d23 100644 --- a/src/surface.c +++ b/src/surface.c @@ -37,8 +37,6 @@ #include -#include - #include "v4l2.h" #include "media.h" #include "utils.h" @@ -225,58 +223,6 @@ VAStatus SunxiCedrusQuerySurfaceStatus(VADriverContextP context, return VA_STATUS_SUCCESS; } -VAStatus SunxiCedrusPutSurface(VADriverContextP context, VASurfaceID surface_id, - void *draw, short src_x, short src_y, unsigned short src_width, - unsigned short src_height, short dst_x, short dst_y, - unsigned short dst_width, unsigned short dst_height, - VARectangle *cliprects, unsigned int cliprects_count, - unsigned int flags) -{ - struct sunxi_cedrus_driver_data *driver_data = - (struct sunxi_cedrus_driver_data *) context->pDriverData; - GC gc; - Display *display; - const XID xid = (XID)(uintptr_t)draw; - XColor xcolor; - int screen; - Colormap cm; - int colorratio = 65535 / 255; - int x, y; - struct object_surface *surface_object; - - /* WARNING: This is for development purpose only!!! */ - - surface_object = SURFACE(surface_id); - - display = XOpenDisplay(getenv("DISPLAY")); - if (display == NULL) { - sunxi_cedrus_log("Cannot connect to X server\n"); - exit(1); - } - - sunxi_cedrus_log("warning: using vaPutSurface with sunxi-cedrus is not recommended\n"); - screen = DefaultScreen(display); - gc = XCreateGC(display, RootWindow(display, screen), 0, NULL); - XSync(display, False); - - cm = DefaultColormap(display, screen); - xcolor.flags = DoRed | DoGreen | DoBlue; - - for(x=dst_x; x < dst_x+dst_width; x++) { - for(y=dst_y; y < dst_y+dst_height; y++) { - char lum = ((char *) surface_object->destination_data[0])[x+src_width*y]; - xcolor.red = xcolor.green = xcolor.blue = lum*colorratio; - XAllocColor(display, cm, &xcolor); - XSetForeground(display, gc, xcolor.pixel); - XDrawPoint(display, xid, gc, x, y); - } - } - - XFlush(display); - XCloseDisplay(display); - return VA_STATUS_SUCCESS; -} - VAStatus SunxiCedrusLockSurface(VADriverContextP context, VASurfaceID surface_id, unsigned int *fourcc, unsigned int *luma_stride, unsigned int *chroma_u_stride, unsigned int *chroma_v_stride, diff --git a/src/surface.h b/src/surface.h index e16815c..ea7486d 100644 --- a/src/surface.h +++ b/src/surface.h @@ -62,12 +62,6 @@ VAStatus SunxiCedrusSyncSurface(VADriverContextP context, VASurfaceID surface_id); VAStatus SunxiCedrusQuerySurfaceStatus(VADriverContextP context, VASurfaceID surface_id, VASurfaceStatus *status); -VAStatus SunxiCedrusPutSurface(VADriverContextP context, VASurfaceID surface_id, - void *draw, short src_x, short src_y, unsigned short src_width, - unsigned short src_height, short dst_x, short dst_y, - unsigned short dst_width, unsigned short dst_height, - VARectangle *cliprects, unsigned int cliprects_count, - unsigned int flags); VAStatus SunxiCedrusLockSurface(VADriverContextP context, VASurfaceID surface_id, unsigned int *fourcc, unsigned int *luma_stride, unsigned int *chroma_u_stride, unsigned int *chroma_v_stride,