Mercurial > mplayer.hg
annotate libvo/vo_s3fb.c @ 36920:40ad45360c8a
Replace old item 'potmeter' by new item 'pimage'.
Recent versions of the X11/GTK GUI didn't allow to control a potmeter,
because that didn't seem to make any sense.
In order to get rid of the confusing potmeter that doesn't distinguish
from a hpotmeter and in order to allow the more useful behaviour recent
versions of the X11/GTK GUI have been utilized (and because we're still
supporting item 'potmeter' for reasons of compatibility with old skins),
introduce new item 'pimage' that reuses most of the current potmeter
code.
Additionally, remove remaining code and documentation of 'potmeter'.
author | ib |
---|---|
date | Mon, 17 Mar 2014 12:29:46 +0000 |
parents | cb3210c03df6 |
children |
rev | line source |
---|---|
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
1 /* |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
2 * copyright (C) 2006 Mark Sanderson <mmp@kiora.ath.cx> |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
3 * |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
4 * 30-Mar-2006 Modified from tdfxfb.c by Mark Zealey |
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
5 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
6 * This file is part of MPlayer. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
7 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
11 * (at your option) any later version. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
12 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
16 * GNU General Public License for more details. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
17 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
21 */ |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
22 |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
25220
diff
changeset
|
23 /* Hints and tricks: |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
24 * - Use -dr to get direct rendering |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
25 * - Use -vf yuy2 to get yuy2 rendering, *MUCH* faster than yv12 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
26 */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
27 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
28 #include <stdio.h> |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
29 #include <stdlib.h> |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
30 #include <errno.h> |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
31 #include <string.h> |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
32 #include <unistd.h> |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
33 #include <sys/ioctl.h> |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
34 #include <fcntl.h> |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
35 #include <linux/fb.h> |
18541
0df97a9423d0
include sys/io.h instead of asm/io.h so iopl() gets declared too
ivo
parents:
18540
diff
changeset
|
36 #include <sys/io.h> |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
37 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
38 #include "config.h" |
33412
2a2e9b6551d8
configure: Convert HAVE_SYS_MMAN_H into a 0/1 definition.
diego
parents:
33305
diff
changeset
|
39 #if HAVE_SYS_MMAN_H |
18540
fb07cde79487
only include sys/mman.h if HAVE_SYS_MMAN_H is defined
ivo
parents:
18535
diff
changeset
|
40 #include <sys/mman.h> |
fb07cde79487
only include sys/mman.h if HAVE_SYS_MMAN_H is defined
ivo
parents:
18535
diff
changeset
|
41 #endif |
18542 | 42 #include "mp_msg.h" |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
43 #include "fastmemcpy.h" |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
44 #include "video_out.h" |
36627
cb3210c03df6
vo_s3fb: Fix wrong define, draw_slice stub was removed, not draw_frame.
reimar
parents:
36517
diff
changeset
|
45 #define NO_DRAW_SLICE |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
46 #include "video_out_internal.h" |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
47 #include "aspect.h" |
32467 | 48 #include "sub/sub.h" |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
49 |
25216 | 50 static const vo_info_t info = |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
51 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
52 "S3 Virge over fbdev", |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
53 "s3fb", |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
54 "Mark Sanderson <mmp@kiora.ath.cx>", |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
55 "" |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
56 }; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
57 |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
58 const LIBVO_EXTERN(s3fb) |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
59 |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
60 typedef struct vga_type { |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
61 int cr38, cr39, cr53; |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
62 unsigned char *mmio; |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
63 } vga_t; |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
64 |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
65 static vga_t *v = NULL; |
18691 | 66 static int fd = -1; |
67 static struct fb_fix_screeninfo fb_finfo; | |
68 static struct fb_var_screeninfo fb_vinfo; | |
69 static uint32_t in_width, in_height, in_format, in_depth, in_s3_format, | |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
70 screenwidth, screenheight, screendepth, screenstride, |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
71 vidwidth, vidheight, vidx, vidy, page, offset, sreg; |
18691 | 72 static char *inpage, *inpage0, *smem = NULL; |
33845
786d1187960d
libvo: extend alpha_func function pointers with parameter type declaration
diego
parents:
33412
diff
changeset
|
73 static void (*alpha_func)(int, int, unsigned char*, unsigned char*, int, unsigned char*, int); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
74 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27509
diff
changeset
|
75 static void clear_screen(void); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
76 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
77 /* streams registers */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
78 #define PSTREAM_CONTROL_REG 0x8180 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
79 #define COL_CHROMA_KEY_CONTROL_REG 0x8184 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
80 #define SSTREAM_CONTROL_REG 0x8190 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
81 #define CHROMA_KEY_UPPER_BOUND_REG 0x8194 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
82 #define SSTREAM_STRETCH_REG 0x8198 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
83 #define BLEND_CONTROL_REG 0x81A0 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
84 #define PSTREAM_FBADDR0_REG 0x81C0 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
85 #define PSTREAM_FBADDR1_REG 0x81C4 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
86 #define PSTREAM_STRIDE_REG 0x81C8 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
87 #define DOUBLE_BUFFER_REG 0x81CC |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
88 #define SSTREAM_FBADDR0_REG 0x81D0 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
89 #define SSTREAM_FBADDR1_REG 0x81D4 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
90 #define SSTREAM_STRIDE_REG 0x81D8 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
91 #define OPAQUE_OVERLAY_CONTROL_REG 0x81DC |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
92 #define K1_VSCALE_REG 0x81E0 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
93 #define K2_VSCALE_REG 0x81E4 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
94 #define DDA_VERT_REG 0x81E8 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
95 #define STREAMS_FIFO_REG 0x81EC |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
96 #define PSTREAM_START_REG 0x81F0 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
97 #define PSTREAM_WINDOW_SIZE_REG 0x81F4 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
98 #define SSTREAM_START_REG 0x81F8 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
99 #define SSTREAM_WINDOW_SIZE_REG 0x81FC |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
100 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
101 #define S3_MEMBASE sreg |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
102 #define S3_NEWMMIO_REGBASE 0x1000000 /* 16MB */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
103 #define S3_NEWMMIO_REGSIZE 0x10000 /* 64KB */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
104 #define S3V_MMIO_REGSIZE 0x8000 /* 32KB */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
105 #define S3_NEWMMIO_VGABASE (S3_NEWMMIO_REGBASE + 0x8000) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
106 |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
107 #define OUTREG(mmreg, value) *(unsigned int *)(&v->mmio[mmreg]) = value |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
108 |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
109 static int readcrtc(int reg) |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
110 { |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
111 outb(reg, 0x3d4); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
112 return inb(0x3d5); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
113 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
114 |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
115 static void writecrtc(int reg, int value) |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
116 { |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
117 outb(reg, 0x3d4); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
118 outb(value, 0x3d5); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
119 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
120 |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
121 // enable S3 registers |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
122 static int enable(void) |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
123 { |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
124 int fd; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
125 |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
126 if (v) |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
127 return 1; |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
128 errno = 0; |
18878 | 129 v = malloc(sizeof(vga_t)); |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
130 if (v) { |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
131 if (ioperm(0x3d4, 2, 1) == 0) { |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
132 fd = open("/dev/mem", O_RDWR); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
133 if (fd != -1) { |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
134 v->mmio = mmap(0, S3_NEWMMIO_REGSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
135 S3_MEMBASE + S3_NEWMMIO_REGBASE); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
136 close(fd); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
137 if (v->mmio != MAP_FAILED) { |
18691 | 138 v->cr38 = readcrtc(0x38); |
139 v->cr39 = readcrtc(0x39); | |
140 v->cr53 = readcrtc(0x53); | |
141 writecrtc(0x38, 0x48); | |
142 writecrtc(0x39, 0xa5); | |
143 writecrtc(0x53, 0x08); | |
144 return 1; | |
145 } | |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
146 } |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
147 iopl(0); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
148 } |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
149 free(v); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
150 v = NULL; |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
151 } |
24250 | 152 return 0; |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
153 } |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
154 |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
155 static void disable(void) |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
156 { |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
157 if (v) { |
18691 | 158 writecrtc(0x53, v->cr53); |
159 writecrtc(0x39, v->cr39); | |
160 writecrtc(0x38, v->cr38); | |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
161 ioperm(0x3d4, 2, 0); |
18691 | 162 munmap(v->mmio, S3_NEWMMIO_REGSIZE); |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
163 free(v); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
164 v = NULL; |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
165 } |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
166 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
167 |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
168 static int yuv_on(int format, int src_w, int src_h, int dst_x, int dst_y, |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
169 int dst_w, int dst_h, int crop, int xres, int yres, |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
170 int line_length, int offset) |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
171 { |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
172 int tmp, pitch, start, src_wc, src_hc, bpp; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
173 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
174 if (format == 0 || format == 7) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
175 bpp = 4; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
176 else if (format == 6) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
177 bpp = 3; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
178 else |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
179 bpp = 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
180 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
181 src_wc = src_w - crop * 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
182 src_hc = src_h - crop * 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
183 pitch = src_w * bpp; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
184 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
185 // video card memory layout: |
18691 | 186 // 0-n: visible screen memory, n = width * height * bytes per pixel |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
187 // n-m: scaler source memory, n is aligned to a page boundary |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
188 // m+: scaler source memory for multiple buffers |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
189 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
190 // offset is the first aligned byte after the screen memory, where the scaler input buffer is |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
191 tmp = (yres * line_length + 4095) & ~4095; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
192 offset += tmp; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
193 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
194 // start is the top left viewable scaler input pixel |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
195 start = offset + crop * pitch + crop * bpp; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
196 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
197 OUTREG(COL_CHROMA_KEY_CONTROL_REG, 0x47000000); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
198 OUTREG(CHROMA_KEY_UPPER_BOUND_REG, 0x0); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
199 OUTREG(BLEND_CONTROL_REG, 0x00000020); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
200 OUTREG(DOUBLE_BUFFER_REG, 0x0); /* Choose fbaddr0 as stream source. */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
201 OUTREG(OPAQUE_OVERLAY_CONTROL_REG, 0x0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
202 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
203 OUTREG(PSTREAM_CONTROL_REG, 0x06000000); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
204 OUTREG(PSTREAM_FBADDR0_REG, 0x0); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
205 OUTREG(PSTREAM_FBADDR1_REG, 0x0); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
206 OUTREG(PSTREAM_STRIDE_REG, line_length); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
207 OUTREG(PSTREAM_START_REG, 0x00010001); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
208 OUTREG(PSTREAM_WINDOW_SIZE_REG, 0x00010001); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
209 //OUTREG(SSTREAM_WINDOW_SIZE_REG, ( ((xres-1) << 16) | yres) & 0x7ff07ff); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
210 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
211 if (dst_w == src_w) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
212 tmp = 0; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
213 else |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
214 tmp = 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
215 /* format 1=YCbCr-16 2=YUV-16 3=BGR15 4=YUV-16/32(mixed 2/4byte stride) 5=BGR16 6=BGR24 0,7=BGR32 */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
216 /* The YUV format pixel has a range of value from 0 to 255, while the YCbCr format pixel values are in the range of 16 to 240. */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
217 OUTREG(SSTREAM_CONTROL_REG, tmp << 28 | (format << 24) | |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
218 ((((src_wc-1)<<1)-(dst_w-1)) & 0xfff)); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
219 OUTREG(SSTREAM_STRETCH_REG, |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
220 ((src_wc - 1) & 0x7ff) | (((src_wc - dst_w-1) & 0x7ff) << 16)); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
221 OUTREG(SSTREAM_FBADDR0_REG, start & 0x3fffff ); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
222 OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff ); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
223 OUTREG(SSTREAM_START_REG, ((dst_x + 1) << 16) | (dst_y + 1)); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
224 OUTREG(SSTREAM_WINDOW_SIZE_REG, ( ((dst_w-1) << 16) | (dst_h ) ) & 0x7ff07ff); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
225 OUTREG(K1_VSCALE_REG, src_hc - 1 ); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
226 OUTREG(K2_VSCALE_REG, (src_hc - dst_h) & 0x7ff ); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
227 /* 0xc000 = bw & vert interp */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
228 /* 0x8000 = no bw save */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
229 OUTREG(DDA_VERT_REG, (((~dst_h)-1) & 0xfff ) | 0xc000); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
230 writecrtc(0x92, (((pitch + 7) / 8) >> 8) | 0x80); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
231 writecrtc(0x93, (pitch + 7) / 8); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
232 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
233 writecrtc(0x67, readcrtc(0x67) | 0x4); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
234 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
235 return offset; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
236 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
237 |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
238 static void yuv_off(void) |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
29263
diff
changeset
|
239 { |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
240 writecrtc(0x67, readcrtc(0x67) & ~0xc); |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
241 memset(v->mmio + 0x8180, 0, 0x80); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
242 OUTREG(0x81b8, 0x900); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
243 OUTREG(0x81bc, 0x900); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
244 OUTREG(0x81c8, 0x900); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
245 OUTREG(0x81cc, 0x900); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
246 OUTREG(0x81d8, 0x1); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
247 OUTREG(0x81f8, 0x07ff07ff); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
248 OUTREG(0x81fc, 0x00010001); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
249 writecrtc(0x92, 0); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
250 writecrtc(0x93, 0); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
251 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
252 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
253 static int preinit(const char *arg) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
254 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
255 char *name; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
256 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
257 if(arg) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
258 name = (char*)arg; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
259 else if(!(name = getenv("FRAMEBUFFER"))) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
260 name = "/dev/fb0"; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
261 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
262 if((fd = open(name, O_RDWR)) == -1) { |
18542 | 263 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: can't open %s: %s\n", name, strerror(errno)); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
264 return -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
265 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
266 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
267 if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) { |
18542 | 268 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: problem with FBITGET_FSCREENINFO ioctl: %s\n", |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
269 strerror(errno)); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
270 close(fd); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
271 fd = -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
272 return -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
273 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
274 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
275 if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { |
18542 | 276 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: problem with FBITGET_VSCREENINFO ioctl: %s\n", |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
277 strerror(errno)); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
278 close(fd); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
279 fd = -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
280 return -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
281 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
282 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
283 // Check the depth now as config() musn't fail |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
284 switch(fb_vinfo.bits_per_pixel) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
285 case 16: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
286 case 24: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
287 case 32: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
288 break; // Ok |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
289 default: |
18542 | 290 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: %d bpp output is not supported\n", fb_vinfo.bits_per_pixel); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
291 close(fd); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
292 fd = -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
293 return -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
294 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
295 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
296 /* Open up a window to the hardware */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
297 smem = mmap(0, fb_finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
298 sreg = fb_finfo.smem_start; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
299 |
18692 | 300 if(smem == (void *)-1) { |
18542 | 301 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Couldn't map memory areas: %s\n", strerror(errno)); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
302 smem = NULL; |
18553
f85b5c5d5d18
Remove dead code, and do close smem file descriptor during un-init
poirierg
parents:
18542
diff
changeset
|
303 close(fd); |
f85b5c5d5d18
Remove dead code, and do close smem file descriptor during un-init
poirierg
parents:
18542
diff
changeset
|
304 fd = -1; |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
305 return -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
306 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
307 |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
308 if (!enable()) { |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
309 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Couldn't map S3 registers: %s\n", strerror(errno)); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
310 close(fd); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
311 fd = -1; |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
312 return -1; |
18691 | 313 } |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
314 |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
315 return 0; // Success |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
316 } |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
317 |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
318 /* And close our mess */ |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
319 static void uninit(void) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
320 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
321 if (inpage0) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
322 clear_screen(); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
323 yuv_off(); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
324 inpage0 = NULL; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
325 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
326 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
327 if(smem) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
328 munmap(smem, fb_finfo.smem_len); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
329 smem = NULL; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
330 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
331 |
18690
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
332 disable(); |
f31c0f34db76
Fixes suggested by Ivo, and failure under non-root operation improved. Original patch by Mark Sanderson < mmp AH kiora P ath P cx > (reworked a bit to try to meet out commit policy).
gpoirier
parents:
18553
diff
changeset
|
333 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
334 if(fd != -1) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
335 close(fd); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
336 fd = -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
337 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
338 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
339 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
27509
diff
changeset
|
340 static void clear_screen(void) |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
341 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
342 if (inpage0) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
343 int n; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
344 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
345 memset(smem, 0, screenheight * screenstride); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
346 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
347 if (in_format == IMGFMT_YUY2) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
348 unsigned short *ptr; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
349 int i; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
350 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
351 ptr = (unsigned short *)inpage0; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
352 n = in_width * in_height; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
353 if (vo_doublebuffering) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
354 n *= 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
355 for(i=0; i<n; i++) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
356 *ptr++ = 0x8000; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
357 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
358 } else { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
359 n = in_depth * in_width * in_height; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
360 if (vo_doublebuffering) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
361 n *= 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
362 memset(inpage0, 0, n); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
363 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
364 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
365 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
366 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
367 /* Setup output screen dimensions etc */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
368 static void setup_screen(uint32_t full) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
369 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
370 int inpageoffset; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
371 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
372 aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
373 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
374 // center picture |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
375 vidx = (screenwidth - vidwidth) / 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
376 vidy = (screenheight - vidheight) / 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
377 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
378 geometry(&vidx, &vidy, &vidwidth, &vidheight, screenwidth, screenheight); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
379 vo_fs = full; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
380 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
381 inpageoffset = yuv_on(in_s3_format, in_width, in_height, vidx, vidy, vidwidth, vidheight, 0, screenwidth, screenheight, screenstride, 0); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
382 inpage0 = smem + inpageoffset; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
383 inpage = inpage0; |
18542 | 384 mp_msg(MSGT_VO, MSGL_INFO, "s3fb: output is at %dx%d +%dx%d\n", vidx, vidy, vidwidth, vidheight); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
385 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
386 clear_screen(); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
387 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
388 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
389 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
390 uint32_t flags, char *title, uint32_t format) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
391 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
392 screenwidth = fb_vinfo.xres; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
393 screenheight = fb_vinfo.yres; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
394 screenstride = fb_finfo.line_length; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
395 aspect_save_screenres(fb_vinfo.xres,fb_vinfo.yres); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
396 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
397 in_width = width; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
398 in_height = height; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
399 in_format = format; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
400 aspect_save_orig(width,height); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
401 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
402 aspect_save_prescale(d_width,d_height); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
403 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
404 /* Setup the screen for rendering to */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
405 screendepth = fb_vinfo.bits_per_pixel / 8; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
406 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
407 switch(in_format) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
408 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
409 case IMGFMT_YUY2: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
410 in_depth = 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
411 in_s3_format = 1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
412 alpha_func = vo_draw_alpha_yuy2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
413 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
414 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
415 case IMGFMT_BGR15: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
416 in_depth = 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
417 in_s3_format = 3; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
418 alpha_func = vo_draw_alpha_rgb16; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
419 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
420 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
421 case IMGFMT_BGR16: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
422 in_depth = 2; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
423 in_s3_format = 5; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
424 alpha_func = vo_draw_alpha_rgb16; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
425 break; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
426 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
427 case IMGFMT_BGR24: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
428 in_depth = 3; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
429 in_s3_format = 6; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
430 alpha_func = vo_draw_alpha_rgb24; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
431 break; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
432 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
433 case IMGFMT_BGR32: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
434 in_depth = 4; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
435 in_s3_format = 7; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
436 alpha_func = vo_draw_alpha_rgb32; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
437 break; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
438 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
439 default: |
18542 | 440 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Eik! Something's wrong with control().\n"); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
441 return -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
442 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
443 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
444 offset = in_width * in_depth * in_height; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
445 if (vo_doublebuffering) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
446 page = offset; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
447 else |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
448 page = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
449 |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
450 if(screenheight * screenstride + page + offset > fb_finfo.smem_len) { |
18542 | 451 mp_msg(MSGT_VO, MSGL_FATAL, "s3fb: Not enough video memory to play this movie. Try at a lower resolution\n"); |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
452 return -1; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
453 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
454 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
455 setup_screen(flags & VOFLAG_FULLSCREEN); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
456 if (vo_doublebuffering) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
457 inpage = inpage0 + page; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
458 |
18542 | 459 mp_msg(MSGT_VO, MSGL_INFO, "s3fb: screen is %dx%d at %d bpp, in is %dx%d at %d bpp, norm is %dx%d\n", |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
460 screenwidth, screenheight, screendepth * 8, |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
461 in_width, in_height, in_depth * 8, |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
462 d_width, d_height); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
463 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
464 return 0; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
465 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
466 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
467 static void draw_alpha(int x, int y, int w, int h, unsigned char *src, |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
468 unsigned char *srca, int stride) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
469 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
470 char *dst = inpage + (y * in_width + x) * in_depth; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
471 alpha_func(w, h, src, srca, stride, dst, in_width * in_depth); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
472 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
473 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
474 static void draw_osd(void) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
475 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
476 if (!vo_doublebuffering) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
477 vo_draw_text(in_width, in_height, draw_alpha); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
478 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
479 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
480 /* Render onto the screen */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
481 static void flip_page(void) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
482 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
483 if(vo_doublebuffering) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
484 vo_draw_text(in_width, in_height, draw_alpha); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
485 yuv_on(in_s3_format, in_width, in_height, vidx, vidy, vidwidth, vidheight, 0, screenwidth, screenheight, screenstride, page); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
486 page ^= offset; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
487 inpage = inpage0 + page; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
488 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
489 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
490 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
491 static int draw_frame(uint8_t *src[]) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
492 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
493 mem2agpcpy(inpage, src[0], in_width * in_depth * in_height); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
494 return 0; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
495 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
496 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
497 /* Attempt to start doing DR */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
498 static uint32_t get_image(mp_image_t *mpi) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
499 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
500 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
501 if(mpi->flags & MP_IMGFLAG_READABLE) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
502 return VO_FALSE; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
503 if(mpi->type == MP_IMGTYPE_STATIC && vo_doublebuffering) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
504 return VO_FALSE; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
505 if(mpi->type > MP_IMGTYPE_TEMP) |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
506 return VO_FALSE; // TODO ?? |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
507 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
508 switch(in_format) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
509 case IMGFMT_BGR15: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
510 case IMGFMT_BGR16: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
511 case IMGFMT_BGR24: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
512 case IMGFMT_BGR32: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
513 case IMGFMT_YUY2: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
514 mpi->planes[0] = inpage; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
515 mpi->stride[0] = in_width * in_depth; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
516 break; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
517 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
518 default: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
519 return VO_FALSE; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
520 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
521 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
522 mpi->width = in_width; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
523 mpi->flags |= MP_IMGFLAG_DIRECT; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
524 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
525 return VO_TRUE; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
526 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
527 |
33305
ddb45e9443ec
Remove the variable arguments from the libvo control() functions.
iive
parents:
32467
diff
changeset
|
528 static int control(uint32_t request, void *data) |
18535
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
529 { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
530 switch(request) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
531 case VOCTRL_GET_IMAGE: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
532 return get_image(data); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
533 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
534 case VOCTRL_QUERY_FORMAT: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
535 switch(*((uint32_t*)data)) { |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
536 case IMGFMT_BGR15: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
537 case IMGFMT_BGR16: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
538 case IMGFMT_BGR24: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
539 case IMGFMT_BGR32: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
540 case IMGFMT_YUY2: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
541 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
542 VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
543 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
544 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
545 return 0; /* Not supported */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
546 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
547 case VOCTRL_FULLSCREEN: |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
548 setup_screen(!vo_fs); |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
549 return 0; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
550 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
551 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
552 return VO_NOTIMPL; |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
553 } |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
554 |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
555 /* Dummy funcs */ |
8e92dd0ff93a
Add YUY2 and back end scaling on S3 Virge chips in combination with fbdev.
gpoirier
parents:
diff
changeset
|
556 static void check_events(void) {} |