From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 8/9] drm/i915: Cleanup fbdev fb setup
Date: Fri, 10 May 2024 14:32:45 +0300 [thread overview]
Message-ID: <87a5kxj40y.fsf@intel.com> (raw)
In-Reply-To: <20240510102257.25096-1-ville.syrjala@linux.intel.com>
On Fri, 10 May 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We use a mix of 'intel_fb' vs. 'ifbdev->fb' in the same function.
> Both should be pointing at the same thing. Make things less
> confusing by just getting existing fb from 'ifbdev->fb' at the
> start and then sticking with the local 'fb' (renamed from the
> 'intel_fb') until the very end.
>
> v2: rebase
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_fbdev.c | 38 ++++++++++++----------
> 1 file changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 4bbbf481bb3a..e898018ab76a 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -175,7 +175,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
> struct drm_fb_helper_surface_size *sizes)
> {
> struct intel_fbdev *ifbdev = to_intel_fbdev(helper);
> - struct intel_framebuffer *intel_fb = ifbdev->fb;
> + struct intel_framebuffer *fb = ifbdev->fb;
> struct drm_device *dev = helper->dev;
> struct drm_i915_private *dev_priv = to_i915(dev);
> const struct i915_gtt_view view = {
> @@ -195,29 +195,30 @@ static int intelfb_create(struct drm_fb_helper *helper,
> if (ret)
> return ret;
>
> - if (intel_fb &&
> - (sizes->fb_width > intel_fb->base.width ||
> - sizes->fb_height > intel_fb->base.height)) {
> + ifbdev->fb = NULL;
> +
> + if (fb &&
> + (sizes->fb_width > fb->base.width ||
> + sizes->fb_height > fb->base.height)) {
> drm_dbg_kms(&dev_priv->drm,
> "BIOS fb too small (%dx%d), we require (%dx%d),"
> " releasing it\n",
> - intel_fb->base.width, intel_fb->base.height,
> + fb->base.width, fb->base.height,
> sizes->fb_width, sizes->fb_height);
> - drm_framebuffer_put(&intel_fb->base);
> - intel_fb = ifbdev->fb = NULL;
> + drm_framebuffer_put(&fb->base);
> + fb = NULL;
> }
> - if (!intel_fb || drm_WARN_ON(dev, !intel_fb_obj(&intel_fb->base))) {
> + if (!fb || drm_WARN_ON(dev, !intel_fb_obj(&fb->base))) {
> drm_dbg_kms(&dev_priv->drm,
> "no BIOS fb, allocating a new one\n");
> - intel_fb = intel_fbdev_fb_alloc(helper, sizes);
> - if (IS_ERR(intel_fb))
> - return PTR_ERR(intel_fb);
> - ifbdev->fb = intel_fb;
> + fb = intel_fbdev_fb_alloc(helper, sizes);
> + if (IS_ERR(fb))
> + return PTR_ERR(fb);
> } else {
> drm_dbg_kms(&dev_priv->drm, "re-using BIOS fb\n");
> prealloc = true;
> - sizes->fb_width = intel_fb->base.width;
> - sizes->fb_height = intel_fb->base.height;
> + sizes->fb_width = fb->base.width;
> + sizes->fb_height = fb->base.height;
> }
>
> wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
> @@ -226,7 +227,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
> * This also validates that any existing fb inherited from the
> * BIOS is suitable for own access.
> */
> - vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, false,
> + vma = intel_pin_and_fence_fb_obj(&fb->base, false,
> &view, false, &flags);
> if (IS_ERR(vma)) {
> ret = PTR_ERR(vma);
> @@ -240,11 +241,11 @@ static int intelfb_create(struct drm_fb_helper *helper,
> goto out_unpin;
> }
>
> - ifbdev->helper.fb = &ifbdev->fb->base;
> + ifbdev->helper.fb = &fb->base;
>
> info->fbops = &intelfb_ops;
>
> - obj = intel_fb_obj(&intel_fb->base);
> + obj = intel_fb_obj(&fb->base);
>
> ret = intel_fbdev_fb_fill_info(dev_priv, info, obj, vma);
> if (ret)
> @@ -262,8 +263,9 @@ static int intelfb_create(struct drm_fb_helper *helper,
> /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
>
> drm_dbg_kms(&dev_priv->drm, "allocated %dx%d fb: 0x%08x\n",
> - ifbdev->fb->base.width, ifbdev->fb->base.height,
> + fb->base.width, fb->base.height,
> i915_ggtt_offset(vma));
> + ifbdev->fb = fb;
> ifbdev->vma = vma;
> ifbdev->vma_flags = flags;
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-05-10 11:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 12:57 [PATCH 0/9] drm/i915: Plane fb refactoring Ville Syrjala
2024-05-06 12:57 ` [PATCH 1/9] drm/i915: Split gen2 vs. gen3 .max_stride() Ville Syrjala
2024-05-06 13:57 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 2/9] drm/i915: Clean up skl+ plane stride limits Ville Syrjala
2024-05-06 14:03 ` Jani Nikula
2024-05-06 16:38 ` Ville Syrjälä
2024-05-07 9:02 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 3/9] drm/i915: Drop 'uses_fence' parameter from intel_pin_fb_obj_dpt() Ville Syrjala
2024-05-06 14:04 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 4/9] drm/i915: Extract intel_plane_needs_physical() Ville Syrjala
2024-05-06 14:05 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 5/9] drm/i915: Polish types in fb calculations Ville Syrjala
2024-05-06 14:07 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 6/9] drm/i915: Constify 'fb' in during pinning Ville Syrjala
2024-05-06 14:11 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 7/9] drm/i915: Change intel_fbdev_fb_alloc() reuturn type Ville Syrjala
2024-05-06 14:16 ` Jani Nikula
2024-05-06 16:51 ` Ville Syrjälä
2024-05-06 18:19 ` Ville Syrjälä
2024-05-10 10:22 ` [PATCH v2 7/9] drm/i915: Change intel_fbdev_fb_alloc() return type Ville Syrjala
2024-05-10 11:30 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 8/9] drm/i915: Cleanup fbdev fb setup Ville Syrjala
2024-05-10 10:22 ` [PATCH v2 " Ville Syrjala
2024-05-10 11:32 ` Jani Nikula [this message]
2024-05-06 12:57 ` [PATCH 9/9] drm/i915: Rename the fb pinning functions to indicate the address space Ville Syrjala
2024-05-10 11:35 ` Jani Nikula
2024-05-06 13:34 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Plane fb refactoring Patchwork
2024-05-06 13:42 ` ✓ Fi.CI.BAT: success " Patchwork
2024-05-06 18:13 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-10 12:37 ` ✓ Fi.CI.BAT: success for drm/i915: Plane fb refactoring (rev3) Patchwork
2024-05-10 16:55 ` [PATCH 0/9] drm/i915: Plane fb refactoring Ville Syrjälä
2024-05-11 19:00 ` Lucas De Marchi
2024-05-11 4:12 ` ✗ Fi.CI.IGT: failure for drm/i915: Plane fb refactoring (rev3) 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=87a5kxj40y.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=ville.syrjala@linux.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;
as well as URLs for NNTP newsgroup(s).