[RFC PATCH 01/13] drm/dsc: Add dsc pps header init function

Vinod Koul
2021-05-21T12:50:28Z

We required a helper to create and set the dsc_dce_header, so add the
dsc_dce_header and API drm_dsc_dsi_pps_header_init

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/gpu/drm/drm_dsc.c | 11 +++++++++++
include/drm/drm_dsc.h | 16 ++++++++++++++++
2 files changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
index ff602f7ec65b..0c1b745090e2 100644
--- a/drivers/gpu/drm/drm_dsc.c
+++ b/drivers/gpu/drm/drm_dsc.c
@@ -49,6 +49,17 @@ void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header)
}
EXPORT_SYMBOL(drm_dsc_dp_pps_header_init);

+void drm_dsc_dsi_pps_header_init(struct dsc_dce_header *dsc_header)
+{
+ memset(dsc_header, 0, sizeof(*dsc_header));
+
+ dsc_header->bp0 = 0x0A;
+ dsc_header->bp1 = 1;
+ dsc_header->bp4 = 10;
+ dsc_header->bp6 = 128;
+}
+EXPORT_SYMBOL(drm_dsc_dsi_pps_header_init);
+
/**
* drm_dsc_dp_rc_buffer_size - get rc buffer size in bytes
* @rc_buffer_block_size: block size code, according to DPCD offset 62h
diff --git a/include/drm/drm_dsc.h b/include/drm/drm_dsc.h
index bbe120f461e5..5a3bbeb3e12f 100644
--- a/include/drm/drm_dsc.h
+++ b/include/drm/drm_dsc.h
@@ -602,8 +602,24 @@ struct drm_dsc_pps_infoframe {
struct drm_dsc_picture_parameter_set pps_payload;
} __packed;

+struct dsc_dce_header {
+ u8 bp0;
+ u8 bp1;
+ u8 bp2;
+ u8 bp3;
+ u8 bp4;
+ u8 bp5;
+ u8 bp6;
+} __packed;
+
+struct drm_dsi_dsc_infoframe {
+ struct dsc_dce_header dsc_header;
+ struct drm_dsc_picture_parameter_set pps_payload;
+} __packed;
+
void drm_dsc_dp_pps_header_init(struct dp_sdp_header *pps_header);
int drm_dsc_dp_rc_buffer_size(u8 rc_buffer_block_size, u8 rc_buffer_size);
+void drm_dsc_dsi_pps_header_init(struct dsc_dce_header *dsc_header);
void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_sdp,
const struct drm_dsc_config *dsc_cfg);
int drm_dsc_compute_rc_parameters(struct drm_dsc_config *vdsc_cfg);
--
2.26.3