Commit d5f90f3a authored by Leo (Hanghong) Ma's avatar Leo (Hanghong) Ma Committed by Alex Deucher

drm/amd/display: Expose generic SDP message access interface

[Why]
We need to add DP SDP message test debugfs to make sdp message test
more convenient and efficient.

[How]
Add a DM accessible SDP interface for custom data.
Signed-off-by: default avatarLeo (Hanghong) Ma <hanghong.ma@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Reviewed-by: default avatarRoman Li <Roman.Li@amd.com>
Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6ffaa6fc
......@@ -2394,6 +2394,21 @@ static void set_spd_info_packet(
*info_packet = stream->vrr_infopacket;
}
static void set_dp_sdp_info_packet(
struct dc_info_packet *info_packet,
struct dc_stream_state *stream)
{
/* SPD info packet for custom sdp message */
/* Return if false. If true,
* set the corresponding bit in the info packet
*/
if (!stream->dpsdp_infopacket.valid)
return;
*info_packet = stream->dpsdp_infopacket;
}
static void set_hdr_static_info_packet(
struct dc_info_packet *info_packet,
struct dc_stream_state *stream)
......@@ -2490,6 +2505,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
info->spd.valid = false;
info->hdrsmd.valid = false;
info->vsc.valid = false;
info->dpsdp.valid = false;
signal = pipe_ctx->stream->signal;
......@@ -2509,6 +2525,8 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
set_spd_info_packet(&info->spd, pipe_ctx->stream);
set_hdr_static_info_packet(&info->hdrsmd, pipe_ctx->stream);
set_dp_sdp_info_packet(&info->dpsdp, pipe_ctx->stream);
}
patch_gamut_packet_checksum(&info->gamut);
......
......@@ -345,6 +345,68 @@ uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream)
return 0;
}
static void build_dp_sdp_info_frame(struct pipe_ctx *pipe_ctx,
const uint8_t *custom_sdp_message,
unsigned int sdp_message_size)
{
uint8_t i;
struct encoder_info_frame *info = &pipe_ctx->stream_res.encoder_info_frame;
/* set valid info */
info->dpsdp.valid = true;
/* set sdp message header */
info->dpsdp.hb0 = custom_sdp_message[0]; /* package id */
info->dpsdp.hb1 = custom_sdp_message[1]; /* package type */
info->dpsdp.hb2 = custom_sdp_message[2]; /* package specific byte 0 any data */
info->dpsdp.hb3 = custom_sdp_message[3]; /* package specific byte 0 any data */
/* set sdp message data */
for (i = 0; i < 32; i++)
info->dpsdp.sb[i] = (custom_sdp_message[i+4]);
}
static void invalid_dp_sdp_info_frame(struct pipe_ctx *pipe_ctx)
{
struct encoder_info_frame *info = &pipe_ctx->stream_res.encoder_info_frame;
/* in-valid info */
info->dpsdp.valid = false;
}
bool dc_stream_send_dp_sdp(const struct dc_stream_state *stream,
const uint8_t *custom_sdp_message,
unsigned int sdp_message_size)
{
int i;
struct dc *core_dc;
struct resource_context *res_ctx;
if (stream == NULL) {
dm_error("DC: dc_stream is NULL!\n");
return false;
}
core_dc = stream->ctx->dc;
res_ctx = &core_dc->current_state->res_ctx;
for (i = 0; i < MAX_PIPES; i++) {
struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
if (pipe_ctx->stream != stream)
continue;
build_dp_sdp_info_frame(pipe_ctx, custom_sdp_message, sdp_message_size);
core_dc->hwss.update_info_frame(pipe_ctx);
invalid_dp_sdp_info_frame(pipe_ctx);
}
return true;
}
bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
uint32_t *v_blank_start,
uint32_t *v_blank_end,
......
......@@ -80,6 +80,7 @@ struct dc_stream_state {
struct dc_info_packet vrr_infopacket;
struct dc_info_packet vsc_infopacket;
struct dc_info_packet vsp_infopacket;
struct dc_info_packet dpsdp_infopacket;
struct rect src; /* composition area */
struct rect dst; /* stream addressable area */
......@@ -221,6 +222,13 @@ struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i);
*/
uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream);
/*
* Send dp sdp message.
*/
bool dc_stream_send_dp_sdp(const struct dc_stream_state *stream,
const uint8_t *custom_sdp_message,
unsigned int sdp_message_size);
/* TODO: Return parsed values rather than direct register read
* This has a dependency on the caller (amdgpu_display_get_crtc_scanoutpos)
* being refactored properly to be dce-specific
......
......@@ -725,13 +725,19 @@ void enc1_stream_encoder_update_dp_info_packets(
3, /* packetIndex */
&info_frame->hdrsmd);
if (info_frame->dpsdp.valid)
enc1_update_generic_info_packet(
enc1,
4,/* packetIndex */
&info_frame->dpsdp);
/* enable/disable transmission of packet(s).
* If enabled, packet transmission begins on the next frame
*/
REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP0_ENABLE, info_frame->vsc.valid);
REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP2_ENABLE, info_frame->spd.valid);
REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP3_ENABLE, info_frame->hdrsmd.valid);
REG_UPDATE(DP_SEC_CNTL, DP_SEC_GSP4_ENABLE, info_frame->dpsdp.valid);
/* This bit is the master enable bit.
* When enabling secondary stream engine,
......
......@@ -63,6 +63,8 @@ struct encoder_info_frame {
struct dc_info_packet vsc;
/* HDR Static MetaData */
struct dc_info_packet hdrsmd;
/* custom sdp message */
struct dc_info_packet dpsdp;
};
struct encoder_unblank_param {
......
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