Add support for writeback transcoder offsets for DG2 class devices.

If the transcoder offsets are missing for a given device but writeback
is enabled anyway, the failure mode is non-obvious. Rather than giving
any kind of error, the setup completes successfully but then timeouts
are seen when trying to use the writeback output followed by
inconsistent state errors. E.g.:
[May12 09:20] xe 0000:00:02.0: [drm] *ERROR* [CRTC:151:pipe A] flip_done timed 
out
[  +0.000003] xe 0000:00:02.0: [drm] attached crtc is active, but connector 
isn't
[  +0.000003] WARNING: drivers/gpu/drm/i915/display/intel_modeset_verify.c:59 
at verify_connector_state+0x208/0x3b0 [xe], CPU#5: kms_writeback/1203

To make the issue clearer, update the transcoder configuration to fail
if the necessary offsets are not configured. That forces the atomic
mode set to fail and writeback just can't be used. Hence no kernel
ERRORs, WARNINGs or timeouts.

Signed-off-by: John Harrison <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_writeback.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_writeback.c 
b/drivers/gpu/drm/i915/display/intel_writeback.c
index 2fd49405c0b6..064c6ff5bc73 100644
--- a/drivers/gpu/drm/i915/display/intel_writeback.c
+++ b/drivers/gpu/drm/i915/display/intel_writeback.c
@@ -465,9 +465,10 @@ intel_writeback_compute_config(struct intel_encoder 
*encoder,
        if (!conn_state->writeback_job)
                return 0;
 
-       if (HAS_TRANSCODER(display, TRANSCODER_WD_0))
-               pipe_config->cpu_transcoder = TRANSCODER_WD_0;
+       if (!HAS_TRANSCODER(display, TRANSCODER_WD_0))
+               return -ENODEV;
 
+       pipe_config->cpu_transcoder = TRANSCODER_WD_0;
        pipe_config->output_types |= BIT(INTEL_OUTPUT_WRITEBACK);
        pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 
-- 
2.43.0

Reply via email to