linux-2.6-microblaze.git
14 months agodrm/i915: Split some long lines in hsw_fdi_link_train()
Ville Syrjälä [Tue, 2 May 2023 14:39:02 +0000 (17:39 +0300)]
drm/i915: Split some long lines in hsw_fdi_link_train()

Split some overly long lines in hsw_fdi_link_train().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230502143906.2401-8-ville.syrjala@linux.intel.com
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
14 months agodrm/i915: Fix FEC state dump
Ville Syrjälä [Tue, 2 May 2023 14:39:01 +0000 (17:39 +0300)]
drm/i915: Fix FEC state dump

Stop dumping state while reading it out. We have a proper
place for that stuff.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230502143906.2401-7-ville.syrjala@linux.intel.com
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
14 months agodrm/i915: Fix FEC pipe A vs. DDI A mixup
Ville Syrjälä [Tue, 2 May 2023 14:38:59 +0000 (17:38 +0300)]
drm/i915: Fix FEC pipe A vs. DDI A mixup

On pre-TGL FEC is a port level feature, not a transcoder
level feature, and it's DDI A which doesn't have it, not
trancoder A. Check for the correct thing when determining
whether FEC is supported or not.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230502143906.2401-5-ville.syrjala@linux.intel.com
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
14 months agodrm/i915/mst: Read out FEC state
Ville Syrjälä [Tue, 2 May 2023 14:38:58 +0000 (17:38 +0300)]
drm/i915/mst: Read out FEC state

The MST codepath is missing FEC readout. Add it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230502143906.2401-4-ville.syrjala@linux.intel.com
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
14 months agodrm/i915/gt: rename DBG() to GTT_TRACE()
Jani Nikula [Mon, 11 Sep 2023 12:33:05 +0000 (15:33 +0300)]
drm/i915/gt: rename DBG() to GTT_TRACE()

intel_gtt.h is indirectly included absolutely everywhere in the
driver. DBG() is too short a name. Rename it GTT_TRACE() after
GEM_TRACE().

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230911123305.1682554-1-jani.nikula@intel.com
14 months agodrm/i915/dsc: use REG_BIT, REG_GENMASK, and friends for PPS0 and PPS1
Jani Nikula [Tue, 5 Sep 2023 17:11:27 +0000 (20:11 +0300)]
drm/i915/dsc: use REG_BIT, REG_GENMASK, and friends for PPS0 and PPS1

Use the register helper macros for PPS0 and PPS1 register contents.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/0dfebe37a391a5ceb8bfae8e16383f1e5aef815d.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915/dsc: add the PPS number to the register content macros
Jani Nikula [Tue, 5 Sep 2023 17:11:26 +0000 (20:11 +0300)]
drm/i915/dsc: add the PPS number to the register content macros

Improve clarity by specifying the PPS number in the register content
macros. It's easier to notice if macros are being used for the wrong
register.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/58de57b04ad2da5207f52c56c9e40663aaf16173.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915/dsc: clean up pps comments
Jani Nikula [Tue, 5 Sep 2023 17:11:25 +0000 (20:11 +0300)]
drm/i915/dsc: clean up pps comments

Unify comments to be the simple "PPS n" instead of all sorts of
variants.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/915970973ef117fc8d47fbc57e8fa296235ad3e3.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915/dsc: drop redundant = 0 assignments
Jani Nikula [Tue, 5 Sep 2023 17:11:24 +0000 (20:11 +0300)]
drm/i915/dsc: drop redundant = 0 assignments

Directly assign the values instead of first assigning 0 and then |= the
values.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d752a148cc84558b76c8c3dacd9c0b2e0a4efd91.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915/dsc: rename pps write to intel_dsc_pps_write()
Jani Nikula [Tue, 5 Sep 2023 17:11:23 +0000 (20:11 +0300)]
drm/i915/dsc: rename pps write to intel_dsc_pps_write()

Make the function name conform to existing style better.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/e793056e610ee8cfe2a8d69605402cd2445a517a.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915/dsc: have intel_dsc_pps_read() return the value
Jani Nikula [Tue, 5 Sep 2023 17:11:22 +0000 (20:11 +0300)]
drm/i915/dsc: have intel_dsc_pps_read() return the value

Register read functions usually return the value instead of passing via
pointer parameters. Return the multiple register verification results
via a pointer parameter, which can also be NULL to skip the extra
checks.

Make the name conform to existing style better while at it.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4d08c0f63c4975cc8cd01b0f82845c989bf13dd0.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915/dsc: have intel_dsc_pps_read_and_verify() return the value
Jani Nikula [Tue, 5 Sep 2023 17:11:21 +0000 (20:11 +0300)]
drm/i915/dsc: have intel_dsc_pps_read_and_verify() return the value

Register read functions usually return the value instead of passing via
pointer parameters. The calling code becomes easier to read.

Make the name conform to existing style better while at it.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/89b7d70bb19114ab3ff0e150a4b862d8032f136d.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915/dsc: improve clarity of the pps reg read/write helpers
Jani Nikula [Tue, 5 Sep 2023 17:11:20 +0000 (20:11 +0300)]
drm/i915/dsc: improve clarity of the pps reg read/write helpers

Make it clear what's the number of vdsc per pipe, and what's the number
of registers to grab. Have intel_dsc_get_pps_reg() return the registers
it knows even if the requested amount is bigger.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/e2551b52ac0dd2b4ffe18d5e7733fafdc191d68a.1693933849.git.jani.nikula@intel.com
14 months agodrm/i915: Only check eDP HPD when AUX CH is shared
Ville Syrjälä [Fri, 8 Sep 2023 05:25:27 +0000 (08:25 +0300)]
drm/i915: Only check eDP HPD when AUX CH is shared

Apparently Acer Chromebook C740 (BDW-ULT) doesn't have the
eDP HPD line properly connected, and thus fails the new
HPD check during eDP probe. The result is that we lose the
eDP output.

I suspect all such machines would be Chromebooks or other
Linux exclusive systems as the Windows driver likely wouldn't
work either. I did check a few other BDW machines here and
those do have eDP HPD connected, one of them even is a
different Chromebook (Samus).

To account for these funky machines let's skip the HPD check when
it looks like the eDP port is the only one using that specific AUX
channel. In case of multiple ports sharing the same AUX CH (eg. on
Asrock B250M-HDV) we still do the check and thus should correctly
ignore the eDP port in favor of the other DP port (usually a DP->VGA
converter).

v2: Don't oops during list iteration

Cc: stable@vger.kernel.org
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/9264
Fixes: cfe5bdfb27fa ("drm/i915: Check HPD live state during eDP probe")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230908052527.685-1-ville.syrjala@linux.intel.com
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
14 months agodrm/i915/display: Apply workarounds during display init
Matt Roper [Wed, 6 Sep 2023 23:47:37 +0000 (16:47 -0700)]
drm/i915/display: Apply workarounds during display init

Rather than applying display workarounds as part of
intel_clock_gating_init() (which in turn is confusingly called from
i915_gem_init during device probe), handle them at the point we're
actually initializing the display hardware.  This will also ensure that
these workarounds are properly applied during display initialization on
the Xe driver, which re-uses i915's display code, but does not call
i915's gem init.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230906234732.3728630-10-matthew.d.roper@intel.com
14 months agodrm/i915/display: Extract display workarounds from clock gating init
Matt Roper [Thu, 7 Sep 2023 00:10:10 +0000 (17:10 -0700)]
drm/i915/display: Extract display workarounds from clock gating init

Several of the register updates that are currently done in the clock
gating init functions are actually display workarounds that should move
into the display-specific part of the code.  Furthermore, some of the
registers being programmed don't even have anything to do with clock
gating at all.

Extract the display workarounds for gen11 and later platforms to a
dedicated display/intel_display_wa.c file to keep these separate from
the SOC / sgunit clock gating that we need on some platforms.  The gen11
cutoff here is selected somewhat arbitrarily; this is the point where
workarounds were first assigned dedicated lineage numbers that can be
easily looked up and confirmed in the modern workaround database.  It
also avoids any confusion on older platforms where the exact boundaries
between display/GT/other IP blocks wasn't as well-defined as it is
today.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230907001009.3732474-2-matthew.d.roper@intel.com
14 months agodrm/i915/adlp: Stop calling gen12lp_init_clock_gating()
Matt Roper [Wed, 6 Sep 2023 23:47:35 +0000 (16:47 -0700)]
drm/i915/adlp: Stop calling gen12lp_init_clock_gating()

The only programming that happens in gen12lp_init_clock_gating is for
display workarounds that are specific to display version 12 and are not
relevant to ADL-P's display version 13.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230906234732.3728630-8-matthew.d.roper@intel.com
14 months agodrm/i915: Stop forcing clock gating init for future platforms
Matt Roper [Wed, 6 Sep 2023 23:47:34 +0000 (16:47 -0700)]
drm/i915: Stop forcing clock gating init for future platforms

In the early days of i915, pretty much every platform needed to
initialize _something_ in the clock gating init functions.  In some
cases the items initialized were inside the GT (and really should have
been initialized through the GT workaround infrastructure instead).
In other cases they were display programming (sometimes not even related
to "clock gating" at all!) which probably needs to move inside the
display-specific code.  The number of initialization tasks that are
truly "clock gating" and don't fall within the GT or display domains is
relatively limited.  Let's stop forcing future platforms to always
define a clock gating init hook.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230906234732.3728630-7-matthew.d.roper@intel.com
14 months agodrm/i915/dsb: Don't use indexed writes when byte enables are not all set
Ville Syrjälä [Tue, 6 Jun 2023 19:14:52 +0000 (22:14 +0300)]
drm/i915/dsb: Don't use indexed writes when byte enables are not all set

The indexed write instruction doesn't support byte-enables, so
if the non-indexed write used those we must not convert it to
an indexed write.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230606191504.18099-8-ville.syrjala@linux.intel.com
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
14 months agodrm/i915/dsb: Avoid corrupting the first register write
Ville Syrjälä [Tue, 6 Jun 2023 19:14:51 +0000 (22:14 +0300)]
drm/i915/dsb: Avoid corrupting the first register write

i915_gem_object_create_internal() does not hand out zeroed
memory. Thus we may confuse whatever stale garbage is in
there as a previous register write and mistakenly handle the
first actual register write as an indexed write. This can
end up corrupting the instruction sufficiently well to lose
the entire register write.

Make sure we've actually emitted a previous instruction before
attemting indexed register write merging.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230606191504.18099-7-ville.syrjala@linux.intel.com
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
14 months agodrm/i915/dsb: Dump the DSB command buffer when DSB fails
Ville Syrjälä [Tue, 6 Jun 2023 19:14:48 +0000 (22:14 +0300)]
drm/i915/dsb: Dump the DSB command buffer when DSB fails

Dump the full DSB command buffers and head/tail pointers if the
the DSB hasn't completed its job in time.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230606191504.18099-4-ville.syrjala@linux.intel.com
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
14 months agodrm/i915: Constify LUT entries in checker
Ville Syrjälä [Tue, 6 Jun 2023 19:14:46 +0000 (22:14 +0300)]
drm/i915: Constify LUT entries in checker

The LUT checker doesn't modify the LUT entries so make them const.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230606191504.18099-2-ville.syrjala@linux.intel.com
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
14 months agodrm/i915/cx0: Check and increase msgbus timeout threshold
Gustavo Sousa [Wed, 30 Aug 2023 12:15:24 +0000 (09:15 -0300)]
drm/i915/cx0: Check and increase msgbus timeout threshold

We have experienced timeout issues when going through the sequence to
access C20 SRAM registers. Experimentation showed that bumping the
message bus timer threshold helped on getting display Type-C connection
on the C20 PHY to work.

While the timeout is still under investigation with the HW team, having
logic to allow forward progress (with the proper warnings) seems useful.
Thus, let's bump the threshold when a timeout is detected.

The bumped value of 0x200 pclk cycles was somewhat arbitrary - 2x the
default value. That value was successfully tested on real hardware that
was displaying timeouts otherwise.

v2:
  - Reword commit message to indicate that access to C20 SRAM registers
    is not direct. (Radhakrishna)
  - Prefer not to use REG_FIELD_PREP() in intel_cx0_phy.c.
    (Radhakrishna)
  - Simplify intel_cx0_bus_check_and_bump_timer() to use a fixed bumped
    value instead of progressively increasing the threshold. (Mika)

BSpec: 65156
Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230830121524.15101-1-gustavo.sousa@intel.com
14 months agodrm/i915: add trailing newlines to msgs
Jim Cromie [Sun, 3 Sep 2023 18:46:00 +0000 (12:46 -0600)]
drm/i915: add trailing newlines to msgs

By at least strong convention, a print-buffer's trailing newline says
"message complete, send it".  The exception (no TNL, followed by a call
to pr_cont) proves the general rule.

Most DRM.debug calls already comport with this: 207 DRM_DEV_DEBUG,
1288 drm_dbg.  Clean up the remainders, in maintainer sized chunks.

No functional changes.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
[Rodrigo changed subject while pushing]
Link: https://patchwork.freedesktop.org/patch/msgid/20230903184607.272198-4-jim.cromie@gmail.com
14 months agodrm/i915/psr: Add psr sink error status into sink status debugfs
Jouni Högander [Mon, 28 Aug 2023 08:31:07 +0000 (11:31 +0300)]
drm/i915/psr: Add psr sink error status into sink status debugfs

Normally PSR errors detected by the panel are triggering HPD interrupt and
seen as error in dmesg. Some panels are not triggering the interrupt even
it is requested and they are detecting error. Due to this it would be good
to have possibility to check panel detected errors. Add PSR error status
into PSR sink status debugfs interface.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828083107.1520501-1-jouni.hogander@intel.com
14 months agodrm/i915/tc: remove "fia" from intel_tc_port_fia_max_lane_count()
Luca Coelho [Fri, 25 Aug 2023 08:16:38 +0000 (11:16 +0300)]
drm/i915/tc: remove "fia" from intel_tc_port_fia_max_lane_count()

It is irrelevant for the caller that the max lane count is being
derived from a FIA register, so having "fia" in the function name is
irrelevant.  Rename the function accordingly.

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825081638.275795-5-luciano.coelho@intel.com
14 months agodrm/i915/tc: move legacy code out of the main _max_lane_count() func
Luca Coelho [Fri, 25 Aug 2023 08:16:37 +0000 (11:16 +0300)]
drm/i915/tc: move legacy code out of the main _max_lane_count() func

This makes the code a bit more symmetric and readable, especially when
we start adding more display version-specific alternatives.

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825081638.275795-4-luciano.coelho@intel.com
14 months agodrm/i915/tc: make intel_tc_port_get_lane_mask() static
Luca Coelho [Fri, 25 Aug 2023 08:16:36 +0000 (11:16 +0300)]
drm/i915/tc: make intel_tc_port_get_lane_mask() static

This function is only used locally, so make it static and remove the
definition from the header file.

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825081638.275795-3-luciano.coelho@intel.com
14 months agodrm/i915/tc: rename mtl_tc_port_get_pin_assignment_mask()
Luca Coelho [Fri, 25 Aug 2023 08:16:35 +0000 (11:16 +0300)]
drm/i915/tc: rename mtl_tc_port_get_pin_assignment_mask()

This function doesn't really return the pin assignment mask, but the
max lane count derived from that.  So rename the function to
mtl_tc_port_get_max_lane_count() to better reflect what it really does.

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825081638.275795-2-luciano.coelho@intel.com
14 months agodrm/i915/display: Compare the readout dsc pps params
Suraj Kandpal [Mon, 28 Aug 2023 05:43:01 +0000 (11:13 +0530)]
drm/i915/display: Compare the readout dsc pps params

With the dsc config being readout and filled in crtc_state add
macros and use them to compare current and previous PPS param in
DSC.

--v2
-Remove version check [Jani]
-Remove dupe macro for dsc pipe compare and use the existing ones
[Jani]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-9-suraj.kandpal@intel.com
14 months agodrm/i915/vdsc: Fill the intel_dsc_get_pps_config function
Suraj Kandpal [Mon, 28 Aug 2023 05:43:00 +0000 (11:13 +0530)]
drm/i915/vdsc: Fill the intel_dsc_get_pps_config function

We have setup both the read and write functions so we can
move ahead and fill in all the readout state from PPS register
into the crtc_state so we can send it for comparision.

--v2
-Shorten comment to just PPSX rather than having the whole
"Readout PPSX register" [Jani]
-Remove pps_temp reinitialization as its being initialized in
the read function [Jani]
-Use REG_FIELD_GET to readout certain fields of dsc registers
[Jani]

--v9
-Place the masks at a more appropriate place [Ankit]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-8-suraj.kandpal@intel.com
14 months agodrm/i915/vdsc: Remove unused dsc registers
Suraj Kandpal [Mon, 28 Aug 2023 05:42:59 +0000 (11:12 +0530)]
drm/i915/vdsc: Remove unused dsc registers

Now that we have macros that can fetch dsc register values based
on pipe and pps parameters we can go ahead and remove all the
unused register.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-7-suraj.kandpal@intel.com
14 months agodrm/i915/vdsc: Add function to write in PPS register
Suraj Kandpal [Mon, 28 Aug 2023 05:42:58 +0000 (11:12 +0530)]
drm/i915/vdsc: Add function to write in PPS register

Now that we have a function that reads any PPS register based
on intel_dsc_pps enum provided lets create a function that can
write on any PPS.

--v2
-Changes need as PPS enum was dropped
-Remove duplicated code in intel_dsc_write_pps_reg [Jani]

--v3
-Use dsc_split instead of num_vdsc_instances [Ankit]

--v5
-Changes to implement the new dsc_reg array variable passing
[Ankit]

--v7
-Pass no of vdsc instances to get_pps_reg [Ankit]

--v8
-No need for dsc_reg dynamic allocation [Jani]
-Change function to void as no return needs to be sent back

--v9
-Send ARRAY_SIZE(dsc_reg) instead of vdsc_per_pipe [Ankit]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-6-suraj.kandpal@intel.com
14 months agodrm/i915/vdsc: Add function to read any PPS register
Suraj Kandpal [Mon, 28 Aug 2023 05:42:57 +0000 (11:12 +0530)]
drm/i915/vdsc: Add function to read any PPS register

Add function to read any PPS register based on the
intel_dsc_pps enum provided. Add a function which will call the
new pps read function and place it in crtc state. Only PPS0 and
PPS1 are readout the rest of the registers will be read in upcoming
patches.

--v2
-Changes in read function as PPS enum is removed
-Initialize pps_val as 0 in pps_read func itself [Jani]
-Create a function that gets the required register and call that
in the common read function [Jani]
-Move the drm_WARN_ON one abstraction layer above [Jani]

--v3
-Send both reg values regardless of dsc engine no [Jani]
-Don't use num_vdsc_instances stick to dsc_split field [Ankit]

--v4
-Manipulate the reg values instead of creating MACRO to change
name of pps [Ankit]

--v5
-Read dsc reg values using array rather than individual variables
[Ankit]
-Loop the verification of all dsc engine reads to future proof it
[Ankit]
-Keep the fix me comment in this patch and remove it in later one
where we add other readouts [Ankit]
-Add switch statement that fills in the required registers based on
no of vdsc engines per pipe.

--v7
-Pass no of vdsc instances from read_reg function [Ankit]
-Fix issue where arrays do not get freed on return for read_and_verify
func [Ankit]

--v8
-Simplify reading and verifying of register and remove dynamically
allocated arrays [Jani]
-Remove no_ from no_vdsc_per_pipe and wherever else it applies [Ankit]

--v9
-change variable name to dsc_reg_size rather than vdsc_per_pipe [Ankit]

--v10
-remove switch case as we never enter case1 [Ankit]

--v11
-Add _ prefix for register that are not supposed to be used directly
[Jani]
-Remove REG suffix from register macros [Jani]
-Do not duplicate register read [Jani]

--v12
-Use vdsc_per_pipe rather than array size of dsc_reg [Jani]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-5-suraj.kandpal@intel.com
14 months agodrm/i915/vdsc: Add func to get no. of vdsc instances per pipe
Suraj Kandpal [Mon, 28 Aug 2023 05:42:56 +0000 (11:12 +0530)]
drm/i915/vdsc: Add func to get no. of vdsc instances per pipe

We have a function that gets us the total of the vdsc engines being
used but not the no. of vdsc instances being used by each pipe.

--v6
-Change function to static

--v7
-Shorten name to intel_dsc_get_vdsc_per_pipe

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-4-suraj.kandpal@intel.com
14 months agodrm/i915/vdsc: Add a check for dsc split cases
Suraj Kandpal [Mon, 28 Aug 2023 05:42:55 +0000 (11:12 +0530)]
drm/i915/vdsc: Add a check for dsc split cases

In intel_vdsc_get_config we only read the primary dsc engine register
and not take into account if the other dsc engine is in use and if
both registers have the same value or not this patche fixes that by
adding a check.

--v3
-Remove superfluos new line [Jani]
-Fix register naming [Jani]

--v5
-pps_temp0/pps_temp1 can be assigned where they are used [Ankit]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-3-suraj.kandpal@intel.com
14 months agodrm/i915/vdsc: Refactor dsc register field macro
Suraj Kandpal [Mon, 28 Aug 2023 05:42:54 +0000 (11:12 +0530)]
drm/i915/vdsc: Refactor dsc register field macro

This patch refactors dsc register related macros that prepares
the values to be written in the register. The current bit shifting
looks bad and going forward will not serve our purpose to readout
dsc register field values the change was suggested by Jani Nikula.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-2-suraj.kandpal@intel.com
14 months agodrm/i915: Handle dma fences in dirtyfb callback
Jouni Högander [Fri, 1 Sep 2023 09:35:00 +0000 (12:35 +0300)]
drm/i915: Handle dma fences in dirtyfb callback

Take into account dma fences in dirtyfb callback. If there is no
unsignaled dma fences perform flush immediately. If there are
unsignaled dma fences perform invalidate and add callback which will
queue flush when the fence gets signaled.

v4:
 - Move invalidate before callback is added
v3:
 - Check frontbuffer bits before adding any fence fb
 - Flush only when adding fence cb succeeds
v2: Use dma_resv_get_singleton

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901093500.3463046-5-jouni.hogander@intel.com
14 months agodrm/i915: Add new frontbuffer tracking interface to queue flush
Jouni Högander [Fri, 1 Sep 2023 09:34:59 +0000 (12:34 +0300)]
drm/i915: Add new frontbuffer tracking interface to queue flush

We want to wait dma fences in dirtyfb ioctl. As we don't want to make
dirtyfb ioctl as blocking call we need to use
dma_fence_add_callback. Callback used for dma_fence_add_callback is
called from atomic context. Due to this we need to add a new
frontbuffer tracking interface to queue flush.

v3:
 - Check schedule work success rather than work being pending
 - Init flush work when frontbuffer struct is initialized
v2: Check if flush work is already pending

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901093500.3463046-4-jouni.hogander@intel.com
14 months agodrm/i915/psr: Clear frontbuffer busy bits on flip
Jouni Högander [Fri, 1 Sep 2023 09:34:58 +0000 (12:34 +0300)]
drm/i915/psr: Clear frontbuffer busy bits on flip

We are planning to move flush performed from work queue. This
means it is possible to have invalidate -> flip -> flush sequence.
Handle this by clearing possible busy bits on flip.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901093500.3463046-3-jouni.hogander@intel.com
14 months agodrm/i915/fbc: Clear frontbuffer busy bits on flip
Jouni Högander [Fri, 1 Sep 2023 09:34:57 +0000 (12:34 +0300)]
drm/i915/fbc: Clear frontbuffer busy bits on flip

We are planning to move flush performed from work queue. This
means it is possible to have invalidate -> flip -> flush sequence.
Handle this by clearing possible busy bits on flip.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901093500.3463046-2-jouni.hogander@intel.com
14 months agomedia: cec: core: add note about *_from_edid() function usage in drm
Jani Nikula [Thu, 31 Aug 2023 10:51:44 +0000 (13:51 +0300)]
media: cec: core: add note about *_from_edid() function usage in drm

In the drm subsystem, the source physical address is, in most cases,
available without having to parse the EDID again. Add notes about
preferring to use the pre-parsed address instead.

Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-media@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://patchwork.freedesktop.org/patch/msgid/20230831105144.25923-1-jani.nikula@intel.com
14 months agodrm/i915/cec: switch to setting physical address directly
Jani Nikula [Thu, 24 Aug 2023 13:46:06 +0000 (16:46 +0300)]
drm/i915/cec: switch to setting physical address directly

Avoid parsing the EDID again for source physical address. Also gets rids
of a few remaining raw EDID usages.

Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-media@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Link: https://patchwork.freedesktop.org/patch/msgid/01a90c82c8a4f2fd945e0181ffeaca595928d19e.1692884619.git.jani.nikula@intel.com
14 months agodrm/cec: add drm_dp_cec_attach() as the non-edid version of set edid
Jani Nikula [Fri, 25 Aug 2023 13:01:20 +0000 (16:01 +0300)]
drm/cec: add drm_dp_cec_attach() as the non-edid version of set edid

Connectors have source physical address available in display
info. There's no need to parse the EDID again for this. Add
drm_dp_cec_attach() to do this.

Seems like the set_edid/unset_edid naming is a bit specific now that
there's no need to pass the EDID at all, so aim for attach/detach going
forward.

v2: Fix the embarrashing build failures

Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-media@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825130120.1250089-1-jani.nikula@intel.com
14 months agodrm/edid: parse source physical address
Jani Nikula [Thu, 24 Aug 2023 13:46:04 +0000 (16:46 +0300)]
drm/edid: parse source physical address

CEC needs the source physical address. Parsing it is trivial with the
existing EDID CEA DB infrastructure.

Default to CEC_PHYS_ADDR_INVALID (0xffff) instead of 0 to cater for
easier CEC usage.

Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-media@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/8c6b6403932536b6849e0b44e1ee6e7ebdbe4a69.1692884619.git.jani.nikula@intel.com
14 months agodrm/i915/display: use drm_edid_is_digital()
Jani Nikula [Thu, 24 Aug 2023 13:46:03 +0000 (16:46 +0300)]
drm/i915/display: use drm_edid_is_digital()

Reduce the use of struct edid and drm_edid_raw().

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/dbc0269d34f3140aff410eefae8a2711c59299b3.1692884619.git.jani.nikula@intel.com
14 months agodrm/edid: add drm_edid_is_digital()
Jani Nikula [Thu, 24 Aug 2023 13:46:02 +0000 (16:46 +0300)]
drm/edid: add drm_edid_is_digital()

Checking edid->input & DRM_EDID_INPUT_DIGITAL is common enough to
deserve a helper that also lets us abstract the raw EDID a bit better.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/4bdb407bf189fd922be022eb2f9564692377c81d.1692884619.git.jani.nikula@intel.com
14 months agodrm/i915/hdcp: Use correct aux for capability check scenario
Suraj Kandpal [Wed, 30 Aug 2023 07:34:38 +0000 (13:04 +0530)]
drm/i915/hdcp: Use correct aux for capability check scenario

Send the correct aux rather than the one derived
from intel_digital_port so that the HDCP version of both monitors
are fetched rather than just the primary one's

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230830073437.666263-3-suraj.kandpal@intel.com
14 months agodrm/i915/hdcp: Use intel_connector as argument for hdcp_2_2_capable
Suraj Kandpal [Wed, 30 Aug 2023 07:34:37 +0000 (13:04 +0530)]
drm/i915/hdcp: Use intel_connector as argument for hdcp_2_2_capable

Use intel_connector as argument instead of intel_digital_port in
hdcp_2_2_capable function and dig_port can be later derived from
connector. This will help with getting the correct hdcp version of
particular monitor in a MST setup.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230830073437.666263-2-suraj.kandpal@intel.com
14 months agodrm/i915: add minimal i915_gem_object_frontbuffer.h
Jani Nikula [Wed, 30 Aug 2023 08:51:27 +0000 (11:51 +0300)]
drm/i915: add minimal i915_gem_object_frontbuffer.h

Split out frontbuffer related declarations and static inlines from
gem/i915_gem_object.h into new gem/i915_gem_object_frontbuffer.h.

The main goal is to reduce header interdependencies. With
gem/i915_gem_object.h including display/intel_frontbuffer.h,
modification of the latter causes a whopping 300+ objects to be rebuilt,
while many of the source files actually needing it aren't explicitly
including it at all.

After the change, only 21 objects depend on display/intel_frontbuffer.h,
directly or indirectly.

Cc: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230830085127.2416842-1-jani.nikula@intel.com
14 months agodrm/i915/mtl: Add TC port lockdep assert to AUX power well enabling
Imre Deak [Wed, 30 Aug 2023 14:04:21 +0000 (17:04 +0300)]
drm/i915/mtl: Add TC port lockdep assert to AUX power well enabling

Similarly to earlier platforms, assert in the MTL AUX power well
enabling handler for TC AUX CH power wells that the TC port using the
AUX CH is locked.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230830140421.2031111-2-imre.deak@intel.com
14 months agodrm/i915/dp: Drop redundant AUX power get/put in intel_dp_force()
Imre Deak [Wed, 30 Aug 2023 14:04:20 +0000 (17:04 +0300)]
drm/i915/dp: Drop redundant AUX power get/put in intel_dp_force()

intel_dp_force() takes the AUX power reference as required by the DP AUX
transactions in intel_dp_set_edid(). However the low level AUX handler
takes this reference already so the get/put in intel_dp_force() can be
dropped. This also fixes a problem where the TC port mode changed while
the AUX power well was enabled.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8779
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230830140421.2031111-1-imre.deak@intel.com
14 months agodrm/i915/dg2: Add support for new DG2-G12 revid 0x1
Swati Sharma [Tue, 29 Aug 2023 13:59:45 +0000 (19:29 +0530)]
drm/i915/dg2: Add support for new DG2-G12 revid 0x1

The bspec has been updated with a new revision 0x1 that
translates to A1 GT stepping and C0 display stepping.

Bspec: 44477

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230829135945.1201574-1-swati2.sharma@intel.com
14 months agodrivers/drm/i915: Honor limits->max_bpp while computing DSC max input bpp
Ankit Nautiyal [Thu, 24 Aug 2023 12:51:21 +0000 (18:21 +0530)]
drivers/drm/i915: Honor limits->max_bpp while computing DSC max input bpp

Edid specific BPC constraints are stored in limits->max_bpp. Honor these
limits while computing the input bpp for DSC.

v2: Use int instead of u8 for computations. (Jani)
Add closes tag. (Ankit)

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/9161
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230824125121.840298-3-ankit.k.nautiyal@intel.com
14 months agodrm/display/dp: Assume 8 bpc support when DSC is supported
Ankit Nautiyal [Thu, 24 Aug 2023 12:51:20 +0000 (18:21 +0530)]
drm/display/dp: Assume 8 bpc support when DSC is supported

As per DP v1.4, a DP DSC Sink device shall support 8bpc in DPCD 6Ah.
Apparently some panels that do support DSC, are not setting the bit for
8bpc.

So always assume 8bpc support by DSC decoder, when DSC is claimed to be
supported.

v2: Use helper to get check dsc support. (Ankit)
v3: Fix styling and other typos. (Jani)

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230824125121.840298-2-ankit.k.nautiyal@intel.com
14 months agodrm/i915/psr: Apply Wa_14015648006 for all display 14 steppings
Jouni Högander [Tue, 29 Aug 2023 09:44:35 +0000 (12:44 +0300)]
drm/i915/psr: Apply Wa_14015648006 for all display 14 steppings

According to recent Bspec Wa 14015648006 has to be applied for all display
14 steppings.

Bspec: 66624

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230829094435.2100669-1-jouni.hogander@intel.com
14 months agodrm/i915/sdvo: Print out the i2c pin and slave address
Ville Syrjälä [Fri, 25 Aug 2023 13:44:31 +0000 (16:44 +0300)]
drm/i915/sdvo: Print out the i2c pin and slave address

To reduce the guesswork a bit let's print out the SDVO
device i2c bus and slave address during init.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825134431.24391-7-ville.syrjala@linux.intel.com
14 months agodrm/i915/sdvo: Rework DDC bus handling
Ville Syrjälä [Fri, 25 Aug 2023 13:44:30 +0000 (16:44 +0300)]
drm/i915/sdvo: Rework DDC bus handling

Each SDVO device can have up to three sets of DDC pins.
Currently we just register a single i2c_adapter for the
entire SDVO device and semi-randomly pick the "correct"
set of DDC pins during intel_sdvo_tmds_sink_detect().
This doesn't make any real sense especially if we have
multiple outputs each with their own dedicated DDC bus.

Let's clean up this mess and register a dedicated
i2c_adapter for each of the possible pin pairs. Each
output (ie. connector) can then pick the correct i2c_adapter
to use for its DDC bus. And we can just switch over to
drm_connector_init_with_ddc() to take care of the
connector->ddc association, which also populates the
"ddc" sysfs symlink as a bonus.

And now that things are based on the actual connector we can
also nuke the sketchy sdvo->controller_output thing.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825134431.24391-6-ville.syrjala@linux.intel.com
14 months agodrm/i915/sdvo: Get rid of the per-connector i2c symlink
Ville Syrjälä [Fri, 25 Aug 2023 13:44:29 +0000 (16:44 +0300)]
drm/i915/sdvo: Get rid of the per-connector i2c symlink

We should switch over to the standard "ddc" per-connector
symlink instead of rolling our own thing. The i2c specific
symlink is also in the way of reworking the SDVO DDC handling
(which is a mess atm) so get rid of it.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825134431.24391-5-ville.syrjala@linux.intel.com
14 months agodrm/i915/sdvo: Nuke the duplicate sdvo->port
Ville Syrjälä [Fri, 25 Aug 2023 13:44:28 +0000 (16:44 +0300)]
drm/i915/sdvo: Nuke the duplicate sdvo->port

We already have encoder->port so get rid of the duplicate
sdvo->port.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825134431.24391-4-ville.syrjala@linux.intel.com
14 months agodrm/i915/sdvo: Initialize the encoder earlier
Ville Syrjälä [Fri, 25 Aug 2023 13:44:27 +0000 (16:44 +0300)]
drm/i915/sdvo: Initialize the encoder earlier

Call drm_encoder_init() earlier so that we don't have to keep passing
the i915/dev_priv around separately.

v2: Reorder drm_encoder_cleanup() in the error path (Jani)

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825134431.24391-3-ville.syrjala@linux.intel.com
14 months agodrm/i915/sdvo: Nuke attached_output tracking
Ville Syrjälä [Fri, 25 Aug 2023 13:44:26 +0000 (16:44 +0300)]
drm/i915/sdvo: Nuke attached_output tracking

Instead of operating on the output the user specified (via the
connector) the current code tends to operate on whichever outputs
it has detected as attached. That is not how the kms uapi is supposed
to work. So simply get rid of attached_outputs and instead directly
operate on the output the user has specified.

Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825134431.24391-2-ville.syrjala@linux.intel.com
14 months agodrm/i915/hdcp: Adjust timeout for read in DPMST Scenario
Suraj Kandpal [Mon, 28 Aug 2023 06:34:01 +0000 (12:04 +0530)]
drm/i915/hdcp: Adjust timeout for read in DPMST Scenario

For dpmst hdcp scenario increase the message timeout based
on the number of ports connected as each port needs to be
validated and each will take the prescribed amount of time
for the respective msg_id and total timeout will be
original_timeout * num_ports.

--v2
-Add justification for Adjusting the timeout [Arun]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828063401.600414-5-suraj.kandpal@intel.com
14 months agodrm/i915/hdcp: Send the correct aux for DPMST HDCP scenario
Suraj Kandpal [Mon, 28 Aug 2023 06:34:00 +0000 (12:04 +0530)]
drm/i915/hdcp: Send the correct aux for DPMST HDCP scenario

Up until now we were sending the base aux stored in dig_port which
is not correct as this causes an issue when monitor is connected via
a DPMST hub causing it to be remote hence we end up seeing AUX
failures so let's send the remote aux in case of DPMST.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Arun R Murthy <arun.r.mruthy@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828063401.600414-4-suraj.kandpal@intel.com
14 months agodrm/i915/hdcp: Propagate aux info in DP HDCP functions
Suraj Kandpal [Mon, 28 Aug 2023 06:38:51 +0000 (12:08 +0530)]
drm/i915/hdcp: Propagate aux info in DP HDCP functions

We were propagating dig_port info to dp hdcp2 specific functions.
Let us clean that up and send intel_connector in the following
functions: intel_dp_hdcp2_wait_for_msg, get_receiver_id_list_rx_info,
intel_dp_hdcp2_read_rx_status.
This optimises mst scenarios where aux ends up being remote and not
stored in dig_port and dig_port can always be derived from
intel_connector if needed.

--v2
-Fix Typo [Arun]
-Dont pass drm_dp core structures [Arun]
-Fix commit message styling [Arun]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828063850.604048-1-suraj.kandpal@intel.com
14 months agodrm/i915/hdcp: Use intel_connector argument in intel_hdcp_shim
Suraj Kandpal [Mon, 28 Aug 2023 06:33:58 +0000 (12:03 +0530)]
drm/i915/hdcp: Use intel_connector argument in intel_hdcp_shim

Update intel_hdcp_shim funcs specifically read_2_2_message,
write_2_2_message and config_stream_type to use intel_connector
argument instead of intel_digital_port as this will help in getting
correct aux later for dp mst scenarios also already hdcp funcs
derive digital_port from connector and then many funcs again get back
the connector from dig_port which doesn't seem right.
Connector specific hdcp functions can derive dig_port on need basis.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828063401.600414-2-suraj.kandpal@intel.com
15 months agodrm/i915/color: move pre-SKL gamma and CSC enable read to intel_color
Jani Nikula [Thu, 17 Aug 2023 15:53:08 +0000 (18:53 +0300)]
drm/i915/color: move pre-SKL gamma and CSC enable read to intel_color

Abstract the register access better. The DSPCNTR read could be moved to
either i9xx_plane.c or intel_color.c. The latter feels better, even if
the register is written in the former.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/33830dba5d69027469d976f6909740ccff8c7281.1692287501.git.jani.nikula@intel.com
15 months agodrm/i915/color: move SKL+ gamma and CSC enable read to intel_color
Jani Nikula [Thu, 17 Aug 2023 15:53:07 +0000 (18:53 +0300)]
drm/i915/color: move SKL+ gamma and CSC enable read to intel_color

Abstract the platform specific register access better.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c0c37c06d1f2673c82d567c8bcbb6b0b0054b5fa.1692287501.git.jani.nikula@intel.com
15 months agodrm/i915: move ILK+ CSC mode read to intel_color
Jani Nikula [Thu, 17 Aug 2023 15:53:06 +0000 (18:53 +0300)]
drm/i915: move ILK+ CSC mode read to intel_color

Abstract the platform specific register access better.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8f34c577c663839020405e96cdb464319c2881d4.1692287501.git.jani.nikula@intel.com
15 months agodrm/i915: move HSW+ gamma mode read to intel_color
Jani Nikula [Thu, 17 Aug 2023 15:53:05 +0000 (18:53 +0300)]
drm/i915: move HSW+ gamma mode read to intel_color

Abstract the platform specific register access better. The separate
hsw_read_gamma_mode() will make more sense with the following changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b7ddcc8b0fb783eb149864070821bdb695c40366.1692287501.git.jani.nikula@intel.com
15 months agodrm/i915/color: move CHV CGM pipe mode read to intel_color
Jani Nikula [Thu, 17 Aug 2023 15:53:04 +0000 (18:53 +0300)]
drm/i915/color: move CHV CGM pipe mode read to intel_color

Add color .get_config hook to read config other than LUTs and CSCs, and
start off with CHV CGM pipe mode to abstract the platform specific
register access better.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1444200931ae61b6360e3dcad8cbea206ad62e2f.1692287501.git.jani.nikula@intel.com
15 months agodrm/i915/regs: split out intel_color_regs.h
Jani Nikula [Thu, 17 Aug 2023 15:53:03 +0000 (18:53 +0300)]
drm/i915/regs: split out intel_color_regs.h

Declutter i915_regs.h.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8e76007a361bd3ca8dd8913281854886b3a1954c.1692287501.git.jani.nikula@intel.com
15 months agodrm/i915/display: configure SDP split for DP-MST
Vinod Govindapillai [Tue, 22 Aug 2023 20:48:18 +0000 (23:48 +0300)]
drm/i915/display: configure SDP split for DP-MST

Extend the SDP split audio config for DP-MST

Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230822204818.109742-3-vinod.govindapillai@intel.com
15 months agodrm/i915/display: update intel_dp_has_audio to support MST
Vinod Govindapillai [Tue, 22 Aug 2023 20:48:17 +0000 (23:48 +0300)]
drm/i915/display: update intel_dp_has_audio to support MST

Modify intel_dp_has_audio to handle DP-MST as well.

v1: fix the wrong port comparison (Jani Nikula)

Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230822204818.109742-2-vinod.govindapillai@intel.com
15 months agodrm/i915/vma: constify unbind_fence_ops
Jani Nikula [Fri, 18 Aug 2023 11:27:58 +0000 (14:27 +0300)]
drm/i915/vma: constify unbind_fence_ops

unbind_fence_ops can be const and placed in rodata.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230818112758.3586545-1-jani.nikula@intel.com
15 months agodrm/i915/rpl: Update pci ids for RPL P/U
Dnyaneshwar Bhadane [Thu, 24 Aug 2023 06:28:40 +0000 (11:58 +0530)]
drm/i915/rpl: Update pci ids for RPL P/U

Update pci device ids as per bspec for
RPL P/U.

v2:
- Append new id's instead of replacing the existing in device
id list define

v3:
- Fixed the commit messege with revision details.

Bpsec: 55376
Signed-off-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230824062840.2372872-1-dnyaneshwar.bhadane@intel.com
15 months agodrm/i915/sdvo: Fail gracefully if the TV dotclock is out of range
Ville Syrjälä [Wed, 5 Jul 2023 20:21:16 +0000 (23:21 +0300)]
drm/i915/sdvo: Fail gracefully if the TV dotclock is out of range

Instead of warning and continuing with bogus state when the
requested dotclock isn't acceptable just print some debug
spew and fail gracefully.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230705202122.17915-8-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
15 months agodrm/i915/sdvo: Pick the TV dotclock from adjusted_mode
Ville Syrjälä [Wed, 5 Jul 2023 20:21:15 +0000 (23:21 +0300)]
drm/i915/sdvo: Pick the TV dotclock from adjusted_mode

port_clock is what the encoder/dpll code is supposed to calculate,
it is not the input clock. Use the dotclock as the target we're
trying to achieve instead.

TODO: the SDVO TV clocking is a mess atm and needs further work

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230705202122.17915-7-ville.syrjala@linux.intel.com
Acked-by: Jani Nikula <jani.nikula@intel.com>
15 months agodrm/i915: Fully populate crtc_state->dpll
Ville Syrjälä [Wed, 5 Jul 2023 20:21:14 +0000 (23:21 +0300)]
drm/i915: Fully populate crtc_state->dpll

Call *_calc_dpll_params() even in cases where the encoder has
computed the DPLL params for us.

The SDVO TV output code doesn't populate crtc_state->dpll.dot
leading to the dotclock getting calculated as zero, and that
leads to all kinds of real problems. The g4x DP code also
doesn't populate the derived dividers nor .vco, which could
also create some confusion.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230705202122.17915-6-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
15 months agodrm/i915: Don't warn about zero N/P in *_calc_dpll_params()
Ville Syrjälä [Wed, 5 Jul 2023 20:21:13 +0000 (23:21 +0300)]
drm/i915: Don't warn about zero N/P in *_calc_dpll_params()

Allow *_calc_dpll_params() to be called even if the N/P dividers
are zero without warning. We'll want to call these to make sure the
derived values are fully computed, but not all users (VLV DSI in
particular) even enable the DPLL and thus the dividers will
be left at zero.

It could also be possible that the BIOS has misprogrammed the DPLL
(IIRC happened with some SNB machines with 4k+ displays) and thus
we'll currently generate a lot of dmesg spew. Better be silent and
just let the normal state checker/etc. deal with any driver bugs.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230705202122.17915-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
15 months agodrm/i915/sdvo: s/sdvo_inputs_mask/sdvo_num_inputs/
Ville Syrjälä [Wed, 5 Jul 2023 20:21:12 +0000 (23:21 +0300)]
drm/i915/sdvo: s/sdvo_inputs_mask/sdvo_num_inputs/

The SDVO inputs are reported a simple number, not a bitmask.
Adjust the code to match reality.

Note that we don't actually support dual input SDVO devices,
and we just always use the first input.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230705202122.17915-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
15 months agodrm/i915/sdvo: Protect macro args
Ville Syrjälä [Wed, 5 Jul 2023 20:21:11 +0000 (23:21 +0300)]
drm/i915/sdvo: Protect macro args

Put parens around macro argument evaluation for safety.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230705202122.17915-3-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
15 months agodrm/i915/sdvo: Issue SetTargetOutput prior to GetAttachedDisplays
Ville Syrjälä [Wed, 5 Jul 2023 20:21:10 +0000 (23:21 +0300)]
drm/i915/sdvo: Issue SetTargetOutput prior to GetAttachedDisplays

I have at least one SDVO device (some Lenovo DVI-I ADD2 card,
based on Conexant CX25904) where GetAttachedDisplays returns
success but fails to report any attached displays unless we
precede the command with a SetTargetOutput. Make it so.

I wasn't able to spot anything in the SDVO spec stating that
this should be necessary, but real world wins over spec.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230705202122.17915-2-ville.syrjala@linux.intel.com
Acked-by: Jani Nikula <jani.nikula@intel.com>
15 months agodrm/i915/display: add lock while printing frontbuffer tracking bits to debugfs
Juha-Pekka Heikkila [Mon, 14 Aug 2023 16:34:45 +0000 (19:34 +0300)]
drm/i915/display: add lock while printing frontbuffer tracking bits to debugfs

Add missing spin_lock/unlock

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814163452.2925-1-juhapekka.heikkila@gmail.com
15 months agodrm/i915: Fix HPD polling, reenabling the output poll work as needed
Imre Deak [Tue, 22 Aug 2023 11:30:15 +0000 (14:30 +0300)]
drm/i915: Fix HPD polling, reenabling the output poll work as needed

After the commit in the Fixes: line below, HPD polling stopped working
on i915, since after that change calling drm_kms_helper_poll_enable()
doesn't restart drm_mode_config::output_poll_work if the work was
stopped (no connectors needing polling) and enabling polling for a
connector (during runtime suspend or detecting an HPD IRQ storm).

After the above change calling drm_kms_helper_poll_enable() is a nop
after it's been called already and polling for some connectors was
disabled/re-enabled.

Fix this by calling drm_kms_helper_poll_reschedule() added in the
previous patch instead, which reschedules the work whenever expected.

Fixes: d33a54e3991d ("drm/probe_helper: sort out poll_running vs poll_enabled")
CC: stable@vger.kernel.org # 6.4+
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230822113015.41224-2-imre.deak@intel.com
15 months agodrm: Add an HPD poll helper to reschedule the poll work
Imre Deak [Tue, 22 Aug 2023 11:30:14 +0000 (14:30 +0300)]
drm: Add an HPD poll helper to reschedule the poll work

Add a helper to reschedule drm_mode_config::output_poll_work after
polling has been enabled for a connector (and needing a reschedule,
since previously polling was disabled for all connectors and hence
output_poll_work was not running).

This is needed by the next patch fixing HPD polling on i915.

CC: stable@vger.kernel.org # 6.4+
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230822113015.41224-1-imre.deak@intel.com
15 months agodrm/i915/display: combine DP audio compute config steps
Vinod Govindapillai [Fri, 18 Aug 2023 11:19:48 +0000 (14:19 +0300)]
drm/i915/display: combine DP audio compute config steps

Combine all DP audio configs into a single function

Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230818111950.128992-3-vinod.govindapillai@intel.com
15 months agodrm/i915/display: remove redundant parameter from sdp split update
Vinod Govindapillai [Fri, 18 Aug 2023 11:19:47 +0000 (14:19 +0300)]
drm/i915/display: remove redundant parameter from sdp split update

The needed functionality can be performed using crtc_state here.

Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230818111950.128992-2-vinod.govindapillai@intel.com
15 months agodrm/i915/display: Eliminate IS_METEORLAKE checks
Matt Roper [Mon, 21 Aug 2023 18:06:28 +0000 (11:06 -0700)]
drm/i915/display: Eliminate IS_METEORLAKE checks

Most of the IS_METEORLAKE checks in the display code shouldn't actually
be tied to MTL as a platform, but rather to the Xe_LPD+ display IP
(which is used in MTL, but may show up again in future platforms).  In
cases where we're trying to match that specific IP, use a version check
against IP_VER(14, 0).  For cases where we're just handling new behavior
introduced by this IP (but which may also be inherited by future IP as
well), use a ver >= 14 check.

The one exception here is the stolen memory workaround Wa_13010847436
(which is mislabelled as "Wa_22018444074" in the code).  That's truly a
MTL-specific issue rather than being tied to any of the IP blocks, so
leaving the condition as IS_METEORLAKE is correct there.

v2:
 - cdclk check should be >=, not >.  (Gustavo)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-19-matthew.d.roper@intel.com
15 months agodrm/i915: Eliminate IS_MTL_DISPLAY_STEP
Matt Roper [Mon, 21 Aug 2023 18:06:26 +0000 (11:06 -0700)]
drm/i915: Eliminate IS_MTL_DISPLAY_STEP

Stepping-specific display behavior shouldn't be tied to MTL as a
platform, but rather specifically to the Xe_LPD+ IP.  Future non-MTL
platforms may re-use this IP and will need to follow the exact same
logic and apply the same workarounds.  IS_MTL_DISPLAY_STEP() is dropped
in favor of a new macro IS_DISPLAY_IP_STEP() that only checks the
display IP version.

v2:
 - Rename macro to IS_DISPLAY_IP_STEP for consistency with the
   corresponding GT macro and handle steppings the same way.
v3:
 - Drop the automatic "STEP_" pasting.
v4:
 - Implement IS_DISPLAY_IP_STEP on top of IS_DISPLAY_IP_RANGE /
   IS_DISPLAY_STEP building blocks and make the parameters from/until
   instead of begin/fixed.  (Jani)
 - Fix usage details in comment.
v5:
 - Tweak macro comment.  (Gustavo)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-17-matthew.d.roper@intel.com
15 months agodrm/i915/display: Remove unused POWER_DOMAIN_MODESET
Gustavo Sousa [Thu, 17 Aug 2023 17:53:12 +0000 (14:53 -0300)]
drm/i915/display: Remove unused POWER_DOMAIN_MODESET

That power domain became unused after commit 41b4c7fe72b6 ("drm/i915:
Disable DC states for all commits").

Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817175312.295559-1-gustavo.sousa@intel.com
15 months agodrm/i915/dp: Check if force_dsc_output_format is possible
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:59 +0000 (19:54 +0530)]
drm/i915/dp: Check if force_dsc_output_format is possible

Currently for testing an output format with DSC, we just force the
output format, without checking if it can be supported.
This also creates an issue where there is a PCON which might need to
convert from forced output format to the format to sink format.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-19-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Check src/sink compressed bpp limit for edp
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:58 +0000 (19:54 +0530)]
drm/i915/dp: Check src/sink compressed bpp limit for edp

Use checks for src and sink limits before computing compressed bpp for
eDP.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-18-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Get optimal link config to have best compressed bpp
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:57 +0000 (19:54 +0530)]
drm/i915/dp: Get optimal link config to have best compressed bpp

Currently, we take the max lane, rate and pipe bpp, to get the maximum
compressed bpp possible. We then set the output bpp to this value.
This patch provides support to have max bpp, min rate and min lanes,
that can support the min compressed bpp.

v2:
-Avoid ending up with compressed bpp, same as pipe bpp. (Stan)
-Fix the checks for limits->max/min_bpp while iterating over list of
 valid DSC bpcs. (Stan)

v3:
-Refactor the code to have pipe bpp/compressed bpp computation and slice
count calculation separately for different cases.

v4:
-Separate the pipe_bpp calculation for eDP and DP.

v5:
-Get rid of magic numbers for max and min bpp,
and improve documentation. (Stan).
-Use functions for {src_sink}_{min_max}_compressed_bpp (Ville).

v6:
-Remove lines to set link config to max.

v7:
-Split the part to separate edp and dp functions for computing DSC BPP
into separate patch.

v8:
-Separate mechanism to get compressed bpp for ICL,TGL and XELPD+.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-17-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Separate out function to get compressed bpp with joiner
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:56 +0000 (19:54 +0530)]
drm/i915/dp: Separate out function to get compressed bpp with joiner

Pull the code to get joiner constraints on maximum compressed bpp into
separate function.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-16-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Add DSC BPC/BPP constraints while selecting pipe bpp with DSC
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:55 +0000 (19:54 +0530)]
drm/i915/dp: Add DSC BPC/BPP constraints while selecting pipe bpp with DSC

Currently we check if the pipe_bpp selected is >= the
min DSC bpc/bpp requirement. We do not check if it is <= the max DSC
bpc/bpp requirement.

Add checks for max DSC BPC/BPP constraints while computing the
pipe_bpp when DSC is in use.

v2: Fix the commit message.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-15-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Separate out functions for edp/DP for computing DSC bpp
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:54 +0000 (19:54 +0530)]
drm/i915/dp: Separate out functions for edp/DP for computing DSC bpp

Refactor code to separate functions for eDP and DP for computing
pipe_bpp/compressed bpp when DSC is involved.

This will help to optimize the link configuration for DP later.

v2: Fix checkpatch warning.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-14-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Rename helper to get DSC max pipe_bpp
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:53 +0000 (19:54 +0530)]
drm/i915/dp: Rename helper to get DSC max pipe_bpp

The helper intel_dp_dsc_compute_bpp gives the maximum
pipe bpp that is allowed with DSC.

Rename the this to reflect that it returns max pipe bpp supported
with DSC.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-13-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Avoid left shift of DSC output bpp by 4
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:52 +0000 (19:54 +0530)]
drm/i915/dp: Avoid left shift of DSC output bpp by 4

To make way for fractional bpp support, avoid left shifting the
output_bpp by 4 in helper intel_dp_dsc_get_output_bpp.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-12-ankit.k.nautiyal@intel.com
15 months agodrm/i915/dp: Check min bpc DSC limits for dsc_force_bpc also
Ankit Nautiyal [Thu, 17 Aug 2023 14:24:51 +0000 (19:54 +0530)]
drm/i915/dp: Check min bpc DSC limits for dsc_force_bpc also

For DSC the min BPC is 8 for ICL+ and so the min pipe_bpp is 24.
Check this condition for cases where bpc is forced by debugfs flag
dsc_force_bpc. If the check fails, then WARN and ignore the debugfs
flag.

For MST case the pipe_bpp is already computed (hardcoded to be 24),
and this check is not required.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230817142459.89764-11-ankit.k.nautiyal@intel.com