Skip to content

Commit f086810

Browse files
tombapopcornmix
authored andcommitted
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 <[email protected]>
1 parent 0a7f248 commit f086810

File tree

1 file changed

+17
-11
lines changed
  • drivers/media/platform/raspberrypi/rp1_cfe

1 file changed

+17
-11
lines changed

drivers/media/platform/raspberrypi/rp1_cfe/cfe.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,20 @@ static const struct node_description node_desc[NUM_NODES] = {
199199

200200
#define is_fe_node(node) (((node)->id) >= FE_OUT0)
201201
#define is_csi2_node(node) (!is_fe_node(node))
202-
#define is_image_output_node(node) \
202+
203+
#define is_image_output_node(node) \
203204
(node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
204-
#define is_meta_output_node(node) \
205+
#define is_image_input_node(node) \
206+
(node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
207+
#define is_image_node(node) \
208+
(is_image_output_node(node) || is_image_input_node(node))
209+
210+
#define is_meta_output_node(node) \
205211
(node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_META_CAPTURE)
206-
#define is_meta_input_node(node) \
212+
#define is_meta_input_node(node) \
207213
(node_desc[(node)->id].buf_type == V4L2_BUF_TYPE_META_OUTPUT)
208-
#define is_meta_node(node) (is_meta_output_node(node) || is_meta_input_node(node))
214+
#define is_meta_node(node) \
215+
(is_meta_output_node(node) || is_meta_input_node(node))
209216

210217
/* To track state across all nodes. */
211218
#define NUM_STATES 5
@@ -426,7 +433,7 @@ static int format_show(struct seq_file *s, void *data)
426433
seq_printf(s, "\nNode %u (%s) state: 0x%lx\n", i,
427434
node_desc[i].name, state);
428435

429-
if (is_image_output_node(node))
436+
if (is_image_node(node))
430437
seq_printf(s, "format: " V4L2_FOURCC_CONV " 0x%x\n"
431438
"resolution: %ux%u\nbpl: %u\nsize: %u\n",
432439
V4L2_FOURCC_CONV_ARGS(node->fmt.fmt.pix.pixelformat),
@@ -940,9 +947,8 @@ static int cfe_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
940947
{
941948
struct cfe_node *node = vb2_get_drv_priv(vq);
942949
struct cfe_device *cfe = node->cfe;
943-
unsigned int size = is_image_output_node(node) ?
944-
node->fmt.fmt.pix.sizeimage :
945-
node->fmt.fmt.meta.buffersize;
950+
unsigned int size = is_image_node(node) ? node->fmt.fmt.pix.sizeimage :
951+
node->fmt.fmt.meta.buffersize;
946952

947953
cfe_dbg("%s: [%s]\n", __func__, node_desc[node->id].name);
948954

@@ -973,8 +979,8 @@ static int cfe_buffer_prepare(struct vb2_buffer *vb)
973979
cfe_dbg_verbose("%s: [%s] buffer:%p\n", __func__,
974980
node_desc[node->id].name, vb);
975981

976-
size = is_image_output_node(node) ? node->fmt.fmt.pix.sizeimage :
977-
node->fmt.fmt.meta.buffersize;
982+
size = is_image_node(node) ? node->fmt.fmt.pix.sizeimage :
983+
node->fmt.fmt.meta.buffersize;
978984
if (vb2_plane_size(vb, 0) < size) {
979985
cfe_err("data will not fit into plane (%lu < %lu)\n",
980986
vb2_plane_size(vb, 0), size);
@@ -1757,7 +1763,7 @@ static int cfe_register_node(struct cfe_device *cfe, int id)
17571763
node->cfe = cfe;
17581764
node->id = id;
17591765

1760-
if (is_image_output_node(node)) {
1766+
if (is_image_node(node)) {
17611767
fmt = find_format_by_code(cfe_default_format.code);
17621768
if (!fmt) {
17631769
cfe_err("Failed to find format code\n");

0 commit comments

Comments
 (0)