From: Jocelyn Falempe <jfalempe@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
javierm@redhat.com, jose.exposito89@gmail.com,
arthurgrillo@riseup.net, mairacanal@riseup.net,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
airlied@gmail.com, daniel@ffwll.ch, noralf@tronnes.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 3/5] drm/simpledrm: Store xfrm buffer in device instance
Date: Tue, 26 Sep 2023 09:31:22 +0200 [thread overview]
Message-ID: <c19e0868-b84e-8eb6-909e-9e37e222b809@redhat.com> (raw)
In-Reply-To: <20230920142535.19321-4-tzimmermann@suse.de>
On 20/09/2023 16:24, Thomas Zimmermann wrote:
> Store and instance of struct drm_xfrm_buf in struct simpledrm_device
> and keep the allocated memory allocated across display updates. Avoid
> possibly reallocating temporary memory on each display update. Instead
> preallocate temporary memory during initialization. Releasing the DRM
> device also releases the xfrm buffer.
>
> v2:
> * reserve storage during probe
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/tiny/simpledrm.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 8aceb7d378dea..a3d8a956a4c4e 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -232,6 +232,7 @@ struct simpledrm_device {
> struct drm_display_mode mode;
> const struct drm_format_info *format;
> unsigned int pitch;
> + struct drm_xfrm_buf xfrm;
>
> /* memory management */
> struct iosys_map screen_base;
> @@ -486,7 +487,6 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane
> struct drm_framebuffer *fb = plane_state->fb;
> struct drm_device *dev = plane->dev;
> struct simpledrm_device *sdev = simpledrm_device_of_dev(dev);
> - struct drm_xfrm_buf xfrm = DRM_XFRM_BUF_INIT;
> struct drm_atomic_helper_damage_iter iter;
> struct drm_rect damage;
> int ret, idx;
> @@ -508,13 +508,12 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane
>
> iosys_map_incr(&dst, drm_fb_clip_offset(sdev->pitch, sdev->format, &dst_clip));
> drm_fb_blit(&dst, &sdev->pitch, sdev->format->format, shadow_plane_state->data,
> - fb, &damage, &xfrm);
> + fb, &damage, &sdev->xfrm);
> }
>
> drm_dev_exit(idx);
> out_drm_gem_fb_end_cpu_access:
> drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
> - drm_xfrm_buf_release(&xfrm);
> }
>
> static void simpledrm_primary_plane_helper_atomic_disable(struct drm_plane *plane,
> @@ -637,6 +636,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
> struct drm_connector *connector;
> unsigned long max_width, max_height;
> size_t nformats;
> + void *buf;
> int ret;
>
> sdev = devm_drm_dev_alloc(&pdev->dev, drv, struct simpledrm_device, dev);
> @@ -718,6 +718,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
> drm_dbg(dev, "framebuffer format=%p4cc, size=%dx%d, stride=%d byte\n",
> &format->format, width, height, stride);
>
> + ret = drmm_xfrm_buf_init(dev, &sdev->xfrm);
> + if (ret)
> + return ERR_PTR(ret);
> + buf = drm_xfrm_buf_reserve(&sdev->xfrm, sdev->pitch, GFP_KERNEL);
> + if (!buf)
> + return ERR_PTR(-ENOMEM);
> +
I think it would be nice to have a "init_and_reserve()" function, to
simplify the callers ?
> /*
> * Memory management
> */
next prev parent reply other threads:[~2023-09-26 7:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 14:24 [PATCH v2 0/5] drm: Reuse temporary memory for format conversion Thomas Zimmermann
2023-09-20 14:24 ` [PATCH v2 1/5] drm/format-helper: Add struct drm_xfrm_buf to cache " Thomas Zimmermann
2023-09-29 8:27 ` Javier Martinez Canillas
2023-10-04 7:08 ` Thomas Zimmermann
2023-10-04 7:30 ` Javier Martinez Canillas
2023-09-20 14:24 ` [PATCH v2 2/5] drm/format-helper: Pass xfrm buffer to format-conversion helpers Thomas Zimmermann
2023-09-29 9:04 ` Javier Martinez Canillas
2023-09-20 14:24 ` [PATCH v2 3/5] drm/simpledrm: Store xfrm buffer in device instance Thomas Zimmermann
2023-09-26 7:31 ` Jocelyn Falempe [this message]
2023-09-28 8:15 ` Thomas Zimmermann
2023-09-20 14:24 ` [PATCH v2 4/5] drm/ofdrm: " Thomas Zimmermann
2023-09-20 14:24 ` [PATCH v2 5/5] drm/ssd130x: " Thomas Zimmermann
2023-09-29 9:16 ` Javier Martinez Canillas
2023-09-26 7:28 ` [PATCH v2 0/5] drm: Reuse temporary memory for format conversion Jocelyn Falempe
2023-09-29 12:11 ` Maxime Ripard
2023-09-29 14:58 ` Thomas Zimmermann
2023-10-02 13:24 ` Maxime Ripard
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=c19e0868-b84e-8eb6-909e-9e37e222b809@redhat.com \
--to=jfalempe@redhat.com \
--cc=airlied@gmail.com \
--cc=arthurgrillo@riseup.net \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jose.exposito89@gmail.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mairacanal@riseup.net \
--cc=mripard@kernel.org \
--cc=noralf@tronnes.org \
--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