Skip to contentSkip to conversation

i915/dp/fec: Cache the FEC_CAPABLE DPCD register

PATCH New Anusha Srivatsa 2 participants 3 messages Nov 2, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 i915/dp/fec: Cache the FEC_CAPABLE DPCD register

Similar to DSC DPCD registers, let us cache
FEC_CAPABLE register to avoid using stale
values. With this we can avoid aux reads
everytime and instead read the cached values.

v2: Avoid using memset and array for a single
field. (Manasi,Jani)

v3: Print FEC CAPABILITY value. (Manasi)

---
 drivers/gpu/drm/i915/intel_dp.c  | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 2 files changed, 14 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +13 -0
index 9a2db61c1ba7..e8bafbc44c34 100644
@@ -4012,6 +4012,9 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
 	 */
 	memset(intel_dp->dsc_dpcd, 0, sizeof(intel_dp->dsc_dpcd));
 
+	/* Clear fec_capable to avoid using stale values */
+	intel_dp->fec_capable = 0;
+
 	/* Cache the DSC DPCD if eDP or DP rev >= 1.4 */
 	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x14 ||
 	    intel_dp->edp_dpcd[0] >= DP_EDP_14) {
@@ -4024,6 +4027,16 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
 		DRM_DEBUG_KMS("DSC DPCD: %*ph\n",
 			      (int)sizeof(intel_dp->dsc_dpcd),
 			      intel_dp->dsc_dpcd);
+		/* FEC is supported only on DP 1.4 */
+		if (!intel_dp_is_edp(intel_dp)) {
+			if (drm_dp_dpcd_readb(&intel_dp->aux, DP_FEC_CAPABILITY,
+					      &intel_dp->fec_capable) < 0)
+				DRM_ERROR("Failed to read FEC DPCD register\n");
+
+		DRM_DEBUG_KMS("FEC CAPABILITY: %*ph\n",
+			      (int)sizeof(intel_dp->fec_capable),
+			      intel_dp->fec_capable);
+		}
 	}
 }
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 2d9882138b0b..dff43910110f 100644
@@ -1115,6 +1115,7 @@ struct intel_dp {
 	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
 	uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
 	u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
+	u8 fec_capable;
 	/* source rates */
 	int num_source_rates;
 	const int *source_rates;
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 drm/dp/fec: DRM helper for Forward Error Correction

DP 1.4 has Forward Error Correction Support(FEC).
Add helper function to check if the sink device
supports FEC.

v2: Separate the helper and the code that uses the helper into two separate patches. (Manasi)

v3:
- Move the code to drm_dp_helper.c (Manasi)
- change the return type, code style changes (Gaurav)
- Use drm_dp_dpcd_readb instead of drm_dp_dpcd_read. (Jani)

v4:
- Avoid aux reads everytime, instead read cached
values of dpcd register (jani)
- Move helper to drm_dp_helper.h like other dsc
helpers.(Anusha)

v5: rebased. Change the helper parameter suitably.

---
 include/drm/drm_dp_helper.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/drm/drm_dp_helper.h +7 -0
index 0fba8d2198a4..3314e91f6eb3 100644
@@ -1149,6 +1149,13 @@ drm_dp_dsc_sink_max_slice_width(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
 		DP_DSC_SLICE_WIDTH_MULTIPLIER;
 }
 
+/* Forward Error Correction Support on DP 1.4 */
+static inline bool
+drm_dp_sink_supports_fec(const u8 fec_capable)
+{
+	return fec_capable & DP_FEC_CAPABLE;
+}
+
 /*
  * DisplayPort AUX channel
  */
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✗ Fi.CI.BAT: failure for series starting with [CI,1/2] i915/dp/fec: Cache the FEC_CAPABLE DPCD register

In reply to Anusha Srivatsa
== Series Details ==

== Series Details ==

Series: series starting with [CI,1/2] i915/dp/fec: Cache the FEC_CAPABLE DPCD register
URL : https://patchwork.freedesktop.org/series/51906/
State : failure

== Summary ==

CALL scripts/checksyscalls.sh
DESCEND objtool
CHK include/generated/compile.h
CC [M] drivers/gpu/drm/i915/intel_dp.o
In file included from ./include/drm/drm_mm.h:49:0,

                 from ./include/drm/drmP.h:73,
                 from drivers/gpu/drm/i915/intel_dp.c:35:
drivers/gpu/drm/i915/intel_dp.c: In function ‘intel_dp_get_dsc_sink_cap’:
drivers/gpu/drm/i915/intel_dp.c:3978:17: error: format ‘%p’ expects argument of type ‘void *’, but argument 4 has type ‘int’ [-Werror=format=]
   DRM_DEBUG_KMS("FEC CAPABILITY: %*ph\n",
                 ^
drivers/gpu/drm/i915/intel_dp.c:3980:10:
          intel_dp->fec_capable);
          ~~~~~~~~~~~
./include/drm/drm_print.h:362:22: note: in definition of macro ‘DRM_DEBUG_KMS’
  drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
                      ^~~

cc1: all warnings being treated as errors
scripts/Makefile.build:305: recipe for target 'drivers/gpu/drm/i915/intel_dp.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_dp.o] Error 1 scripts/Makefile.build:546: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:546: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:546: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:1052: recipe for target 'drivers' failed
make: *** [drivers] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx