Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/drivers/media/video/davinci/vpif_display.h
17683 views
1
/*
2
* DM646x display header file
3
*
4
* Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License as
8
* published by the Free Software Foundation version 2.
9
*
10
* This program is distributed .as is. WITHOUT ANY WARRANTY of any
11
* kind, whether express or implied; without even the implied warranty
12
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*/
15
16
#ifndef DAVINCIHD_DISPLAY_H
17
#define DAVINCIHD_DISPLAY_H
18
19
/* Header files */
20
#include <linux/videodev2.h>
21
#include <linux/version.h>
22
#include <media/v4l2-common.h>
23
#include <media/v4l2-device.h>
24
#include <media/videobuf-core.h>
25
#include <media/videobuf-dma-contig.h>
26
27
#include "vpif.h"
28
29
/* Macros */
30
#define VPIF_MAJOR_RELEASE (0)
31
#define VPIF_MINOR_RELEASE (0)
32
#define VPIF_BUILD (1)
33
34
#define VPIF_DISPLAY_VERSION_CODE \
35
((VPIF_MAJOR_RELEASE << 16) | (VPIF_MINOR_RELEASE << 8) | VPIF_BUILD)
36
37
#define VPIF_VALID_FIELD(field) \
38
(((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \
39
(((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \
40
(V4L2_FIELD_SEQ_BT == field)))
41
42
#define VPIF_DISPLAY_MAX_DEVICES (2)
43
#define VPIF_SLICED_BUF_SIZE (256)
44
#define VPIF_SLICED_MAX_SERVICES (3)
45
#define VPIF_VIDEO_INDEX (0)
46
#define VPIF_VBI_INDEX (1)
47
#define VPIF_HBI_INDEX (2)
48
49
/* Setting it to 1 as HBI/VBI support yet to be added , else 3*/
50
#define VPIF_NUMOBJECTS (1)
51
52
/* Macros */
53
#define ISALIGNED(a) (0 == ((a) & 7))
54
55
/* enumerated data types */
56
/* Enumerated data type to give id to each device per channel */
57
enum vpif_channel_id {
58
VPIF_CHANNEL2_VIDEO = 0, /* Channel2 Video */
59
VPIF_CHANNEL3_VIDEO, /* Channel3 Video */
60
};
61
62
/* structures */
63
64
struct video_obj {
65
enum v4l2_field buf_field;
66
u32 latest_only; /* indicate whether to return
67
* most recent displayed frame only */
68
v4l2_std_id stdid; /* Currently selected or default
69
* standard */
70
u32 dv_preset;
71
struct v4l2_bt_timings bt_timings;
72
u32 output_id; /* Current output id */
73
};
74
75
struct vbi_obj {
76
int num_services;
77
struct vpif_vbi_params vbiparams; /* vpif parameters for the raw
78
* vbi data */
79
};
80
81
struct common_obj {
82
/* Buffer specific parameters */
83
u8 *fbuffers[VIDEO_MAX_FRAME]; /* List of buffer pointers for
84
* storing frames */
85
u32 numbuffers; /* number of buffers */
86
struct videobuf_buffer *cur_frm; /* Pointer pointing to current
87
* videobuf_buffer */
88
struct videobuf_buffer *next_frm; /* Pointer pointing to next
89
* videobuf_buffer */
90
enum v4l2_memory memory; /* This field keeps track of
91
* type of buffer exchange
92
* method user has selected */
93
struct v4l2_format fmt; /* Used to store the format */
94
struct videobuf_queue buffer_queue; /* Buffer queue used in
95
* video-buf */
96
struct list_head dma_queue; /* Queue of filled frames */
97
spinlock_t irqlock; /* Used in video-buf */
98
99
/* channel specific parameters */
100
struct mutex lock; /* lock used to access this
101
* structure */
102
u32 io_usrs; /* number of users performing
103
* IO */
104
u8 started; /* Indicates whether streaming
105
* started */
106
u32 ytop_off; /* offset of Y top from the
107
* starting of the buffer */
108
u32 ybtm_off; /* offset of Y bottom from the
109
* starting of the buffer */
110
u32 ctop_off; /* offset of C top from the
111
* starting of the buffer */
112
u32 cbtm_off; /* offset of C bottom from the
113
* starting of the buffer */
114
/* Function pointer to set the addresses */
115
void (*set_addr) (unsigned long, unsigned long,
116
unsigned long, unsigned long);
117
u32 height;
118
u32 width;
119
};
120
121
struct channel_obj {
122
/* V4l2 specific parameters */
123
struct video_device *video_dev; /* Identifies video device for
124
* this channel */
125
struct v4l2_prio_state prio; /* Used to keep track of state of
126
* the priority */
127
atomic_t usrs; /* number of open instances of
128
* the channel */
129
u32 field_id; /* Indicates id of the field
130
* which is being displayed */
131
u8 initialized; /* flag to indicate whether
132
* encoder is initialized */
133
134
enum vpif_channel_id channel_id;/* Identifies channel */
135
struct vpif_params vpifparams;
136
struct common_obj common[VPIF_NUMOBJECTS];
137
struct video_obj video;
138
struct vbi_obj vbi;
139
};
140
141
/* File handle structure */
142
struct vpif_fh {
143
struct channel_obj *channel; /* pointer to channel object for
144
* opened device */
145
u8 io_allowed[VPIF_NUMOBJECTS]; /* Indicates whether this file handle
146
* is doing IO */
147
enum v4l2_priority prio; /* Used to keep track priority of
148
* this instance */
149
u8 initialized; /* Used to keep track of whether this
150
* file handle has initialized
151
* channel or not */
152
};
153
154
/* vpif device structure */
155
struct vpif_device {
156
struct v4l2_device v4l2_dev;
157
struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS];
158
struct v4l2_subdev **sd;
159
160
};
161
162
struct vpif_config_params {
163
u32 min_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
164
u32 channel_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
165
u8 numbuffers[VPIF_DISPLAY_NUM_CHANNELS];
166
u8 min_numbuffers;
167
};
168
169
/* Struct which keeps track of the line numbers for the sliced vbi service */
170
struct vpif_service_line {
171
u16 service_id;
172
u16 service_line[2];
173
u16 enc_service_id;
174
u8 bytestowrite;
175
};
176
177
#endif /* DAVINCIHD_DISPLAY_H */
178
179