Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * vsp1.h  --  R-Car VSP1 API
0004  *
0005  * Copyright (C) 2015 Renesas Electronics Corporation
0006  *
0007  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
0008  */
0009 #ifndef __MEDIA_VSP1_H__
0010 #define __MEDIA_VSP1_H__
0011 
0012 #include <linux/scatterlist.h>
0013 #include <linux/types.h>
0014 #include <linux/videodev2.h>
0015 
0016 struct device;
0017 
0018 int vsp1_du_init(struct device *dev);
0019 
0020 #define VSP1_DU_STATUS_COMPLETE     BIT(0)
0021 #define VSP1_DU_STATUS_WRITEBACK    BIT(1)
0022 
0023 /**
0024  * struct vsp1_du_lif_config - VSP LIF configuration
0025  * @width: output frame width
0026  * @height: output frame height
0027  * @interlaced: true for interlaced pipelines
0028  * @callback: frame completion callback function (optional). When a callback
0029  *        is provided, the VSP driver guarantees that it will be called once
0030  *        and only once for each vsp1_du_atomic_flush() call.
0031  * @callback_data: data to be passed to the frame completion callback
0032  */
0033 struct vsp1_du_lif_config {
0034     unsigned int width;
0035     unsigned int height;
0036     bool interlaced;
0037 
0038     void (*callback)(void *data, unsigned int status, u32 crc);
0039     void *callback_data;
0040 };
0041 
0042 int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
0043               const struct vsp1_du_lif_config *cfg);
0044 
0045 /**
0046  * struct vsp1_du_atomic_config - VSP atomic configuration parameters
0047  * @pixelformat: plane pixel format (V4L2 4CC)
0048  * @pitch: line pitch in bytes for the first plane
0049  * @mem: DMA memory address for each plane of the frame buffer
0050  * @src: source rectangle in the frame buffer (integer coordinates)
0051  * @dst: destination rectangle on the display (integer coordinates)
0052  * @alpha: alpha value (0: fully transparent, 255: fully opaque)
0053  * @zpos: Z position of the plane (from 0 to number of planes minus 1)
0054  */
0055 struct vsp1_du_atomic_config {
0056     u32 pixelformat;
0057     unsigned int pitch;
0058     dma_addr_t mem[3];
0059     struct v4l2_rect src;
0060     struct v4l2_rect dst;
0061     unsigned int alpha;
0062     unsigned int zpos;
0063 };
0064 
0065 /**
0066  * enum vsp1_du_crc_source - Source used for CRC calculation
0067  * @VSP1_DU_CRC_NONE: CRC calculation disabled
0068  * @VSP1_DU_CRC_PLANE: Perform CRC calculation on an input plane
0069  * @VSP1_DU_CRC_OUTPUT: Perform CRC calculation on the composed output
0070  */
0071 enum vsp1_du_crc_source {
0072     VSP1_DU_CRC_NONE,
0073     VSP1_DU_CRC_PLANE,
0074     VSP1_DU_CRC_OUTPUT,
0075 };
0076 
0077 /**
0078  * struct vsp1_du_crc_config - VSP CRC computation configuration parameters
0079  * @source: source for CRC calculation
0080  * @index: index of the CRC source plane (when source is set to plane)
0081  */
0082 struct vsp1_du_crc_config {
0083     enum vsp1_du_crc_source source;
0084     unsigned int index;
0085 };
0086 
0087 /**
0088  * struct vsp1_du_writeback_config - VSP writeback configuration parameters
0089  * @pixelformat: plane pixel format (V4L2 4CC)
0090  * @pitch: line pitch in bytes for the first plane
0091  * @mem: DMA memory address for each plane of the frame buffer
0092  */
0093 struct vsp1_du_writeback_config {
0094     u32 pixelformat;
0095     unsigned int pitch;
0096     dma_addr_t mem[3];
0097 };
0098 
0099 /**
0100  * struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters
0101  * @crc: CRC computation configuration
0102  * @writeback: writeback configuration
0103  */
0104 struct vsp1_du_atomic_pipe_config {
0105     struct vsp1_du_crc_config crc;
0106     struct vsp1_du_writeback_config writeback;
0107 };
0108 
0109 void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index);
0110 int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
0111               unsigned int rpf,
0112               const struct vsp1_du_atomic_config *cfg);
0113 void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
0114               const struct vsp1_du_atomic_pipe_config *cfg);
0115 int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt);
0116 void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
0117 
0118 #endif /* __MEDIA_VSP1_H__ */