Skip to content

Commit 8f15005

Browse files
committed
drm/msm/dpu: move scaling limitations out of the hw_catalog
Max upscale / downscale factors are constant between platforms. In preparation to adding support for virtual planes and allocating SSPP blocks on demand move max scaling factors out of the HW catalog and handle them in the dpu_plane directly. If any of the scaling blocks gets different limitations, this will have to be handled separately, after the plane refactoring. Signed-off-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/621481/ Link: https://lore.kernel.org/r/[email protected]
1 parent b96ca23 commit 8f15005

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@
147147
#define MAX_HORZ_DECIMATION 4
148148
#define MAX_VERT_DECIMATION 4
149149

150-
#define MAX_UPSCALE_RATIO 20
151-
#define MAX_DOWNSCALE_RATIO 4
152-
#define SSPP_UNITY_SCALE 1
153-
154150
#define STRCAT(X, Y) (X Y)
155151

156152
static const uint32_t plane_formats[] = {
@@ -308,8 +304,6 @@ static const u32 wb2_formats_rgb_yuv[] = {
308304
/* SSPP common configuration */
309305
#define _VIG_SBLK(scaler_ver) \
310306
{ \
311-
.maxdwnscale = MAX_DOWNSCALE_RATIO, \
312-
.maxupscale = MAX_UPSCALE_RATIO, \
313307
.scaler_blk = {.name = "scaler", \
314308
.version = scaler_ver, \
315309
.base = 0xa00, .len = 0xa0,}, \
@@ -322,8 +316,6 @@ static const u32 wb2_formats_rgb_yuv[] = {
322316

323317
#define _VIG_SBLK_ROT(scaler_ver, rot_cfg) \
324318
{ \
325-
.maxdwnscale = MAX_DOWNSCALE_RATIO, \
326-
.maxupscale = MAX_UPSCALE_RATIO, \
327319
.scaler_blk = {.name = "scaler", \
328320
.version = scaler_ver, \
329321
.base = 0xa00, .len = 0xa0,}, \
@@ -336,17 +328,13 @@ static const u32 wb2_formats_rgb_yuv[] = {
336328

337329
#define _VIG_SBLK_NOSCALE() \
338330
{ \
339-
.maxdwnscale = SSPP_UNITY_SCALE, \
340-
.maxupscale = SSPP_UNITY_SCALE, \
341331
.format_list = plane_formats, \
342332
.num_formats = ARRAY_SIZE(plane_formats), \
343333
}
344334

345335
/* qseed2 is not supported, so disabled scaling */
346336
#define _VIG_SBLK_QSEED2() \
347337
{ \
348-
.maxdwnscale = SSPP_UNITY_SCALE, \
349-
.maxupscale = SSPP_UNITY_SCALE, \
350338
.scaler_blk = {.name = "scaler", \
351339
/* no version for qseed2 */ \
352340
.base = 0x200, .len = 0xa0,}, \
@@ -359,8 +347,6 @@ static const u32 wb2_formats_rgb_yuv[] = {
359347

360348
#define _RGB_SBLK() \
361349
{ \
362-
.maxdwnscale = SSPP_UNITY_SCALE, \
363-
.maxupscale = SSPP_UNITY_SCALE, \
364350
.scaler_blk = {.name = "scaler", \
365351
.base = 0x200, .len = 0x28,}, \
366352
.format_list = plane_formats, \
@@ -369,8 +355,6 @@ static const u32 wb2_formats_rgb_yuv[] = {
369355

370356
#define _DMA_SBLK() \
371357
{ \
372-
.maxdwnscale = SSPP_UNITY_SCALE, \
373-
.maxupscale = SSPP_UNITY_SCALE, \
374358
.format_list = plane_formats, \
375359
.num_formats = ARRAY_SIZE(plane_formats), \
376360
}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,6 @@ struct dpu_caps {
364364
/**
365365
* struct dpu_sspp_sub_blks : SSPP sub-blocks
366366
* common: Pointer to common configurations shared by sub blocks
367-
* @maxdwnscale: max downscale ratio supported(without DECIMATION)
368-
* @maxupscale: maxupscale ratio supported
369367
* @max_per_pipe_bw: maximum allowable bandwidth of this pipe in kBps
370368
* @qseed_ver: qseed version
371369
* @scaler_blk:
@@ -375,8 +373,6 @@ struct dpu_caps {
375373
* @dpu_rotation_cfg: inline rotation configuration
376374
*/
377375
struct dpu_sspp_sub_blks {
378-
u32 maxdwnscale;
379-
u32 maxupscale;
380376
u32 max_per_pipe_bw;
381377
u32 qseed_ver;
382378
struct dpu_scaler_blk scaler_blk;

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,15 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
777777
return 0;
778778
}
779779

780+
#define MAX_UPSCALE_RATIO 20
781+
#define MAX_DOWNSCALE_RATIO 4
782+
780783
static int dpu_plane_atomic_check(struct drm_plane *plane,
781784
struct drm_atomic_state *state)
782785
{
783786
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
784787
plane);
785-
int i, ret = 0, min_scale;
788+
int i, ret = 0, min_scale, max_scale;
786789
struct dpu_plane *pdpu = to_dpu_plane(plane);
787790
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
788791
u64 max_mdp_clk_rate = kms->perf.max_core_clk_rate;
@@ -813,10 +816,17 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
813816
pipe_hw_caps = pipe->sspp->cap;
814817
sblk = pipe->sspp->cap->sblk;
815818

816-
min_scale = FRAC_16_16(1, sblk->maxupscale);
819+
if (sblk->scaler_blk.len) {
820+
min_scale = FRAC_16_16(1, MAX_UPSCALE_RATIO);
821+
max_scale = MAX_DOWNSCALE_RATIO << 16;
822+
} else {
823+
min_scale = DRM_PLANE_NO_SCALING;
824+
max_scale = DRM_PLANE_NO_SCALING;
825+
}
826+
817827
ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
818828
min_scale,
819-
sblk->maxdwnscale << 16,
829+
max_scale,
820830
true, true);
821831
if (ret) {
822832
DPU_DEBUG_PLANE(pdpu, "Check plane state failed (%d)\n", ret);

0 commit comments

Comments
 (0)