Skip to content

Commit 6aaff21

Browse files
committed
Merge tag 'drm-intel-next-2023-12-18' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
- Drop pointless null checks and fix a scaler bug (Ville) - Meteor Lake display fixes and clean-ups (RK, Jani, Andrzej, Mika, Imre) - Clean-up around flip done IRQ (Ville) - Fix eDP Meteor Lake bug (Jani) - Bigjoiner fixes (Ankit, Ville) - Cdclk/voltage_level cleanups and fixes (Ville) - DMC event stuff (Ville) - Remove dead code around intel_atomic_helper->free_list (Jouni) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ZYB5XBRdWWgWoMKc@intel.com
2 parents 4f88cfd + 716c3cf commit 6aaff21

23 files changed

+305
-281
lines changed

drivers/gpu/drm/i915/display/i9xx_wm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ static bool intel_crtc_active(struct intel_crtc *crtc)
608608
* crtc->state->active once we have proper CRTC states wired up
609609
* for atomic.
610610
*/
611-
return crtc && crtc->active && crtc->base.primary->state->fb &&
611+
return crtc->active && crtc->base.primary->state->fb &&
612612
crtc->config->hw.adjusted_mode.crtc_clock;
613613
}
614614

drivers/gpu/drm/i915/display/intel_bios.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3475,8 +3475,7 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
34753475
if (!devdata->dsc)
34763476
return false;
34773477

3478-
if (crtc_state)
3479-
fill_dsc(crtc_state, devdata->dsc, dsc_max_bpc);
3478+
fill_dsc(crtc_state, devdata->dsc, dsc_max_bpc);
34803479

34813480
return true;
34823481
}

drivers/gpu/drm/i915/display/intel_cdclk.c

Lines changed: 69 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ static void skl_sanitize_cdclk(struct drm_i915_private *dev_priv)
11801180
/* force cdclk programming */
11811181
dev_priv->display.cdclk.hw.cdclk = 0;
11821182
/* force full PLL disable + enable */
1183-
dev_priv->display.cdclk.hw.vco = -1;
1183+
dev_priv->display.cdclk.hw.vco = ~0;
11841184
}
11851185

11861186
static void skl_cdclk_init_hw(struct drm_i915_private *dev_priv)
@@ -1446,50 +1446,77 @@ static u8 bxt_calc_voltage_level(int cdclk)
14461446
return DIV_ROUND_UP(cdclk, 25000);
14471447
}
14481448

1449+
static u8 calc_voltage_level(int cdclk, int num_voltage_levels,
1450+
const int voltage_level_max_cdclk[])
1451+
{
1452+
int voltage_level;
1453+
1454+
for (voltage_level = 0; voltage_level < num_voltage_levels; voltage_level++) {
1455+
if (cdclk <= voltage_level_max_cdclk[voltage_level])
1456+
return voltage_level;
1457+
}
1458+
1459+
MISSING_CASE(cdclk);
1460+
return num_voltage_levels - 1;
1461+
}
1462+
14491463
static u8 icl_calc_voltage_level(int cdclk)
14501464
{
1451-
if (cdclk > 556800)
1452-
return 2;
1453-
else if (cdclk > 312000)
1454-
return 1;
1455-
else
1456-
return 0;
1465+
static const int icl_voltage_level_max_cdclk[] = {
1466+
[0] = 312000,
1467+
[1] = 556800,
1468+
[2] = 652800,
1469+
};
1470+
1471+
return calc_voltage_level(cdclk,
1472+
ARRAY_SIZE(icl_voltage_level_max_cdclk),
1473+
icl_voltage_level_max_cdclk);
14571474
}
14581475

14591476
static u8 ehl_calc_voltage_level(int cdclk)
14601477
{
1461-
if (cdclk > 326400)
1462-
return 3;
1463-
else if (cdclk > 312000)
1464-
return 2;
1465-
else if (cdclk > 180000)
1466-
return 1;
1467-
else
1468-
return 0;
1478+
static const int ehl_voltage_level_max_cdclk[] = {
1479+
[0] = 180000,
1480+
[1] = 312000,
1481+
[2] = 326400,
1482+
/*
1483+
* Bspec lists the limit as 556.8 MHz, but some JSL
1484+
* development boards (at least) boot with 652.8 MHz
1485+
*/
1486+
[3] = 652800,
1487+
};
1488+
1489+
return calc_voltage_level(cdclk,
1490+
ARRAY_SIZE(ehl_voltage_level_max_cdclk),
1491+
ehl_voltage_level_max_cdclk);
14691492
}
14701493

14711494
static u8 tgl_calc_voltage_level(int cdclk)
14721495
{
1473-
if (cdclk > 556800)
1474-
return 3;
1475-
else if (cdclk > 326400)
1476-
return 2;
1477-
else if (cdclk > 312000)
1478-
return 1;
1479-
else
1480-
return 0;
1496+
static const int tgl_voltage_level_max_cdclk[] = {
1497+
[0] = 312000,
1498+
[1] = 326400,
1499+
[2] = 556800,
1500+
[3] = 652800,
1501+
};
1502+
1503+
return calc_voltage_level(cdclk,
1504+
ARRAY_SIZE(tgl_voltage_level_max_cdclk),
1505+
tgl_voltage_level_max_cdclk);
14811506
}
14821507

14831508
static u8 rplu_calc_voltage_level(int cdclk)
14841509
{
1485-
if (cdclk > 556800)
1486-
return 3;
1487-
else if (cdclk > 480000)
1488-
return 2;
1489-
else if (cdclk > 312000)
1490-
return 1;
1491-
else
1492-
return 0;
1510+
static const int rplu_voltage_level_max_cdclk[] = {
1511+
[0] = 312000,
1512+
[1] = 480000,
1513+
[2] = 556800,
1514+
[3] = 652800,
1515+
};
1516+
1517+
return calc_voltage_level(cdclk,
1518+
ARRAY_SIZE(rplu_voltage_level_max_cdclk),
1519+
rplu_voltage_level_max_cdclk);
14931520
}
14941521

14951522
static void icl_readout_refclk(struct drm_i915_private *dev_priv,
@@ -1800,6 +1827,8 @@ static bool cdclk_pll_is_unknown(unsigned int vco)
18001827
return vco == ~0;
18011828
}
18021829

1830+
static const int cdclk_squash_len = 16;
1831+
18031832
static int cdclk_squash_divider(u16 waveform)
18041833
{
18051834
return hweight16(waveform ?: 0xffff);
@@ -1811,7 +1840,6 @@ static bool cdclk_compute_crawl_and_squash_midpoint(struct drm_i915_private *i91
18111840
struct intel_cdclk_config *mid_cdclk_config)
18121841
{
18131842
u16 old_waveform, new_waveform, mid_waveform;
1814-
int size = 16;
18151843
int div = 2;
18161844

18171845
/* Return if PLL is in an unknown state, force a complete disable and re-enable. */
@@ -1850,7 +1878,8 @@ static bool cdclk_compute_crawl_and_squash_midpoint(struct drm_i915_private *i91
18501878
}
18511879

18521880
mid_cdclk_config->cdclk = DIV_ROUND_CLOSEST(cdclk_squash_divider(mid_waveform) *
1853-
mid_cdclk_config->vco, size * div);
1881+
mid_cdclk_config->vco,
1882+
cdclk_squash_len * div);
18541883

18551884
/* make sure the mid clock came out sane */
18561885

@@ -1878,9 +1907,9 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
18781907
{
18791908
int cdclk = cdclk_config->cdclk;
18801909
int vco = cdclk_config->vco;
1881-
u32 val;
1910+
int unsquashed_cdclk;
18821911
u16 waveform;
1883-
int clock;
1912+
u32 val;
18841913

18851914
if (HAS_CDCLK_CRAWL(dev_priv) && dev_priv->display.cdclk.hw.vco > 0 && vco > 0 &&
18861915
!cdclk_pll_is_unknown(dev_priv->display.cdclk.hw.vco)) {
@@ -1897,15 +1926,13 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
18971926

18981927
waveform = cdclk_squash_waveform(dev_priv, cdclk);
18991928

1900-
if (waveform)
1901-
clock = vco / 2;
1902-
else
1903-
clock = cdclk;
1929+
unsquashed_cdclk = DIV_ROUND_CLOSEST(cdclk * cdclk_squash_len,
1930+
cdclk_squash_divider(waveform));
19041931

19051932
if (HAS_CDCLK_SQUASH(dev_priv))
19061933
dg2_cdclk_squash_program(dev_priv, waveform);
19071934

1908-
val = bxt_cdclk_cd2x_div_sel(dev_priv, clock, vco) |
1935+
val = bxt_cdclk_cd2x_div_sel(dev_priv, unsquashed_cdclk, vco) |
19091936
bxt_cdclk_cd2x_pipe(dev_priv, pipe);
19101937

19111938
/*
@@ -2075,7 +2102,7 @@ static void bxt_sanitize_cdclk(struct drm_i915_private *dev_priv)
20752102
dev_priv->display.cdclk.hw.cdclk = 0;
20762103

20772104
/* force full PLL disable + enable */
2078-
dev_priv->display.cdclk.hw.vco = -1;
2105+
dev_priv->display.cdclk.hw.vco = ~0;
20792106
}
20802107

20812108
static void bxt_cdclk_init_hw(struct drm_i915_private *dev_priv)
@@ -3489,7 +3516,7 @@ static const struct intel_cdclk_funcs mtl_cdclk_funcs = {
34893516
.get_cdclk = bxt_get_cdclk,
34903517
.set_cdclk = bxt_set_cdclk,
34913518
.modeset_calc_cdclk = bxt_modeset_calc_cdclk,
3492-
.calc_voltage_level = tgl_calc_voltage_level,
3519+
.calc_voltage_level = rplu_calc_voltage_level,
34933520
};
34943521

34953522
static const struct intel_cdclk_funcs rplu_cdclk_funcs = {

drivers/gpu/drm/i915/display/intel_crtc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,15 @@ void intel_pipe_update_start(struct intel_atomic_state *state,
553553

554554
intel_psr_lock(new_crtc_state);
555555

556-
if (new_crtc_state->do_async_flip)
556+
if (new_crtc_state->do_async_flip) {
557+
spin_lock_irq(&crtc->base.dev->event_lock);
558+
/* arm the event for the flip done irq handler */
559+
crtc->flip_done_event = new_crtc_state->uapi.event;
560+
spin_unlock_irq(&crtc->base.dev->event_lock);
561+
562+
new_crtc_state->uapi.event = NULL;
557563
return;
564+
}
558565

559566
if (intel_crtc_needs_vblank_work(new_crtc_state))
560567
intel_crtc_vblank_work_init(new_crtc_state);

0 commit comments

Comments
 (0)