frontends/va: Support rotation and mirror for processing
Reviewed-by: Thong Thai <thong.thai@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32919>
This commit is contained in:
@@ -740,7 +740,6 @@ vl_compositor_yuv_deint_full(struct vl_compositor_state *s,
|
||||
struct pipe_surface **dst_surfaces;
|
||||
|
||||
dst_surfaces = dst->get_surfaces(dst);
|
||||
vl_compositor_clear_layers(s);
|
||||
|
||||
set_yuv_layer(s, c, 0, src, src_rect, NULL, VL_COMPOSITOR_PLANE_Y, deinterlace);
|
||||
vl_compositor_set_layer_dst_area(s, 0, dst_rect);
|
||||
@@ -800,8 +799,6 @@ vl_compositor_convert_rgb_to_yuv(struct vl_compositor_state *s,
|
||||
u_sampler_view_default_template(&sv_templ, src_res, src_res->format);
|
||||
sv = s->pipe->create_sampler_view(s->pipe, src_res, &sv_templ);
|
||||
|
||||
vl_compositor_clear_layers(s);
|
||||
|
||||
set_rgb_to_yuv_layer(s, c, 0, sv, src_rect, NULL, VL_COMPOSITOR_PLANE_Y);
|
||||
vl_compositor_set_layer_dst_area(s, 0, dst_rect);
|
||||
vl_compositor_render(s, c, dst_surfaces[0], NULL, false);
|
||||
|
||||
@@ -111,6 +111,8 @@ vlVaPostProcCompositor(vlVaDriver *drv,
|
||||
struct u_rect src_rect;
|
||||
struct u_rect dst_rect;
|
||||
enum VL_CSC_COLOR_STANDARD color_standard;
|
||||
enum vl_compositor_rotation rotation;
|
||||
enum vl_compositor_mirror mirror;
|
||||
bool src_yuv = util_format_is_yuv(src->buffer_format);
|
||||
bool dst_yuv = util_format_is_yuv(dst->buffer_format);
|
||||
bool src_full_range = vlVaGetFullRange(src->buffer_format,
|
||||
@@ -172,6 +174,39 @@ vlVaPostProcCompositor(vlVaDriver *drv,
|
||||
vlVaGetChromaLocation(param->output_color_properties.chroma_sample_location,
|
||||
dst->buffer_format);
|
||||
|
||||
switch (param->rotation_state) {
|
||||
default:
|
||||
case VA_ROTATION_NONE:
|
||||
rotation = VL_COMPOSITOR_ROTATE_0;
|
||||
break;
|
||||
case VA_ROTATION_90:
|
||||
rotation = VL_COMPOSITOR_ROTATE_90;
|
||||
break;
|
||||
case VA_ROTATION_180:
|
||||
rotation = VL_COMPOSITOR_ROTATE_180;
|
||||
break;
|
||||
case VA_ROTATION_270:
|
||||
rotation = VL_COMPOSITOR_ROTATE_270;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (param->mirror_state) {
|
||||
default:
|
||||
case VA_MIRROR_NONE:
|
||||
mirror = VL_COMPOSITOR_MIRROR_NONE;
|
||||
break;
|
||||
case VA_MIRROR_HORIZONTAL:
|
||||
mirror = VL_COMPOSITOR_MIRROR_HORIZONTAL;
|
||||
break;
|
||||
case VA_MIRROR_VERTICAL:
|
||||
mirror = VL_COMPOSITOR_MIRROR_VERTICAL;
|
||||
break;
|
||||
}
|
||||
|
||||
vl_compositor_clear_layers(&drv->cstate);
|
||||
vl_compositor_set_layer_rotation(&drv->cstate, 0, rotation);
|
||||
vl_compositor_set_layer_mirror(&drv->cstate, 0, mirror);
|
||||
|
||||
if (dst_yuv) {
|
||||
if (src_yuv) {
|
||||
/* YUV -> YUV */
|
||||
|
||||
@@ -1461,25 +1461,26 @@ vlVaQueryVideoProcPipelineCaps(VADriverContextP ctx, VAContextID context,
|
||||
pipeline_cap->filter_flags = 0;
|
||||
pipeline_cap->num_forward_references = 0;
|
||||
pipeline_cap->num_backward_references = 0;
|
||||
pipeline_cap->rotation_flags = VA_ROTATION_NONE;
|
||||
pipeline_cap->mirror_flags = VA_MIRROR_NONE;
|
||||
|
||||
struct pipe_screen *pscreen = VL_VA_PSCREEN(ctx);
|
||||
bool media_only = !pscreen->caps.graphics && !pscreen->caps.compute;
|
||||
uint32_t pipe_orientation_flags = pscreen->get_video_param(pscreen,
|
||||
PIPE_VIDEO_PROFILE_UNKNOWN,
|
||||
PIPE_VIDEO_ENTRYPOINT_PROCESSING,
|
||||
PIPE_VIDEO_CAP_VPP_ORIENTATION_MODES);
|
||||
|
||||
pipeline_cap->rotation_flags = VA_ROTATION_NONE;
|
||||
if(pipe_orientation_flags & PIPE_VIDEO_VPP_ROTATION_90)
|
||||
if (!media_only || pipe_orientation_flags & PIPE_VIDEO_VPP_ROTATION_90)
|
||||
pipeline_cap->rotation_flags |= (1 << VA_ROTATION_90);
|
||||
if(pipe_orientation_flags & PIPE_VIDEO_VPP_ROTATION_180)
|
||||
if (!media_only || pipe_orientation_flags & PIPE_VIDEO_VPP_ROTATION_180)
|
||||
pipeline_cap->rotation_flags |= (1 << VA_ROTATION_180);
|
||||
if(pipe_orientation_flags & PIPE_VIDEO_VPP_ROTATION_270)
|
||||
if (!media_only || pipe_orientation_flags & PIPE_VIDEO_VPP_ROTATION_270)
|
||||
pipeline_cap->rotation_flags |= (1 << VA_ROTATION_270);
|
||||
|
||||
pipeline_cap->mirror_flags = VA_MIRROR_NONE;
|
||||
if(pipe_orientation_flags & PIPE_VIDEO_VPP_FLIP_HORIZONTAL)
|
||||
if (!media_only || pipe_orientation_flags & PIPE_VIDEO_VPP_FLIP_HORIZONTAL)
|
||||
pipeline_cap->mirror_flags |= VA_MIRROR_HORIZONTAL;
|
||||
if(pipe_orientation_flags & PIPE_VIDEO_VPP_FLIP_VERTICAL)
|
||||
if (!media_only || pipe_orientation_flags & PIPE_VIDEO_VPP_FLIP_VERTICAL)
|
||||
pipeline_cap->mirror_flags |= VA_MIRROR_VERTICAL;
|
||||
|
||||
if (pscreen->get_video_param(pscreen, PIPE_VIDEO_PROFILE_UNKNOWN, PIPE_VIDEO_ENTRYPOINT_PROCESSING,
|
||||
|
||||
Reference in New Issue
Block a user