annotate libvo/vo_mga.c @ 17463:b56f34ba3f2f

proper support for shared libpostproc patch by Nico Sabbi, fixes and consistency cleanups by me
author diego
date Sun, 22 Jan 2006 18:11:35 +0000
parents fd51fd1ff231
children a107276371a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
7679
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
2 * output through mga_vid kernel driver
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 #include <sys/mman.h>
4595
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
17 #include <linux/fb.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #include "drivers/mga_vid.h"
616
41d6eec69b60 clean up
pontscho
parents: 614
diff changeset
20 #include "sub.h"
2317
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
21 #include "aspect.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7680
diff changeset
23 static vo_info_t info =
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 {
7679
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
25 "Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 "mga",
7679
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
27 "A'rpi",
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
28 "Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7680
diff changeset
31 LIBVO_EXTERN(mga)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #include "mga_common.c"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
4595
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
35 #define FBDEV "/dev/fb0"
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
36
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15218
diff changeset
37 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39
5433
d596cf3c54aa open(/dev/mga_vid) moved to preinit
arpi
parents: 5389
diff changeset
40 // if (f >= 0) mga_uninit();
4595
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
41 if(!vo_screenwidth || !vo_screenheight) {
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
42 int fd;
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
43 struct fb_var_screeninfo fbinfo;
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
44
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
45 if(-1 != (fd = open(FBDEV, O_RDONLY))) {
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
46 if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) {
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
47 if(!vo_screenwidth) vo_screenwidth = fbinfo.xres;
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
48 if(!vo_screenheight) vo_screenheight = fbinfo.yres;
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
49 } else {
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
50 perror("FBIOGET_VSCREENINFO");
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
51 }
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
52 close(fd);
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
53 } else {
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
54 perror(FBDEV);
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
55 }
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
56 }
6f54ae46ac27 screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents: 4592
diff changeset
57
2317
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
58 if(vo_screenwidth && vo_screenheight){
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
59 aspect_save_orig(width,height);
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
60 aspect_save_prescale(d_width,d_height);
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
61 aspect_save_screenres(vo_screenwidth,vo_screenheight);
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
62
15218
090c8df3f6fe 100l to Jindrich! Changing the parameter name in the body, too.
rathann
parents: 15212
diff changeset
63 if(flags&VOFLAG_FULLSCREEN) { /* -fs */
2318
atmos4
parents: 2317
diff changeset
64 aspect(&d_width,&d_height,A_ZOOM);
5987
08c552788216 fullscreen toggle for vo_mga
rfelker
parents: 5433
diff changeset
65 vo_fs = VO_TRUE;
08c552788216 fullscreen toggle for vo_mga
rfelker
parents: 5433
diff changeset
66 } else {
2317
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
67 aspect(&d_width,&d_height,A_NOZOOM);
5987
08c552788216 fullscreen toggle for vo_mga
rfelker
parents: 5433
diff changeset
68 vo_fs = VO_FALSE;
08c552788216 fullscreen toggle for vo_mga
rfelker
parents: 5433
diff changeset
69 }
2319
9c76ec4846b3 Add some info putput for aspect().
atmos4
parents: 2318
diff changeset
70 printf("vo_mga aspect(): resized to %dx%d\n",d_width,d_height);
2317
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
71 }
1f1880196a1c Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents: 1637
diff changeset
72
9994
275766100443 fix panscan font resizing with vo_mga
rfelker
parents: 8148
diff changeset
73 vo_dwidth=d_width; vo_dheight=d_height;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 mga_vid_config.dest_width = d_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 mga_vid_config.dest_height= d_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
2351
c53969b13353 Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents: 2319
diff changeset
78 if(vo_screenwidth && vo_screenheight){
c53969b13353 Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents: 2319
diff changeset
79 mga_vid_config.x_org=(vo_screenwidth-d_width)/2;
c53969b13353 Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents: 2319
diff changeset
80 mga_vid_config.y_org=(vo_screenheight-d_height)/2;
c53969b13353 Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents: 2319
diff changeset
81 }
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
82
7679
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
83 return mga_init(width,height,format);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85
7679
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
86 static void uninit(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 {
7679
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
88 printf("vo: uninit!\n");
e4e70b0e1786 some cleanup
arpi
parents: 7124
diff changeset
89 mga_uninit();
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
92 static void flip_page(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
93 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
94 vo_mga_flip_page();
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
95 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
97
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
98 static void check_events(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
99 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
100 }
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
101