Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: rodrigo.vivi@intel.com, lucas.demarchi@intel.com,
	ville.syrjala@linux.intel.com
Subject: Re: [PATCH 03/22] drm/i915/fb: convert parts of intel_fb.c to struct drm_gem_object
Date: Tue, 17 Sep 2024 20:22:46 +0200	[thread overview]
Message-ID: <2ddf117d-8007-47ba-b7e8-b7d2d58d1573@linux.intel.com> (raw)
In-Reply-To: <2751dd56c9b45e0ace9b57b861aa0a78d75e779c.1726589119.git.jani.nikula@intel.com>



Den 2024-09-17 kl. 18:13, skrev Jani Nikula:
> Prefer the driver agnostic struct drm_gem_object over i915 specific
> struct drm_i915_gem_object. Add new intel_bo_* functions as needed.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bo.c | 10 +++++++++
>  drivers/gpu/drm/i915/display/intel_bo.h |  2 ++
>  drivers/gpu/drm/i915/display/intel_fb.c | 29 +++++++++++++------------
>  drivers/gpu/drm/xe/display/intel_bo.c   | 10 +++++++++
>  4 files changed, 37 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bo.c b/drivers/gpu/drm/i915/display/intel_bo.c
> index fede0a545951..5708d9bab1ab 100644
> --- a/drivers/gpu/drm/i915/display/intel_bo.c
> +++ b/drivers/gpu/drm/i915/display/intel_bo.c
> @@ -8,3 +8,13 @@ bool intel_bo_is_tiled(struct drm_gem_object *obj)
>  {
>  	return i915_gem_object_is_tiled(to_intel_bo(obj));
>  }
> +
> +bool intel_bo_is_userptr(struct drm_gem_object *obj)
> +{
> +	return i915_gem_object_is_userptr(to_intel_bo(obj));
> +}
> +
> +void intel_bo_flush_if_display(struct drm_gem_object *obj)
> +{
> +	i915_gem_object_flush_if_display(to_intel_bo(obj));
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_bo.h b/drivers/gpu/drm/i915/display/intel_bo.h
> index f5dfcc16d33e..0fa29211a9d0 100644
> --- a/drivers/gpu/drm/i915/display/intel_bo.h
> +++ b/drivers/gpu/drm/i915/display/intel_bo.h
> @@ -9,5 +9,7 @@
>  struct drm_gem_object;
>  
>  bool intel_bo_is_tiled(struct drm_gem_object *obj);
> +bool intel_bo_is_userptr(struct drm_gem_object *obj);
> +void intel_bo_flush_if_display(struct drm_gem_object *obj);
>  
>  #endif /* __INTEL_BO__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 834a49395638..eb8dc3dd21ee 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -13,6 +13,7 @@
>  #include "gem/i915_gem_object_types.h"
>  #include "i915_drv.h"
>  #include "intel_atomic_plane.h"
> +#include "intel_bo.h"
>  #include "intel_display.h"
>  #include "intel_display_types.h"
>  #include "intel_dpt.h"
> @@ -1225,7 +1226,7 @@ static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state)
>  static int convert_plane_offset_to_xy(const struct intel_framebuffer *fb, int color_plane,
>  				      int plane_width, int *x, int *y)
>  {
> -	struct drm_i915_gem_object *obj = intel_fb_obj(&fb->base);
> +	struct drm_gem_object *obj = intel_fb_bo(&fb->base);
>  	int ret;
>  
>  	ret = intel_fb_offset_to_xy(x, y, &fb->base, color_plane);
> @@ -1249,7 +1250,7 @@ static int convert_plane_offset_to_xy(const struct intel_framebuffer *fb, int co
>  	 * fb layout agrees with the fence layout. We already check that the
>  	 * fb stride matches the fence stride elsewhere.
>  	 */
> -	if (color_plane == 0 && i915_gem_object_is_tiled(obj) &&
> +	if (color_plane == 0 && intel_bo_is_tiled(obj) &&
>  	    (*x + plane_width) * fb->base.format->cpp[color_plane] > fb->base.pitches[color_plane]) {
>  		drm_dbg_kms(fb->base.dev,
>  			    "bad fb plane %d offset: 0x%x\n",
> @@ -1569,7 +1570,7 @@ static unsigned int intel_fb_min_alignment(const struct drm_framebuffer *fb)
>  
>  int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *fb)
>  {
> -	struct drm_i915_gem_object *obj = intel_fb_obj(&fb->base);
> +	struct drm_gem_object *obj = intel_fb_bo(&fb->base);
>  	u32 gtt_offset_rotated = 0;
>  	u32 gtt_offset_remapped = 0;
>  	unsigned int max_size = 0;
> @@ -1642,10 +1643,10 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *
>  		max_size = max(max_size, offset + size);
>  	}
>  
> -	if (mul_u32_u32(max_size, tile_size) > intel_bo_to_drm_bo(obj)->size) {
> +	if (mul_u32_u32(max_size, tile_size) > obj->size) {
>  		drm_dbg_kms(&i915->drm,
>  			    "fb too big for bo (need %llu bytes, have %zu bytes)\n",
> -			    mul_u32_u32(max_size, tile_size), intel_bo_to_drm_bo(obj)->size);
> +			    mul_u32_u32(max_size, tile_size), obj->size);
>  		return -EINVAL;
>  	}
>  
> @@ -1878,16 +1879,16 @@ static int intel_user_framebuffer_create_handle(struct drm_framebuffer *fb,
>  						struct drm_file *file,
>  						unsigned int *handle)
>  {
> -	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> -	struct drm_i915_private *i915 = to_i915(intel_bo_to_drm_bo(obj)->dev);
> +	struct drm_gem_object *obj = intel_fb_bo(fb);
> +	struct intel_display *display = to_intel_display(obj->dev);
>  
> -	if (i915_gem_object_is_userptr(obj)) {
> -		drm_dbg(&i915->drm,
> +	if (intel_bo_is_userptr(obj)) {
> +		drm_dbg(display->drm,
>  			"attempting to use a userptr for a framebuffer, denied\n");
>  		return -EINVAL;
>  	}
>  
> -	return drm_gem_handle_create(file, intel_bo_to_drm_bo(obj), handle);
> +	return drm_gem_handle_create(file, obj, handle);
>  }
>  
>  struct frontbuffer_fence_cb {
> @@ -1911,7 +1912,7 @@ static int intel_user_framebuffer_dirty(struct drm_framebuffer *fb,
>  					struct drm_clip_rect *clips,
>  					unsigned int num_clips)
>  {
> -	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> +	struct drm_gem_object *obj = intel_fb_bo(fb);
>  	struct intel_frontbuffer *front = to_intel_frontbuffer(fb);
>  	struct dma_fence *fence;
>  	struct frontbuffer_fence_cb *cb;
> @@ -1920,10 +1921,10 @@ static int intel_user_framebuffer_dirty(struct drm_framebuffer *fb,
>  	if (!atomic_read(&front->bits))
>  		return 0;
>  
> -	if (dma_resv_test_signaled(intel_bo_to_drm_bo(obj)->resv, dma_resv_usage_rw(false)))
> +	if (dma_resv_test_signaled(obj->resv, dma_resv_usage_rw(false)))
>  		goto flush;
>  
> -	ret = dma_resv_get_singleton(intel_bo_to_drm_bo(obj)->resv, dma_resv_usage_rw(false),
> +	ret = dma_resv_get_singleton(obj->resv, dma_resv_usage_rw(false),
>  				     &fence);
>  	if (ret || !fence)
>  		goto flush;
> @@ -1950,7 +1951,7 @@ static int intel_user_framebuffer_dirty(struct drm_framebuffer *fb,
>  	return ret;
>  
>  flush:
> -	i915_gem_object_flush_if_display(obj);
> +	intel_bo_flush_if_display(obj);
>  	intel_frontbuffer_flush(front, ORIGIN_DIRTYFB);
>  	return ret;
>  }
> diff --git a/drivers/gpu/drm/xe/display/intel_bo.c b/drivers/gpu/drm/xe/display/intel_bo.c
> index d564fb7d85e5..f57b684050da 100644
> --- a/drivers/gpu/drm/xe/display/intel_bo.c
> +++ b/drivers/gpu/drm/xe/display/intel_bo.c
> @@ -10,3 +10,13 @@ bool intel_bo_is_tiled(struct drm_gem_object *obj)
>  	/* legacy tiling is unused */
>  	return false;
>  }
> +
> +bool intel_bo_is_userptr(struct drm_gem_object *obj)
> +{
> +	/* legacy tiling is unused */
This comment should be 'xe does not have userptr bos'. :)
> +	return false;
> +}
> +
> +void intel_bo_flush_if_display(struct drm_gem_object *obj)
> +{
> +}


  reply	other threads:[~2024-09-17 18:22 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-17 16:13 [PATCH 00/22] drm/i915 & drm/xe: kill off -Ddrm_i915_gem_object=xe_bo Jani Nikula
2024-09-17 16:13 ` [PATCH 01/22] drm/i915/display: start a buffer object abstraction layer Jani Nikula
2024-09-17 16:13 ` [PATCH 02/22] drm/i915/display: convert intel_atomic_plane.c to struct drm_gem_object Jani Nikula
2024-09-17 16:13 ` [PATCH 03/22] drm/i915/fb: convert parts of intel_fb.c " Jani Nikula
2024-09-17 18:22   ` Maarten Lankhorst [this message]
2024-09-18  6:26     ` Jani Nikula
2024-09-18  6:25   ` [PATCH v2] " Jani Nikula
2024-09-18  9:24     ` Maarten Lankhorst
2024-09-17 16:13 ` [PATCH 04/22] drm/i915/fbdev: convert intel_fbdev.c " Jani Nikula
2024-09-17 16:13 ` [PATCH 05/22] drm/i915/display: convert skl_universal_plane.c " Jani Nikula
2024-09-17 16:13 ` [PATCH 06/22] drm/i915/fb: convert intel_framebuffer_init() " Jani Nikula
2024-09-17 16:13 ` [PATCH 07/22] drm/i915/fb: convert intel_fb_bo_lookup_valid_bo() " Jani Nikula
2024-09-17 16:13 ` [PATCH 08/22] drm/i915/fb: convert intel_fb_bo_framebuffer_init() to struct drm_i915_gem_object Jani Nikula
2024-09-17 16:13 ` [PATCH 09/22] drm/i915/fb: convert intel_fb_bo_framebuffer_fini() " Jani Nikula
2024-09-17 16:13 ` [PATCH 10/22] drm/xe/display: use correct bo type in intel_fbdev_fb_alloc() Jani Nikula
2024-09-19 13:21   ` Lucas De Marchi
2024-09-17 16:13 ` [PATCH 11/22] drm/i915/fb: convert intel_framebuffer_create() to struct drm_gem_object Jani Nikula
2024-09-17 16:13 ` [PATCH 12/22] drm/xe/display: stop using intel_fb_obj() in xe_fb_pin.c Jani Nikula
2024-09-19 13:20   ` Lucas De Marchi
2024-09-17 16:13 ` [PATCH 13/22] drm/i915/display: add intel_bo_read_from_page() and use it Jani Nikula
2024-09-17 16:13 ` [PATCH 14/22] drm/i915/display: add intel_bo_get/set_frontbuffer() and use them Jani Nikula
2024-09-17 16:13 ` [PATCH 15/22] drm/i915/frontbuffer: convert intel_frontbuffer_get() to struct drm_gem_object Jani Nikula
2024-09-17 16:13 ` [PATCH 16/22] drm/i915/frontbuffer: convert frontbuffer->obj " Jani Nikula
2024-09-17 16:13 ` [PATCH 17/22] drm/i915/display: add intel_bo_describe() and use it Jani Nikula
2024-09-17 16:13 ` [PATCH 18/22] drm/i915/fb: remove intel_fb_obj() Jani Nikula
2024-09-17 16:13 ` [PATCH 19/22] drm/i915/display: clean up some gem/ includes Jani Nikula
2024-09-17 16:13 ` [PATCH 20/22] drm/xe/compat: remove a bunch of compat gem headers Jani Nikula
2024-09-19 13:16   ` Lucas De Marchi
2024-09-17 16:14 ` [PATCH 21/22] drm/xe: remove a number of superfluous compat macros Jani Nikula
2024-09-19 13:20   ` Lucas De Marchi
2024-09-17 16:14 ` [PATCH 22/22] drm/xe: eradicate -Ddrm_i915_gem_object=xe_bo Jani Nikula
2024-09-17 21:53   ` Maarten Lankhorst
2024-09-19 13:19   ` Lucas De Marchi
2024-09-17 16:22 ` ✓ CI.Patch_applied: success for drm/i915 & drm/xe: kill off -Ddrm_i915_gem_object=xe_bo Patchwork
2024-09-17 16:22 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-17 16:24 ` ✓ CI.KUnit: success " Patchwork
2024-09-17 16:35 ` ✓ CI.Build: " Patchwork
2024-09-17 16:38 ` ✓ CI.Hooks: " Patchwork
2024-09-17 16:39 ` ✗ CI.checksparse: warning " Patchwork
2024-09-17 16:57 ` ✓ CI.BAT: success " Patchwork
2024-09-17 18:06 ` ✗ CI.FULL: failure " Patchwork
2024-09-18  8:58 ` ✓ CI.Patch_applied: success for drm/i915 & drm/xe: kill off -Ddrm_i915_gem_object=xe_bo (rev2) Patchwork
2024-09-18  8:59 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-18  9:04 ` ✓ CI.KUnit: success " Patchwork
2024-09-18  9:21 ` ✓ CI.Build: " Patchwork
2024-09-18  9:23 ` ✓ CI.Hooks: " Patchwork
2024-09-18  9:25 ` ✗ CI.checksparse: warning " Patchwork
2024-09-18 12:34 ` [PATCH 00/22] drm/i915 & drm/xe: kill off -Ddrm_i915_gem_object=xe_bo Jani Nikula
2024-09-18 12:46 ` ✗ CI.FULL: failure for drm/i915 & drm/xe: kill off -Ddrm_i915_gem_object=xe_bo (rev2) Patchwork
2024-09-19 13:42 ` [PATCH 00/22] drm/i915 & drm/xe: kill off -Ddrm_i915_gem_object=xe_bo Jani Nikula

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=2ddf117d-8007-47ba-b7e8-b7d2d58d1573@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --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