summarylogtreecommitdiffstats
path: root/implement-vaquerysurfaceattributes.patch
blob: d3267495cf16bac369ab1e16dfa6844507cb1b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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(