Patch "media: hantro: Empty encoder capture buffers by default" has been added to the 5.15-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    media: hantro: Empty encoder capture buffers by default

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-hantro-empty-encoder-capture-buffers-by-defaul.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 817b3a96702b9fad62540b7b2927ae2a1c4073da
Author: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
Date:   Thu Mar 31 09:49:06 2022 +0100

    media: hantro: Empty encoder capture buffers by default
    
    [ Upstream commit 309373a3571ef7175bd9da0c9b13476a718e8478 ]
    
    The payload size for encoder capture buffers is set by the driver upon
    finishing encoding each frame, based on the encoded length returned from
    hardware, and whatever header and padding length used. Setting a
    non-zero default serves no real purpose, and also causes issues if the
    capture buffer is returned to userspace unused, confusing the
    application.
    
    Instead, always set the payload size to 0 for encoder capture buffers
    when preparing them.
    
    Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
    Fixes: 082aaecff35f ("media: hantro: Fix .buf_prepare")
    Signed-off-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
    Reviewed-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
index bcb0bdff4a9a..629bf40a5e5c 100644
--- a/drivers/staging/media/hantro/hantro_v4l2.c
+++ b/drivers/staging/media/hantro/hantro_v4l2.c
@@ -647,8 +647,12 @@ static int hantro_buf_prepare(struct vb2_buffer *vb)
 	 * (for OUTPUT buffers, if userspace passes 0 bytesused, v4l2-core sets
 	 * it to buffer length).
 	 */
-	if (V4L2_TYPE_IS_CAPTURE(vq->type))
-		vb2_set_plane_payload(vb, 0, pix_fmt->plane_fmt[0].sizeimage);
+	if (V4L2_TYPE_IS_CAPTURE(vq->type)) {
+		if (ctx->is_encoder)
+			vb2_set_plane_payload(vb, 0, 0);
+		else
+			vb2_set_plane_payload(vb, 0, pix_fmt->plane_fmt[0].sizeimage);
+	}
 
 	return 0;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux