public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sui Jingfeng <sui.jingfeng@linux.dev>
To: 15620332615@163.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
	simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Zhuoheng Li <lizhuoheng@kylinos.cn>
Subject: Re: drm/lsdc: Use drm_gem_dumb_map_offset() helper
Date: Wed, 24 Sep 2025 16:52:08 +0800	[thread overview]
Message-ID: <32f3c69f-707e-4aa9-b194-fe3ec03b238e@linux.dev> (raw)
In-Reply-To: <20250812124418.30914-1-15620332615@163.com>

Hi,

On 2025/8/12 20:44, 15620332615@163.com wrote:
> From: Zhuoheng Li <lizhuoheng@kylinos.cn>
>
> Replace the open-coded mmap offset calculation in the LSDC
> driver with the drm_gem_dumb_map_offset() helper. This avoids
> code duplication and ensures consistency with other DRM
> drivers.


OK, thank you.


> No functional changes intended.


There is a *small* functional change though.

The drm_gem_dumb_map_offset() don't allow imported objects
to be mapped. While, our driver could, in theory, import
a dmabuf and create a GTT object base on it. Then, we
could do some software rendering with the CPU.


> Signed-off-by: Zhuoheng Li <lizhuoheng@kylinos.cn>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   drivers/gpu/drm/loongson/lsdc_drv.c |  2 +-
>   drivers/gpu/drm/loongson/lsdc_gem.c | 16 ----------------
>   drivers/gpu/drm/loongson/lsdc_gem.h |  5 -----
>   3 files changed, 1 insertion(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index 12193d2a301a..7638cb6dd9b2 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -44,7 +44,7 @@ static const struct drm_driver lsdc_drm_driver = {
>   
>   	.debugfs_init = lsdc_debugfs_init,
>   	.dumb_create = lsdc_dumb_create,
> -	.dumb_map_offset = lsdc_dumb_map_offset,
> +	.dumb_map_offset = drm_gem_dumb_map_offset,
>   	.gem_prime_import_sg_table = lsdc_prime_import_sg_table,
>   	DRM_FBDEV_TTM_DRIVER_OPS,
>   };
> diff --git a/drivers/gpu/drm/loongson/lsdc_gem.c b/drivers/gpu/drm/loongson/lsdc_gem.c
> index a720d8f53209..107efd240756 100644
> --- a/drivers/gpu/drm/loongson/lsdc_gem.c
> +++ b/drivers/gpu/drm/loongson/lsdc_gem.c
> @@ -246,22 +246,6 @@ int lsdc_dumb_create(struct drm_file *file, struct drm_device *ddev,
>   	return 0;
>   }
>   
> -int lsdc_dumb_map_offset(struct drm_file *filp, struct drm_device *ddev,
> -			 u32 handle, uint64_t *offset)
> -{
> -	struct drm_gem_object *gobj;
> -
> -	gobj = drm_gem_object_lookup(filp, handle);
> -	if (!gobj)
> -		return -ENOENT;
> -
> -	*offset = drm_vma_node_offset_addr(&gobj->vma_node);
> -
> -	drm_gem_object_put(gobj);
> -
> -	return 0;
> -}
> -
>   void lsdc_gem_init(struct drm_device *ddev)
>   {
>   	struct lsdc_device *ldev = to_lsdc(ddev);
> diff --git a/drivers/gpu/drm/loongson/lsdc_gem.h b/drivers/gpu/drm/loongson/lsdc_gem.h
> index 92cbb10e6e13..f79f06874286 100644
> --- a/drivers/gpu/drm/loongson/lsdc_gem.h
> +++ b/drivers/gpu/drm/loongson/lsdc_gem.h
> @@ -14,11 +14,6 @@ lsdc_prime_import_sg_table(struct drm_device *ddev,
>   			   struct dma_buf_attachment *attach,
>   			   struct sg_table *sg);
>   
> -int lsdc_dumb_map_offset(struct drm_file *file,
> -			 struct drm_device *dev,
> -			 u32 handle,
> -			 uint64_t *offset);
> -
>   int lsdc_dumb_create(struct drm_file *file,
>   		     struct drm_device *ddev,
>   		     struct drm_mode_create_dumb *args);

      parent reply	other threads:[~2025-09-24  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 12:44 [PATCH] drm/lsdc: Use drm_gem_dumb_map_offset() helper 15620332615
2025-08-13 12:23 ` Thomas Zimmermann
2025-09-24  8:52 ` Sui Jingfeng [this message]

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=32f3c69f-707e-4aa9-b194-fe3ec03b238e@linux.dev \
    --to=sui.jingfeng@linux.dev \
    --cc=15620332615@163.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhuoheng@kylinos.cn \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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