Mercurial > mplayer.hg
comparison libvo/vo_tdfx_vid.c @ 29263:0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
author | diego |
---|---|
date | Wed, 13 May 2009 02:58:57 +0000 |
parents | c413dfbbbc13 |
children | 32725ca88fed |
comparison
equal
deleted
inserted
replaced
29262:7d545a6b8aff | 29263:0f1b5b68af32 |
---|---|
37 | 37 |
38 #include "fastmemcpy.h" | 38 #include "fastmemcpy.h" |
39 #include "drivers/tdfx_vid.h" | 39 #include "drivers/tdfx_vid.h" |
40 | 40 |
41 | 41 |
42 static const vo_info_t info = | 42 static const vo_info_t info = |
43 { | 43 { |
44 "tdfx vid", | 44 "tdfx vid", |
45 "tdfx_vid", | 45 "tdfx_vid", |
46 "Albeu", | 46 "Albeu", |
47 "" | 47 "" |
76 #if 0 | 76 #if 0 |
77 static void clear_screen(void) { | 77 static void clear_screen(void) { |
78 tdfx_vid_agp_move_t mov; | 78 tdfx_vid_agp_move_t mov; |
79 | 79 |
80 memset(agp_mem,0,tdfx_cfg.screen_width*dst_bpp*tdfx_cfg.screen_height); | 80 memset(agp_mem,0,tdfx_cfg.screen_width*dst_bpp*tdfx_cfg.screen_height); |
81 | 81 |
82 mov.move2 = TDFX_VID_MOVE_2_PACKED; | 82 mov.move2 = TDFX_VID_MOVE_2_PACKED; |
83 mov.width = tdfx_cfg.screen_width*dst_bpp; | 83 mov.width = tdfx_cfg.screen_width*dst_bpp; |
84 mov.height = tdfx_cfg.screen_height; | 84 mov.height = tdfx_cfg.screen_height; |
85 mov.src = 0; | 85 mov.src = 0; |
86 mov.src_stride = tdfx_cfg.screen_width*dst_bpp; | 86 mov.src_stride = tdfx_cfg.screen_width*dst_bpp; |
89 | 89 |
90 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_Move, mov.width,mov.src_stride,mov.height,mov.dst_stride); | 90 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_Move, mov.width,mov.src_stride,mov.height,mov.dst_stride); |
91 | 91 |
92 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) | 92 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) |
93 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AGPMoveFailedToClearTheScreen); | 93 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AGPMoveFailedToClearTheScreen); |
94 | 94 |
95 } | 95 } |
96 #endif | 96 #endif |
97 | 97 |
98 static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | 98 static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) |
99 { | 99 { |
109 case IMGFMT_BGR16: | 109 case IMGFMT_BGR16: |
110 case IMGFMT_BGR24: | 110 case IMGFMT_BGR24: |
111 case IMGFMT_BGR32: | 111 case IMGFMT_BGR32: |
112 // copy :( to agp_mem | 112 // copy :( to agp_mem |
113 // still faster than tdfxfb wich directly copy to the video mem :) | 113 // still faster than tdfxfb wich directly copy to the video mem :) |
114 mem2agpcpy_pic(agp_mem + current_buffer * buffer_size + | 114 mem2agpcpy_pic(agp_mem + current_buffer * buffer_size + |
115 y*buffer_stride[0] + x * src_bpp, | 115 y*buffer_stride[0] + x * src_bpp, |
116 image[0], | 116 image[0], |
117 src_bpp*w,h,buffer_stride[0],stride[0]); | 117 src_bpp*w,h,buffer_stride[0],stride[0]); |
118 return 0; | 118 return 0; |
119 | 119 |
129 ptr[2] = ptr[1] + (src_height*src_width/4); | 129 ptr[2] = ptr[1] + (src_height*src_width/4); |
130 mem2agpcpy_pic(ptr[2] + y/2 * buffer_stride[2] + x/2,image[2],w/2,h/2, | 130 mem2agpcpy_pic(ptr[2] + y/2 * buffer_stride[2] + x/2,image[2],w/2,h/2, |
131 buffer_stride[2],stride[2]); | 131 buffer_stride[2],stride[2]); |
132 return 0; | 132 return 0; |
133 } | 133 } |
134 | 134 |
135 return 1; | 135 return 1; |
136 } | 136 } |
137 | 137 |
138 static void draw_osd(void) | 138 static void draw_osd(void) |
139 { | 139 { |
165 blit.src_x = 0; | 165 blit.src_x = 0; |
166 blit.src_y = 0; | 166 blit.src_y = 0; |
167 blit.src_w = src_width; | 167 blit.src_w = src_width; |
168 blit.src_h = src_height; | 168 blit.src_h = src_height; |
169 blit.src_format = src_fmt; | 169 blit.src_format = src_fmt; |
170 | 170 |
171 blit.dst = front_buffer; | 171 blit.dst = front_buffer; |
172 blit.dst_stride = dst_stride; | 172 blit.dst_stride = dst_stride; |
173 blit.dst_x = 0; | 173 blit.dst_x = 0; |
174 blit.dst_y = 0; | 174 blit.dst_y = 0; |
175 blit.dst_w = src_width; | 175 blit.dst_w = src_width; |
241 if(!(flags & VOFLAG_XOVERLAY_SUB_VO)) { | 241 if(!(flags & VOFLAG_XOVERLAY_SUB_VO)) { |
242 if(!vo_screenwidth) | 242 if(!vo_screenwidth) |
243 vo_screenwidth = tdfx_cfg.screen_width; | 243 vo_screenwidth = tdfx_cfg.screen_width; |
244 if(!vo_screenheight) | 244 if(!vo_screenheight) |
245 vo_screenheight = tdfx_cfg.screen_height; | 245 vo_screenheight = tdfx_cfg.screen_height; |
246 | 246 |
247 aspect_save_orig(width,height); | 247 aspect_save_orig(width,height); |
248 aspect_save_prescale(d_width,d_height); | 248 aspect_save_prescale(d_width,d_height); |
249 aspect_save_screenres(vo_screenwidth,vo_screenheight); | 249 aspect_save_screenres(vo_screenwidth,vo_screenheight); |
250 | 250 |
251 if(flags&VOFLAG_FULLSCREEN) { /* -fs */ | 251 if(flags&VOFLAG_FULLSCREEN) { /* -fs */ |
252 aspect(&d_width,&d_height,A_ZOOM); | 252 aspect(&d_width,&d_height,A_ZOOM); |
253 vo_fs = VO_TRUE; | 253 vo_fs = VO_TRUE; |
254 } else { | 254 } else { |
255 aspect(&d_width,&d_height,A_NOZOOM); | 255 aspect(&d_width,&d_height,A_NOZOOM); |
267 case IMGFMT_BGR32: | 267 case IMGFMT_BGR32: |
268 if(use_overlay) | 268 if(use_overlay) |
269 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_NonNativeOverlayFormatNeedConversion); | 269 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_NonNativeOverlayFormatNeedConversion); |
270 case IMGFMT_BGR15: | 270 case IMGFMT_BGR15: |
271 case IMGFMT_BGR16: | 271 case IMGFMT_BGR16: |
272 src_bpp = ((format & 0x3F)+7)/8; | 272 src_bpp = ((format & 0x3F)+7)/8; |
273 break; | 273 break; |
274 case IMGFMT_YV12: | 274 case IMGFMT_YV12: |
275 case IMGFMT_I420: | 275 case IMGFMT_I420: |
276 buffer_size = src_width * src_height * 3 / 2; | 276 buffer_size = src_width * src_height * 3 / 2; |
277 buffer_stride[0] = ((src_width+1)/2)*2; | 277 buffer_stride[0] = ((src_width+1)/2)*2; |
278 buffer_stride[1] = buffer_stride[2] = buffer_stride[0]/2; | 278 buffer_stride[1] = buffer_stride[2] = buffer_stride[0]/2; |
279 src_fmt = TDFX_VID_FORMAT_YUY2; | 279 src_fmt = TDFX_VID_FORMAT_YUY2; |
280 case IMGFMT_YUY2: | 280 case IMGFMT_YUY2: |
281 case IMGFMT_UYVY: | 281 case IMGFMT_UYVY: |
282 src_bpp = 2; | 282 src_bpp = 2; |
283 break; | 283 break; |
284 default: | 284 default: |
285 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_UnsupportedInputFormat,format); | 285 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_UnsupportedInputFormat,format); |
286 return 1; | 286 return 1; |
349 use_overlay = 0; | 349 use_overlay = 0; |
350 break; | 350 break; |
351 } | 351 } |
352 use_overlay++; | 352 use_overlay++; |
353 } | 353 } |
354 | 354 |
355 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_OverlayReady, | 355 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_OverlayReady, |
356 src_width,src_stride,src_height,src_bpp, | 356 src_width,src_stride,src_height,src_bpp, |
357 dst_width,dst_stride,dst_height,dst_bpp); | 357 dst_width,dst_stride,dst_height,dst_bpp); |
358 break; | 358 break; |
359 } | 359 } |
360 | 360 |
361 if(!use_overlay) | 361 if(!use_overlay) |
362 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_TextureBlitReady, | 362 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_TextureBlitReady, |
363 src_width,src_stride,src_height,src_bpp, | 363 src_width,src_stride,src_height,src_bpp, |
364 dst_width,dst_stride,dst_height,dst_bpp); | 364 dst_width,dst_stride,dst_height,dst_bpp); |
365 | 365 |
366 return 0; | 366 return 0; |
367 } | 367 } |
368 | 368 |
369 static void | 369 static void |
370 uninit(void) | 370 uninit(void) |
383 { | 383 { |
384 } | 384 } |
385 | 385 |
386 static int preinit(const char *arg) | 386 static int preinit(const char *arg) |
387 { | 387 { |
388 | 388 |
389 tdfx_fd = open(arg ? arg : "/dev/tdfx_vid", O_RDWR); | 389 tdfx_fd = open(arg ? arg : "/dev/tdfx_vid", O_RDWR); |
390 if(tdfx_fd < 0) { | 390 if(tdfx_fd < 0) { |
391 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_CantOpen,arg ? arg : "/dev/tdfx_vid", | 391 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_CantOpen,arg ? arg : "/dev/tdfx_vid", |
392 strerror(errno)); | 392 strerror(errno)); |
393 return 1; | 393 return 1; |
414 | 414 |
415 if(agp_mem == MAP_FAILED) { | 415 if(agp_mem == MAP_FAILED) { |
416 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_MemmapFailed); | 416 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_MemmapFailed); |
417 return 1; | 417 return 1; |
418 } | 418 } |
419 | 419 |
420 memset(agp_mem,0,1024*768*4); | 420 memset(agp_mem,0,1024*768*4); |
421 | 421 |
422 return 0; | 422 return 0; |
423 } | 423 } |
424 | 424 |
468 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_GetImageTodo); | 468 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_GetImageTodo); |
469 return VO_FALSE; | 469 return VO_FALSE; |
470 } | 470 } |
471 mpi->flags |= MP_IMGFLAG_DIRECT; | 471 mpi->flags |= MP_IMGFLAG_DIRECT; |
472 mpi->priv = (void*)buf; | 472 mpi->priv = (void*)buf; |
473 | 473 |
474 return VO_TRUE; | 474 return VO_TRUE; |
475 } | 475 } |
476 | 476 |
477 static uint32_t start_slice(mp_image_t *mpi){ | 477 static uint32_t start_slice(mp_image_t *mpi){ |
478 int buf = 0; | 478 int buf = 0; |
524 mov.move2 = TDFX_VID_MOVE_2_PACKED; | 524 mov.move2 = TDFX_VID_MOVE_2_PACKED; |
525 mov.width = mpi->width*((mpi->bpp+7)/8); | 525 mov.width = mpi->width*((mpi->bpp+7)/8); |
526 mov.height = mpi->height; | 526 mov.height = mpi->height; |
527 mov.src = planes[0] - agp_mem; | 527 mov.src = planes[0] - agp_mem; |
528 mov.src_stride = buffer_stride[0]; | 528 mov.src_stride = buffer_stride[0]; |
529 | 529 |
530 mov.dst = back_buffer; | 530 mov.dst = back_buffer; |
531 mov.dst_stride = src_stride; | 531 mov.dst_stride = src_stride; |
532 | 532 |
533 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) | 533 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) |
534 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailed); | 534 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailed); |
535 break; | 535 break; |
536 | 536 |
537 case IMGFMT_YV12: | 537 case IMGFMT_YV12: |
561 yuv.stride = src_stride; | 561 yuv.stride = src_stride; |
562 if(ioctl(tdfx_fd,TDFX_VID_SET_YUV,&yuv)) { | 562 if(ioctl(tdfx_fd,TDFX_VID_SET_YUV,&yuv)) { |
563 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_SetYuvFailed); | 563 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_SetYuvFailed); |
564 break; | 564 break; |
565 } | 565 } |
566 | 566 |
567 | 567 |
568 // Now agp move that | 568 // Now agp move that |
569 // Y | 569 // Y |
570 mov.move2 = TDFX_VID_MOVE_2_YUV; | 570 mov.move2 = TDFX_VID_MOVE_2_YUV; |
571 mov.width = mpi->width; | 571 mov.width = mpi->width; |