From: Raag Jadav <raag.jadav@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 3/6] drm/i915/display: add intel_display_conversion.c to hide stuff better
Date: Thu, 31 Oct 2024 14:50:53 +0200 [thread overview]
Message-ID: <ZyN9LdA6yGjtWuQy@black.fi.intel.com> (raw)
In-Reply-To: <f08d3740e464b52bffd80b344e8abf5b1fda975c.1730374470.git.jani.nikula@intel.com>
On Thu, Oct 31, 2024 at 01:38:33PM +0200, Jani Nikula wrote:
> The __to_intel_display() generics require the definition of struct
> drm_i915_private i.e. inclusion of i915_drv.h. Add
> intel_display_conversion.c with a __i915_to_display() function to do the
> conversion without the intel_display_conversion.h having an implicit
> dependency on i915_drv.h.
>
> The long term goal is to remove __to_intel_display() and the
> intel_display_conversion.[ch] files altoghether, and this is merely a
> transitional step to make the dependencies on i915_drv.h explicit.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/Makefile | 1 +
> drivers/gpu/drm/i915/display/intel_display_conversion.c | 9 +++++++++
> drivers/gpu/drm/i915/display/intel_display_conversion.h | 9 +++++++--
> drivers/gpu/drm/xe/Makefile | 1 +
> 4 files changed, 18 insertions(+), 2 deletions(-)
> create mode 100644 drivers/gpu/drm/i915/display/intel_display_conversion.c
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index ac47d7e988fc..43686d843ef7 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -237,6 +237,7 @@ i915-y += \
> display/intel_crtc_state_dump.o \
> display/intel_cursor.o \
> display/intel_display.o \
> + display/intel_display_conversion.o \
> display/intel_display_driver.o \
> display/intel_display_irq.o \
> display/intel_display_params.o \
> diff --git a/drivers/gpu/drm/i915/display/intel_display_conversion.c b/drivers/gpu/drm/i915/display/intel_display_conversion.c
> new file mode 100644
> index 000000000000..bdd947f5ccd8
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/display/intel_display_conversion.c
> @@ -0,0 +1,9 @@
> +// SPDX-License-Identifier: MIT
> +/* Copyright © 2024 Intel Corporation */
> +
> +#include "i915_drv.h"
> +
> +struct intel_display *__i915_to_display(struct drm_i915_private *i915)
> +{
> + return &i915->display;
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_display_conversion.h b/drivers/gpu/drm/i915/display/intel_display_conversion.h
> index ad8545c8055d..790d0be698dc 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_conversion.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_conversion.h
> @@ -8,14 +8,19 @@
> #ifndef __INTEL_DISPLAY_CONVERSION__
> #define __INTEL_DISPLAY_CONVERSION__
>
> +struct drm_i915_private;
> +struct intel_display;
> +
> +struct intel_display *__i915_to_display(struct drm_i915_private *i915);
> +
> /*
> * Transitional macro to optionally convert struct drm_i915_private * to struct
> * intel_display *, also accepting the latter.
> */
> #define __to_intel_display(p) \
> _Generic(p, \
> - const struct drm_i915_private *: (&((const struct drm_i915_private *)(p))->display), \
> - struct drm_i915_private *: (&((struct drm_i915_private *)(p))->display), \
> + const struct drm_i915_private *: __i915_to_display((struct drm_i915_private *)(p)), \
> + struct drm_i915_private *: __i915_to_display((struct drm_i915_private *)(p)), \
> const struct intel_display *: (p), \
> struct intel_display *: (p))
Perhaps,
#define TYPE_ENTRY(type, x) \
const type: x, \
type: x
May snip the duplication.
Raag
next prev parent reply other threads:[~2024-10-31 12:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 11:38 [PATCH 0/6] drm/i915/display: make all i915_drv.h includes explicit Jani Nikula
2024-10-31 11:38 ` [PATCH 1/6] drm/i915/gvt: always pass struct intel_display * to register macros Jani Nikula
2024-10-31 11:38 ` [PATCH 2/6] drm/i915: extract intel_uncore_trace.[ch] Jani Nikula
2024-10-31 11:38 ` [PATCH 3/6] drm/i915/display: add intel_display_conversion.c to hide stuff better Jani Nikula
2024-10-31 12:50 ` Raag Jadav [this message]
2024-10-31 13:06 ` Jani Nikula
2024-10-31 11:38 ` [PATCH 4/6] drm/i915/uncore: add to_intel_uncore() and use it Jani Nikula
2024-10-31 11:38 ` [PATCH 5/6] drm/i915/display: add struct drm_device to struct intel_display conversion function Jani Nikula
2024-10-31 11:38 ` [PATCH 6/6] drm/i915/display: drop i915_drv.h include from intel_display_trace.h Jani Nikula
2024-10-31 12:13 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/display: make all i915_drv.h includes explicit Patchwork
2024-10-31 12:14 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-10-31 13:26 ` ✗ Fi.CI.BAT: failure " 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=ZyN9LdA6yGjtWuQy@black.fi.intel.com \
--to=raag.jadav@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@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