Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: lucas.demarchi@intel.com, intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH 01/10] fixup! drm/xe/display: Implement display support
Date: Wed, 04 Oct 2023 17:23:14 +0300	[thread overview]
Message-ID: <87ttr6eab1.fsf@intel.com> (raw)
In-Reply-To: <ZR1wY+2IKMC6r75M@intel.com>

On Wed, 04 Oct 2023, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Tue, Oct 03, 2023 at 05:34:48PM +0300, Jani Nikula wrote:
>> We have an abstraction for "has display", and it's
>> HAS_DISPLAY(). Unfortunately, it requires access to
>> DISPLAY_RUNTIME_INFO(), so include compat-i915-headers/i915_drv.h too,
>> although it's a bit meh.
>> 
>> Looking at this makes me think there's a bunch of confusion in:
>> 
>> - the pipe_mask or now HAS_DISPLAY() checks
>> - the global enable_display checks
>> - the xe->info.enable_display checks
>> - redefinition of INTEL_DISPLAY_ENABLED()
>> 
>> I really don't understand this, but it all looks very suspicious. This
>> change leaves all that in place, unmodified.
>> 
>> v2: define local has_display() to make this a bit cleaner
>> 
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/xe/xe_display.c | 16 +++++++++++-----
>>  1 file changed, 11 insertions(+), 5 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/xe/xe_display.c b/drivers/gpu/drm/xe/xe_display.c
>> index 07898e0e175e..68729997e1fe 100644
>> --- a/drivers/gpu/drm/xe/xe_display.c
>> +++ b/drivers/gpu/drm/xe/xe_display.c
>> @@ -15,6 +15,7 @@
>>  #include <drm/xe_drm.h>
>>  
>>  #include "soc/intel_dram.h"
>> +#include "i915_drv.h"		/* FIXME: HAS_DISPLAY() depends on this */
>
> should we then add a FIXME tag to the commit subject as well?
> just to ensure we don't miss this here?
>
>>  #include "intel_acpi.h"
>>  #include "intel_audio.h"
>>  #include "intel_bw.h"
>> @@ -32,6 +33,11 @@
>>  
>>  /* Xe device functions */
>>  
>> +static bool has_display(struct xe_device *xe)
>> +{
>> +	return HAS_DISPLAY(xe);
>> +}
>> +
>>  /**
>>   * xe_display_driver_probe_defer - Detect if we need to wait for other drivers
>>   *				   early on
>> @@ -316,7 +322,7 @@ static void intel_suspend_encoders(struct xe_device *xe)
>>  	struct drm_device *dev = &xe->drm;
>>  	struct intel_encoder *encoder;
>>  
>> -	if (xe->info.display_runtime.pipe_mask)
>> +	if (has_display(xe))
>>  		return;
>>  
>>  	drm_modeset_lock_all(dev);
>> @@ -346,7 +352,7 @@ void xe_display_pm_suspend(struct xe_device *xe)
>>  	 * properly.
>>  	 */
>>  	intel_power_domains_disable(xe);
>> -	if (xe->info.display_runtime.pipe_mask)
>> +	if (has_display(xe))
>>  		drm_kms_helper_poll_disable(&xe->drm);
>>  
>>  	intel_display_driver_suspend(xe);
>> @@ -392,7 +398,7 @@ void xe_display_pm_resume(struct xe_device *xe)
>>  
>>  	intel_dmc_resume(xe);
>>  
>> -	if (xe->info.display_runtime.pipe_mask)
>> +	if (has_display(xe))
>>  		drm_mode_config_reset(&xe->drm);
>>  
>>  	intel_display_driver_init_hw(xe);
>> @@ -403,7 +409,7 @@ void xe_display_pm_resume(struct xe_device *xe)
>>  	intel_display_driver_resume(xe);
>>  
>>  	intel_hpd_poll_disable(xe);
>> -	if (xe->info.display_runtime.pipe_mask)
>> +	if (has_display(xe))
>>  		drm_kms_helper_poll_enable(&xe->drm);
>>  
>>  	intel_opregion_resume(xe);
>> @@ -424,7 +430,7 @@ void xe_display_probe(struct xe_device *xe)
>>  
>>  	intel_display_device_probe(xe);
>>  
>> -	if (xe->info.display_runtime.pipe_mask)
>> +	if (has_display(xe))
>
> my first reaction to this probe function when I bump into it during
> rebase is that it should be simply refactor to something like
>
>
> xe_display_probe()
> {
> 	if(!xe->info.enable_display)
> 		return;
>
> 	intel_display_device_probe(xe);
> }
>
> but then I put the pipe_mask check and the goto back to avoid
> disruption, but without clearly understanding on why we have
> that to start with.
>
> My thoughts was on maybe it was a redundant check to see if
> display init setup went well, but now I see it was more about
> has_display...
>
> But now I wonder if we cannot simply use the HAS_DISPLAY()
> directly in the first line of this function and avoid everything
> else?

The display probe may end up detecting there's no display
i.e. HAS_DISPLAY() may change depending on probe. And if there's no
display, you need to drop DRIVER_MODESET and DRIVER_ATOMIC from
driver_features.

Or are you suggesting to use HAS_DISPLAY() directly instead of the
has_display() wrapper I cooked up?


BR,
Jani.



>
>>  		return;
>>  
>>  no_display:
>> -- 
>> 2.39.2
>> 

-- 
Jani Nikula, Intel

  reply	other threads:[~2023-10-04 14:23 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 14:34 [Intel-xe] [PATCH 00/10] xe/display: clarify display configuration Jani Nikula
2023-10-03 14:34 ` [Intel-xe] [PATCH 01/10] fixup! drm/xe/display: Implement display support Jani Nikula
2023-10-04 14:02   ` Rodrigo Vivi
2023-10-04 14:23     ` Jani Nikula [this message]
2023-10-04 14:41       ` Rodrigo Vivi
2023-10-04 14:25     ` Jani Nikula
2023-10-03 14:34 ` [Intel-xe] [PATCH 02/10] " Jani Nikula
2023-10-04 14:04   ` Rodrigo Vivi
2023-10-03 14:34 ` [Intel-xe] [PATCH 03/10] " Jani Nikula
2023-10-04 14:04   ` Rodrigo Vivi
2023-10-03 14:34 ` [Intel-xe] [PATCH 04/10] fixup! drm/xe: Introduce Xe assert macros Jani Nikula
2023-10-04 14:05   ` Rodrigo Vivi
2023-10-03 14:34 ` [Intel-xe] [PATCH 05/10] fixup! drm/xe/display: Implement display support Jani Nikula
2023-10-04 14:05   ` Rodrigo Vivi
2023-10-03 14:34 ` [Intel-xe] [PATCH 06/10] " Jani Nikula
2023-10-04 14:05   ` Rodrigo Vivi
2023-10-04 16:19   ` Lucas De Marchi
2023-10-04 16:31     ` Jani Nikula
2023-10-03 14:34 ` [Intel-xe] [PATCH 07/10] " Jani Nikula
2023-10-04 14:06   ` Rodrigo Vivi
2023-10-03 14:34 ` [Intel-xe] [PATCH 08/10] " Jani Nikula
2023-10-04 14:23   ` Rodrigo Vivi
2023-10-04 14:37     ` Jani Nikula
2023-10-04 16:14       ` Rodrigo Vivi
2023-10-04 16:41   ` Lucas De Marchi
2023-10-04 17:11     ` Jani Nikula
2023-10-04 18:03       ` Lucas De Marchi
2023-10-03 14:34 ` [Intel-xe] [PATCH 09/10] " Jani Nikula
2023-10-04 14:21   ` Rodrigo Vivi
2023-10-04 16:28   ` Lucas De Marchi
2023-10-04 17:32     ` Jani Nikula
2023-10-03 14:34 ` [Intel-xe] [PATCH 10/10] " Jani Nikula
2023-10-04 14:09   ` Rodrigo Vivi
2023-10-03 14:48 ` [Intel-xe] ✓ CI.Patch_applied: success for xe/display: clarify display configuration Patchwork
2023-10-03 14:48 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-10-03 14:49 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-10-03 14:56 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-03 14:57 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-10-03 14:58 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-10-03 15:35 ` [Intel-xe] ✓ CI.BAT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttr6eab1.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox