[PATCH] drm/i915: implement vmap/vunmap GEM object functions

Thomas Zimmermann tzimmermann at suse.de
Tue Jul 2 07:17:02 UTC 2024


Hi

Am 29.06.24 um 20:25 schrieb Asbjørn Sloth Tønnesen:
> Implement i915_gem_vmap_object() and i915_gem_vunmap_object(),
> based on i915_gem_dmabuf_vmap() and i915_gem_dmabuf_vunmap().
>
> This enables a drm_client to use drm_client_buffer_vmap() and
> drm_client_buffer_vunmap() on hardware using the i915 driver.
>
> Tested with a currently out of tree pixelflut drm_client[1] on:
> - Lenovo ThinkCentre M720q (CoffeeLake-S GT2 / Intel UHD Graphics 630)
> - Dell Wyse N06D - 3030 LT (ValleyView on Intel Celeron N2807 SOC)
>
> [1] XDP->DRM pixelflut: https://labitat.dk/wiki/Pixelflut-XDR
>
> Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn at asbjorn.st>

I didn't do a review, but

Ack-by: Thomas Zimmermann <tzimmermann at suse.de>

as it would possible allow to share more code with the fbdev helpers.

Best regards
Thomas

> ---
> This patch applies on top of drm-intel/drm-intel-next (32a120f52a4c)
>
>   drivers/gpu/drm/i915/gem/i915_gem_object.c | 26 ++++++++++++++++++++++
>   1 file changed, 26 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index 58e6c680fe0d..356530b599ce 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -873,6 +873,30 @@ bool i915_gem_object_needs_ccs_pages(struct drm_i915_gem_object *obj)
>   	return lmem_placement;
>   }
>   
> +static int i915_gem_vmap_object(struct drm_gem_object *gem_obj,
> +				struct iosys_map *map)
> +{
> +	struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
> +	void *vaddr;
> +
> +	vaddr = i915_gem_object_pin_map(obj, I915_MAP_WB);
> +	if (IS_ERR(vaddr))
> +		return PTR_ERR(vaddr);
> +
> +	iosys_map_set_vaddr(map, vaddr);
> +
> +	return 0;
> +}
> +
> +static void i915_gem_vunmap_object(struct drm_gem_object *gem_obj,
> +				   struct iosys_map *map)
> +{
> +	struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
> +
> +	i915_gem_object_flush_map(obj);
> +	i915_gem_object_unpin_map(obj);
> +}
> +
>   void i915_gem_init__objects(struct drm_i915_private *i915)
>   {
>   	INIT_WORK(&i915->mm.free_work, __i915_gem_free_work);
> @@ -896,6 +920,8 @@ static const struct drm_gem_object_funcs i915_gem_object_funcs = {
>   	.free = i915_gem_free_object,
>   	.close = i915_gem_close_object,
>   	.export = i915_gem_prime_export,
> +	.vmap = i915_gem_vmap_object,
> +	.vunmap = i915_gem_vunmap_object,
>   };
>   
>   /**

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



More information about the dri-devel mailing list