Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 2/9] drm/{i915, xe}/fbdev: add intel_fbdev_fb_pitch_align()
Date: Fri, 5 Sep 2025 12:23:23 +0300	[thread overview]
Message-ID: <aLqsC87Ol_zCXOkN@intel.com> (raw)
In-Reply-To: <ae51d1e224048bdc87bf7a56d8f5ebd0fbb6a383.1756931441.git.jani.nikula@intel.com>

On Wed, Sep 03, 2025 at 11:31:59PM +0300, Jani Nikula wrote:
> Add new helper intel_fbdev_fb_pitch_align() in preparation for further
> refactoring. The alignment is different for i915 and xe.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fbdev_fb.c | 8 ++++++--
>  drivers/gpu/drm/i915/display/intel_fbdev_fb.h | 3 +++
>  drivers/gpu/drm/xe/display/intel_fbdev_fb.c   | 8 ++++++--
>  3 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> index 9c557917d781..d1c03d7b9bdc 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> @@ -13,6 +13,11 @@
>  #include "intel_fb.h"
>  #include "intel_fbdev_fb.h"
>  
> +u32 intel_fbdev_fb_pitch_align(u32 stride)
> +{
> +	return ALIGN(stride, 64);
> +}
> +
>  struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
>  					       struct drm_fb_helper_surface_size *sizes)
>  {
> @@ -30,8 +35,7 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
>  	mode_cmd.width = sizes->surface_width;
>  	mode_cmd.height = sizes->surface_height;
>  
> -	mode_cmd.pitches[0] = ALIGN(mode_cmd.width *
> -				    DIV_ROUND_UP(sizes->surface_bpp, 8), 64);
> +	mode_cmd.pitches[0] = intel_fbdev_fb_pitch_align(mode_cmd.width * DIV_ROUND_UP(sizes->surface_bpp, 8));
>  	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
>  							  sizes->surface_depth);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.h b/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> index 668ae355f5e5..caeb543d5efc 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> @@ -6,6 +6,8 @@
>  #ifndef __INTEL_FBDEV_FB_H__
>  #define __INTEL_FBDEV_FB_H__
>  
> +#include <linux/types.h>
> +
>  struct drm_device;
>  struct drm_fb_helper_surface_size;
>  struct drm_gem_object;
> @@ -13,6 +15,7 @@ struct fb_info;
>  struct i915_vma;
>  struct intel_display;
>  
> +u32 intel_fbdev_fb_pitch_align(u32 stride);
>  struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
>  					       struct drm_fb_helper_surface_size *sizes);
>  int intel_fbdev_fb_fill_info(struct intel_display *display, struct fb_info *info,
> diff --git a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> index bafca1059a40..fd2c40020eea 100644
> --- a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> +++ b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> @@ -15,6 +15,11 @@
>  
>  #include <generated/xe_wa_oob.h>
>  
> +u32 intel_fbdev_fb_pitch_align(u32 stride)
> +{
> +	return ALIGN(stride, XE_PAGE_SIZE);

I think someone needs to explain what the heck this extra alignment
is trying to achieve? I suspect it just needs to get nuked.

> +}
> +
>  struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
>  					       struct drm_fb_helper_surface_size *sizes)
>  {
> @@ -31,8 +36,7 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_device *drm,
>  	mode_cmd.width = sizes->surface_width;
>  	mode_cmd.height = sizes->surface_height;
>  
> -	mode_cmd.pitches[0] = ALIGN(mode_cmd.width *
> -				    DIV_ROUND_UP(sizes->surface_bpp, 8), XE_PAGE_SIZE);
> +	mode_cmd.pitches[0] = intel_fbdev_fb_pitch_align(mode_cmd.width * DIV_ROUND_UP(sizes->surface_bpp, 8));
>  	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
>  							  sizes->surface_depth);
>  
> -- 
> 2.47.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-09-05  9:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 20:31 [PATCH 0/9] drm/{i915,xe}/fbdev: refactor Jani Nikula
2025-09-03 20:31 ` [PATCH 1/9] drm/{i915, xe}/fbdev: pass struct drm_device to intel_fbdev_fb_alloc() Jani Nikula
2025-09-03 20:31 ` [PATCH 2/9] drm/{i915,xe}/fbdev: add intel_fbdev_fb_pitch_align() Jani Nikula
2025-09-05  9:23   ` Ville Syrjälä [this message]
2025-09-08 12:55     ` [PATCH 2/9] drm/{i915, xe}/fbdev: " Jani Nikula
2025-09-08 14:19       ` Lucas De Marchi
2025-09-08 16:10         ` Maarten Lankhorst
2025-09-08 16:27           ` Ville Syrjälä
2025-09-16 11:44             ` Jani Nikula
2025-09-16 19:19               ` Ville Syrjälä
2025-09-18  8:43                 ` Jani Nikula
2025-10-13 13:52                   ` Jani Nikula
2025-10-13 17:19                     ` Ville Syrjälä
2025-10-14  4:48                       ` Hogander, Jouni
2025-09-03 20:32 ` [PATCH 3/9] drm/{i915, xe}/fbdev: deduplicate struct drm_mode_fb_cmd2 init Jani Nikula
2025-09-03 20:32 ` [PATCH 4/9] drm/i915/fbdev: abstract bo creation Jani Nikula
2025-09-03 20:32 ` [PATCH 5/9] drm/xe/fbdev: " Jani Nikula
2025-09-03 20:32 ` [PATCH 6/9] drm/{i915,xe}/fbdev: add intel_fbdev_fb_bo_destroy() Jani Nikula
2025-09-04 14:37   ` Ville Syrjälä
2025-09-08 13:01     ` Jani Nikula
2025-09-17 12:33     ` Jani Nikula
2025-09-17 14:07       ` Ville Syrjälä
2025-09-18  8:46         ` Jani Nikula
2025-09-03 20:32 ` [PATCH 7/9] drm/{i915,xe}/fbdev: deduplicate fbdev creation Jani Nikula
2025-09-04 14:39   ` Ville Syrjälä
2025-09-08 12:57     ` Jani Nikula
2025-09-03 20:32 ` [PATCH 8/9] drm/{i915, xe}/fbdev: pass struct drm_device to intel_fbdev_fb_fill_info() Jani Nikula
2025-09-03 20:32 ` [PATCH 9/9] drm/i915/fbdev: drop dependency on display in i915 specific code Jani Nikula
2025-09-03 21:15 ` ✓ i915.CI.BAT: success for drm/{i915,xe}/fbdev: refactor Patchwork
2025-09-05  1:09 ` ✗ i915.CI.Full: 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=aLqsC87Ol_zCXOkN@intel.com \
    --to=ville.syrjala@linux.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