Skip to content

Commit

Permalink
drm/msm/dpu: add support for DSC encoder v1.2 engine
Browse files Browse the repository at this point in the history
Add support for DSC 1.2 by providing the necessary hooks to program
the DPU DSC 1.2 encoder.

Changes in v3:
-- fixed kernel test rebot report that "__iomem *off" is declared but not
   used at dpu_hw_dsc_config_1_2()
-- unrolling thresh loops

Changes in v4:
-- delete DPU_DSC_HW_REV_1_1
-- delete off and used real register name directly

Changes in v7:
-- replace offset with sblk->enc.base
-- replace ss with slice

Changes in v8:
-- fixed checkpatch warning

Changes in v9:
-- replaced __dsc_calc_ob_max_addr() with __dsc_calc_output_buf_max_addr()
-- replaced variable num_ss with num_softslice
-- remove inline from function  declaration

changes in v10:
-- rewording text of changes in v9
-- replace DPU_DSC_NATIVE_422_EN with DPU_DSC_NATIVE_42x_EN
-- replace drm_dsc_calculate_flatness_det_thresh() with drm_dsc_flatness_det_thresh()

Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Patchwork: https://patchwork.freedesktop.org/patch/539500/
Link: https://lore.kernel.org/r/1685036458-22683-7-git-send-email-quic_khsieh@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
  • Loading branch information
Kuogee Hsieh authored and Dmitry Baryshkov committed Jun 15, 2023
1 parent 1494193 commit 8c4094b
Show file tree
Hide file tree
Showing 5 changed files with 436 additions and 4 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/msm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ msm-$(CONFIG_DRM_MSM_DPU) += \
disp/dpu1/dpu_hw_catalog.o \
disp/dpu1/dpu_hw_ctl.o \
disp/dpu1/dpu_hw_dsc.o \
disp/dpu1/dpu_hw_dsc_1_2.o \
disp/dpu1/dpu_hw_interrupts.o \
disp/dpu1/dpu_hw_intf.o \
disp/dpu1/dpu_hw_lm.o \
Expand Down
31 changes: 29 additions & 2 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved.
*/

Expand Down Expand Up @@ -240,12 +240,18 @@ enum {
};

/**
* DSC features
* DSC sub-blocks/features
* @DPU_DSC_OUTPUT_CTRL Configure which PINGPONG block gets
* the pixel output from this DSC.
* @DPU_DSC_HW_REV_1_2 DSC block supports DSC 1.1 and 1.2
* @DPU_DSC_NATIVE_42x_EN Supports NATIVE_422_EN and NATIVE_420_EN encoding
* @DPU_DSC_MAX
*/
enum {
DPU_DSC_OUTPUT_CTRL = 0x1,
DPU_DSC_HW_REV_1_2,
DPU_DSC_NATIVE_42x_EN,
DPU_DSC_MAX
};

/**
Expand Down Expand Up @@ -301,6 +307,14 @@ struct dpu_pp_blk {
u32 version;
};

/**
* struct dpu_dsc_blk - DSC Encoder sub-blk information
* @info: HW register and features supported by this sub-blk
*/
struct dpu_dsc_blk {
DPU_HW_SUBBLK_INFO;
};

/**
* enum dpu_qos_lut_usage - define QoS LUT use cases
*/
Expand Down Expand Up @@ -431,6 +445,16 @@ struct dpu_pingpong_sub_blks {
struct dpu_pp_blk dither;
};

/**
* struct dpu_dsc_sub_blks - DSC sub-blks
* @enc: DSC encoder sub-block
* @ctl: DSC controller sub-block
*/
struct dpu_dsc_sub_blks {
struct dpu_dsc_blk enc;
struct dpu_dsc_blk ctl;
};

/**
* dpu_clk_ctrl_type - Defines top level clock control signals
*/
Expand Down Expand Up @@ -585,10 +609,13 @@ struct dpu_merge_3d_cfg {
* struct dpu_dsc_cfg - information of DSC blocks
* @id enum identifying this block
* @base register offset of this block
* @len: length of hardware block
* @features bit mask identifying sub-blocks/features
* @sblk: sub-blocks information
*/
struct dpu_dsc_cfg {
DPU_HW_BLK_INFO;
const struct dpu_dsc_sub_blks *sblk;
};

/**
Expand Down
14 changes: 13 additions & 1 deletion drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2020-2022, Linaro Limited */
/*
* Copyright (c) 2020-2022, Linaro Limited
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved
*/

#ifndef _DPU_HW_DSC_H
#define _DPU_HW_DSC_H
Expand Down Expand Up @@ -68,6 +71,15 @@ struct dpu_hw_dsc {
struct dpu_hw_dsc *dpu_hw_dsc_init(const struct dpu_dsc_cfg *cfg,
void __iomem *addr);

/**
* dpu_hw_dsc_init_1_2() - initializes the v1.2 DSC hw driver object
* @cfg: DSC catalog entry for which driver object is required
* @addr: Mapped register io address of MDP
* Returns: Error code or allocated dpu_hw_dsc context
*/
struct dpu_hw_dsc *dpu_hw_dsc_init_1_2(const struct dpu_dsc_cfg *cfg,
void __iomem *addr);

/**
* dpu_hw_dsc_destroy - destroys dsc driver context
* @dsc: Pointer to dsc driver context returned by dpu_hw_dsc_init
Expand Down
Loading

0 comments on commit 8c4094b

Please sign in to comment.