gallium/video: Add video post processing interface

Add process_frame to pipe_video codec
Add new structures/caps for video post-processing with rotation,
flip, alpha blending, crop, and scaling, via the video engine.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17557>
This commit is contained in:
Sil Vilerino 2022-07-21 12:34:55 -04:00 committed by Marge Bot
parent 721d9eea81
commit d09cf4333c
3 changed files with 53 additions and 0 deletions

View file

@ -95,6 +95,13 @@ struct pipe_video_codec
struct pipe_resource *destination,
void **feedback);
/**
* Perform post-process effect
*/
void (*process_frame)(struct pipe_video_codec *codec,
struct pipe_video_buffer *source,
const struct pipe_vpp_desc *process_properties);
/**
* end decoding of the current frame
*/

View file

@ -95,8 +95,37 @@ enum pipe_video_cap
PIPE_VIDEO_CAP_ENC_MAX_SLICES_PER_FRAME = 13,
PIPE_VIDEO_CAP_ENC_SLICES_STRUCTURE = 14,
PIPE_VIDEO_CAP_ENC_MAX_REFERENCES_PER_FRAME = 15,
PIPE_VIDEO_CAP_VPP_ORIENTATION_MODES = 16,
PIPE_VIDEO_CAP_VPP_BLEND_MODES = 17,
PIPE_VIDEO_CAP_VPP_MAX_INPUT_WIDTH = 18,
PIPE_VIDEO_CAP_VPP_MAX_INPUT_HEIGHT = 19,
PIPE_VIDEO_CAP_VPP_MIN_INPUT_WIDTH = 20,
PIPE_VIDEO_CAP_VPP_MIN_INPUT_HEIGHT = 21,
PIPE_VIDEO_CAP_VPP_MAX_OUTPUT_WIDTH = 22,
PIPE_VIDEO_CAP_VPP_MAX_OUTPUT_HEIGHT = 23,
PIPE_VIDEO_CAP_VPP_MIN_OUTPUT_WIDTH = 24,
PIPE_VIDEO_CAP_VPP_MIN_OUTPUT_HEIGHT = 25,
};
/* To be used with PIPE_VIDEO_CAP_VPP_ORIENTATION_MODES and for VPP state*/
enum pipe_video_vpp_orientation
{
PIPE_VIDEO_VPP_ORIENTATION_DEFAULT = 0x0,
PIPE_VIDEO_VPP_ROTATION_90 = 0x01,
PIPE_VIDEO_VPP_ROTATION_180 = 0x02,
PIPE_VIDEO_VPP_ROTATION_270 = 0x04,
PIPE_VIDEO_VPP_FLIP_HORIZONTAL = 0x08,
PIPE_VIDEO_VPP_FLIP_VERTICAL = 0x10,
};
/* To be used with PIPE_VIDEO_CAP_VPP_BLEND_MODES and for VPP state*/
enum pipe_video_vpp_blend_mode
{
PIPE_VIDEO_VPP_BLEND_MODE_NONE = 0x0,
PIPE_VIDEO_VPP_BLEND_MODE_GLOBAL_ALPHA = 0x1,
};
/* To be used with cap PIPE_VIDEO_CAP_ENC_SLICES_STRUCTURE*/
/**
* pipe_video_cap_slice_structure

View file

@ -34,6 +34,7 @@
#include "pipe/p_screen.h"
#include "util/u_hash_table.h"
#include "util/u_inlines.h"
#include "util/u_rect.h"
#ifdef __cplusplus
extern "C" {
@ -963,6 +964,22 @@ struct pipe_av1_picture_desc
} slice_parameter;
};
struct pipe_vpp_blend
{
enum pipe_video_vpp_blend_mode mode;
/* To be used with PIPE_VIDEO_VPP_BLEND_MODE_GLOBAL_ALPHA */
float global_alpha;
};
struct pipe_vpp_desc
{
struct pipe_picture_desc base;
struct u_rect src_region;
struct u_rect dst_region;
enum pipe_video_vpp_orientation orientation;
struct pipe_vpp_blend blend;
};
#ifdef __cplusplus
}
#endif