0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-25 06:26:15 +00:00
openwrt/target/linux/bcm27xx/patches-6.6/950-0779-media-rp1-cfe-Add-is_image_node.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

92 lines
3.8 KiB
Diff

From 60b53e40b4dc611027c71d6b6d877586a3d508f4 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date: Fri, 22 Sep 2023 13:47:10 +0300
Subject: [PATCH 0779/1085] media: rp1: cfe: Add is_image_node()
The hardware supports streaming from memory (in addition to streaming
from the CSI-2 RX), but the driver does not support this at the moment.
There are multiple places in the driver which uses
is_image_output_node(), even if the "output" part is not relevant. Thus,
in a minor preparation for the possible support for streaming from
memory, and to make it more obvious that the pieces of code are not
about the "output", add is_image_node() which will return true for both
input and output video nodes.
While at it, reformat also the metadata related macros to fit inside 80
columns.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
.../media/platform/raspberrypi/rp1_cfe/cfe.c | 28 +++++++++++--------
1 file changed, 17 insertions(+), 11 deletions(-)
--- a/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
@@ -199,13 +199,20 @@ static const struct node_description nod
#define is_fe_node(node) (((node)->id) >= FE_OUT0)
#define is_csi2_node(node) (!is_fe_node(node))
-#define is_image_output_node(node) \
+
+#define is_image_output_node(node) \
(node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-#define is_meta_output_node(node) \
+#define is_image_input_node(node) \
+ (node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
+#define is_image_node(node) \
+ (is_image_output_node(node) || is_image_input_node(node))
+
+#define is_meta_output_node(node) \
(node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_META_CAPTURE)
-#define is_meta_input_node(node) \
+#define is_meta_input_node(node) \
(node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_META_OUTPUT)
-#define is_meta_node(node) (is_meta_output_node(node) || is_meta_input_node(node))
+#define is_meta_node(node) \
+ (is_meta_output_node(node) || is_meta_input_node(node))
/* To track state across all nodes. */
#define NUM_STATES 5
@@ -426,7 +433,7 @@ static int format_show(struct seq_file *
seq_printf(s, "\nNode %u (%s) state: 0x%lx\n", i,
node_desc[i].name, state);
- if (is_image_output_node(node))
+ if (is_image_node(node))
seq_printf(s, "format: " V4L2_FOURCC_CONV " 0x%x\n"
"resolution: %ux%u\nbpl: %u\nsize: %u\n",
V4L2_FOURCC_CONV_ARGS(node->fmt.fmt.pix.pixelformat),
@@ -940,9 +947,8 @@ static int cfe_queue_setup(struct vb2_qu
{
struct cfe_node *node = vb2_get_drv_priv(vq);
struct cfe_device *cfe = node->cfe;
- unsigned int size = is_image_output_node(node) ?
- node->fmt.fmt.pix.sizeimage :
- node->fmt.fmt.meta.buffersize;
+ unsigned int size = is_image_node(node) ? node->fmt.fmt.pix.sizeimage :
+ node->fmt.fmt.meta.buffersize;
cfe_dbg("%s: [%s]\n", __func__, node_desc[node->id].name);
@@ -973,8 +979,8 @@ static int cfe_buffer_prepare(struct vb2
cfe_dbg_verbose("%s: [%s] buffer:%p\n", __func__,
node_desc[node->id].name, vb);
- size = is_image_output_node(node) ? node->fmt.fmt.pix.sizeimage :
- node->fmt.fmt.meta.buffersize;
+ size = is_image_node(node) ? node->fmt.fmt.pix.sizeimage :
+ node->fmt.fmt.meta.buffersize;
if (vb2_plane_size(vb, 0) < size) {
cfe_err("data will not fit into plane (%lu < %lu)\n",
vb2_plane_size(vb, 0), size);
@@ -1757,7 +1763,7 @@ static int cfe_register_node(struct cfe_
node->cfe = cfe;
node->id = id;
- if (is_image_output_node(node)) {
+ if (is_image_node(node)) {
fmt = find_format_by_code(cfe_default_format.code);
if (!fmt) {
cfe_err("Failed to find format code\n");