Commit 6e4d6bee authored by Tony Cheng's avatar Tony Cheng Committed by Alex Deucher

drm/amd/display: remove hw_info_frame

- construct using encoder_info_frame directly
Signed-off-by: default avatarTony Cheng <tony.cheng@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6235b23c
......@@ -1211,70 +1211,27 @@ void validate_guaranteed_copy_streams(
}
}
static void translate_info_frame(const struct hw_info_frame *hw_info_frame,
struct encoder_info_frame *encoder_info_frame)
static void patch_gamut_packet_checksum(
struct encoder_info_packet *gamut_packet)
{
memset(
encoder_info_frame, 0, sizeof(struct encoder_info_frame));
/* For gamut we recalc checksum */
if (hw_info_frame->gamut_packet.valid) {
if (gamut_packet->valid) {
uint8_t chk_sum = 0;
uint8_t *ptr;
uint8_t i;
memmove(
&encoder_info_frame->gamut,
&hw_info_frame->gamut_packet,
sizeof(struct hw_info_packet));
/*start of the Gamut data. */
ptr = &encoder_info_frame->gamut.sb[3];
ptr = &gamut_packet->sb[3];
for (i = 0; i <= encoder_info_frame->gamut.sb[1]; i++)
for (i = 0; i <= gamut_packet->sb[1]; i++)
chk_sum += ptr[i];
encoder_info_frame->gamut.sb[2] = (uint8_t) (0x100 - chk_sum);
}
if (hw_info_frame->avi_info_packet.valid) {
memmove(
&encoder_info_frame->avi,
&hw_info_frame->avi_info_packet,
sizeof(struct hw_info_packet));
}
if (hw_info_frame->vendor_info_packet.valid) {
memmove(
&encoder_info_frame->vendor,
&hw_info_frame->vendor_info_packet,
sizeof(struct hw_info_packet));
}
if (hw_info_frame->spd_packet.valid) {
memmove(
&encoder_info_frame->spd,
&hw_info_frame->spd_packet,
sizeof(struct hw_info_packet));
}
if (hw_info_frame->vsc_packet.valid) {
memmove(
&encoder_info_frame->vsc,
&hw_info_frame->vsc_packet,
sizeof(struct hw_info_packet));
}
if (hw_info_frame->hdrsmd_packet.valid) {
memmove(
&encoder_info_frame->hdrsmd,
&hw_info_frame->hdrsmd_packet,
sizeof(struct hw_info_packet));
gamut_packet->sb[2] = (uint8_t) (0x100 - chk_sum);
}
}
static void set_avi_info_frame(
struct hw_info_packet *info_packet,
struct encoder_info_packet *info_packet,
struct pipe_ctx *pipe_ctx)
{
struct core_stream *stream = pipe_ctx->stream;
......@@ -1288,9 +1245,6 @@ static void set_avi_info_frame(
uint8_t *check_sum = NULL;
uint8_t byte_index = 0;
if (info_packet == NULL)
return;
color_space = pipe_ctx->stream->public.output_color_space;
/* Initialize header */
......@@ -1458,8 +1412,9 @@ static void set_avi_info_frame(
info_packet->valid = true;
}
static void set_vendor_info_packet(struct core_stream *stream,
struct hw_info_packet *info_packet)
static void set_vendor_info_packet(
struct encoder_info_packet *info_packet,
struct core_stream *stream)
{
uint32_t length = 0;
bool hdmi_vic_mode = false;
......@@ -1467,9 +1422,6 @@ static void set_vendor_info_packet(struct core_stream *stream,
uint32_t i = 0;
enum dc_timing_3d_format format;
ASSERT_CRITICAL(stream != NULL);
ASSERT_CRITICAL(info_packet != NULL);
format = stream->public.timing.timing_3d_format;
/* Can be different depending on packet content */
......@@ -1567,8 +1519,9 @@ static void set_vendor_info_packet(struct core_stream *stream,
info_packet->valid = true;
}
static void set_spd_info_packet(struct core_stream *stream,
struct hw_info_packet *info_packet)
static void set_spd_info_packet(
struct encoder_info_packet *info_packet,
struct core_stream *stream)
{
/* SPD info packet for FreeSync */
......@@ -1688,9 +1641,9 @@ static void set_spd_info_packet(struct core_stream *stream,
}
static void set_hdr_static_info_packet(
struct encoder_info_packet *info_packet,
struct core_surface *surface,
struct core_stream *stream,
struct hw_info_packet *info_packet)
struct core_stream *stream)
{
uint16_t i = 0;
enum signal_type signal = stream->signal;
......@@ -1791,8 +1744,9 @@ static void set_hdr_static_info_packet(
}
}
static void set_vsc_info_packet(struct core_stream *stream,
struct hw_info_packet *info_packet)
static void set_vsc_info_packet(
struct encoder_info_packet *info_packet,
struct core_stream *stream)
{
unsigned int vscPacketRevision = 0;
unsigned int i;
......@@ -1894,36 +1848,38 @@ struct clock_source *dc_resource_find_first_free_pll(
void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
{
enum signal_type signal = SIGNAL_TYPE_NONE;
struct hw_info_frame info_frame = { { 0 } };
struct encoder_info_frame *info = &pipe_ctx->encoder_info_frame;
/* default all packets to invalid */
info_frame.avi_info_packet.valid = false;
info_frame.gamut_packet.valid = false;
info_frame.vendor_info_packet.valid = false;
info_frame.spd_packet.valid = false;
info_frame.vsc_packet.valid = false;
info_frame.hdrsmd_packet.valid = false;
info->avi.valid = false;
info->gamut.valid = false;
info->vendor.valid = false;
info->hdrsmd.valid = false;
info->vsc.valid = false;
signal = pipe_ctx->stream->signal;
/* HDMi and DP have different info packets*/
if (dc_is_hdmi_signal(signal)) {
set_avi_info_frame(
&info_frame.avi_info_packet, pipe_ctx);
set_vendor_info_packet(
pipe_ctx->stream, &info_frame.vendor_info_packet);
set_spd_info_packet(pipe_ctx->stream, &info_frame.spd_packet);
set_hdr_static_info_packet(pipe_ctx->surface,
pipe_ctx->stream, &info_frame.hdrsmd_packet);
set_avi_info_frame(&info->avi, pipe_ctx);
set_vendor_info_packet(&info->vendor, pipe_ctx->stream);
set_spd_info_packet(&info->spd, pipe_ctx->stream);
set_hdr_static_info_packet(&info->hdrsmd,
pipe_ctx->surface, pipe_ctx->stream);
} else if (dc_is_dp_signal(signal)) {
set_vsc_info_packet(pipe_ctx->stream, &info_frame.vsc_packet);
set_spd_info_packet(pipe_ctx->stream, &info_frame.spd_packet);
set_hdr_static_info_packet(pipe_ctx->surface,
pipe_ctx->stream, &info_frame.hdrsmd_packet);
set_vsc_info_packet(&info->vsc, pipe_ctx->stream);
set_spd_info_packet(&info->spd, pipe_ctx->stream);
set_hdr_static_info_packet(&info->hdrsmd,
pipe_ctx->surface, pipe_ctx->stream);
}
translate_info_frame(&info_frame,
&pipe_ctx->encoder_info_frame);
patch_gamut_packet_checksum(&info->gamut);
}
enum dc_status resource_map_clock_resources(
......
......@@ -40,27 +40,4 @@ struct drr_params {
uint32_t vertical_total_max;
};
/* TODO hw_info_frame and hw_info_packet structures are same as in encoder
* merge it*/
struct hw_info_packet {
bool valid;
uint8_t hb0;
uint8_t hb1;
uint8_t hb2;
uint8_t hb3;
uint8_t sb[32];
};
struct hw_info_frame {
/* Auxiliary Video Information */
struct hw_info_packet avi_info_packet;
struct hw_info_packet gamut_packet;
struct hw_info_packet vendor_info_packet;
/* Source Product Description */
struct hw_info_packet spd_packet;
/* Video Stream Configuration */
struct hw_info_packet vsc_packet;
struct hw_info_packet hdrsmd_packet;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment