Merge pull request #7525 from IdrisKalp/master

libva-vdpau-driver add to repo
This commit is contained in:
Idris Kalp
2020-01-14 14:59:20 +03:00
committed by GitHub
8 changed files with 341 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt.
from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
def setup():
autotools.autoreconf("-vif")
autotools.configure()
def build():
autotools.make()
def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
pisitools.dodoc("COPYING", "AUTHORS", "README")
@@ -0,0 +1,51 @@
Index: vdpau-video-0.7.4/src/vdpau_driver.c
===================================================================
--- vdpau-video-0.7.4.orig/src/vdpau_driver.c
+++ vdpau-video-0.7.4/src/vdpau_driver.c
@@ -174,7 +174,7 @@ vdpau_common_Terminate(vdpau_driver_data
}
vdpau_gate_exit(driver_data);
- if (driver_data->vdp_dpy) {
+ if (!driver_data->x_fallback && driver_data->vdp_dpy) {
XCloseDisplay(driver_data->vdp_dpy);
driver_data->vdp_dpy = NULL;
}
@@ -187,9 +187,14 @@ vdpau_common_Initialize(vdpau_driver_dat
/* Create a dedicated X11 display for VDPAU purposes */
const char * const x11_dpy_name = XDisplayString(driver_data->x11_dpy);
driver_data->vdp_dpy = XOpenDisplay(x11_dpy_name);
- if (!driver_data->vdp_dpy)
- return VA_STATUS_ERROR_UNKNOWN;
-
+ /* Fallback to existing X11 display */
+ driver_data->x_fallback = false;
+ if (!driver_data->vdp_dpy) {
+ driver_data->x_fallback = true;
+ driver_data->vdp_dpy = driver_data->x11_dpy;
+ printf("Failed to create dedicated X11 display!\n");
+ }
+
VdpStatus vdp_status;
driver_data->vdp_device = VDP_INVALID_HANDLE;
vdp_status = vdp_device_create_x11(
Index: vdpau-video-0.7.4/src/vdpau_driver.h
===================================================================
--- vdpau-video-0.7.4.orig/src/vdpau_driver.h
+++ vdpau-video-0.7.4/src/vdpau_driver.h
@@ -21,6 +21,7 @@
#ifndef VDPAU_DRIVER_H
#define VDPAU_DRIVER_H
+#include <stdbool.h>
#include <va/va_backend.h>
#include "vaapi_compat.h"
#include "vdpau_gate.h"
@@ -100,6 +101,7 @@ struct vdpau_driver_data {
uint64_t va_display_attrs_mtime[VDPAU_MAX_DISPLAY_ATTRIBUTES];
unsigned int va_display_attrs_count;
char va_vendor[256];
+ bool x_fallback;
};
typedef struct object_config *object_config_p;
@@ -0,0 +1,105 @@
Index: vdpau-video-0.7.4/src/vdpau_driver_template.h
===================================================================
--- vdpau-video-0.7.4.orig/src/vdpau_driver_template.h
+++ vdpau-video-0.7.4/src/vdpau_driver_template.h
@@ -115,6 +115,13 @@ struct VA_DRIVER_VTABLE {
int *num_attribs /* out */
);
+ VAStatus (*vaQuerySurfaceAttributes) (
+ VADisplay dpy,
+ VAConfigID config_id,
+ VASurfaceAttrib *attrib_list, /* out */
+ unsigned int *num_attribs /* out */
+ );
+
VAStatus (*vaCreateSurfaces) (
VADriverContextP ctx,
int width,
@@ -589,6 +596,7 @@ static VAStatus FUNC(Initialize)(VA_DRIV
vtable->vaCreateConfig = vdpau_CreateConfig;
vtable->vaDestroyConfig = vdpau_DestroyConfig;
vtable->vaGetConfigAttributes = vdpau_GetConfigAttributes;
+ vtable->vaQuerySurfaceAttributes = vdpau_QuerySurfaceAttributes;
vtable->vaCreateSurfaces = vdpau_CreateSurfaces;
vtable->vaDestroySurfaces = vdpau_DestroySurfaces;
vtable->vaCreateContext = vdpau_CreateContext;
Index: vdpau-video-0.7.4/src/vdpau_video.c
===================================================================
--- vdpau-video-0.7.4.orig/src/vdpau_video.c
+++ vdpau-video-0.7.4/src/vdpau_video.c
@@ -309,6 +309,54 @@ int surface_remove_association(
return -1;
}
+// vaQuerySurfaceAttributes
+VAStatus
+vdpau_QuerySurfaceAttributes(
+ VADriverContextP ctx,
+ VAConfigID config_id,
+ VASurfaceAttrib *attrib_list,
+ unsigned int *num_attribs
+)
+{
+ VDPAU_DRIVER_DATA_INIT;
+
+ object_config_p obj_config;
+ if ((obj_config = VDPAU_CONFIG(config_id)) == NULL)
+ return VA_STATUS_ERROR_INVALID_CONFIG;
+
+ if (!attrib_list && !num_attribs)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ if (!attrib_list) {
+ *num_attribs = 2;
+ return VA_STATUS_SUCCESS;
+ }
+
+ if (*num_attribs < 2) {
+ *num_attribs = 2;
+ return VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
+ }
+
+ VdpDecoderProfile vdp_profile;
+ uint32_t max_width, max_height;
+ vdp_profile = get_VdpDecoderProfile(obj_config->profile);
+ if (!get_max_surface_size(driver_data, vdp_profile, &max_width, &max_height))
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+
+ if (attrib_list) {
+ attrib_list[0].type = VASurfaceAttribMaxWidth;
+ attrib_list[0].flags = VA_SURFACE_ATTRIB_GETTABLE;
+ attrib_list[0].value.type = VAGenericValueTypeInteger;
+ attrib_list[0].value.value.i = max_width;
+ attrib_list[1].type = VASurfaceAttribMaxHeight;
+ attrib_list[1].flags = VA_SURFACE_ATTRIB_GETTABLE;
+ attrib_list[1].value.type = VAGenericValueTypeInteger;
+ attrib_list[1].value.value.i = max_height;
+ }
+
+ return VA_STATUS_SUCCESS;
+}
+
// vaDestroySurfaces
VAStatus
vdpau_DestroySurfaces(
Index: vdpau-video-0.7.4/src/vdpau_video.h
===================================================================
--- vdpau-video-0.7.4.orig/src/vdpau_video.h
+++ vdpau-video-0.7.4/src/vdpau_video.h
@@ -165,6 +165,15 @@ vdpau_QueryConfigAttributes(
int *num_attribs
) attribute_hidden;
+// vaQuerySurfaceAttributes
+VAStatus
+vdpau_QuerySurfaceAttributes(
+ VADriverContextP ctx,
+ VAConfigID config_id,
+ VASurfaceAttrib *attrib_list,
+ unsigned int *num_attribs
+) attribute_hidden;
+
// vaCreateSurfaces
VAStatus
vdpau_CreateSurfaces(
@@ -0,0 +1,29 @@
>From fda3706eb74ba5ad874853969f3df3e372739c8d Mon Sep 17 00:00:00 2001
From: "Xiang, Haihao" <haihao.xiang@intel.com>
Date: Fri, 21 Jun 2013 12:55:30 +0800
Subject: [PATCH] VAEncH264VUIBufferType and VAEncH264SEIBufferType are
dropped from VA API
The driver doesn't use them indeed
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
---
src/vdpau_dump.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/vdpau_dump.c b/src/vdpau_dump.c
index 899888b..610e7cd 100644
--- a/src/vdpau_dump.c
+++ b/src/vdpau_dump.c
@@ -59,8 +59,6 @@ const char *string_of_VABufferType(VABufferType type)
_(VAEncSequenceParameterBufferType);
_(VAEncPictureParameterBufferType);
_(VAEncSliceParameterBufferType);
- _(VAEncH264VUIBufferType);
- _(VAEncH264SEIBufferType);
#endif
#if VA_CHECK_VERSION(0,31,1)
_(VAQMatrixBufferType);
--
1.7.9.5
@@ -0,0 +1,16 @@
--- a/src/utils_glx.h~ 2012-10-05 16:02:58.000000000 +0100
+++ b/src/utils_glx.h 2012-10-19 08:44:12.469642440 +0100
@@ -48,6 +48,13 @@
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
#endif
+#if GL_GLEXT_VERSION >= 85
+/* XXX: PFNGLMULTITEXCOORD2FPROC got out of the GL_VERSION_1_3_DEPRECATED
+ block and is not defined if GL_VERSION_1_3 is defined in <GL/gl.h>
+ Redefine the type here as an interim solution */
+typedef void (*PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
+#endif
+
#ifndef GL_FRAMEBUFFER_BINDING
#define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT
#endif
@@ -0,0 +1,11 @@
--- a/src/vdpau_decode.c
+++ b/src/vdpau_decode.c
@@ -1289,7 +1289,7 @@
driver_data,
obj_context->vdp_decoder,
obj_surface->vdp_surface,
- (VdpPictureInfo)&obj_context->vdp_picture_info,
+ (VdpPictureInfo *)&obj_context->vdp_picture_info,
obj_context->vdp_bitstream_buffers_count,
obj_context->vdp_bitstream_buffers
);
@@ -0,0 +1,28 @@
diff -Nru libva-vdpau-driver-0.7.4.orig/src/vdpau_video.c libva-vdpau-driver-0.7.4/src/vdpau_video.c
--- libva-vdpau-driver-0.7.4.orig/src/vdpau_video.c 2012-10-05 18:02:58.000000000 +0300
+++ libva-vdpau-driver-0.7.4/src/vdpau_video.c 2020-01-14 14:52:16.835039658 +0300
@@ -927,8 +927,10 @@
vdpau_CreateSurfaceFromV4L2Buf(
VADriverContextP ctx,
int v4l2_fd,
+ /*
struct v4l2_format *v4l2_fmt,
struct v4l2_buffer *v4l2_buf,
+ */
VASurfaceID *surface
)
{
diff -Nru libva-vdpau-driver-0.7.4.orig/src/vdpau_video.h libva-vdpau-driver-0.7.4/src/vdpau_video.h
--- libva-vdpau-driver-0.7.4.orig/src/vdpau_video.h 2012-10-05 18:02:58.000000000 +0300
+++ libva-vdpau-driver-0.7.4/src/vdpau_video.h 2020-01-14 14:52:33.336040027 +0300
@@ -274,8 +274,10 @@
vdpau_CreateSurfaceFromV4L2Buf(
VADriverContextP ctx,
int v4l2_fd,
+ /*
struct v4l2_format *v4l2_fmt,
struct v4l2_buffer *v4l2_buf,
+ */
VASurfaceID *surface
) attribute_hidden;
+81
View File
@@ -0,0 +1,81 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>libva-vdpau-driver</Name>
<Homepage>https://github.com/arekinath/libva-vdpau-driver</Homepage>
<Packager>
<Name>İdris Kalp</Name>
<Email>idriskalp@gmail.com</Email>
</Packager>
<License>GPL</License>
<IsA>driver</IsA>
<Summary>VDPAU backend for VA API</Summary>
<Description>libva-vdpau-driver consists in a VDPAU-based backend for VA-API</Description>
<Archive sha1sum="224318f4ea8bafca6a0fec770e388b7d1a1a66b3" type="tarbz2">https://freedesktop.org/software/vaapi/releases/libva-vdpau-driver/libva-vdpau-driver-0.7.4.tar.bz2</Archive>
<BuildDependencies>
<!-- <Dependency>libglvnd-devel</Dependency> -->
<Dependency>libva-devel</Dependency>
<Dependency>libvdpau-devel</Dependency>
<Dependency>libX11-devel</Dependency>
<Dependency>mesa-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">libva-vdpau-driver-0.7.4-glext-missing-definition.patch</Patch>
<Patch level="1">libva-vdpau-driver-0.7.4-libvdpau-0.8.patch</Patch>
<Patch level="1">libva-vdpau-driver-0.7.4-VAEncH264VUIBufferType.patch</Patch>
<Patch level="1">implement-vaquerysurfaceattributes.patch</Patch>
<Patch level="1">fallback-x.patch</Patch>
<Patch level="1">vdpau_CreateSurfaceFromV4L2Buf-fix.patch</Patch>
</Patches>
</Source>
<Package>
<Name>libva-vdpau-driver</Name>
<RuntimeDependencies>
<!-- <Dependency>libglvnd</Dependency> -->
<Dependency>libva</Dependency>
<Dependency>libvdpau</Dependency>
<Dependency>libX11</Dependency>
<Dependency>mesa</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib</Path>
<Path fileType="doc">/usr/share/doc</Path>
</Files>
</Package>
<Package>
<Name>libva-vdpau-driver-32bit</Name>
<BuildType>emul32</BuildType>
<PartOf>emul32</PartOf>
<BuildDependencies>
<!-- <Dependency>libglvnd-32bit</Dependency> -->
<Dependency>libva-32bit</Dependency>
<Dependency>libvdpau-32bit</Dependency>
<Dependency>libX11-32bit</Dependency>
<Dependency>mesa-32bit</Dependency>
</BuildDependencies>
<RuntimeDependencies>
<Dependency release="current">libva-vdpau-driver</Dependency>
<!-- <Dependency>libglvnd-32bit</Dependency> -->
<Dependency>libva-32bit</Dependency>
<Dependency>libvdpau-32bit</Dependency>
<Dependency>libX11-32bit</Dependency>
<Dependency>mesa-32bit</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib32</Path>
</Files>
</Package>
<History>
<Update release="1">
<Date>2020-01-14</Date>
<Version>0.7.4</Version>
<Comment>First release</Comment>
<Name>İdris Kalp</Name>
<Email>idriskalp@gmail.com</Email>
</Update>
</History>
</PISI>