annotate libvo/vo_xvr100.c @ 28835:6f5824a39ada

Make pausing_keep_force the default for the set_mouse_pos and key_down_event - different behaviour is unlikely to make sense but it is better to handle this in input.c instead of adding special cases to mplayer.c and being able to override the default behaviour at least should not hurt.
author reimar
date Sat, 07 Mar 2009 13:25:55 +0000
parents 8df85ad26746
children fbe5c829c69b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
1 /*
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
2 * SUN XVR-100 (ATI Radeon 7000) VO driver for SPARC Solaris(at least)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
3 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
4 * Copyright (C) 2000-2004 Robin Kay <komadori [at] gekkou [dot] co [dot] uk>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
5 * Copyright (C) 2004 Jake Goerzen
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
6 * Copyright (C) 2007 Denes Balatoni
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
7 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
8 * written for xine by
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
9 * Robin Kay <komadori [at] gekkou [dot] co [dot] uk>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
10 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
11 * Sun XVR-100 framebuffer graciously donated by Jake Goerzen.
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
12 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
13 * Ported to mplayer by Denes Balatoni
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
14 * Contains portions from the mga and tdfix_vid vo drivers
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
15 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
16 * no double-buffering, as it would slow down playback (waiting for vertical retraces)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
17 * FIXME: only YV12 supported for now
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
18 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
19 * This file is part of MPlayer.
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
20 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
21 * MPlayer is free software; you can redistribute it and/or modify
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
22 * it under the terms of the GNU General Public License as published by
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
23 * the Free Software Foundation; either version 2 of the License, or
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
24 * (at your option) any later version.
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
25 *
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
26 * MPlayer is distributed in the hope that it will be useful,
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
29 * GNU General Public License for more details.
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
30 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25525
diff changeset
31 * You should have received a copy of the GNU General Public License along
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25525
diff changeset
32 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25525
diff changeset
33 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
34 */
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
35
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
36 #include <stdlib.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
37 #include <stdio.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
38 #include <unistd.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
39 #include <fcntl.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
40 #include <sys/fbio.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
41 #include <sys/visual_io.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
42 #include <strings.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
43 #include <sys/mman.h>
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
44
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
45 #include "config.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
46 #include "video_out.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
47 #include "video_out_internal.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
48 #include "aspect.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
49 #include "geometry.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
50 #include "fastmemcpy.h"
25525
0918f2b6aca0 Add missing #include, fixes the warning:
diego
parents: 25524
diff changeset
51 #include "sub.h"
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
52 #include "mp_msg.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
53
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
54
25216
3aee342be929 Make vo info structs const
reimar
parents: 23985
diff changeset
55 static const vo_info_t info = {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
56 "sun xvr-100",
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
57 "xvr100",
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
58 "Denes Balatoni",
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
59 ""
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
60 };
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
61
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
62 const LIBVO_EXTERN(xvr100)
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
63
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
64 #define PFB_VRAM_MMAPBASE 0x08000000
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
65 #define PFB_VRAM_MMAPLEN 0x04000000 /* depends on memory size */
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
66 #define PFB_REGS_MMAPBASE 0x10000000
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
67 #define PFB_REGS_MMAPLEN 0x00040000
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
68
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
69 #define PFB_CLOCK_CNTL_INDEX 0x002
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
70 #define PFB_CLOCK_CNTL_DATA 0x003
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
71
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
72 #define PFB_MC_FB_LOCATION 0x052
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
73
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
74 #define PFB_OV0_Y_X_START 0x100
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
75 #define PFB_OV0_Y_X_END 0x101
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
76 #define PFB_OV0_REG_LOAD_CNTL 0x104
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
77 #define PFB_OV0_REG_LOAD_LOCK 0x00000001
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
78 #define PFB_OV0_REG_LOAD_LOCK_READBACK 0x00000008
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
79 #define PFB_OV0_SCALE_CNTL 0x108
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
80 #define PFB_OV0_SCALE_EN 0x417f0000/*417f0000*/
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
81 #define PFB_OV0_SCALE_YUV12 0x00000A00
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
82 #define PFB_OV0_SCALE_VYUY422 0x00000B00
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
83 #define PFB_OV0_V_INC 0x109
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
84 #define PFB_OV0_P1_V_ACCUM_INIT 0x10A
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
85 #define PFB_OV0_P23_V_ACCUM_INIT 0x10B
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
86 #define PFB_OV0_P1_BLANK_LINES_AT_TOP 0x10C
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
87 #define PFB_OV0_P23_BLANK_LINES_AT_TOP 0x10D
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
88 #define PFB_OV0_BASE_ADDR 0x10F
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
89 #define PFB_OV0_BUF0_BASE_ADRS 0x110
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
90 #define PFB_OV0_BUF1_BASE_ADRS 0x111
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
91 #define PFB_OV0_BUF2_BASE_ADRS 0x112
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
92 #define PFB_OV0_BUF3_BASE_ADRS 0x113
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
93 #define PFB_OV0_BUF4_BASE_ADRS 0x114
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
94 #define PFB_OV0_BUF5_BASE_ADRS 0x115
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
95 #define PFB_OV0_VID_BUF_PITCH0_VALUE 0x118
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
96 #define PFB_OV0_VID_BUF_PITCH1_VALUE 0x119
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
97 #define PFB_OV0_AUTO_FLIP_CNTL 0x11C
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
98 #define PFB_OV0_AUTO_FLIP_BUF0 0x00000200
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
99 #define PFB_OV0_AUTO_FLIP_BUF3 0x00000243
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
100 #define PFB_OV0_DEINTERLACE_PATTERN 0x11D
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
101 #define PFB_OV0_H_INC 0x120
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
102 #define PFB_OV0_STEP_BY 0x121
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
103 #define PFB_OV0_P1_H_ACCUM_INIT 0x122
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
104 #define PFB_OV0_P23_H_ACCUM_INIT 0x123
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
105 #define PFB_OV0_P1_X_START_END 0x125
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
106 #define PFB_OV0_P2_X_START_END 0x126
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
107 #define PFB_OV0_P3_X_START_END 0x127
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
108 #define PFB_OV0_FILTER_CNTL 0x128
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
109 #define PFB_OV0_FILTER_EN 0x0000000f
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
110 #define PFB_OV0_GRPH_KEY_CLR_LOW 0x13B
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
111 #define PFB_OV0_GRPH_KEY_CLR_HIGH 0x13C
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
112 #define PFB_OV0_KEY_CNTL 0x13D
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
113 #define PFB_OV0_KEY_EN 0x00000121
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
114
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
115 #define PFB_DISP_MERGE_CNTL 0x358
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
116 #define PFB_DISP_MERGE_EN 0xffff0000
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
117
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
118
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
119
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
120 static char pfb_devname[]="/dev/fbs/pfb0";
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
121 static int pfb_devfd;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
122 static uint8_t *pfb_vbase;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
123 static volatile uint32_t *pfb_vregs;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
124 static int pfb_buffer[3];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
125 static int pfb_stride[3];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
126 static int pfb_srcwidth, pfb_srcheight, pfb_dstwidth, pfb_dstheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
127 static int pfb_native_format=PFB_OV0_SCALE_YUV12;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
128 static int pfb_deinterlace_en=0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
129 static short int pfb_wx0, pfb_wy0, pfb_wx1, pfb_wy1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
130 static int pfb_xres,pfb_yres;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
131 static int pfb_free_top;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
132 static int pfb_fs;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
133 static int pfb_usecolorkey=0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
134 static uint32_t pfb_colorkey;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
135
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
136
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
137
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
138 void pfb_overlay_on(void) {
25524
28db88e2d50d Remove unused variable, fixes the warning:
diego
parents: 25220
diff changeset
139 int h_inc, h_step, ecp_div;
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
140
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
141 pfb_vregs[PFB_CLOCK_CNTL_INDEX] = (pfb_vregs[PFB_CLOCK_CNTL_INDEX] & ~0x0000003f) | 0x00000008;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
142 ecp_div = (pfb_vregs[PFB_CLOCK_CNTL_DATA] >> 8) & 0x3;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
143 h_inc = (pfb_srcwidth << (12 + ecp_div)) / pfb_dstwidth;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
144 h_step = 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
145
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
146 while (h_inc > 0x1fff) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
147 h_inc >>= 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
148 h_step++;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
149 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
150
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
151 pfb_vregs[PFB_OV0_REG_LOAD_CNTL] = PFB_OV0_REG_LOAD_LOCK;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
152 while (!(pfb_vregs[PFB_OV0_REG_LOAD_CNTL] & PFB_OV0_REG_LOAD_LOCK_READBACK))
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
153 usleep(100);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
154
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
155 pfb_vregs[PFB_DISP_MERGE_CNTL] = PFB_DISP_MERGE_EN;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
156 pfb_vregs[PFB_OV0_Y_X_START] = (pfb_wy0 << 16) | pfb_wx0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
157 pfb_vregs[PFB_OV0_Y_X_END] = ((pfb_wy1 - 1) << 16) | (pfb_wx1 - 1);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
158 pfb_vregs[PFB_OV0_V_INC] = ((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) << 20) / pfb_dstheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
159 pfb_vregs[PFB_OV0_P1_V_ACCUM_INIT] = 0x00180001;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
160 pfb_vregs[PFB_OV0_P23_V_ACCUM_INIT] = 0x00180001;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
161 pfb_vregs[PFB_OV0_P1_BLANK_LINES_AT_TOP] = (((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) - 1) << 16) | 0xfff;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
162 pfb_vregs[PFB_OV0_P23_BLANK_LINES_AT_TOP] = (((pfb_deinterlace_en ? pfb_srcheight/2 : pfb_srcheight) / 2 - 1) << 16) | 0x7ff;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
163 pfb_vregs[PFB_OV0_BASE_ADDR] = (pfb_vregs[PFB_MC_FB_LOCATION] & 0xffff) << 16;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
164 pfb_vregs[PFB_OV0_VID_BUF_PITCH0_VALUE] = pfb_deinterlace_en ? pfb_stride[0]*2 : pfb_stride[0];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
165 pfb_vregs[PFB_OV0_VID_BUF_PITCH1_VALUE] = pfb_deinterlace_en ? pfb_stride[1]*2 : pfb_stride[1];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
166 pfb_vregs[PFB_OV0_DEINTERLACE_PATTERN] = 0x000aaaaa;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
167 pfb_vregs[PFB_OV0_H_INC] = ((h_inc / 2) << 16) | h_inc;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
168 pfb_vregs[PFB_OV0_STEP_BY] = (h_step << 8) | h_step;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
169 pfb_vregs[PFB_OV0_P1_H_ACCUM_INIT] = (((0x00005000 + h_inc) << 7) & 0x000f8000) | (((0x00005000 + h_inc) << 15) & 0xf0000000);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
170 pfb_vregs[PFB_OV0_P23_H_ACCUM_INIT] = (((0x0000A000 + h_inc) << 6) & 0x000f8000) | (((0x0000A000 + h_inc) << 14) & 0x70000000);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
171 pfb_vregs[PFB_OV0_P1_X_START_END] = pfb_srcwidth - 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
172 pfb_vregs[PFB_OV0_P2_X_START_END] = (pfb_srcwidth / 2) - 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
173 pfb_vregs[PFB_OV0_P3_X_START_END] = (pfb_srcwidth / 2) - 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
174 pfb_vregs[PFB_OV0_FILTER_CNTL] = PFB_OV0_FILTER_EN;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
175
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
176 if (pfb_usecolorkey) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
177 pfb_vregs[PFB_OV0_GRPH_KEY_CLR_LOW] = pfb_colorkey;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
178 pfb_vregs[PFB_OV0_GRPH_KEY_CLR_HIGH] = pfb_colorkey | 0xff000000;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
179 pfb_vregs[PFB_OV0_KEY_CNTL] = PFB_OV0_KEY_EN;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
180 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
181 pfb_vregs[PFB_OV0_KEY_CNTL] = 0x010;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
182 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
183
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
184 pfb_vregs[PFB_OV0_SCALE_CNTL] = PFB_OV0_SCALE_EN | pfb_native_format;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
185
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
186 pfb_vregs[PFB_OV0_REG_LOAD_CNTL] = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
187
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
188 pfb_vregs[PFB_OV0_BUF0_BASE_ADRS] = pfb_buffer[0];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
189 pfb_vregs[PFB_OV0_BUF1_BASE_ADRS] = pfb_buffer[1] | 0x00000001;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
190 pfb_vregs[PFB_OV0_BUF2_BASE_ADRS] = pfb_buffer[2] | 0x00000001;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
191
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
192 pfb_vregs[PFB_OV0_AUTO_FLIP_CNTL] = PFB_OV0_AUTO_FLIP_BUF0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
193 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
194
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
195 void pfb_overlay_off(void) {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
196 pfb_vregs[PFB_OV0_SCALE_CNTL] = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
197 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
198
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
199 void center_overlay(void) {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
200 if (pfb_xres > pfb_dstwidth) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
201 pfb_wx0 = (pfb_xres - pfb_dstwidth) / 2;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
202 pfb_wx1 = pfb_wx0 + pfb_dstwidth;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
203 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
204 else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
205 pfb_wx0 = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
206 pfb_wx1 = pfb_xres;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
207 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
208
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
209 if (pfb_yres > pfb_dstheight) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
210 pfb_wy0 = (pfb_yres - pfb_dstheight) / 2;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
211 pfb_wy1 = pfb_wy0 + pfb_dstheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
212 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
213 else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
214 pfb_wy0 = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
215 pfb_wy1 = pfb_yres;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
216 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
217 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
218
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
219 static int config(uint32_t width, uint32_t height, uint32_t d_width,
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
220 uint32_t d_height, uint32_t flags, char *title,
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
221 uint32_t format) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
222 int memsize;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
223
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
224 pfb_srcwidth=width;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
225 pfb_srcheight=height;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
226
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
227 if (pfb_srcwidth>1536)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
228 mp_msg(MSGT_VO, MSGL_WARN, "vo_xvr100: XVR-100 can not handle width greater than 1536 pixels!\n");
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
229
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
230 if (!(flags & VOFLAG_XOVERLAY_SUB_VO)) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
231 aspect_save_orig(width,height);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
232 aspect_save_prescale(d_width,d_height);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
233 aspect_save_screenres(pfb_xres,pfb_yres);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
234 if( flags&VOFLAG_FULLSCREEN) { /* -fs */
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
235 aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
236 pfb_fs = 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
237 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
238 aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
239 pfb_fs = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
240 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
241 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
242 pfb_dstwidth=d_width;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
243 pfb_dstheight=d_height;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
244 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
245
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
246 center_overlay();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
247
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
248 pfb_stride[0]=(pfb_srcwidth+15) & ~15;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
249 pfb_stride[1]=pfb_stride[2]=(((pfb_srcwidth+1)>>1)+15) & ~15;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
250 memsize = (pfb_stride[0]*pfb_srcheight+pfb_stride[1]*((pfb_srcheight+1) & ~1));
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
251 if (memsize > pfb_free_top) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
252 mp_msg(MSGT_VO, MSGL_FATAL, "vo_xvr100: out of VRAM! \n");
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
253 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
254 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
255 pfb_buffer[0] = pfb_free_top - memsize;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
256 pfb_buffer[1] = pfb_buffer[0] + pfb_stride[0]*pfb_srcheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
257 pfb_buffer[2] = pfb_buffer[1] + pfb_stride[1]*((pfb_srcheight+1)>>1);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
258
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
259 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
260
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
261 return 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
262 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
263
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
264 static int preinit(const char *arg) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
265 struct vis_identifier ident;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
266 struct fbgattr attr;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
267
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
268 if ((pfb_devfd = open(pfb_devname, O_RDWR)) < 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
269 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: can't open framebuffer device '%s'\n", pfb_devname);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
270 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
271 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
272
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
273 if (ioctl(pfb_devfd, VIS_GETIDENTIFIER, &ident) < 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
274 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: ioctl failed (VIS_GETIDENTIFIER), bad device (%s)\n", pfb_devname);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
275 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
276 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
277
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
278 if (strcmp("SUNWpfb", ident.name) == 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
279 mp_msg(MSGT_VO, MSGL_INFO, "vo_xvr100: SUNWpfb (XVR-100/ATI Radeon 7000) detected \n");
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
280 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
281 else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
282 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: '%s' is not a SUN XVR-100 framebuffer device\n", pfb_devname);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
283 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
284 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
285
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
286 if (ioctl(pfb_devfd, FBIOGATTR, &attr) < 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
287 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: ioctl failed (FBIOGATTR)\n");
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
288 close(pfb_devfd);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
289 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
290 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
291
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
292 pfb_free_top = attr.fbtype.fb_size - 0x2000;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
293 pfb_xres = attr.fbtype.fb_width;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
294 pfb_yres = attr.fbtype.fb_height;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
295
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
296 if ((pfb_vbase = mmap(NULL, PFB_VRAM_MMAPLEN, PROT_READ | PROT_WRITE,
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
297 MAP_SHARED, pfb_devfd, PFB_VRAM_MMAPBASE)) == MAP_FAILED) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
298 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: unable to memory map framebuffer\n");
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
299 close(pfb_devfd);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
300 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
301 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
302
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
303 if ((pfb_vregs = (uint32_t *)(void *)mmap(NULL, PFB_REGS_MMAPLEN, PROT_READ | PROT_WRITE,
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
304 MAP_SHARED, pfb_devfd, PFB_REGS_MMAPBASE)) == MAP_FAILED) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
305 mp_msg(MSGT_VO, MSGL_ERR, "vo_xvr100: Error: unable to memory map framebuffer\n");
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
306 munmap(pfb_vbase, PFB_VRAM_MMAPLEN);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
307 close(pfb_devfd);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
308 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
309 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
310
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
311 return 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
312 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
313
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
314 static void uninit(void)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
315 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
316 if (!vo_config_count)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
317 return;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
318
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
319 pfb_overlay_off();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
320 munmap(pfb_vbase, PFB_VRAM_MMAPLEN);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
321 munmap(pfb_vregs, PFB_REGS_MMAPLEN);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
322 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
323
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
324 static uint32_t pfb_fullscreen(void) {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
325 if (!pfb_fs) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
326 aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
327 pfb_fs = 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
328 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
329 aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
330 pfb_fs = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
331 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
332
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
333 center_overlay();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
334
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
335 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
336
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
337 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
338 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
339
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
340 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
341 vo_draw_alpha_yv12(w,h,src,srca,stride,pfb_vbase+pfb_buffer[0]+pfb_stride[0]*y0+x0,pfb_stride[0]);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
342 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
343
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
344 static void draw_osd(void)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
345 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
346 vo_draw_text(pfb_srcwidth, pfb_srcheight,draw_alpha);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
347 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
348
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
349 static void check_events(void)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
350 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
351 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
352
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
353 static void flip_page(void)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
354 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
355 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
356
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
357 static uint32_t get_image(mp_image_t *mpi){
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
358 if (mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
359 if (!(mpi->flags&MP_IMGFLAG_PLANAR)) return VO_FALSE; // FIXME: impossible for YV12, right?
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
360 if (!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE)) return VO_FALSE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
361
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
362 mpi->planes[0]=pfb_vbase + pfb_buffer[0];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
363 mpi->planes[1]=pfb_vbase + pfb_buffer[1];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
364 mpi->planes[2]=pfb_vbase + pfb_buffer[2];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
365 mpi->stride[0]=pfb_stride[0];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
366 mpi->stride[1]=mpi->stride[2]=pfb_stride[1];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
367 mpi->flags|=MP_IMGFLAG_DIRECT;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
368
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
369 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
370 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
371
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
372 static int draw_frame(uint8_t *src[])
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
373 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
374 mp_msg(MSGT_VO,MSGL_WARN,"!!! vo_xvr100::draw_frame() called !!!\n");
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
375 return 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
376 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
377
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
378
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
379 static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
380 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
381 mem2agpcpy_pic(pfb_vbase + pfb_buffer[0] + pfb_stride[0] * y + x, src[0], w, h, pfb_stride[0], stride[0]);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
382 w>>=1; h>>=1; x>>=1; y>>=1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
383 mem2agpcpy_pic(pfb_vbase + pfb_buffer[1] + pfb_stride[1] * y + x, src[1], w, h, pfb_stride[1], stride[1]);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
384 mem2agpcpy_pic(pfb_vbase + pfb_buffer[2] + pfb_stride[1] * y + x, src[2], w, h, pfb_stride[1], stride[2]);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
385
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
386 return 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
387 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
388
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
389
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
390 static uint32_t draw_image(mp_image_t *mpi){
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
391 // if -dr or -slices then do nothing:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
392 if (mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
393
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
394 draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,0,0);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
395
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
396 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
397 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
398
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
399 static uint32_t pfb_set_colorkey(mp_colorkey_t* colork) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
400 pfb_colorkey = colork->x11;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
401 pfb_usecolorkey = 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
402
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
403 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
404
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
405 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
406 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
407
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
408 static uint32_t pfb_set_window(mp_win_t* w) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
409 pfb_dstwidth = w->w;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
410 pfb_dstheight = w->h;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
411 pfb_wx0 = w->x;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
412 pfb_wy0 = w->y;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
413 pfb_wx1 = w->x + pfb_dstwidth;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
414 pfb_wy1 = w->y + pfb_dstheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
415
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
416 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
417
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
418 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
419 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
420
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
421 static int query_format(uint32_t format)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
422 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
423 switch(format){
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
424 case IMGFMT_YV12:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
425 case IMGFMT_I420:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
426 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_ACCEPT_STRIDE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
427 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
428 return 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
429 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
430
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
431 static int control(uint32_t request, void *data, ...)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
432 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
433 switch (request) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
434 case VOCTRL_GET_IMAGE:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
435 return get_image(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
436 case VOCTRL_QUERY_FORMAT:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
437 return query_format(*((uint32_t*)data));
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
438 case VOCTRL_DRAW_IMAGE:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
439 return draw_image(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
440 case VOCTRL_FULLSCREEN:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
441 return pfb_fullscreen();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
442 case VOCTRL_XOVERLAY_SUPPORT:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
443 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
444 case VOCTRL_XOVERLAY_SET_COLORKEY:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
445 return pfb_set_colorkey(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
446 case VOCTRL_XOVERLAY_SET_WIN:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
447 return pfb_set_window(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
448 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
449
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
450 return VO_NOTIMPL;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
451 }