amd/vpelib: VPE descriptor added
[WHY] - Need to implement code for new version - There are some format changes in new version [HOW] - Add plane descriptor - Add plane descriptor patch - Add command builder - Restructure the code base to apply for multiple version Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com> Reviewed-by: Tomson Chang <Tomson.Chang@amd.com> Acked-by: ChuanYu Tseng <ChuanYu.Tseng@amd.com> Signed-off-by: Jude Shih <shenshih@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35012>
This commit is contained in:
committed by
ChuanYu Tseng (Max)
parent
f80a69d756
commit
c40ac921aa
@@ -177,7 +177,7 @@ struct vpe_plane_size {
|
||||
};
|
||||
|
||||
/** @struct vpe_plane_dcc_param
|
||||
* @brief Not used
|
||||
* @brief dcc params
|
||||
*/
|
||||
struct vpe_plane_dcc_param {
|
||||
bool enable;
|
||||
|
||||
@@ -31,6 +31,42 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct vpe10_plane_desc_header {
|
||||
int32_t nps0;
|
||||
int32_t npd0;
|
||||
int32_t nps1;
|
||||
int32_t npd1;
|
||||
int32_t subop;
|
||||
};
|
||||
|
||||
struct vpe10_plane_desc_src {
|
||||
uint8_t tmz;
|
||||
enum vpe_swizzle_mode_values swizzle;
|
||||
enum vpe_rotation_angle rotation;
|
||||
uint32_t base_addr_lo;
|
||||
uint32_t base_addr_hi;
|
||||
uint16_t pitch;
|
||||
uint16_t viewport_x;
|
||||
uint16_t viewport_y;
|
||||
uint16_t viewport_w;
|
||||
uint16_t viewport_h;
|
||||
uint8_t elem_size;
|
||||
};
|
||||
|
||||
struct vpe10_plane_desc_dst {
|
||||
uint8_t tmz;
|
||||
enum vpe_swizzle_mode_values swizzle;
|
||||
enum vpe_mirror mirror;
|
||||
uint32_t base_addr_lo;
|
||||
uint32_t base_addr_hi;
|
||||
uint16_t pitch;
|
||||
uint16_t viewport_x;
|
||||
uint16_t viewport_y;
|
||||
uint16_t viewport_w;
|
||||
uint16_t viewport_h;
|
||||
uint8_t elem_size;
|
||||
};
|
||||
|
||||
/** initialize the plane descriptor writer.
|
||||
* Calls right before building any plane descriptor
|
||||
*
|
||||
@@ -40,15 +76,15 @@ extern "C" {
|
||||
*/
|
||||
|
||||
void vpe10_plane_desc_writer_init(
|
||||
struct plane_desc_writer *writer, struct vpe_buf *buf, struct plane_desc_header *header);
|
||||
struct plane_desc_writer *writer, struct vpe_buf *buf, void *p_header);
|
||||
|
||||
/** fill the value to the embedded buffer. */
|
||||
void vpe10_plane_desc_writer_add_source(
|
||||
struct plane_desc_writer *writer, struct plane_desc_src *source, bool is_plane0);
|
||||
struct plane_desc_writer *writer, void *p_source, bool is_plane0);
|
||||
|
||||
/** fill the value to the embedded buffer. */
|
||||
void vpe10_plane_desc_writer_add_destination(
|
||||
struct plane_desc_writer *writer, struct plane_desc_dst *destination, bool is_plane0);
|
||||
struct plane_desc_writer *writer, void *p_destination, bool is_plane0);
|
||||
|
||||
void vpe10_construct_plane_desc_writer(struct plane_desc_writer *writer);
|
||||
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
#include "common.h"
|
||||
#include "vpe_priv.h"
|
||||
#include "vpe10_command.h"
|
||||
#include "vpe10_plane_desc_writer.h"
|
||||
#include "vpe10_cmd_builder.h"
|
||||
|
||||
/***** Internal helpers *****/
|
||||
static void get_np_and_subop(struct vpe_priv *vpe_priv, struct vpe_cmd_info *cmd_info, struct plane_desc_header *header);
|
||||
static void get_np_and_subop(struct vpe_priv *vpe_priv, struct vpe_cmd_info *cmd_info,
|
||||
struct vpe10_plane_desc_header *header);
|
||||
|
||||
static enum VPE_PLANE_CFG_ELEMENT_SIZE vpe_get_element_size(
|
||||
enum vpe_surface_pixel_format format, int plane_idx);
|
||||
@@ -182,16 +184,16 @@ enum vpe_status vpe10_build_vpe_cmd(
|
||||
enum vpe_status vpe10_build_plane_descriptor(
|
||||
struct vpe_priv *vpe_priv, struct vpe_buf *buf, uint32_t cmd_idx)
|
||||
{
|
||||
struct stream_ctx *stream_ctx;
|
||||
struct vpe_surface_info *surface_info;
|
||||
int32_t stream_idx;
|
||||
PHYSICAL_ADDRESS_LOC *addrloc;
|
||||
struct plane_desc_src src;
|
||||
struct plane_desc_dst dst;
|
||||
struct plane_desc_header header = {0};
|
||||
struct cmd_builder *builder = &vpe_priv->resource.cmd_builder;
|
||||
struct plane_desc_writer *plane_desc_writer = &vpe_priv->plane_desc_writer;
|
||||
struct vpe_cmd_info *cmd_info = vpe_vector_get(vpe_priv->vpe_cmd_vector, cmd_idx);
|
||||
struct stream_ctx *stream_ctx;
|
||||
struct vpe_surface_info *surface_info;
|
||||
int32_t stream_idx;
|
||||
PHYSICAL_ADDRESS_LOC *addrloc;
|
||||
struct vpe10_plane_desc_src src;
|
||||
struct vpe10_plane_desc_dst dst;
|
||||
struct vpe10_plane_desc_header header = {0};
|
||||
struct cmd_builder *builder = &vpe_priv->resource.cmd_builder;
|
||||
struct plane_desc_writer *plane_desc_writer = &vpe_priv->plane_desc_writer;
|
||||
struct vpe_cmd_info *cmd_info = vpe_vector_get(vpe_priv->vpe_cmd_vector, cmd_idx);
|
||||
VPE_ASSERT(cmd_info);
|
||||
|
||||
VPE_ASSERT(cmd_info->num_inputs == 1);
|
||||
@@ -280,7 +282,7 @@ enum vpe_status vpe10_build_plane_descriptor(
|
||||
}
|
||||
|
||||
static void get_np_and_subop(struct vpe_priv *vpe_priv, struct vpe_cmd_info *cmd_info,
|
||||
struct plane_desc_header *header)
|
||||
struct vpe10_plane_desc_header *header)
|
||||
{
|
||||
header->npd1 = 0;
|
||||
|
||||
|
||||
@@ -35,10 +35,12 @@ void vpe10_construct_plane_desc_writer(struct plane_desc_writer *writer)
|
||||
}
|
||||
|
||||
void vpe10_plane_desc_writer_init(
|
||||
struct plane_desc_writer *writer, struct vpe_buf *buf, struct plane_desc_header *header)
|
||||
struct plane_desc_writer *writer, struct vpe_buf *buf, void *p_header)
|
||||
{
|
||||
uint32_t *cmd_space;
|
||||
uint64_t size = 4;
|
||||
struct vpe10_plane_desc_header *header = (struct vpe10_plane_desc_header *)p_header;
|
||||
|
||||
writer->status = VPE_STATUS_OK;
|
||||
writer->base_cpu_va = buf->cpu_va;
|
||||
writer->base_gpu_va = buf->gpu_va;
|
||||
@@ -63,11 +65,12 @@ void vpe10_plane_desc_writer_init(
|
||||
|
||||
/** fill the value to the embedded buffer. */
|
||||
void vpe10_plane_desc_writer_add_source(
|
||||
struct plane_desc_writer *writer, struct plane_desc_src *src, bool is_plane0)
|
||||
struct plane_desc_writer *writer, void *p_source, bool is_plane0)
|
||||
{
|
||||
uint32_t *cmd_space, *cmd_start;
|
||||
uint32_t num_wd = is_plane0 ? 6 : 5;
|
||||
uint64_t size = num_wd * sizeof(uint32_t);
|
||||
struct vpe10_plane_desc_src *src = (struct vpe10_plane_desc_src *)p_source;
|
||||
|
||||
if (writer->status != VPE_STATUS_OK)
|
||||
return;
|
||||
@@ -107,11 +110,12 @@ void vpe10_plane_desc_writer_add_source(
|
||||
|
||||
/** fill the value to the embedded buffer. */
|
||||
void vpe10_plane_desc_writer_add_destination(
|
||||
struct plane_desc_writer *writer, struct plane_desc_dst *dst, bool is_plane0)
|
||||
struct plane_desc_writer *writer, void *p_destination, bool is_plane0)
|
||||
{
|
||||
uint32_t *cmd_space, *cmd_start;
|
||||
uint32_t num_wd = is_plane0 ? 6 : 5;
|
||||
uint64_t size = num_wd * sizeof(uint32_t);
|
||||
struct vpe10_plane_desc_dst *dst = (struct vpe10_plane_desc_dst *)p_destination;
|
||||
|
||||
if (writer->status != VPE_STATUS_OK)
|
||||
return;
|
||||
|
||||
@@ -28,42 +28,6 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
struct plane_desc_header {
|
||||
int32_t nps0;
|
||||
int32_t npd0;
|
||||
int32_t nps1;
|
||||
int32_t npd1;
|
||||
int32_t subop;
|
||||
};
|
||||
|
||||
struct plane_desc_src {
|
||||
uint8_t tmz;
|
||||
enum vpe_swizzle_mode_values swizzle;
|
||||
enum vpe_rotation_angle rotation;
|
||||
uint32_t base_addr_lo;
|
||||
uint32_t base_addr_hi;
|
||||
uint16_t pitch;
|
||||
uint16_t viewport_x;
|
||||
uint16_t viewport_y;
|
||||
uint16_t viewport_w;
|
||||
uint16_t viewport_h;
|
||||
uint8_t elem_size;
|
||||
};
|
||||
|
||||
struct plane_desc_dst {
|
||||
uint8_t tmz;
|
||||
enum vpe_swizzle_mode_values swizzle;
|
||||
enum vpe_mirror mirror;
|
||||
uint32_t base_addr_lo;
|
||||
uint32_t base_addr_hi;
|
||||
uint16_t pitch;
|
||||
uint16_t viewport_x;
|
||||
uint16_t viewport_y;
|
||||
uint16_t viewport_w;
|
||||
uint16_t viewport_h;
|
||||
uint8_t elem_size;
|
||||
};
|
||||
|
||||
|
||||
struct plane_desc_writer {
|
||||
struct vpe_buf *buf; /**< store the current buf pointer */
|
||||
@@ -78,12 +42,9 @@ struct plane_desc_writer {
|
||||
int32_t num_dst;
|
||||
enum vpe_status status;
|
||||
|
||||
void (*init)(
|
||||
struct plane_desc_writer *writer, struct vpe_buf *buf, struct plane_desc_header *header);
|
||||
void (*add_source)(
|
||||
struct plane_desc_writer *writer, struct plane_desc_src *source, bool is_plane0);
|
||||
void (*add_destination)(
|
||||
struct plane_desc_writer *writer, struct plane_desc_dst *destination, bool is_plane0);
|
||||
void (*init)(struct plane_desc_writer *writer, struct vpe_buf *buf, void *p_header);
|
||||
void (*add_source)(struct plane_desc_writer *writer, void *p_source, bool is_plane0);
|
||||
void (*add_destination)(struct plane_desc_writer *writer, void *p_destination, bool is_plane0);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -39,8 +39,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct vpe_priv;
|
||||
struct vpe_cmd_output;
|
||||
struct vpe_cmd_info;
|
||||
struct segment_ctx;
|
||||
enum vpe_stream_type;
|
||||
|
||||
#define MIN_VPE_CMD (1024)
|
||||
#define MIN_NUM_CONFIG (16)
|
||||
@@ -162,6 +164,8 @@ void calculate_scaling_ratios(struct scaler_data *scl_data, struct vpe_rect *src
|
||||
uint16_t vpe_get_num_segments(struct vpe_priv *vpe_priv, const struct vpe_rect *src,
|
||||
const struct vpe_rect *dst, const uint32_t max_seg_width);
|
||||
|
||||
bool should_generate_cmd_info(enum vpe_stream_type stream_type);
|
||||
|
||||
enum vpe_status vpe_resource_build_scaling_params(struct segment_ctx *segment);
|
||||
|
||||
void vpe_handle_output_h_mirror(struct vpe_priv *vpe_priv);
|
||||
|
||||
@@ -613,6 +613,19 @@ uint16_t vpe_get_num_segments(struct vpe_priv *vpe_priv, const struct vpe_rect *
|
||||
return (uint16_t)(max(max(num_seg_src, num_seg_dst), 1));
|
||||
}
|
||||
|
||||
bool should_generate_cmd_info(enum vpe_stream_type stream_type)
|
||||
{
|
||||
switch (stream_type) {
|
||||
case VPE_STREAM_TYPE_INPUT:
|
||||
case VPE_STREAM_TYPE_BG_GEN:
|
||||
return true;
|
||||
default:
|
||||
/* destination-as-input virtual stream doesn't need a new cmd_info,
|
||||
it is used as one of the inputs in blending normal input stream only */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void vpe_clip_stream(
|
||||
struct vpe_rect *src_rect, struct vpe_rect *dst_rect, const struct vpe_rect *target_rect)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user