1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
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");
|