[Libva] [PATCH 5/5] tests: avcenc: use common VA display creation routines.

Gwenole Beauchesne gb.devel at gmail.com
Mon Jul 2 09:25:24 PDT 2012


From: Dmitry Ermilov <dmitry.ermilov at intel.com>

Signed-off-by: Dmitry Ermilov <dmitry.ermilov at intel.com>
---
 test/encode/Makefile.am |   20 ++++++++++++++++----
 test/encode/avcenc.c    |   12 ++++--------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/test/encode/Makefile.am b/test/encode/Makefile.am
index de42d31..b3e4056 100644
--- a/test/encode/Makefile.am
+++ b/test/encode/Makefile.am
@@ -22,15 +22,27 @@
 
 bin_PROGRAMS = h264encode avcenc
 
-INCLUDES = -I$(top_srcdir)
+libva_helpers = \
+	$(top_builddir)/test/common/libva-display.la	\
+	$(NULL)
 
-TEST_LIBS = $(top_builddir)/va/$(libvabackendlib) $(top_builddir)/va/$(libvacorelib) -lpthread -lX11
+INCLUDES = \
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/test/common		\
+	$(NULL)
+
+TEST_LIBS = \
+	$(top_builddir)/va/$(libvabackendlib)	\
+	$(top_builddir)/va/$(libvacorelib)	\
+	$(libva_helpers)			\
+	$(NULL)
 
 h264encode_LDADD = $(TEST_LIBS)
 h264encode_SOURCES = h264encode_x11.c
 
-avcenc_LDADD= $(TEST_LIBS)
-avcenc_SOURCES= avcenc.c
+avcenc_LDADD		= $(TEST_LIBS)
+avcenc_SOURCES		= avcenc.c
+avcenc_DEPENDENCIES	= $(libva_helpers)
 
 EXTRA_DIST = h264encode_common.c
 
diff --git a/test/encode/avcenc.c b/test/encode/avcenc.c
index adaa28a..04a0d45 100644
--- a/test/encode/avcenc.c
+++ b/test/encode/avcenc.c
@@ -28,11 +28,11 @@
  * ./avcenc <width> <height> <input file> <output file> [qp]
  */  
 
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <getopt.h>
-#include <X11/Xlib.h>
 
 #include <unistd.h>
 
@@ -47,7 +47,7 @@
 
 #include <va/va.h>
 #include <va/va_enc_h264.h>
-#include <va/va_x11.h>
+#include "va_display.h"
 
 #define NAL_REF_IDC_NONE        0
 #define NAL_REF_IDC_LOW         1
@@ -76,7 +76,6 @@
         exit(1);                                                        \
     }
 
-static Display *x11_display;
 static VADisplay va_dpy;
 
 static int picture_width, picture_width_in_mbs;
@@ -142,10 +141,7 @@ static void create_encode_pipe()
     int major_ver, minor_ver;
     VAStatus va_status;
 
-    x11_display = XOpenDisplay(":0.0");
-    assert(x11_display);
-
-    va_dpy = vaGetDisplay(x11_display);
+    va_dpy = va_open_display();
     va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
     CHECK_VASTATUS(va_status, "vaInitialize");
 
@@ -200,7 +196,7 @@ static void destory_encode_pipe()
     vaDestroyContext(va_dpy,avcenc_context.context_id);
     vaDestroyConfig(va_dpy,avcenc_context.config_id);
     vaTerminate(va_dpy);
-    XCloseDisplay(x11_display);
+    va_close_display(va_dpy);
 }
 
 /***************************************************
-- 
1.7.9.5



More information about the Libva mailing list