comparison libvo/vo_vesa.c @ 2676:d3393d940aa5

Fixed rgb2rgb in DGA mode
author nick
date Sun, 04 Nov 2001 11:50:52 +0000
parents d05fc32b7984
children 44ff6b5c7cea
comparison
equal deleted inserted replaced
2675:cd2841d7d35e 2676:d3393d940aa5
85 static uint8_t *dga_buffer = NULL; /* for yuv2rgb and sw_scaling */ 85 static uint8_t *dga_buffer = NULL; /* for yuv2rgb and sw_scaling */
86 static unsigned video_mode; /* selected video mode for playback */ 86 static unsigned video_mode; /* selected video mode for playback */
87 static struct VesaModeInfoBlock video_mode_info; 87 static struct VesaModeInfoBlock video_mode_info;
88 static int flip_trigger = 0; 88 static int flip_trigger = 0;
89 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); 89 static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
90 static void (*rgb2rgb_fnc)(uint8_t *src,uint8_t *dst,uint32_t src_size); 90 static void (*rgb2rgb_fnc)(const uint8_t *src,uint8_t *dst,uint32_t src_size);
91 91
92 /* multibuffering */ 92 /* multibuffering */
93 uint8_t* video_base; /* should be never changed */ 93 uint8_t* video_base; /* should be never changed */
94 uint32_t multi_buff[MAX_BUFFERS]; /* contains offsets of buffers */ 94 uint32_t multi_buff[MAX_BUFFERS]; /* contains offsets of buffers */
95 uint8_t multi_size=0; /* total number of buffers */ 95 uint8_t multi_size=0; /* total number of buffers */
163 int shift_r = video_mode_info.RedFieldPosition; 163 int shift_r = video_mode_info.RedFieldPosition;
164 int shift_g = video_mode_info.GreenFieldPosition; 164 int shift_g = video_mode_info.GreenFieldPosition;
165 int shift_b = video_mode_info.BlueFieldPosition; 165 int shift_b = video_mode_info.BlueFieldPosition;
166 int pixel_size = (video_mode_info.BitsPerPixel+7)/8; 166 int pixel_size = (video_mode_info.BitsPerPixel+7)/8;
167 int bpl = video_mode_info.BytesPerScanLine; 167 int bpl = video_mode_info.BytesPerScanLine;
168 int color, offset; 168 int color;
169 unsigned offset;
169 170
170 if (x < 0 || x >= x_res || y < 0 || y >= y_res) return; 171 if (x < 0 || x >= x_res || y < 0 || y >= y_res) return;
171 r >>= 8 - video_mode_info.RedMaskSize; 172 r >>= 8 - video_mode_info.RedMaskSize;
172 g >>= 8 - video_mode_info.GreenMaskSize; 173 g >>= 8 - video_mode_info.GreenMaskSize;
173 b >>= 8 - video_mode_info.BlueMaskSize; 174 b >>= 8 - video_mode_info.BlueMaskSize;
204 Copies frame to video memory. Data should be in the same format as video 205 Copies frame to video memory. Data should be in the same format as video
205 memory. 206 memory.
206 */ 207 */
207 208
208 #define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8) 209 #define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
209 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*pixel_size) 210 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
210 #define IMAGE_LINE_SIZE(pixel_size) (image_width*pixel_size) 211 #define IMAGE_LINE_SIZE(pixel_size) (image_width*(pixel_size))
211 212
212 static void __vbeCopyData(uint8_t *image) 213 static void __vbeCopyData(uint8_t *image)
213 { 214 {
214 unsigned long i,j,image_offset,offset; 215 unsigned long i,j,image_offset,offset;
215 unsigned pixel_size,image_line_size,screen_line_size,x_shift; 216 unsigned pixel_size,image_line_size,screen_line_size,x_shift;
341 if(rgb2rgb_fnc) 342 if(rgb2rgb_fnc)
342 { 343 {
343 if(HAS_DGA()) 344 if(HAS_DGA())
344 { 345 {
345 size_t i, psize, ssize, dsize; 346 size_t i, psize, ssize, dsize;
346 uint8_t *dest, *sptr; 347 uint8_t *dest;
348 const uint8_t *sptr;
347 psize = PIXEL_SIZE(); 349 psize = PIXEL_SIZE();
348 dsize = SCREEN_LINE_SIZE(psize); 350 dsize = SCREEN_LINE_SIZE(psize);
349 ssize = IMAGE_LINE_SIZE(image_bpp); 351 ssize = IMAGE_LINE_SIZE((image_bpp+7)/8);
350 dest = dga_buffer/* + y_offset*dsize + x_offset*psize*/; 352 dest = dga_buffer + y_offset*dsize + x_offset*psize;
351 sptr = src[0]; 353 sptr = src[0];
352 for(i=0;i<image_height;i++) 354 for(i=0;i<image_height;i++)
353 { 355 {
354 (*rgb2rgb_fnc)(sptr,dest,ssize); 356 (*rgb2rgb_fnc)(sptr,dest,ssize);
355 sptr += ssize; 357 sptr += ssize;