Skip to content

Commit 53324b9

Browse files
Abhinav Kumarlumag
authored andcommitted
drm/msm/dpu: add writeback blocks to the sm8250 DPU catalog
Add writeback blocks to the sm8250 DPU hardware catalog. Other chipsets support writeback too but add it to sm8250 to prototype the feature so that it can be easily extended to other chipsets. changes in v4: - fix the copyright year order Signed-off-by: Abhinav Kumar <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/483510/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 7933aec commit 53324b9

File tree

2 files changed

+137
-1
lines changed

2 files changed

+137
-1
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
3+
* Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
34
*/
45

56
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
@@ -120,6 +121,16 @@
120121
BIT(MDP_AD4_0_INTR) | \
121122
BIT(MDP_AD4_1_INTR))
122123

124+
#define WB_SM8250_MASK (BIT(DPU_WB_LINE_MODE) | \
125+
BIT(DPU_WB_UBWC) | \
126+
BIT(DPU_WB_YUV_CONFIG) | \
127+
BIT(DPU_WB_PIPE_ALPHA) | \
128+
BIT(DPU_WB_XY_ROI_OFFSET) | \
129+
BIT(DPU_WB_QOS) | \
130+
BIT(DPU_WB_QOS_8LVL) | \
131+
BIT(DPU_WB_CDP) | \
132+
BIT(DPU_WB_INPUT_CTRL))
133+
123134
#define DEFAULT_PIXEL_RAM_SIZE (50 * 1024)
124135
#define DEFAULT_DPU_LINE_WIDTH 2048
125136
#define DEFAULT_DPU_OUTPUT_LINE_WIDTH 2560
@@ -211,6 +222,40 @@ static const u32 rotation_v2_formats[] = {
211222
/* TODO add formats after validation */
212223
};
213224

225+
static const uint32_t wb2_formats[] = {
226+
DRM_FORMAT_RGB565,
227+
DRM_FORMAT_BGR565,
228+
DRM_FORMAT_RGB888,
229+
DRM_FORMAT_ARGB8888,
230+
DRM_FORMAT_RGBA8888,
231+
DRM_FORMAT_ABGR8888,
232+
DRM_FORMAT_XRGB8888,
233+
DRM_FORMAT_RGBX8888,
234+
DRM_FORMAT_XBGR8888,
235+
DRM_FORMAT_ARGB1555,
236+
DRM_FORMAT_RGBA5551,
237+
DRM_FORMAT_XRGB1555,
238+
DRM_FORMAT_RGBX5551,
239+
DRM_FORMAT_ARGB4444,
240+
DRM_FORMAT_RGBA4444,
241+
DRM_FORMAT_RGBX4444,
242+
DRM_FORMAT_XRGB4444,
243+
DRM_FORMAT_BGR565,
244+
DRM_FORMAT_BGR888,
245+
DRM_FORMAT_ABGR8888,
246+
DRM_FORMAT_BGRA8888,
247+
DRM_FORMAT_BGRX8888,
248+
DRM_FORMAT_XBGR8888,
249+
DRM_FORMAT_ABGR1555,
250+
DRM_FORMAT_BGRA5551,
251+
DRM_FORMAT_XBGR1555,
252+
DRM_FORMAT_BGRX5551,
253+
DRM_FORMAT_ABGR4444,
254+
DRM_FORMAT_BGRA4444,
255+
DRM_FORMAT_BGRX4444,
256+
DRM_FORMAT_XBGR4444,
257+
};
258+
214259
/*************************************************************
215260
* DPU sub blocks config
216261
*************************************************************/
@@ -448,6 +493,8 @@ static const struct dpu_mdp_cfg sm8250_mdp[] = {
448493
.reg_off = 0x2C4, .bit_off = 8},
449494
.clk_ctrls[DPU_CLK_CTRL_REG_DMA] = {
450495
.reg_off = 0x2BC, .bit_off = 20},
496+
.clk_ctrls[DPU_CLK_CTRL_WB2] = {
497+
.reg_off = 0x3B8, .bit_off = 24},
451498
},
452499
};
453500

@@ -1234,6 +1281,29 @@ static const struct dpu_intf_cfg qcm2290_intf[] = {
12341281
INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 26, 27),
12351282
};
12361283

1284+
/*************************************************************
1285+
* Writeback blocks config
1286+
*************************************************************/
1287+
#define WB_BLK(_name, _id, _base, _features, _clk_ctrl, \
1288+
__xin_id, vbif_id, _reg, _wb_done_bit) \
1289+
{ \
1290+
.name = _name, .id = _id, \
1291+
.base = _base, .len = 0x2c8, \
1292+
.features = _features, \
1293+
.format_list = wb2_formats, \
1294+
.num_formats = ARRAY_SIZE(wb2_formats), \
1295+
.clk_ctrl = _clk_ctrl, \
1296+
.xin_id = __xin_id, \
1297+
.vbif_idx = vbif_id, \
1298+
.maxlinewidth = DEFAULT_DPU_LINE_WIDTH, \
1299+
.intr_wb_done = DPU_IRQ_IDX(_reg, _wb_done_bit) \
1300+
}
1301+
1302+
static const struct dpu_wb_cfg sm8250_wb[] = {
1303+
WB_BLK("wb_2", WB_2, 0x65000, WB_SM8250_MASK, DPU_CLK_CTRL_WB2, 6,
1304+
VBIF_RT, MDP_SSPP_TOP0_INTR, 4),
1305+
};
1306+
12371307
/*************************************************************
12381308
* VBIF sub blocks config
12391309
*************************************************************/
@@ -1832,6 +1902,8 @@ static void sm8250_cfg_init(struct dpu_mdss_cfg *dpu_cfg)
18321902
.intf = sm8150_intf,
18331903
.vbif_count = ARRAY_SIZE(sdm845_vbif),
18341904
.vbif = sdm845_vbif,
1905+
.wb_count = ARRAY_SIZE(sm8250_wb),
1906+
.wb = sm8250_wb,
18351907
.reg_dma_count = 1,
18361908
.dma_cfg = sm8250_regdma,
18371909
.perf = sm8250_perf_data,

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
2-
/* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved.
2+
/*
3+
* Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved.
35
*/
46

57
#ifndef _DPU_HW_CATALOG_H
@@ -213,6 +215,42 @@ enum {
213215
DPU_INTF_MAX
214216
};
215217

218+
/**
219+
* WB sub-blocks and features
220+
* @DPU_WB_LINE_MODE Writeback module supports line/linear mode
221+
* @DPU_WB_BLOCK_MODE Writeback module supports block mode read
222+
* @DPU_WB_CHROMA_DOWN, Writeback chroma down block,
223+
* @DPU_WB_DOWNSCALE, Writeback integer downscaler,
224+
* @DPU_WB_DITHER, Dither block
225+
* @DPU_WB_TRAFFIC_SHAPER, Writeback traffic shaper bloc
226+
* @DPU_WB_UBWC, Writeback Universal bandwidth compression
227+
* @DPU_WB_YUV_CONFIG Writeback supports output of YUV colorspace
228+
* @DPU_WB_PIPE_ALPHA Writeback supports pipe alpha
229+
* @DPU_WB_XY_ROI_OFFSET Writeback supports x/y-offset of out ROI in
230+
* the destination image
231+
* @DPU_WB_QOS, Writeback supports QoS control, danger/safe/creq
232+
* @DPU_WB_QOS_8LVL, Writeback supports 8-level QoS control
233+
* @DPU_WB_CDP Writeback supports client driven prefetch
234+
* @DPU_WB_INPUT_CTRL Writeback supports from which pp block input pixel
235+
* data arrives.
236+
* @DPU_WB_CROP CWB supports cropping
237+
* @DPU_WB_MAX maximum value
238+
*/
239+
enum {
240+
DPU_WB_LINE_MODE = 0x1,
241+
DPU_WB_BLOCK_MODE,
242+
DPU_WB_UBWC,
243+
DPU_WB_YUV_CONFIG,
244+
DPU_WB_PIPE_ALPHA,
245+
DPU_WB_XY_ROI_OFFSET,
246+
DPU_WB_QOS,
247+
DPU_WB_QOS_8LVL,
248+
DPU_WB_CDP,
249+
DPU_WB_INPUT_CTRL,
250+
DPU_WB_CROP,
251+
DPU_WB_MAX
252+
};
253+
216254
/**
217255
* VBIF sub-blocks and features
218256
* @DPU_VBIF_QOS_OTLIM VBIF supports OT Limit
@@ -460,6 +498,7 @@ enum dpu_clk_ctrl_type {
460498
DPU_CLK_CTRL_CURSOR1,
461499
DPU_CLK_CTRL_INLINE_ROT0_SSPP,
462500
DPU_CLK_CTRL_REG_DMA,
501+
DPU_CLK_CTRL_WB2,
463502
DPU_CLK_CTRL_MAX,
464503
};
465504

@@ -607,6 +646,28 @@ struct dpu_intf_cfg {
607646
s32 intr_vsync;
608647
};
609648

649+
/**
650+
* struct dpu_wb_cfg - information of writeback blocks
651+
* @DPU_HW_BLK_INFO: refer to the description above for DPU_HW_BLK_INFO
652+
* @vbif_idx: vbif client index
653+
* @maxlinewidth: max line width supported by writeback block
654+
* @xin_id: bus client identifier
655+
* @intr_wb_done: interrupt index for WB_DONE
656+
* @format_list: list of formats supported by this writeback block
657+
* @num_formats: number of formats supported by this writeback block
658+
* @clk_ctrl: clock control identifier
659+
*/
660+
struct dpu_wb_cfg {
661+
DPU_HW_BLK_INFO;
662+
u8 vbif_idx;
663+
u32 maxlinewidth;
664+
u32 xin_id;
665+
s32 intr_wb_done;
666+
const u32 *format_list;
667+
u32 num_formats;
668+
enum dpu_clk_ctrl_type clk_ctrl;
669+
};
670+
610671
/**
611672
* struct dpu_vbif_dynamic_ot_cfg - dynamic OT setting
612673
* @pps pixel per seconds
@@ -792,6 +853,9 @@ struct dpu_mdss_cfg {
792853
u32 vbif_count;
793854
const struct dpu_vbif_cfg *vbif;
794855

856+
u32 wb_count;
857+
const struct dpu_wb_cfg *wb;
858+
795859
u32 reg_dma_count;
796860
struct dpu_reg_dma_cfg dma_cfg;
797861

0 commit comments

Comments
 (0)