From: Jani Nikula <jani.nikula@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Abstract display info away during probe
Date: Tue, 03 Oct 2023 12:04:26 +0300 [thread overview]
Message-ID: <87bkdggjqd.fsf@intel.com> (raw)
In-Reply-To: <ZRseAWK0mm0qpfRl@intel.com>
On Mon, 02 Oct 2023, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Mon, Oct 02, 2023 at 07:58:30PM +0300, Jani Nikula wrote:
>> On Mon, 02 Oct 2023, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
>> > On Mon, Oct 02, 2023 at 10:41:14AM +0300, Jani Nikula wrote:
>> >> On Fri, 29 Sep 2023, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
>> >> > The goal is to have this function ready for Xe to use
>> >> > directly. So, let's use the available macro.
>> >>
>> >> Seesm wrong to use DISPLAY_INFO() as an lvalue
>> >
>> > to be really honestly I don't like that either.
>> > I barely like macros, specially used like this.
>> >
>> >> and I'm not sure why
>> >> this wouldn't work as-is.
>> >
>> > I should probably had collected some logs and added to the
>> > commit message. But the thing was that without this assignment,
>> > (xe)->info.display was NULL and the memcpy below was exploding
>> > with NULL dereference.
>>
>> Aww crap. That's because both DISPLAY_INFO() and DISPLAY_RUNTIME_INFO()
>> in xe are completely bogus.
>>
>> They should be
>>
>> #define DISPLAY_INFO(i915) ((i915)->display.info.__device_info)
>> #define DISPLAY_RUNTIME_INFO(i915) (&(i915)->display.info.__runtime_info)
>>
>> instead of
>>
>> #define DISPLAY_INFO(xe) ((xe)->info.display)
>> #define DISPLAY_RUNTIME_INFO(xe) (&(xe)->info.display_runtime)
>>
>> and these should be removed from struct xe_device info member:
>>
>> const struct intel_display_device_info *display;
>> struct intel_display_runtime_info display_runtime;
>
> but in this case we would need the macros in Xe to resolve the access
> to these items anyway right?!
>
> or how should we handle cases like 'if (xe->info.display_runtime.pipe_mask)' ?
Hrmh, we should *not* have code doing direct dereference chases like
that to begin with. :(
I sent a series addressing this. But discovered a bunch of weirdness
around the concepts of "have display" and "display enabled" in xe that
I'm not sure what to do with. It took years to crystallize those
concepts in i915, and xe confuses them again. :(
BR,
Jani.
>
>
>
>>
>> BR,
>> Jani.
>>
>>
>> >
>> >>
>> >> But *shrug*.
>> >>
>> >> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>> >
>> > thanks, pushed as is.
>> >
>> >>
>> >> for merging to i915. (xe should come as a backport with cherry-pick -x.)
>> >
>> > and sent the proper backported cherry-pick to intel-xe ml.
>> >
>> >>
>> >> BR,
>> >> Jani
>> >>
>> >>
>> >> >
>> >> > Cc: Jani Nikula <jani.nikula@intel.com>
>> >> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> >> > ---
>> >> > drivers/gpu/drm/i915/display/intel_display_device.c | 2 +-
>> >> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >> >
>> >> > diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
>> >> > index a6a18eae7ae8..ce55b968e658 100644
>> >> > --- a/drivers/gpu/drm/i915/display/intel_display_device.c
>> >> > +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
>> >> > @@ -926,7 +926,7 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>> >> > else
>> >> > info = probe_display(i915);
>> >> >
>> >> > - i915->display.info.__device_info = info;
>> >> > + DISPLAY_INFO(i915) = info;
>> >> >
>> >> > memcpy(DISPLAY_RUNTIME_INFO(i915),
>> >> > &DISPLAY_INFO(i915)->__runtime_defaults,
>> >>
>> >> --
>> >> Jani Nikula, Intel
>>
>> --
>> Jani Nikula, Intel
--
Jani Nikula, Intel
prev parent reply other threads:[~2023-10-03 9:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 20:50 [Intel-gfx] [PATCH] drm/i915: Abstract display info away during probe Rodrigo Vivi
2023-09-29 22:20 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-09-30 3:12 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-10-02 7:41 ` [Intel-gfx] [PATCH] " Jani Nikula
2023-10-02 16:13 ` Rodrigo Vivi
2023-10-02 16:58 ` Jani Nikula
2023-10-02 19:46 ` Rodrigo Vivi
2023-10-03 9:04 ` Jani Nikula [this message]
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=87bkdggjqd.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--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