Re: [PATCH 8/8] drm/ssd130x: Preallocate xfrm buffer in plane's atomic_check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Am 20.09.23 um 13:10 schrieb Thomas Zimmermann:
[...]
  	if (!fi)
@@ -619,6 +629,15 @@ static int ssd130x_primary_plane_helper_atomic_check(struct drm_plane *plane,
pitch = drm_format_info_min_pitch(fi, 0, ssd130x->width); + if (new_plane_state->fb->format != fi) {
+		void *buf;
+
+		/* format conversion necessary; reserve buffer */
+		buf = drm_xfrm_buf_reserve(&ssd130x->xfrm, pitch, GFP_KERNEL);
+		if (!buf)
+			return -ENOMEM;
+	}

Grrr! Right in the moment I sent this patch, I realized that this code would run concurrently with atomic_update. Hence, it cannot realloc the temporary buffer.

I think drivers could also pre-allocate in the device's probe function after calling drmm_xfrm_buf_init(). It's just enough memory for a single scanline.


+
  	ssd130x_state->buffer = kcalloc(pitch, ssd130x->height, GFP_KERNEL);
  	if (!ssd130x_state->buffer)
  		return -ENOMEM;

--
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)

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux