1de2362d3Smrg#ifndef __RADEON_VIDEO_H__
2de2362d3Smrg#define __RADEON_VIDEO_H__
3de2362d3Smrg
4de2362d3Smrg#include "xf86i2c.h"
5de2362d3Smrg#include "i2c_def.h"
6de2362d3Smrg
7de2362d3Smrg#include "xf86Crtc.h"
8de2362d3Smrg
9de2362d3Smrg#include "bicubic_table.h"
10de2362d3Smrg
11de2362d3Smrg#include <xf86xvmc.h>
12de2362d3Smrg
13de2362d3Smrg#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v))
14de2362d3Smrg
15de2362d3Smrg/* Xvideo port struct */
16de2362d3Smrgtypedef struct {
17de2362d3Smrg   uint32_t	 transform_index;
18de2362d3Smrg   uint32_t	 gamma; /* gamma value x 1000 */
19de2362d3Smrg   int           brightness;
20de2362d3Smrg   int           saturation;
21de2362d3Smrg   int           hue;
22de2362d3Smrg   int           contrast;
2318781e08Smrg
24de2362d3Smrg   unsigned char currentBuffer;
25de2362d3Smrg   RegionRec     clip;
2618781e08Smrg
27de2362d3Smrg   Time          offTime;
28de2362d3Smrg   Time          freeTime;
29de2362d3Smrg   xf86CrtcPtr   desired_crtc;
30de2362d3Smrg
31de2362d3Smrg   int           size;
32de2362d3Smrg
3318781e08Smrg   struct radeon_bo *video_memory;
34de2362d3Smrg
35de2362d3Smrg   int           planeu_offset;
36de2362d3Smrg   int           planev_offset;
37de2362d3Smrg
38de2362d3Smrg   /* bicubic filtering */
39de2362d3Smrg   Bool          bicubic_enabled;
40de2362d3Smrg   int           bicubic_state;
41de2362d3Smrg#define BICUBIC_OFF  0
42de2362d3Smrg#define BICUBIC_ON   1
43de2362d3Smrg#define BICUBIC_AUTO 2
44de2362d3Smrg
45de2362d3Smrg    /* textured video */
46de2362d3Smrg    Bool textured;
47de2362d3Smrg    DrawablePtr pDraw;
48de2362d3Smrg    PixmapPtr pPixmap;
49de2362d3Smrg
50de2362d3Smrg    uint32_t src_pitch;
51de2362d3Smrg    uint8_t *src_addr;
52de2362d3Smrg
53de2362d3Smrg    int id;
54de2362d3Smrg    int src_w, src_h, dst_w, dst_h;
55de2362d3Smrg    int w, h;
56de2362d3Smrg    int drw_x, drw_y;
57de2362d3Smrg    int src_x, src_y;
58de2362d3Smrg    int vsync;
59de2362d3Smrg    Bool is_planar;
60de2362d3Smrg    int vtx_count;
61de2362d3Smrg    int hw_align;
62de2362d3Smrg
63de2362d3Smrg    struct radeon_bo *src_bo[2];
64de2362d3Smrg} RADEONPortPrivRec, *RADEONPortPrivPtr;
65de2362d3Smrg
66de2362d3Smrg/* Reference color space transform data */
67de2362d3Smrgtypedef struct tagREF_TRANSFORM
68de2362d3Smrg{
69de2362d3Smrg    float   RefLuma;
70de2362d3Smrg    float   RefRCb;
71de2362d3Smrg    float   RefRCr;
72de2362d3Smrg    float   RefGCb;
73de2362d3Smrg    float   RefGCr;
74de2362d3Smrg    float   RefBCb;
75de2362d3Smrg    float   RefBCr;
76de2362d3Smrg} REF_TRANSFORM;
77de2362d3Smrg
78de2362d3Smrg#define RTFSaturation(a)   (1.0 + ((a)*1.0)/1000.0)
79de2362d3Smrg#define RTFBrightness(a)   (((a)*1.0)/2000.0)
80de2362d3Smrg#define RTFIntensity(a)   (((a)*1.0)/2000.0)
81de2362d3Smrg#define RTFContrast(a)   (1.0 + ((a)*1.0)/1000.0)
82de2362d3Smrg#define RTFHue(a)   (((a)*3.1416)/1000.0)
83de2362d3Smrg
84de2362d3SmrgXF86VideoAdaptorPtr
85de2362d3SmrgRADEONSetupImageTexturedVideo(ScreenPtr pScreen);
86de2362d3Smrg
87de2362d3SmrgXF86MCAdaptorPtr
88861b9feeSmrgRADEONCreateAdaptorXvMC(ScreenPtr pScreen, const char *xv_adaptor_name);
89de2362d3Smrg
90de2362d3Smrgvoid
91de2362d3SmrgRADEONCopyData(ScrnInfoPtr pScrn,
92de2362d3Smrg	       unsigned char *src, unsigned char *dst,
93de2362d3Smrg	       unsigned int srcPitch, unsigned int dstPitch,
94de2362d3Smrg	       unsigned int h, unsigned int w, unsigned int bpp);
95de2362d3Smrg
96de2362d3Smrgvoid
97de2362d3SmrgRADEONCopyMungedData(ScrnInfoPtr pScrn,
98de2362d3Smrg		     unsigned char *src1, unsigned char *src2,
99de2362d3Smrg		     unsigned char *src3, unsigned char *dst1,
100de2362d3Smrg		     unsigned int srcPitch, unsigned int srcPitch2,
101de2362d3Smrg		     unsigned int dstPitch, unsigned int h, unsigned int w);
102de2362d3Smrg
10318781e08SmrgBool radeon_crtc_is_enabled(xf86CrtcPtr crtc);
10418781e08Smrg
105de2362d3Smrg#endif
106