radeon_video.h revision 2f39173d
1#ifndef __RADEON_VIDEO_H__
2#define __RADEON_VIDEO_H__
3
4#include "xf86i2c.h"
5#include "fi1236.h"
6#include "msp3430.h"
7#include "tda9885.h"
8#include "uda1380.h"
9#include "i2c_def.h"
10
11#include "generic_bus.h"
12#include "theatre.h"
13
14#include "xf86Crtc.h"
15
16#include "bicubic_table.h"
17
18#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v))
19
20/* Xvideo port struct */
21typedef struct {
22   uint32_t	 transform_index;
23   uint32_t	 gamma; /* gamma value x 1000 */
24   int           brightness;
25   int           saturation;
26   int           hue;
27   int           contrast;
28   int           red_intensity;
29   int           green_intensity;
30   int           blue_intensity;
31
32	/* overlay composition mode */
33   int		 alpha_mode; /* 0 = key mode, 1 = global mode */
34   int		 ov_alpha;
35   int		 gr_alpha;
36
37     /* i2c bus and devices */
38   I2CBusPtr     i2c;
39   uint32_t      radeon_i2c_timing;
40   uint32_t      radeon_M;
41   uint32_t      radeon_N;
42   uint32_t      i2c_status;
43   uint32_t      i2c_cntl;
44
45   FI1236Ptr     fi1236;
46   uint8_t       tuner_type;
47   MSP3430Ptr    msp3430;
48   TDA9885Ptr    tda9885;
49   UDA1380Ptr    uda1380;
50
51   /* VIP bus and devices */
52   GENERIC_BUS_Ptr  VIP;
53   TheatrePtr       theatre;
54
55   Bool          video_stream_active;
56   int           encoding;
57   uint32_t      frequency;
58   int           volume;
59   Bool          mute;
60   int           sap_channel;
61   int           v;
62   uint32_t      adjustment; /* general purpose variable */
63
64#define METHOD_BOB      0
65#define METHOD_SINGLE   1
66#define METHOD_WEAVE    2
67#define METHOD_ADAPTIVE 3
68
69   int           overlay_deinterlacing_method;
70
71   int           capture_vbi_data;
72
73   int           dec_brightness;
74   int           dec_saturation;
75   int           dec_hue;
76   int           dec_contrast;
77
78   Bool          doubleBuffer;
79   unsigned char currentBuffer;
80   RegionRec     clip;
81   uint32_t      colorKey;
82   uint32_t      videoStatus;
83   Time          offTime;
84   Time          freeTime;
85   Bool          autopaint_colorkey;
86   xf86CrtcPtr   desired_crtc;
87
88   int           size;
89
90   void         *video_memory;
91   int           video_offset;
92
93   int           planeu_offset;
94   int           planev_offset;
95
96   /* bicubic filtering */
97   Bool          bicubic_enabled;
98   uint32_t      bicubic_src_offset;
99   int           bicubic_state;
100#define BICUBIC_OFF  0
101#define BICUBIC_ON   1
102#define BICUBIC_AUTO 2
103
104   Atom          device_id, location_id, instance_id;
105
106    /* textured video */
107    Bool textured;
108    DrawablePtr pDraw;
109    PixmapPtr pPixmap;
110
111    uint32_t src_offset;
112    uint32_t src_pitch;
113    uint8_t *src_addr;
114
115    int id;
116    int src_w, src_h, dst_w, dst_h;
117    int w, h;
118    int drw_x, drw_y;
119    int src_x, src_y;
120    int vsync;
121    Bool is_planar;
122    int vtx_count;
123
124    struct radeon_bo *src_bo[2];
125} RADEONPortPrivRec, *RADEONPortPrivPtr;
126
127/* Reference color space transform data */
128typedef struct tagREF_TRANSFORM
129{
130    float   RefLuma;
131    float   RefRCb;
132    float   RefRCr;
133    float   RefGCb;
134    float   RefGCr;
135    float   RefBCb;
136    float   RefBCr;
137} REF_TRANSFORM;
138
139#define RTFSaturation(a)   (1.0 + ((a)*1.0)/1000.0)
140#define RTFBrightness(a)   (((a)*1.0)/2000.0)
141#define RTFIntensity(a)   (((a)*1.0)/2000.0)
142#define RTFContrast(a)   (1.0 + ((a)*1.0)/1000.0)
143#define RTFHue(a)   (((a)*3.1416)/1000.0)
144
145void RADEONInitI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
146void RADEONResetI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
147
148void RADEONVIP_init(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
149void RADEONVIP_reset(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
150
151int  RADEONSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
152int  RADEONGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer);
153void RADEONStopVideo(ScrnInfoPtr, pointer, Bool);
154void RADEONQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short,
155			 unsigned int *, unsigned int *, pointer);
156int  RADEONQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
157			unsigned short *,  int *, int *);
158
159XF86VideoAdaptorPtr
160RADEONSetupImageTexturedVideo(ScreenPtr pScreen);
161
162void
163RADEONCopyData(ScrnInfoPtr pScrn,
164	       unsigned char *src, unsigned char *dst,
165	       unsigned int srcPitch, unsigned int dstPitch,
166	       unsigned int h, unsigned int w, unsigned int bpp);
167
168void
169RADEONCopyMungedData(ScrnInfoPtr pScrn,
170		     unsigned char *src1, unsigned char *src2,
171		     unsigned char *src3, unsigned char *dst1,
172		     unsigned int srcPitch, unsigned int srcPitch2,
173		     unsigned int dstPitch, unsigned int h, unsigned int w);
174
175#endif
176