Commit 92e17d62 authored by Austin Yuan's avatar Austin Yuan

Merge branch 'master' of git+ssh://AustinYuan@git.freedesktop.org/git/libva into sync-fdo-master

parents 5405c6ed 11f69c84
......@@ -22,7 +22,7 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src test
SUBDIRS = va test
if BUILD_DUMMY_DRIVER
SUBDIRS += dummy_drv_video
endif
......
......@@ -116,9 +116,9 @@ AC_SUBST([libvabackendlib])
AC_OUTPUT([
Makefile
src/Makefile
src/va_version.h
src/x11/Makefile
va/Makefile
va/va_version.h
va/x11/Makefile
dummy_drv_video/Makefile
i965_drv_video/Makefile
i965_drv_video/shaders/Makefile
......
......@@ -23,10 +23,10 @@
dummy_drv_video_la_LTLIBRARIES = dummy_drv_video.la
dummy_drv_video_ladir = @LIBVA_DRIVERS_PATH@
dummy_drv_video_la_LDFLAGS = -module -avoid-version -no-undefined -Wl,--no-undefined
dummy_drv_video_la_LIBADD = $(top_srcdir)/src/$(libvabackendlib)
dummy_drv_video_la_DEPENDENCIES = $(top_srcdir)/src/$(libvabackendlib)
dummy_drv_video_la_LIBADD = $(top_srcdir)/va/$(libvabackendlib)
dummy_drv_video_la_DEPENDENCIES = $(top_srcdir)/va/$(libvabackendlib)
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/../../include/kmd -DIN_LIBVA
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/../../include/kmd
dummy_drv_video_la_SOURCES = dummy_drv_video.c object_heap.c
noinst_HEADERS = dummy_drv_video.h object_heap.h
......@@ -22,12 +22,13 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "va_backend.h"
#include <va/va_backend.h>
#include "dummy_drv_video.h"
#include "assert.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
......
......@@ -25,7 +25,7 @@
#ifndef _DUMMY_DRV_VIDEO_H_
#define _DUMMY_DRV_VIDEO_H_
#include "va.h"
#include <va/va.h>
#include "object_heap.h"
#define DUMMY_MAX_PROFILES 11
......
......@@ -22,12 +22,12 @@
SUBDIRS = shaders
AM_CFLAGS = -Wall -I$(top_srcdir)/src -I$(top_srcdir)/src/x11 @DRM_CFLAGS@ -DIN_LIBVA
AM_CFLAGS = -Wall -I$(top_srcdir)/va -I$(top_srcdir)/va/x11 @DRM_CFLAGS@
i965_drv_video_la_LTLIBRARIES = i965_drv_video.la
i965_drv_video_ladir = @LIBVA_DRIVERS_PATH@
i965_drv_video_la_LDFLAGS = -module -avoid-version -no-undefined -Wl,--no-undefined @DRM_LIBS@ -ldrm_intel
i965_drv_video_la_LIBADD = ../src/libva-x11.la -lpthread
i965_drv_video_la_LIBADD = ../va/libva-x11.la -lpthread
i965_drv_video_la_SOURCES = \
object_heap.c \
......
......@@ -27,11 +27,11 @@
*
*/
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "va_backend.h"
#include "va_dricommon.h"
#include "va/x11/va_dricommon.h"
#include "intel_driver.h"
#include "intel_memman.h"
......
......@@ -30,7 +30,9 @@
#ifndef _I965_DRV_VIDEO_H_
#define _I965_DRV_VIDEO_H_
#include "va.h"
#include <va/va.h>
#include <va/va_backend.h>
#include "object_heap.h"
#include "intel_driver.h"
......
......@@ -31,7 +31,7 @@
#include <string.h>
#include <assert.h>
#include "va_backend.h"
#include <va/va_backend.h>
#include "intel_batchbuffer.h"
#include "intel_driver.h"
......
......@@ -31,7 +31,7 @@
#include <string.h>
#include <assert.h>
#include "va_backend.h"
#include <va/va_backend.h>
#include "intel_batchbuffer.h"
#include "intel_driver.h"
......
......@@ -32,11 +32,12 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "va_backend.h"
#include "va_dricommon.h"
#include <va/va_backend.h>
#include "va/x11/va_dricommon.h"
#include "intel_batchbuffer.h"
#include "intel_driver.h"
......
......@@ -25,10 +25,11 @@
*
**************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "va_backend.h"
#include <va/va_backend.h>
#include "intel_batchbuffer.h"
......
......@@ -9,7 +9,7 @@
#include <i915_drm.h>
#include <intel_bufmgr.h>
#include "va_backend.h"
#include <va/va_backend.h>
#if defined(__GNUC__)
#define INLINE __inline__
......
......@@ -23,11 +23,11 @@
bin_PROGRAMS = vainfo
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/test/basic -I$(top_srcdir)/src/x11 -DIN_LIBVA
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/test/basic -I$(top_srcdir)/src/x11
vainfo_LDADD = $(top_srcdir)/src/$(libvabackendlib)
vainfo_DEPENDENCIES = $(top_srcdir)/src/$(libvabackendlib)
vainfo_LDADD = $(top_srcdir)/va/$(libvabackendlib)
vainfo_DEPENDENCIES = $(top_srcdir)/va/$(libvabackendlib)
vainfo_SOURCES = vainfo.c
SUBDIRS = basic decode encode putsurface
......
......@@ -23,9 +23,9 @@
bin_PROGRAMS = test_01 test_02 test_03 test_04 test_05 test_06 \
test_07 test_08 test_09 test_10 test_11
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/x11 -DIN_LIBVA
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/src/x11
TEST_LIBS = $(top_srcdir)/src/$(libvabackendlib)
TEST_LIBS = $(top_srcdir)/va/$(libvabackendlib)
test_01_LDADD = $(TEST_LIBS)
test_01_SOURCES = test_01.c
......
......@@ -22,11 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef IN_LIBVA
#include <va_x11.h>
#else
#include <va/va_x11.h>
#endif
#include "assert.h"
#include <stdarg.h>
......
......@@ -22,11 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef IN_LIBVA
#include <va_x11.h>
#else
#include <va/va_x11.h>
#endif
#include "assert.h"
#include <stdarg.h>
......
......@@ -22,9 +22,9 @@
bin_PROGRAMS = mpeg2vldemo
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/x11 -DIN_LIBVA
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/src/x11
TEST_LIBS = $(top_srcdir)/src/$(libvabackendlib)
TEST_LIBS = $(top_srcdir)/va/$(libvabackendlib)
mpeg2vldemo_LDADD = $(TEST_LIBS)
mpeg2vldemo_SOURCES = mpeg2vldemo.c
......
......@@ -47,8 +47,8 @@
#include <assert.h>
#include "va.h"
#include "va_x11.h"
#include <va/va.h>
#include <va/va_x11.h>
#define CHECK_VASTATUS(va_status,func) \
if (va_status != VA_STATUS_SUCCESS) { \
......
......@@ -22,9 +22,9 @@
bin_PROGRAMS = h264encode
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/x11 -DIN_LIBVA
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/src/x11
TEST_LIBS = $(top_srcdir)/src/$(libvabackendlib)
TEST_LIBS = $(top_srcdir)/va/$(libvabackendlib)
h264encode_LDADD = $(TEST_LIBS)
h264encode_SOURCES = h264encode.c
......
......@@ -26,7 +26,7 @@
* it is a real program to show how VAAPI encoding work,
* It does H264 element stream level encoding on auto-generated YUV data
*
* gcc -o h264encode h264encode -lva -lva-x11 -I/usr/include/va
* gcc -o h264encode h264encode -lva -lva-x11
* ./h264encode -w <width> -h <height> -n <frame_num>
*
*/
......@@ -44,9 +44,8 @@
#include <assert.h>
#include "va.h"
#include "va_x11.h"
#include <va/va.h>
#include <va/va_x11.h>
#define CHECK_VASTATUS(va_status,func) \
if (va_status != VA_STATUS_SUCCESS) { \
......@@ -212,10 +211,11 @@ static int do_h264_encoding(void)
VAEncPictureParameterBufferH264 pic_h264;
VAEncSliceParameterBuffer slice_h264;
VAStatus va_status;
VABufferID coded_buf, seq_param_buf, pic_param_buf, slice_param_buf;
VABufferID seq_param_buf, pic_param_buf, slice_param_buf;
int codedbuf_size;
VASurfaceStatus surface_status;
int src_surface, dst_surface, ref_surface;
int codedbuf_idx = 0;
int frame_skipped = 0;
int i;
......@@ -229,12 +229,24 @@ static int do_h264_encoding(void)
codedbuf_size = (frame_width * frame_height * 400) / (16*16);
for (i = 0; i < CODEDBUF_NUM; i++) {
/* create coded buffer once for all
* other VA buffers which won't be used again after vaRenderPicture.
* so APP can always vaCreateBuffer for every frame
* but coded buffer need to be mapped and accessed after vaRenderPicture/vaEndPicture
* so VA won't maintain the coded buffer
*/
va_status = vaCreateBuffer(va_dpy,context_id,VAEncCodedBufferType,
codedbuf_size, 1, NULL, &coded_buf[i]);
CHECK_VASTATUS(va_status,"vaBeginPicture");
}
src_surface = 0;
/* the last two frames are reference/reconstructed frame */
dst_surface = SURFACE_NUM - 1;
ref_surface = SURFACE_NUM - 2;
for (i=0; i < frame_count; i++) {
for (i = 0; i < frame_count; i++) {
va_status = vaBeginPicture(va_dpy, context_id, surface_id[src_surface]);
CHECK_VASTATUS(va_status,"vaBeginPicture");
......@@ -249,7 +261,7 @@ static int do_h264_encoding(void)
seq_h264.frame_rate = frame_rate;
seq_h264.initial_qp = initial_qp;
seq_h264.min_qp = minimal_qp;
seq_h264.basic_unit_size = 6;
seq_h264.basic_unit_size = 0;
seq_h264.intra_period = intra_count;
va_status = vaCreateBuffer(va_dpy, context_id,
......@@ -261,12 +273,10 @@ static int do_h264_encoding(void)
CHECK_VASTATUS(va_status,"vaRenderPicture");;
}
va_status = vaCreateBuffer(va_dpy,context_id,VAEncCodedBufferType,
codedbuf_size, 1, NULL, &coded_buf);
pic_h264.reference_picture = surface_id[ref_surface];
pic_h264.reconstructed_picture= surface_id[dst_surface];
pic_h264.coded_buf = coded_buf;
pic_h264.coded_buf = coded_buf[codedbuf_idx];
pic_h264.picture_width = frame_width;
pic_h264.picture_height = frame_height;
pic_h264.last_picture = (i==frame_count);
......@@ -300,7 +310,7 @@ static int do_h264_encoding(void)
va_status = vaQuerySurfaceStatus(va_dpy, surface_id[src_surface],&surface_status);
frame_skipped = (surface_status & VASurfaceSkipped);
save_coded_buf(coded_buf, i, frame_skipped);
save_coded_buf(coded_buf[codedbuf_idx], i, frame_skipped);
/* should display reconstructed frame, but just diplay source frame */
if (frame_display) {
......@@ -316,6 +326,11 @@ static int do_h264_encoding(void)
if (src_surface == (SURFACE_NUM - 2))
src_surface = 0;
/* use next codedbuf */
codedbuf_idx++;
if (codedbuf_idx == (CODEDBUF_NUM - 1))
codedbuf_idx = 0;
/* if a frame is skipped, current frame still use last reference frame */
if (frame_skipped == 0) {
/* swap ref/dst */
......@@ -376,6 +391,7 @@ int main(int argc,char **argv)
printf("./h264encode <options>\n");
printf(" -w -h: resolution\n");
printf(" -n frame number\n");
printf(" -d display the source frame\n");
printf(" -p P frame count between two I frames\n");
printf(" -f frame rate\n");
printf(" -r bit rate\n");
......
......@@ -22,13 +22,15 @@
bin_PROGRAMS = putsurface
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/x11 -DIN_LIBVA
AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/src/x11
TEST_LIBS = $(top_srcdir)/src/$(libvabackendlib)
TEST_LIBS = $(top_srcdir)/va/$(libvabackendlib) -lpthread
putsurface_LDADD = $(TEST_LIBS)
putsurface_SOURCES = putsurface.c
EXTRA_DIST = loadsurface.h
valgrind: $(bin_PROGRAMS)
for a in $(bin_PROGRAMS); do \
......
......@@ -23,7 +23,7 @@
*/
/* gcc -o putsurface putsurface.c -lva -lva-x11 -I/usr/include/va */
/* gcc -o putsurface putsurface.c -lva -lva-x11 */
#include <stdio.h>
#include <string.h>
......@@ -39,8 +39,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#include "va.h"
#include "va_x11.h"
#include <va/va.h>
#include <va/va_x11.h>
#include <assert.h>
......
......@@ -22,11 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef IN_LIBVA
#include <va_x11.h>
#else
#include <va/va_x11.h>
#endif
#include <stdarg.h>
#include <stdio.h>
......
......@@ -21,8 +21,7 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
INCLUDES = \
$(LIBVA_CFLAGS) -I$(top_srcdir)/src/x11 \
-DIN_LIBVA \
$(LIBVA_CFLAGS) -I$(top_srcdir)/va/x11 \
-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\""
LDADD = \
......@@ -46,7 +45,7 @@ SUBDIRS = x11
libva_la_SOURCES = va.c
libvaincludedir = ${includedir}/va
libvainclude_HEADERS = va.h va_backend.h va_version.h
libvainclude_HEADERS = va.h va_x11.h va_backend.h va_version.h
DISTCLEANFILES = \
va_version.h
......
......@@ -23,21 +23,18 @@
*/
#define _GNU_SOURCE 1
#include "va.h"
#include "va_backend.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <unistd.h>
#include <linux/videodev2.h>
#include "va_dri.h"
#include "va_dri2.h"
#include "va_dricommon.h"
#define DRIVER_INIT_FUNC "__vaDriverInit_0_31"
......
......@@ -65,11 +65,7 @@
#ifndef _VA_H_
#define _VA_H_
#ifdef IN_LIBVA
#include "va_version.h"
#else
#include <va/va_version.h>
#endif
#ifdef __cplusplus
extern "C" {
......@@ -131,6 +127,22 @@ typedef int VAStatus; /* Return status type from functions */
#define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
/* De-interlacing flags for vaPutSurface() */
#define VA_FRAME_PICTURE 0x00000000
#define VA_TOP_FIELD 0x00000001
#define VA_BOTTOM_FIELD 0x00000002
/*
* Clears the drawable with background color.
* for hardware overlay based implementation this flag
* can be used to turn off the overlay
*/
#define VA_CLEAR_DRAWABLE 0x00000008
/* Color space conversion flags for vaPutSurface() */
#define VA_SRC_BT601 0x00000010
#define VA_SRC_BT709 0x00000020
/*
* Returns a short english description of error_status
*/
......
......@@ -29,15 +29,8 @@
#ifndef _VA_BACKEND_H_
#define _VA_BACKEND_H_
#ifdef IN_LIBVA
#include "va.h"
#include "x11/va_x11.h"
#else
#include <va/va.h>
#include <va/va_x11.h>
#endif
#include <stdlib.h>
#include <X11/Xlib.h>
#include <linux/videodev2.h>
......
#ifndef _VA_X11_H_
#define _VA_X11_H_
#ifdef IN_LIBVA
#include "va.h"
#else
#include <va/va.h>
#endif
#include <X11/Xlib.h>
#ifdef __cplusplus
......@@ -27,22 +23,6 @@ VADisplay vaGetDisplay (
* color space conversion and scaling to the destination
* rectangle
*/
/* de-interlacing flags for vaPutSurface */
#define VA_FRAME_PICTURE 0x00000000
#define VA_TOP_FIELD 0x00000001
#define VA_BOTTOM_FIELD 0x00000002
/*
* clears the drawable with background color.
* for hardware overlay based implementation this flag
* can be used to turn off the overlay
*/
#define VA_CLEAR_DRAWABLE 0x00000008
/* color space conversion flags for vaPutSurface */
#define VA_SRC_BT601 0x00000010
#define VA_SRC_BT709 0x00000020
VAStatus vaPutSurface (
VADisplay dpy,
VASurfaceID surface,
......
......@@ -18,12 +18,12 @@
# otherwise. Any license under such intellectual property rights must be
# express and approved by Intel in writing.
AM_CFLAGS = -DLINUX -DIN_LIBVA -I$(top_srcdir)/src $(DRM_CFLAGS)
AM_CFLAGS = -DLINUX -I$(top_srcdir)/va $(DRM_CFLAGS)
noinst_LTLIBRARIES = libva_x11.la
libva_x11includedir = ${includedir}/va
libva_x11include_HEADERS = va_x11.h va_dri.h va_dri2.h va_dricommon.h
libva_x11include_HEADERS = va_dri.h va_dri2.h va_dricommon.h
libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c
......
......@@ -7,7 +7,7 @@
#include <drm.h>
#include <drm_sarea.h>
#include "va_backend.h"
#include <va/va_backend.h>
enum
{
......
......@@ -32,6 +32,7 @@
#include "va_dricommon.h"
#include "va_nvctrl.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment