2018-04-22 21:33:20 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2015-08-02 17:15:23 +00:00
|
|
|
/*
|
|
|
|
* vsp1_pipe.h -- R-Car VSP1 Pipeline
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013-2015 Renesas Electronics Corporation
|
|
|
|
*
|
|
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
|
|
*/
|
|
|
|
#ifndef __VSP1_PIPE_H__
|
|
|
|
#define __VSP1_PIPE_H__
|
|
|
|
|
2016-01-17 21:53:56 +00:00
|
|
|
#include <linux/kref.h>
|
2015-08-02 17:15:23 +00:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/wait.h>
|
|
|
|
|
|
|
|
#include <media/media-entity.h>
|
|
|
|
|
2015-11-08 22:06:57 +00:00
|
|
|
struct vsp1_dl_list;
|
2015-08-02 17:15:23 +00:00
|
|
|
struct vsp1_rwpf;
|
|
|
|
|
2015-08-03 13:21:49 +00:00
|
|
|
/*
|
|
|
|
* struct vsp1_format_info - VSP1 video format description
|
|
|
|
* @fourcc: V4L2 pixel format FCC identifier
|
2016-06-09 17:57:02 +00:00
|
|
|
* @mbus: media bus format code
|
|
|
|
* @hwfmt: VSP1 hardware format
|
|
|
|
* @swap: swap register control
|
2015-08-03 13:21:49 +00:00
|
|
|
* @planes: number of planes
|
|
|
|
* @bpp: bits per pixel
|
|
|
|
* @swap_yc: the Y and C components are swapped (Y comes before C)
|
|
|
|
* @swap_uv: the U and V components are swapped (V comes before U)
|
|
|
|
* @hsub: horizontal subsampling factor
|
|
|
|
* @vsub: vertical subsampling factor
|
|
|
|
* @alpha: has an alpha channel
|
|
|
|
*/
|
|
|
|
struct vsp1_format_info {
|
|
|
|
u32 fourcc;
|
|
|
|
unsigned int mbus;
|
|
|
|
unsigned int hwfmt;
|
|
|
|
unsigned int swap;
|
|
|
|
unsigned int planes;
|
|
|
|
unsigned int bpp[3];
|
|
|
|
bool swap_yc;
|
|
|
|
bool swap_uv;
|
|
|
|
unsigned int hsub;
|
|
|
|
unsigned int vsub;
|
|
|
|
bool alpha;
|
|
|
|
};
|
|
|
|
|
2015-08-02 17:15:23 +00:00
|
|
|
enum vsp1_pipeline_state {
|
|
|
|
VSP1_PIPELINE_STOPPED,
|
|
|
|
VSP1_PIPELINE_RUNNING,
|
|
|
|
VSP1_PIPELINE_STOPPING,
|
|
|
|
};
|
|
|
|
|
2017-08-04 16:32:42 +00:00
|
|
|
/*
|
2017-08-04 16:32:44 +00:00
|
|
|
* struct vsp1_partition_window - Partition window coordinates
|
2017-08-04 16:32:42 +00:00
|
|
|
* @left: horizontal coordinate of the partition start in pixels relative to the
|
|
|
|
* left edge of the image
|
|
|
|
* @width: partition width in pixels
|
|
|
|
*/
|
2017-08-04 16:32:44 +00:00
|
|
|
struct vsp1_partition_window {
|
2017-08-04 16:32:42 +00:00
|
|
|
unsigned int left;
|
|
|
|
unsigned int width;
|
|
|
|
};
|
|
|
|
|
2017-08-04 16:32:44 +00:00
|
|
|
/*
|
|
|
|
* struct vsp1_partition - A description of a slice for the partition algorithm
|
|
|
|
* @rpf: The RPF partition window configuration
|
|
|
|
* @uds_sink: The UDS input partition window configuration
|
|
|
|
* @uds_source: The UDS output partition window configuration
|
|
|
|
* @sru: The SRU partition window configuration
|
|
|
|
* @wpf: The WPF partition window configuration
|
|
|
|
*/
|
|
|
|
struct vsp1_partition {
|
|
|
|
struct vsp1_partition_window rpf;
|
|
|
|
struct vsp1_partition_window uds_sink;
|
|
|
|
struct vsp1_partition_window uds_source;
|
|
|
|
struct vsp1_partition_window sru;
|
|
|
|
struct vsp1_partition_window wpf;
|
|
|
|
};
|
|
|
|
|
2015-08-02 17:15:23 +00:00
|
|
|
/*
|
|
|
|
* struct vsp1_pipeline - A VSP1 hardware pipeline
|
2015-08-02 21:24:55 +00:00
|
|
|
* @pipe: the media pipeline
|
2015-08-02 17:15:23 +00:00
|
|
|
* @irqlock: protects the pipeline state
|
2015-08-02 21:24:55 +00:00
|
|
|
* @state: current state
|
2016-05-13 22:13:51 +00:00
|
|
|
* @wq: wait queue to wait for state change completion
|
2015-08-02 21:24:55 +00:00
|
|
|
* @frame_end: frame end interrupt handler
|
2015-08-02 17:15:23 +00:00
|
|
|
* @lock: protects the pipeline use count and stream count
|
2016-01-17 21:53:56 +00:00
|
|
|
* @kref: pipeline reference count
|
2015-08-02 21:24:55 +00:00
|
|
|
* @stream_count: number of streaming video nodes
|
|
|
|
* @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
|
2016-04-10 05:59:04 +00:00
|
|
|
* @sequence: frame sequence number
|
2015-08-02 21:24:55 +00:00
|
|
|
* @num_inputs: number of RPFs
|
2015-08-05 19:40:31 +00:00
|
|
|
* @inputs: array of RPFs in the pipeline (indexed by RPF index)
|
2015-08-02 21:24:55 +00:00
|
|
|
* @output: WPF at the output of the pipeline
|
2018-02-26 16:06:21 +00:00
|
|
|
* @brx: BRx entity, if present
|
2016-02-24 23:40:22 +00:00
|
|
|
* @hgo: HGO entity, if present
|
2016-09-06 14:38:56 +00:00
|
|
|
* @hgt: HGT entity, if present
|
2015-08-02 21:24:55 +00:00
|
|
|
* @lif: LIF entity, if present
|
|
|
|
* @uds: UDS entity, if present
|
|
|
|
* @uds_input: entity at the input of the UDS, if the UDS is present
|
|
|
|
* @entities: list of entities in the pipeline
|
2018-05-18 20:42:03 +00:00
|
|
|
* @stream_config: cached stream configuration for video pipelines
|
|
|
|
* @configured: when false the @stream_config shall be written to the hardware
|
2018-08-03 11:37:29 +00:00
|
|
|
* @interlaced: True when the pipeline is configured in interlaced mode
|
2016-07-12 13:06:34 +00:00
|
|
|
* @partitions: The number of partitions used to process one frame
|
2017-08-04 16:32:40 +00:00
|
|
|
* @partition: The current partition for configuration to process
|
|
|
|
* @part_table: The pre-calculated partitions used by the pipeline
|
2015-08-02 17:15:23 +00:00
|
|
|
*/
|
|
|
|
struct vsp1_pipeline {
|
|
|
|
struct media_pipeline pipe;
|
|
|
|
|
|
|
|
spinlock_t irqlock;
|
|
|
|
enum vsp1_pipeline_state state;
|
|
|
|
wait_queue_head_t wq;
|
|
|
|
|
2018-04-04 21:30:49 +00:00
|
|
|
void (*frame_end)(struct vsp1_pipeline *pipe, unsigned int completion);
|
2015-08-02 17:15:23 +00:00
|
|
|
|
|
|
|
struct mutex lock;
|
2016-01-17 21:53:56 +00:00
|
|
|
struct kref kref;
|
2015-08-02 17:15:23 +00:00
|
|
|
unsigned int stream_count;
|
|
|
|
unsigned int buffers_ready;
|
2016-04-10 05:59:04 +00:00
|
|
|
unsigned int sequence;
|
2015-08-02 17:15:23 +00:00
|
|
|
|
|
|
|
unsigned int num_inputs;
|
|
|
|
struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
|
|
|
|
struct vsp1_rwpf *output;
|
2018-02-26 16:06:21 +00:00
|
|
|
struct vsp1_entity *brx;
|
2016-02-24 23:40:22 +00:00
|
|
|
struct vsp1_entity *hgo;
|
2016-09-06 14:38:56 +00:00
|
|
|
struct vsp1_entity *hgt;
|
2015-08-02 17:15:23 +00:00
|
|
|
struct vsp1_entity *lif;
|
|
|
|
struct vsp1_entity *uds;
|
|
|
|
struct vsp1_entity *uds_input;
|
|
|
|
|
2017-08-04 16:32:44 +00:00
|
|
|
/*
|
|
|
|
* The order of this list must be identical to the order of the entities
|
|
|
|
* in the pipeline, as it is assumed by the partition algorithm that we
|
|
|
|
* can walk this list in sequence.
|
|
|
|
*/
|
2015-08-02 17:15:23 +00:00
|
|
|
struct list_head entities;
|
2015-09-07 04:40:25 +00:00
|
|
|
|
2018-05-18 20:42:03 +00:00
|
|
|
struct vsp1_dl_body *stream_config;
|
|
|
|
bool configured;
|
2018-08-03 11:37:29 +00:00
|
|
|
bool interlaced;
|
2016-07-12 13:06:34 +00:00
|
|
|
|
|
|
|
unsigned int partitions;
|
2017-08-04 16:32:42 +00:00
|
|
|
struct vsp1_partition *partition;
|
|
|
|
struct vsp1_partition *part_table;
|
2015-08-02 17:15:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
|
2015-08-02 20:32:13 +00:00
|
|
|
void vsp1_pipeline_init(struct vsp1_pipeline *pipe);
|
2015-08-02 17:15:23 +00:00
|
|
|
|
|
|
|
void vsp1_pipeline_run(struct vsp1_pipeline *pipe);
|
|
|
|
bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe);
|
|
|
|
int vsp1_pipeline_stop(struct vsp1_pipeline *pipe);
|
|
|
|
bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe);
|
|
|
|
|
|
|
|
void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);
|
|
|
|
|
|
|
|
void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
|
2018-05-18 20:42:02 +00:00
|
|
|
struct vsp1_dl_body *dlb,
|
|
|
|
unsigned int alpha);
|
2015-08-02 17:15:23 +00:00
|
|
|
|
2017-08-04 16:32:44 +00:00
|
|
|
void vsp1_pipeline_propagate_partition(struct vsp1_pipeline *pipe,
|
|
|
|
struct vsp1_partition *partition,
|
|
|
|
unsigned int index,
|
|
|
|
struct vsp1_partition_window *window);
|
|
|
|
|
2016-09-15 19:08:09 +00:00
|
|
|
const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1,
|
|
|
|
u32 fourcc);
|
2015-08-03 13:21:49 +00:00
|
|
|
|
2015-08-02 17:15:23 +00:00
|
|
|
#endif /* __VSP1_PIPE_H__ */
|