alistair23-linux/drivers/media/platform/vimc/vimc-streamer.h
Helen Fornazier b6c61a6c37 media: vimc: propagate pixel format in the stream
Media bus codes were being mapped to pixelformats, which causes a
limitation on vimc because not all pixelformats can be mapped to media
bus codes.
Also, media bus codes are an internal configuration from the device.
Userspace only assures media bus codes matches between pads and expects
the image in a given pixelformat. So we can allow almost any media bus
format to be configured between pads, except for debayer that expects a
media bus code of type bayer in the sink pad.

[hverkuil-cisco@xs4all.nl: drop use of v4l2_get_fourcc_name: not yet available]
[hverkuil-cisco@xs4all.nl: made vimc_mbus_list static]

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-04-22 10:58:51 -04:00

59 lines
1.9 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* vimc-streamer.h Virtual Media Controller Driver
*
* Copyright (C) 2018 Lucas A. M. Magalhães <lucmaga@gmail.com>
*
*/
#ifndef _VIMC_STREAMER_H_
#define _VIMC_STREAMER_H_
#include <media/media-device.h>
#include "vimc-common.h"
#define VIMC_STREAMER_PIPELINE_MAX_SIZE 16
/**
* struct vimc_stream - struct that represents a stream in the pipeline
*
* @pipe: the media pipeline object associated with this stream
* @ved_pipeline: array containing all the entities participating in the
* stream. The order is from a video device (usually a capture device) where
* stream_on was called, to the entity generating the first base image to be
* processed in the pipeline.
* @pipe_size: size of @ved_pipeline
* @kthread: thread that generates the frames of the stream.
* @producer_pixfmt: the pixel format requested from the pipeline. This must
* be set just before calling vimc_streamer_s_stream(ent, 1). This value is
* propagated up to the source of the base image (usually a sensor node) and
* can be modified by entities during s_stream callback to request a different
* format from rest of the pipeline.
*
* When the user call stream_on in a video device, struct vimc_stream is
* used to keep track of all entities and subdevices that generates and
* process frames for the stream.
*/
struct vimc_stream {
struct media_pipeline pipe;
struct vimc_ent_device *ved_pipeline[VIMC_STREAMER_PIPELINE_MAX_SIZE];
unsigned int pipe_size;
struct task_struct *kthread;
u32 producer_pixfmt;
};
/**
* vimc_streamer_s_streamer - start/stop the stream
*
* @stream: the pointer to the stream to start or stop
* @ved: The last entity of the streamer pipeline
* @enable: any non-zero number start the stream, zero stop
*
*/
int vimc_streamer_s_stream(struct vimc_stream *stream,
struct vimc_ent_device *ved,
int enable);
#endif //_VIMC_STREAMER_H_