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