Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce autoprobing for decoder driver #19

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4

MAINTAINERCLEANFILES = aclocal.m4 \
compile \
Expand Down
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ AC_INIT([libva-v4l2-request], [1.0.0], [[email protected]])
AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects foreign])

AC_CONFIG_SRCDIR([src/request.c])
AC_CONFIG_MACRO_DIRS([m4])
AC_ENABLE_SHARED
AC_DISABLE_STATIC
AC_LANG_C
Expand All @@ -35,6 +36,7 @@ AM_PROG_AS

PKG_CHECK_MODULES([LIBVA], [libva >= 1.1.0])
PKG_CHECK_MODULES([DRM], [libdrm >= 2.4.52])
PKG_CHECK_MODULES([UDEV], [libudev >= 217])

#LIBS="$LIBS $DRM_LIBS"
#CFLAGS="$CFLAGS $DRM_CFLAGS $LIBVA_CFLAGS"
Expand All @@ -49,5 +51,5 @@ AC_DEFINE_UNQUOTED([VA_DRIVER_INIT_FUNC], [$VA_DRIVER_INIT_FUNC],

AC_CONFIG_HEADERS([src/autoconfig.h])
AC_CONFIG_FILES([Makefile src/Makefile])

AC_CONFIG_MACRO_DIRS([m4])
AC_OUTPUT
18 changes: 16 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,26 @@

project('libva-v4l2-request', 'c',
version: '1.0.0',
default_library : 'shared',
meson_version: '>= 0.43.0')

add_project_arguments('-DMESON_BUILD', language : 'c')

cc = meson.get_compiler('c')

libva_dep = dependency('libva', version : '>= 1.1.0')
libdrm_dep = dependency('libdrm', version : '>= 2.4.52')
libva_dep = dependency('libva',
method: 'pkg-config',
version: '>= 1.1.0',
required: true)

libdrm_dep = dependency('libdrm',
method: 'pkg-config',
version : '>= 2.4.52',
required: true)

libudev_dep = dependency('libudev',
method: 'pkg-config',
required: true)

va_api_version_array = libva_dep.version().split('.')
va_api_major_version = va_api_version_array[0]
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ v4l2_request_drv_video_la_SOURCES = request.c \
h265.c \
h265.h

v4l2_request_drv_video_la_CFLAGS = -I../include $(DRM_CFLAGS) $(LIBVA_CFLAGS)
v4l2_request_drv_video_la_CFLAGS = -I../include $(DRM_CFLAGS) $(LIBVA_CFLAGS) $(UDEV_LIBS)
v4l2_request_drv_video_la_LDFLAGS = -module -avoid-version -no-undefined \
-Wl,--no-undefined
v4l2_request_drv_video_la_LIBADD = $(DRM_LIBS) $(LIBVA_LIBS)
v4l2_request_drv_video_la_LIBADD = $(DRM_LIBS) $(LIBVA_LIBS) $(UDEV_LIBS)
v4l2_request_drv_video_la_LTLIBRARIES = v4l2_request_drv_video.la
v4l2_request_drv_video_ladir = /usr/lib/dri/

Expand Down
9 changes: 6 additions & 3 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "config.h"
#include "request.h"

#include <assert.h>
#include <string.h>

#include <sys/ioctl.h>

#include <linux/videodev2.h>

#include "config.h"
#include "request.h"
#include "utils.h"
#include "v4l2.h"

Expand Down Expand Up @@ -122,9 +121,11 @@ VAStatus RequestQueryConfigProfiles(VADriverContextP context,
profiles[index++] = VAProfileMPEG2Main;
}

/*
found = v4l2_find_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_PIX_FMT_H264_SLICE);
*/
if (found && index < (V4L2_REQUEST_MAX_CONFIG_ATTRIBUTES - 5)) {
profiles[index++] = VAProfileH264Main;
profiles[index++] = VAProfileH264High;
Expand All @@ -133,9 +134,11 @@ VAStatus RequestQueryConfigProfiles(VADriverContextP context,
profiles[index++] = VAProfileH264StereoHigh;
}

/*
found = v4l2_find_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_PIX_FMT_HEVC_SLICE);
*/
if (found && index < (V4L2_REQUEST_MAX_CONFIG_ATTRIBUTES - 1))
profiles[index++] = VAProfileHEVCMain;

Expand Down
4 changes: 4 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include "object_heap.h"
#include "request.h"

#ifdef MESON_BUILD
#define __vaDriverInit "@version@"
#endif

#define CONFIG(data, id) \
((struct object_config *)object_heap_lookup(&(data)->config_heap, id))
#define CONFIG_ID_OFFSET 0x01000000
Expand Down
4 changes: 4 additions & 0 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,21 @@ VAStatus RequestCreateContext(VADriverContextP context, VAConfigID config_id,
pixelformat = V4L2_PIX_FMT_MPEG2_SLICE;
break;

#ifdef V4L2_PIX_FMT_H264_SLICE
case VAProfileH264Main:
case VAProfileH264High:
case VAProfileH264ConstrainedBaseline:
case VAProfileH264MultiviewHigh:
case VAProfileH264StereoHigh:
pixelformat = V4L2_PIX_FMT_H264_SLICE;
break;
#endif

#ifdef V4L2_PIX_FMT_HEVC_SLICE
case VAProfileHEVCMain:
pixelformat = V4L2_PIX_FMT_HEVC_SLICE;
break;
#endif

default:
status = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
Expand Down
Loading