diff --git a/src/amd/vpelib/inc/vpe_hw_types.h b/src/amd/vpelib/inc/vpe_hw_types.h index 6915baf77c4..ddeca457032 100644 --- a/src/amd/vpelib/inc/vpe_hw_types.h +++ b/src/amd/vpelib/inc/vpe_hw_types.h @@ -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; diff --git a/src/amd/vpelib/src/chip/vpe10/inc/vpe10_plane_desc_writer.h b/src/amd/vpelib/src/chip/vpe10/inc/vpe10_plane_desc_writer.h index 6c2b1415f57..11edda6782b 100644 --- a/src/amd/vpelib/src/chip/vpe10/inc/vpe10_plane_desc_writer.h +++ b/src/amd/vpelib/src/chip/vpe10/inc/vpe10_plane_desc_writer.h @@ -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); diff --git a/src/amd/vpelib/src/chip/vpe10/vpe10_cmd_builder.c b/src/amd/vpelib/src/chip/vpe10/vpe10_cmd_builder.c index 7c792529cc6..6da5f524524 100644 --- a/src/amd/vpelib/src/chip/vpe10/vpe10_cmd_builder.c +++ b/src/amd/vpelib/src/chip/vpe10/vpe10_cmd_builder.c @@ -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; diff --git a/src/amd/vpelib/src/chip/vpe10/vpe10_plane_desc_writer.c b/src/amd/vpelib/src/chip/vpe10/vpe10_plane_desc_writer.c index 64425bd2e34..9d70d1dcf61 100644 --- a/src/amd/vpelib/src/chip/vpe10/vpe10_plane_desc_writer.c +++ b/src/amd/vpelib/src/chip/vpe10/vpe10_plane_desc_writer.c @@ -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; diff --git a/src/amd/vpelib/src/core/inc/plane_desc_writer.h b/src/amd/vpelib/src/core/inc/plane_desc_writer.h index f777bbc3c37..948e64cf8aa 100644 --- a/src/amd/vpelib/src/core/inc/plane_desc_writer.h +++ b/src/amd/vpelib/src/core/inc/plane_desc_writer.h @@ -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 diff --git a/src/amd/vpelib/src/core/inc/resource.h b/src/amd/vpelib/src/core/inc/resource.h index bea8eabfe63..1956d5f4161 100644 --- a/src/amd/vpelib/src/core/inc/resource.h +++ b/src/amd/vpelib/src/core/inc/resource.h @@ -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); diff --git a/src/amd/vpelib/src/core/resource.c b/src/amd/vpelib/src/core/resource.c index ca70d2d1800..214756f4356 100644 --- a/src/amd/vpelib/src/core/resource.c +++ b/src/amd/vpelib/src/core/resource.c @@ -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) {