From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/5] drm/i915/plane: convert initial plane setup to struct intel_display
Date: Thu, 14 Nov 2024 12:52:22 -0500 [thread overview]
Message-ID: <ZzY41udgvMJIqV9n@intel.com> (raw)
In-Reply-To: <360fc078c5204f9199d31c207abc3ac3d9f918ed.1731347547.git.jani.nikula@intel.com>
On Mon, Nov 11, 2024 at 07:53:32PM +0200, Jani Nikula wrote:
> struct intel_display replaces struct drm_i915_private as the main
> display device pointer. Convert initial plane setup to it, as much as
> possible.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> .../drm/i915/display/intel_display_driver.c | 2 +-
> .../drm/i915/display/intel_plane_initial.c | 56 ++++++++++---------
> .../drm/i915/display/intel_plane_initial.h | 4 +-
> drivers/gpu/drm/xe/display/xe_plane_initial.c | 8 +--
> 4 files changed, 37 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index 5983570b510f..8daf48d2ba7d 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -472,7 +472,7 @@ int intel_display_driver_probe_nogem(struct drm_i915_private *i915)
> intel_acpi_assign_connector_fwnodes(display);
> drm_modeset_unlock_all(dev);
>
> - intel_initial_plane_config(i915);
> + intel_initial_plane_config(display);
>
> /*
> * Make sure hardware watermarks really match the state we read out.
> diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c
> index 62401f6a04e4..6789b7f14095 100644
> --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c
> +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c
> @@ -20,10 +20,10 @@ intel_reuse_initial_plane_obj(struct intel_crtc *this,
> struct drm_framebuffer **fb,
> struct i915_vma **vma)
> {
> - struct drm_i915_private *i915 = to_i915(this->base.dev);
> + struct intel_display *display = to_intel_display(this);
> struct intel_crtc *crtc;
>
> - for_each_intel_crtc(&i915->drm, crtc) {
> + for_each_intel_crtc(display->drm, crtc) {
> struct intel_plane *plane =
> to_intel_plane(crtc->base.primary);
> const struct intel_plane_state *plane_state =
> @@ -48,9 +48,10 @@ intel_reuse_initial_plane_obj(struct intel_crtc *this,
> }
>
> static bool
> -initial_plane_phys_lmem(struct drm_i915_private *i915,
> +initial_plane_phys_lmem(struct intel_display *display,
> struct intel_initial_plane_config *plane_config)
> {
> + struct drm_i915_private *i915 = to_i915(display->drm);
> gen8_pte_t __iomem *gte = to_gt(i915)->ggtt->gsm;
> struct intel_memory_region *mem;
> dma_addr_t dma_addr;
> @@ -63,7 +64,7 @@ initial_plane_phys_lmem(struct drm_i915_private *i915,
>
> pte = ioread64(gte);
> if (!(pte & GEN12_GGTT_PTE_LM)) {
> - drm_err(&i915->drm,
> + drm_err(display->drm,
> "Initial plane programming missing PTE_LM bit\n");
> return false;
> }
> @@ -75,7 +76,7 @@ initial_plane_phys_lmem(struct drm_i915_private *i915,
> else
> mem = i915->mm.stolen_region;
> if (!mem) {
> - drm_dbg_kms(&i915->drm,
> + drm_dbg_kms(display->drm,
> "Initial plane memory region not initialized\n");
> return false;
> }
> @@ -85,13 +86,13 @@ initial_plane_phys_lmem(struct drm_i915_private *i915,
> * ever be placed in the stolen portion.
> */
> if (dma_addr < mem->region.start || dma_addr > mem->region.end) {
> - drm_err(&i915->drm,
> + drm_err(display->drm,
> "Initial plane programming using invalid range, dma_addr=%pa (%s [%pa-%pa])\n",
> &dma_addr, mem->region.name, &mem->region.start, &mem->region.end);
> return false;
> }
>
> - drm_dbg(&i915->drm,
> + drm_dbg(display->drm,
> "Using dma_addr=%pa, based on initial plane programming\n",
> &dma_addr);
>
> @@ -102,9 +103,10 @@ initial_plane_phys_lmem(struct drm_i915_private *i915,
> }
>
> static bool
> -initial_plane_phys_smem(struct drm_i915_private *i915,
> +initial_plane_phys_smem(struct intel_display *display,
> struct intel_initial_plane_config *plane_config)
> {
> + struct drm_i915_private *i915 = to_i915(display->drm);
> struct intel_memory_region *mem;
> u32 base;
>
> @@ -112,7 +114,7 @@ initial_plane_phys_smem(struct drm_i915_private *i915,
>
> mem = i915->mm.stolen_region;
> if (!mem) {
> - drm_dbg_kms(&i915->drm,
> + drm_dbg_kms(display->drm,
> "Initial plane memory region not initialized\n");
> return false;
> }
> @@ -125,19 +127,22 @@ initial_plane_phys_smem(struct drm_i915_private *i915,
> }
>
> static bool
> -initial_plane_phys(struct drm_i915_private *i915,
> +initial_plane_phys(struct intel_display *display,
> struct intel_initial_plane_config *plane_config)
> {
> + struct drm_i915_private *i915 = to_i915(display->drm);
> +
> if (IS_DGFX(i915) || HAS_LMEMBAR_SMEM_STOLEN(i915))
> - return initial_plane_phys_lmem(i915, plane_config);
> + return initial_plane_phys_lmem(display, plane_config);
> else
> - return initial_plane_phys_smem(i915, plane_config);
> + return initial_plane_phys_smem(display, plane_config);
> }
>
> static struct i915_vma *
> -initial_plane_vma(struct drm_i915_private *i915,
> +initial_plane_vma(struct intel_display *display,
> struct intel_initial_plane_config *plane_config)
> {
> + struct drm_i915_private *i915 = to_i915(display->drm);
> struct intel_memory_region *mem;
> struct drm_i915_gem_object *obj;
> struct drm_mm_node orig_mm = {};
> @@ -149,7 +154,7 @@ initial_plane_vma(struct drm_i915_private *i915,
> if (plane_config->size == 0)
> return NULL;
>
> - if (!initial_plane_phys(i915, plane_config))
> + if (!initial_plane_phys(display, plane_config))
> return NULL;
>
> phys_base = plane_config->phys_base;
> @@ -168,7 +173,7 @@ initial_plane_vma(struct drm_i915_private *i915,
> if (IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
> mem == i915->mm.stolen_region &&
> size * 2 > i915->dsm.usable_size) {
> - drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n");
> + drm_dbg_kms(display->drm, "Initial FB size exceeds half of stolen, discarding\n");
> return NULL;
> }
>
> @@ -176,7 +181,7 @@ initial_plane_vma(struct drm_i915_private *i915,
> I915_BO_ALLOC_USER |
> I915_BO_PREALLOC);
> if (IS_ERR(obj)) {
> - drm_dbg_kms(&i915->drm, "Failed to preallocate initial FB in %s\n",
> + drm_dbg_kms(display->drm, "Failed to preallocate initial FB in %s\n",
> mem->region.name);
> return NULL;
> }
> @@ -254,7 +259,7 @@ initial_plane_vma(struct drm_i915_private *i915,
> if (drm_mm_node_allocated(&orig_mm))
> drm_mm_remove_node(&orig_mm);
>
> - drm_dbg_kms(&i915->drm,
> + drm_dbg_kms(display->drm,
> "Initial plane fb bound to 0x%x in the ggtt (original 0x%x)\n",
> i915_ggtt_offset(vma), plane_config->base);
>
> @@ -271,8 +276,7 @@ static bool
> intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
> struct intel_initial_plane_config *plane_config)
> {
> - struct drm_device *dev = crtc->base.dev;
> - struct drm_i915_private *dev_priv = to_i915(dev);
> + struct intel_display *display = to_intel_display(crtc);
> struct drm_mode_fb_cmd2 mode_cmd = {};
> struct drm_framebuffer *fb = &plane_config->fb->base;
> struct i915_vma *vma;
> @@ -284,13 +288,13 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
> case I915_FORMAT_MOD_4_TILED:
> break;
> default:
> - drm_dbg(&dev_priv->drm,
> + drm_dbg(display->drm,
> "Unsupported modifier for initial FB: 0x%llx\n",
> fb->modifier);
> return false;
> }
>
> - vma = initial_plane_vma(dev_priv, plane_config);
> + vma = initial_plane_vma(display, plane_config);
> if (!vma)
> return false;
>
> @@ -303,7 +307,7 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
>
> if (intel_framebuffer_init(to_intel_framebuffer(fb),
> intel_bo_to_drm_bo(vma->obj), &mode_cmd)) {
> - drm_dbg_kms(&dev_priv->drm, "intel fb init failed\n");
> + drm_dbg_kms(display->drm, "intel fb init failed\n");
> goto err_vma;
> }
>
> @@ -410,12 +414,12 @@ static void plane_config_fini(struct intel_initial_plane_config *plane_config)
> i915_vma_put(plane_config->vma);
> }
>
> -void intel_initial_plane_config(struct drm_i915_private *i915)
> +void intel_initial_plane_config(struct intel_display *display)
> {
> struct intel_initial_plane_config plane_configs[I915_MAX_PIPES] = {};
> struct intel_crtc *crtc;
>
> - for_each_intel_crtc(&i915->drm, crtc) {
> + for_each_intel_crtc(display->drm, crtc) {
> struct intel_initial_plane_config *plane_config =
> &plane_configs[crtc->pipe];
>
> @@ -429,7 +433,7 @@ void intel_initial_plane_config(struct drm_i915_private *i915)
> * can even allow for smooth boot transitions if the BIOS
> * fb is large enough for the active pipe configuration.
> */
> - i915->display.funcs.display->get_initial_plane_config(crtc, plane_config);
> + display->funcs.display->get_initial_plane_config(crtc, plane_config);
>
> /*
> * If the fb is shared between multiple heads, we'll
> @@ -437,7 +441,7 @@ void intel_initial_plane_config(struct drm_i915_private *i915)
> */
> intel_find_initial_plane_obj(crtc, plane_configs);
>
> - if (i915->display.funcs.display->fixup_initial_plane_config(crtc, plane_config))
> + if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config))
> intel_crtc_wait_for_next_vblank(crtc);
>
> plane_config_fini(plane_config);
> diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.h b/drivers/gpu/drm/i915/display/intel_plane_initial.h
> index 64ab95239cd4..6c6aa717ed21 100644
> --- a/drivers/gpu/drm/i915/display/intel_plane_initial.h
> +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.h
> @@ -6,8 +6,8 @@
> #ifndef __INTEL_PLANE_INITIAL_H__
> #define __INTEL_PLANE_INITIAL_H__
>
> -struct drm_i915_private;
> +struct intel_display;
>
> -void intel_initial_plane_config(struct drm_i915_private *i915);
> +void intel_initial_plane_config(struct intel_display *display);
>
> #endif
> diff --git a/drivers/gpu/drm/xe/display/xe_plane_initial.c b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> index 8c113463a3d5..2eb9633f163a 100644
> --- a/drivers/gpu/drm/xe/display/xe_plane_initial.c
> +++ b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> @@ -275,12 +275,12 @@ static void plane_config_fini(struct intel_initial_plane_config *plane_config)
> }
> }
>
> -void intel_initial_plane_config(struct drm_i915_private *i915)
> +void intel_initial_plane_config(struct intel_display *display)
> {
> struct intel_initial_plane_config plane_configs[I915_MAX_PIPES] = {};
> struct intel_crtc *crtc;
>
> - for_each_intel_crtc(&i915->drm, crtc) {
> + for_each_intel_crtc(display->drm, crtc) {
> struct intel_initial_plane_config *plane_config =
> &plane_configs[crtc->pipe];
>
> @@ -294,7 +294,7 @@ void intel_initial_plane_config(struct drm_i915_private *i915)
> * can even allow for smooth boot transitions if the BIOS
> * fb is large enough for the active pipe configuration.
> */
> - i915->display.funcs.display->get_initial_plane_config(crtc, plane_config);
> + display->funcs.display->get_initial_plane_config(crtc, plane_config);
>
> /*
> * If the fb is shared between multiple heads, we'll
> @@ -302,7 +302,7 @@ void intel_initial_plane_config(struct drm_i915_private *i915)
> */
> intel_find_initial_plane_obj(crtc, plane_configs);
>
> - if (i915->display.funcs.display->fixup_initial_plane_config(crtc, plane_config))
> + if (display->funcs.display->fixup_initial_plane_config(crtc, plane_config))
> intel_crtc_wait_for_next_vblank(crtc);
>
> plane_config_fini(plane_config);
> --
> 2.39.5
>
next prev parent reply other threads:[~2024-11-14 17:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 17:53 [PATCH 0/5] drm/i915: intel_display conversions, cleanups Jani Nikula
2024-11-11 17:53 ` [PATCH 1/5] drm/i915/overlay: convert to struct intel_display Jani Nikula
2024-11-12 20:40 ` Rodrigo Vivi
2024-11-13 8:26 ` Jani Nikula
2024-11-11 17:53 ` [PATCH 2/5] drm/i915/overlay: add intel_overlay_available() and use it Jani Nikula
2024-11-14 17:51 ` Rodrigo Vivi
2024-11-11 17:53 ` [PATCH 3/5] drm/i915/plane: convert initial plane setup to struct intel_display Jani Nikula
2024-11-14 17:52 ` Rodrigo Vivi [this message]
2024-11-11 17:53 ` [PATCH 4/5] drm/i915/irq: hide display_irqs_enabled access Jani Nikula
2024-11-14 17:55 ` Rodrigo Vivi
2024-11-15 13:13 ` Jani Nikula
2024-11-15 19:10 ` Rodrigo Vivi
2024-11-11 17:53 ` [PATCH 5/5] drm/i915/irq: emphasize display_irqs_enabled is only about VLV/CHV Jani Nikula
2024-11-14 17:57 ` Rodrigo Vivi
2024-11-15 13:15 ` Jani Nikula
2024-11-15 19:11 ` Rodrigo Vivi
2024-11-11 18:02 ` ✓ CI.Patch_applied: success for drm/i915: intel_display conversions, cleanups Patchwork
2024-11-11 18:02 ` ✗ CI.checkpatch: warning " Patchwork
2024-11-11 18:04 ` ✓ CI.KUnit: success " Patchwork
2024-11-11 18:15 ` ✓ CI.Build: " Patchwork
2024-11-11 18:17 ` ✓ CI.Hooks: " Patchwork
2024-11-11 18:19 ` ✗ CI.checksparse: warning " Patchwork
2024-11-11 19:00 ` ✗ Fi.CI.CHECKPATCH: " Patchwork
2024-11-11 19:00 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-11-11 19:01 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-11-11 19:01 ` ✓ CI.BAT: success " Patchwork
2024-11-11 20:17 ` ✗ CI.FULL: failure " Patchwork
2024-11-18 17:49 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: intel_display conversions, cleanups (rev2) Patchwork
2024-11-18 17:49 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-11-18 18:08 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-11-19 13:15 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: intel_display conversions, cleanups (rev3) Patchwork
2024-11-19 13:16 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-11-19 13:31 ` ✗ 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=ZzY41udgvMJIqV9n@intel.com \
--to=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.