[packages/libva-driver-vdpau] - patches from https://github.com/saiarcot895/chromium-ubuntu-build/issues/13 to have working GpuVid

blekot blekot at pld-linux.org
Mon Nov 5 23:47:14 CET 2018


commit 873337e93cb411d5bbacaa90d2c6cc1e6010f60f
Author: Lukasz Glebicki <blekot at pld-linux.org>
Date:   Mon Nov 5 23:45:27 2018 +0100

    - patches from
    https://github.com/saiarcot895/chromium-ubuntu-build/issues/13 to have
    working GpuVideoDecoder on Chromium Browser

 GL-version-1_3.patch                     |  23 +++++++
 fallback-x.patch                         |  51 +++++++++++++++
 implement-vaquerysurfaceattributes.patch | 105 +++++++++++++++++++++++++++++++
 sigfpe-crash.patch                       |  21 +++++++
 4 files changed, 200 insertions(+)
---
diff --git a/GL-version-1_3.patch b/GL-version-1_3.patch
new file mode 100644
index 0000000..ec67d58
--- /dev/null
+++ b/GL-version-1_3.patch
@@ -0,0 +1,23 @@
+Description: Define PFNGLMULTITEXCOORD2FPROC if it is missing
+Origin: vendor, http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/vdpau-video/trusty/view/head:/debian/patches/GL_VER_1_3.patch
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=713612
+Last-Update: 2014-05-09
+
+diff --git a/src/utils_glx.h b/src/utils_glx.h
+index f753780..e02cedc 100644
+--- a/src/utils_glx.h
++++ b/src/utils_glx.h
+@@ -48,6 +48,13 @@ typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int
+ 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
diff --git a/fallback-x.patch b/fallback-x.patch
new file mode 100644
index 0000000..8e44098
--- /dev/null
+++ b/fallback-x.patch
@@ -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;
diff --git a/implement-vaquerysurfaceattributes.patch b/implement-vaquerysurfaceattributes.patch
new file mode 100644
index 0000000..d326749
--- /dev/null
+++ b/implement-vaquerysurfaceattributes.patch
@@ -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(
diff --git a/sigfpe-crash.patch b/sigfpe-crash.patch
new file mode 100644
index 0000000..e2fe02c
--- /dev/null
+++ b/sigfpe-crash.patch
@@ -0,0 +1,21 @@
+Description: Fix a crash if a heap is destroyed before being initialized
+Author: Sebastian Ramacher <sramacher at debian.org>
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=58836
+Bug-Debian: http://bugs.debian.org/748294
+Last-Update: 2014-06-02
+
+--- vdpau-video-0.7.4.orig/src/object_heap.c
++++ vdpau-video-0.7.4/src/object_heap.c
+@@ -272,8 +272,10 @@ object_heap_destroy(object_heap_p heap)
+         ASSERT(obj->next_free != ALLOCATED);
+     }
+ 
+-    for (i = 0; i < heap->heap_size / heap->heap_increment; i++) {
+-        free(heap->bucket[i]);
++    if (heap->bucket) {
++        for (i = 0; i < heap->heap_size / heap->heap_increment; i++) {
++            free(heap->bucket[i]);
++        }
+     }
+ 
+     pthread_mutex_destroy(&heap->mutex);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libva-driver-vdpau.git/commitdiff/873337e93cb411d5bbacaa90d2c6cc1e6010f60f



More information about the pld-cvs-commit mailing list