summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/va/surface.c
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2015-10-30 11:42:48 +0000
committerChristian König <[email protected]>2015-10-30 13:20:10 +0100
commit0b868807e4d6f209d5fec9948a5994936138ffcc (patch)
tree5c4e0fee220b7804c3de9b3451f60c6ba184dfe8 /src/gallium/state_trackers/va/surface.c
parent05b6ce42097d6ebd2820129e8155113abce0bb42 (diff)
st/va: add colospace conversion through Video Post Processing
Add support for VPP in the following functions: vlVaCreateContext vlVaDestroyContext vlVaBeginPicture vlVaRenderPicture vlVaEndPicture Add support for VAProcFilterNone in: vlVaQueryVideoProcFilters vlVaQueryVideoProcFilterCaps vlVaQueryVideoProcPipelineCaps Add handleVAProcPipelineParameterBufferType helper. One application is: VASurfaceNV12 -> gstvaapipostproc -> VASurfaceRGBA Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va/surface.c')
-rw-r--r--src/gallium/state_trackers/va/surface.c98
1 files changed, 97 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index 12112d29d1a..8f406e09990 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -348,7 +348,8 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID config,
i = 0;
if (config == PIPE_VIDEO_PROFILE_UNKNOWN) {
- /* Assume VAEntrypointVideoProc for now. */
+ /* vlVaCreateConfig returns PIPE_VIDEO_PROFILE_UNKNOWN
+ only for VAEntrypointVideoProc. */
attribs[i].type = VASurfaceAttribPixelFormat;
attribs[i].value.type = VAGenericValueTypeInteger;
attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE;
@@ -634,3 +635,98 @@ no_res:
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
+
+VAStatus
+vlVaQueryVideoProcFilters(VADriverContextP ctx, VAContextID context,
+ VAProcFilterType *filters, unsigned int *num_filters)
+{
+ unsigned int num = 0;
+
+ if (!ctx)
+ return VA_STATUS_ERROR_INVALID_CONTEXT;
+
+ if (!num_filters || !filters)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ filters[num++] = VAProcFilterNone;
+
+ *num_filters = num;
+
+ return VA_STATUS_SUCCESS;
+}
+
+VAStatus
+vlVaQueryVideoProcFilterCaps(VADriverContextP ctx, VAContextID context,
+ VAProcFilterType type, void *filter_caps,
+ unsigned int *num_filter_caps)
+{
+ unsigned int i;
+
+ if (!ctx)
+ return VA_STATUS_ERROR_INVALID_CONTEXT;
+
+ if (!filter_caps || !num_filter_caps)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ i = 0;
+
+ switch (type) {
+ case VAProcFilterNone:
+ break;
+ case VAProcFilterNoiseReduction:
+ case VAProcFilterDeinterlacing:
+ case VAProcFilterSharpening:
+ case VAProcFilterColorBalance:
+ case VAProcFilterSkinToneEnhancement:
+ return VA_STATUS_ERROR_UNIMPLEMENTED;
+ default:
+ assert(0);
+ }
+
+ *num_filter_caps = i;
+
+ return VA_STATUS_SUCCESS;
+}
+
+static VAProcColorStandardType vpp_input_color_standards[VAProcColorStandardCount] = {
+ VAProcColorStandardBT601
+};
+
+static VAProcColorStandardType vpp_output_color_standards[VAProcColorStandardCount] = {
+ VAProcColorStandardBT601
+};
+
+VAStatus
+vlVaQueryVideoProcPipelineCaps(VADriverContextP ctx, VAContextID context,
+ VABufferID *filters, unsigned int num_filters,
+ VAProcPipelineCaps *pipeline_cap)
+{
+ unsigned int i = 0;
+
+ if (!ctx)
+ return VA_STATUS_ERROR_INVALID_CONTEXT;
+
+ if (!pipeline_cap)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ if (num_filters && !filters)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ pipeline_cap->pipeline_flags = 0;
+ pipeline_cap->filter_flags = 0;
+ pipeline_cap->num_forward_references = 0;
+ pipeline_cap->num_backward_references = 0;
+ pipeline_cap->num_input_color_standards = 1;
+ pipeline_cap->input_color_standards = vpp_input_color_standards;
+ pipeline_cap->num_output_color_standards = 1;
+ pipeline_cap->output_color_standards = vpp_output_color_standards;
+
+ for (i = 0; i < num_filters; i++) {
+ vlVaBuffer *buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, filters[i]);
+
+ if (!buf || buf->type >= VABufferTypeMax)
+ return VA_STATUS_ERROR_INVALID_BUFFER;
+ }
+
+ return VA_STATUS_SUCCESS;
+}