radeon_video.h revision b7e1c893
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   Bool          planar_hw;
94   Bool          planar_state;
95   int           planeu_offset;
96   int           planev_offset;
97
98   /* bicubic filtering */
99   void         *bicubic_memory;
100   int           bicubic_offset;
101   Bool          bicubic_enabled;
102   uint32_t      bicubic_src_offset;
103   int           bicubic_state;
104#define BICUBIC_OFF  0
105#define BICUBIC_ON   1
106#define BICUBIC_AUTO 2
107
108   Atom          device_id, location_id, instance_id;
109
110    /* textured video */
111    Bool textured;
112    DrawablePtr pDraw;
113    PixmapPtr pPixmap;
114
115    uint32_t src_offset;
116    uint32_t src_pitch;
117    uint8_t *src_addr;
118
119    int id;
120    int src_w, src_h, dst_w, dst_h;
121    int w, h;
122    int drw_x, drw_y;
123    int vsync;
124} RADEONPortPrivRec, *RADEONPortPrivPtr;
125
126xf86CrtcPtr
127radeon_xv_pick_best_crtc(ScrnInfoPtr pScrn,
128			 int x1, int x2, int y1, int y2);
129
130void RADEONInitI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
131void RADEONResetI2C(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
132
133void RADEONVIP_init(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
134void RADEONVIP_reset(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv);
135
136int  RADEONSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
137int  RADEONGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer);
138void RADEONStopVideo(ScrnInfoPtr, pointer, Bool);
139void RADEONQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short,
140			 unsigned int *, unsigned int *, pointer);
141int  RADEONQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
142			unsigned short *,  int *, int *);
143
144XF86VideoAdaptorPtr
145RADEONSetupImageTexturedVideo(ScreenPtr pScreen);
146
147void
148RADEONCopyData(ScrnInfoPtr pScrn,
149	       unsigned char *src, unsigned char *dst,
150	       unsigned int srcPitch, unsigned int dstPitch,
151	       unsigned int h, unsigned int w, unsigned int bpp);
152
153void
154RADEONCopyMungedData(ScrnInfoPtr pScrn,
155		     unsigned char *src1, unsigned char *src2,
156		     unsigned char *src3, unsigned char *dst1,
157		     unsigned int srcPitch, unsigned int srcPitch2,
158		     unsigned int dstPitch, unsigned int h, unsigned int w);
159
160#endif
161