11de3582 | 10-Aug-2024 |
John Keeping <jkeeping@inmusicbrands.com> |
media: rockchip: rga: fix rga offset lookup
The arguments to rga_lookup_draw_pos() are passed in the wrong order, rotate mode should be before mirror mode.
Fixes: 558c248f930e6 ("media: rockchip: r
media: rockchip: rga: fix rga offset lookup
The arguments to rga_lookup_draw_pos() are passed in the wrong order, rotate mode should be before mirror mode.
Fixes: 558c248f930e6 ("media: rockchip: rga: split src and dst buffer setup") Cc: stable@vger.kernel.org Signed-off-by: John Keeping <jkeeping@inmusicbrands.com> Reviewed-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
show more ...
|
db71a7f5 | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: add NV12M support
Add support for the multi-planar variants of NV12. The RGA is now able to exchange DMABUFs with other devices that only support multi-planar NV12, for example
media: rockchip: rga: add NV12M support
Add support for the multi-planar variants of NV12. The RGA is now able to exchange DMABUFs with other devices that only support multi-planar NV12, for example the Hantro JPEG encoder.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
a61ff67f | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: rework buffer handling for multi-planar formats
Multi-planar formats may have multiple planes that must be handled and correctly mapped into a continuous buffer for the RGA by
media: rockchip: rga: rework buffer handling for multi-planar formats
Multi-planar formats may have multiple planes that must be handled and correctly mapped into a continuous buffer for the RGA by using the DMA descriptors.
The plane offsets in the continuous mapping may now start at page boundaries and the previous calculation based on the frame sizes is only valid for planar buffers in a single memory. Therefore, the offsets must be detected and set while creating the mapping.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
0148bcd7 | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: switch to multi-planar API
Switch to the multi-planar API, which allows to handle buffers with separate planes.
The RGA driver doesn't expose multi-planar formats, yet. The ex
media: rockchip: rga: switch to multi-planar API
Switch to the multi-planar API, which allows to handle buffers with separate planes.
The RGA driver doesn't expose multi-planar formats, yet. The existing contiguous planar formats can be used with the multi-planar API as well, but the multi-planar API is required for multi-planar formats.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
2addee7a | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: use macros for testing buffer type
Use the provided V4L2_TYPE_IS_{OUTPUT,CAPTURE} macros to check if the buffer or queue is OUTPUT or CAPTURE. The macros work also work for the
media: rockchip: rga: use macros for testing buffer type
Use the provided V4L2_TYPE_IS_{OUTPUT,CAPTURE} macros to check if the buffer or queue is OUTPUT or CAPTURE. The macros work also work for the _MPLANE buffer and queue types and make it easier to switch to the multi-planar API.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
4e4dd24e | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: add local variable for pix_format
The local variable allows to simplify the accessed to the format and makes it easier to change the type of the format.
Signed-off-by: Michael
media: rockchip: rga: add local variable for pix_format
The local variable allows to simplify the accessed to the format and makes it easier to change the type of the format.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
012602c5 | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: use pixelformat to find format
Use the pixelformat instead of the v4l2_format to find the rga_fmt. This avoids knowing the structure and type of v4l2_format in rga_fmt_find and
media: rockchip: rga: use pixelformat to find format
Use the pixelformat instead of the v4l2_format to find the rga_fmt. This avoids knowing the structure and type of v4l2_format in rga_fmt_find and simplifies the function.
Also cleanup the users of the function. In try_fmt always return the found pixel format to make sure that the pixel format is always set. Thus, we can be sure that we will find the rga_fmt in s_fmt and can drop the check if a given format has been found.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
60faf2b8 | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: use clamp() to clamp size to limits
The try_fmt should limit the width and height to the know limits of the RGA. Use the clamp() helper instead of open coding the clamping.
Si
media: rockchip: rga: use clamp() to clamp size to limits
The try_fmt should limit the width and height to the know limits of the RGA. Use the clamp() helper instead of open coding the clamping.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
ec9ef8dd | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: set dma mask to 32 bits
The RGA DMA descriptor list contains only 32-bit addresses. Set the dma_mask to only allocate memory that is addressable by the descriptors.
This preve
media: rockchip: rga: set dma mask to 32 bits
The RGA DMA descriptor list contains only 32-bit addresses. Set the dma_mask to only allocate memory that is addressable by the descriptors.
This prevents errors when preparing vb2 buffers that were allocated by the RGA.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
25783e2a | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: pre-calculate plane offsets
Calculate the plane offsets and store them with the video buffer while creating the buffer mapping.
This allows the driver to more freely handle th
media: rockchip: rga: pre-calculate plane offsets
Calculate the plane offsets and store them with the video buffer while creating the buffer mapping.
This allows the driver to more freely handle the memory of the DMA mapping as the offsets and the mapping can be kept in sync.
The driver still has to update the offsets to respect the configured cropping and rotation, but this calculation is now separated from the calculation of the plane offsets.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
558c248f | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: split src and dst buffer setup
Split the register setup for the source and destination video buffers into separate functions.
This is a cleanup to make the code more readable
media: rockchip: rga: split src and dst buffer setup
Split the register setup for the source and destination video buffers into separate functions.
This is a cleanup to make the code more readable by separating the offset calculation for the different buffers and prepares the driver for using pre-calculated offsets of planes.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
6040702a | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: allocate DMA descriptors per buffer
The RGA driver allocates two buffers for the DMA descriptors of the input and output buffers. Whenever a new job is processed, the descripto
media: rockchip: rga: allocate DMA descriptors per buffer
The RGA driver allocates two buffers for the DMA descriptors of the input and output buffers. Whenever a new job is processed, the descriptor list is updated for the current buffers.
By updating the descriptor list during buf_prepare, it is possible to correctly fail DMABUF imports if the buffers that shall be imported are not within the 32 bit address range that can be addressed by the RGA.
Managing the DMA descriptor list with the buffer also makes it easier to track the buffer mapping and the plane offsets into this mapping.
The cost is that the driver now requires DMA coherent memory per buffer for the descriptor list. However, the size scales with the size of the video buffers and is not allocated if the RGA is not used.
While at it, use dma_alloc_coherent to allocate the descriptors and get rid of the virt_to_phys calls to get the physical addresses.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|
77f2e2b2 | 13-Oct-2023 |
Michael Tretter <m.tretter@pengutronix.de> |
media: rockchip: rga: extract helper to fill descriptors
The IOMMU of the RGA is programmed with a list of DMA descriptors that contain an 32 bit address per 4k page in the video buffers. The addres
media: rockchip: rga: extract helper to fill descriptors
The IOMMU of the RGA is programmed with a list of DMA descriptors that contain an 32 bit address per 4k page in the video buffers. The address in the descriptor points to the start address of the page.
Introduce 'struct rga_dma_desc' to make the handling of the DMA descriptors explicit instead of hiding them behind standard types.
While at it, use provided helpers for iterating the sg_table instead of manually calculating the DMA addresses.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
show more ...
|