Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
0004  */
0005 #ifndef VPBE_DISPLAY_H
0006 #define VPBE_DISPLAY_H
0007 
0008 /* Header files */
0009 #include <linux/videodev2.h>
0010 #include <media/v4l2-common.h>
0011 #include <media/v4l2-fh.h>
0012 #include <media/videobuf2-v4l2.h>
0013 #include <media/videobuf2-dma-contig.h>
0014 #include <media/davinci/vpbe_types.h>
0015 #include <media/davinci/vpbe_osd.h>
0016 #include <media/davinci/vpbe.h>
0017 
0018 #define VPBE_DISPLAY_MAX_DEVICES 2
0019 
0020 enum vpbe_display_device_id {
0021     VPBE_DISPLAY_DEVICE_0,
0022     VPBE_DISPLAY_DEVICE_1
0023 };
0024 
0025 #define VPBE_DISPLAY_DRV_NAME   "vpbe-display"
0026 
0027 #define VPBE_DISPLAY_MAJOR_RELEASE              1
0028 #define VPBE_DISPLAY_MINOR_RELEASE              0
0029 #define VPBE_DISPLAY_BUILD                      1
0030 #define VPBE_DISPLAY_VERSION_CODE ((VPBE_DISPLAY_MAJOR_RELEASE << 16) | \
0031     (VPBE_DISPLAY_MINOR_RELEASE << 8)  | \
0032     VPBE_DISPLAY_BUILD)
0033 
0034 #define VPBE_DISPLAY_VALID_FIELD(field)   ((V4L2_FIELD_NONE == field) || \
0035      (V4L2_FIELD_ANY == field) || (V4L2_FIELD_INTERLACED == field))
0036 
0037 /* Exp ratio numerator and denominator constants */
0038 #define VPBE_DISPLAY_H_EXP_RATIO_N  9
0039 #define VPBE_DISPLAY_H_EXP_RATIO_D  8
0040 #define VPBE_DISPLAY_V_EXP_RATIO_N  6
0041 #define VPBE_DISPLAY_V_EXP_RATIO_D  5
0042 
0043 /* Zoom multiplication factor */
0044 #define VPBE_DISPLAY_ZOOM_4X    4
0045 #define VPBE_DISPLAY_ZOOM_2X    2
0046 
0047 /* Structures */
0048 struct display_layer_info {
0049     int enable;
0050     /* Layer ID used by Display Manager */
0051     enum osd_layer id;
0052     struct osd_layer_config config;
0053     enum osd_zoom_factor h_zoom;
0054     enum osd_zoom_factor v_zoom;
0055     enum osd_h_exp_ratio h_exp;
0056     enum osd_v_exp_ratio v_exp;
0057 };
0058 
0059 struct vpbe_disp_buffer {
0060     struct vb2_v4l2_buffer vb;
0061     struct list_head list;
0062 };
0063 
0064 /* vpbe display object structure */
0065 struct vpbe_layer {
0066     /* Pointer to the vpbe_display */
0067     struct vpbe_display *disp_dev;
0068     /* Pointer pointing to current v4l2_buffer */
0069     struct vpbe_disp_buffer *cur_frm;
0070     /* Pointer pointing to next v4l2_buffer */
0071     struct vpbe_disp_buffer *next_frm;
0072     /* videobuf specific parameters
0073      * Buffer queue used in video-buf
0074      */
0075     struct vb2_queue buffer_queue;
0076     /* Queue of filled frames */
0077     struct list_head dma_queue;
0078     /* Used in video-buf */
0079     spinlock_t irqlock;
0080     /* V4l2 specific parameters */
0081     /* Identifies video device for this layer */
0082     struct video_device video_dev;
0083     /* Used to store pixel format */
0084     struct v4l2_pix_format pix_fmt;
0085     enum v4l2_field buf_field;
0086     /* Video layer configuration params */
0087     struct display_layer_info layer_info;
0088     /* vpbe specific parameters
0089      * enable window for display
0090      */
0091     unsigned char window_enable;
0092     /* number of open instances of the layer */
0093     unsigned int usrs;
0094     /* Indicates id of the field which is being displayed */
0095     unsigned int field_id;
0096     /* Identifies device object */
0097     enum vpbe_display_device_id device_id;
0098     /* facilitation of ioctl ops lock by v4l2*/
0099     struct mutex opslock;
0100     u8 layer_first_int;
0101 };
0102 
0103 /* vpbe device structure */
0104 struct vpbe_display {
0105     /* layer specific parameters */
0106     /* lock for isr updates to buf layers*/
0107     spinlock_t dma_queue_lock;
0108     /* C-Plane offset from start of y-plane */
0109     unsigned int cbcr_ofst;
0110     struct vpbe_layer *dev[VPBE_DISPLAY_MAX_DEVICES];
0111     struct vpbe_device *vpbe_dev;
0112     struct osd_state *osd_device;
0113 };
0114 
0115 struct buf_config_params {
0116     unsigned char min_numbuffers;
0117     unsigned char numbuffers[VPBE_DISPLAY_MAX_DEVICES];
0118     unsigned int min_bufsize[VPBE_DISPLAY_MAX_DEVICES];
0119     unsigned int layer_bufsize[VPBE_DISPLAY_MAX_DEVICES];
0120 };
0121 
0122 #endif  /* VPBE_DISPLAY_H */