annotate libvo/vo_xvr100.c @ 37182:1c64016edce3

Cosmetic: Place pkg-config options first.
author ib
date Tue, 09 Sep 2014 10:52:21 +0000
parents 5d3f93051de9
children
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"
36517
5d3f93051de9 Remove empty draw_slice and draw_frame stubs.
reimar
parents: 33305
diff changeset
47 #define NO_DRAW_FRAME
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
48 #include "video_out_internal.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
49 #include "aspect.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
50 #include "geometry.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
51 #include "fastmemcpy.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 28232
diff changeset
52 #include "sub/sub.h"
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
53 #include "mp_msg.h"
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
54
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
55
25216
3aee342be929 Make vo info structs const
reimar
parents: 23985
diff changeset
56 static const vo_info_t info = {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
57 "sun xvr-100",
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
58 "xvr100",
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
59 "Denes Balatoni",
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 };
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
62
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
63 const LIBVO_EXTERN(xvr100)
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
64
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
65 #define PFB_VRAM_MMAPBASE 0x08000000
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
66 #define PFB_VRAM_MMAPLEN 0x04000000 /* depends on memory size */
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
67 #define PFB_REGS_MMAPBASE 0x10000000
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
68 #define PFB_REGS_MMAPLEN 0x00040000
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
69
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
70 #define PFB_CLOCK_CNTL_INDEX 0x002
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
71 #define PFB_CLOCK_CNTL_DATA 0x003
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
72
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
73 #define PFB_MC_FB_LOCATION 0x052
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
74
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
75 #define PFB_OV0_Y_X_START 0x100
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
76 #define PFB_OV0_Y_X_END 0x101
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
77 #define PFB_OV0_REG_LOAD_CNTL 0x104
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
78 #define PFB_OV0_REG_LOAD_LOCK 0x00000001
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
79 #define PFB_OV0_REG_LOAD_LOCK_READBACK 0x00000008
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
80 #define PFB_OV0_SCALE_CNTL 0x108
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
81 #define PFB_OV0_SCALE_EN 0x417f0000/*417f0000*/
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
82 #define PFB_OV0_SCALE_YUV12 0x00000A00
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
83 #define PFB_OV0_SCALE_VYUY422 0x00000B00
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
84 #define PFB_OV0_V_INC 0x109
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
85 #define PFB_OV0_P1_V_ACCUM_INIT 0x10A
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
86 #define PFB_OV0_P23_V_ACCUM_INIT 0x10B
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
87 #define PFB_OV0_P1_BLANK_LINES_AT_TOP 0x10C
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
88 #define PFB_OV0_P23_BLANK_LINES_AT_TOP 0x10D
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
89 #define PFB_OV0_BASE_ADDR 0x10F
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
90 #define PFB_OV0_BUF0_BASE_ADRS 0x110
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
91 #define PFB_OV0_BUF1_BASE_ADRS 0x111
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
92 #define PFB_OV0_BUF2_BASE_ADRS 0x112
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
93 #define PFB_OV0_BUF3_BASE_ADRS 0x113
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
94 #define PFB_OV0_BUF4_BASE_ADRS 0x114
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
95 #define PFB_OV0_BUF5_BASE_ADRS 0x115
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
96 #define PFB_OV0_VID_BUF_PITCH0_VALUE 0x118
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
97 #define PFB_OV0_VID_BUF_PITCH1_VALUE 0x119
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
98 #define PFB_OV0_AUTO_FLIP_CNTL 0x11C
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
99 #define PFB_OV0_AUTO_FLIP_BUF0 0x00000200
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
100 #define PFB_OV0_AUTO_FLIP_BUF3 0x00000243
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
101 #define PFB_OV0_DEINTERLACE_PATTERN 0x11D
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
102 #define PFB_OV0_H_INC 0x120
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
103 #define PFB_OV0_STEP_BY 0x121
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
104 #define PFB_OV0_P1_H_ACCUM_INIT 0x122
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
105 #define PFB_OV0_P23_H_ACCUM_INIT 0x123
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
106 #define PFB_OV0_P1_X_START_END 0x125
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
107 #define PFB_OV0_P2_X_START_END 0x126
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
108 #define PFB_OV0_P3_X_START_END 0x127
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
109 #define PFB_OV0_FILTER_CNTL 0x128
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
110 #define PFB_OV0_FILTER_EN 0x0000000f
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
111 #define PFB_OV0_GRPH_KEY_CLR_LOW 0x13B
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
112 #define PFB_OV0_GRPH_KEY_CLR_HIGH 0x13C
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
113 #define PFB_OV0_KEY_CNTL 0x13D
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
114 #define PFB_OV0_KEY_EN 0x00000121
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
115
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
116 #define PFB_DISP_MERGE_CNTL 0x358
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
117 #define PFB_DISP_MERGE_EN 0xffff0000
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
121 static char pfb_devname[]="/dev/fbs/pfb0";
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
122 static int pfb_devfd;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
123 static uint8_t *pfb_vbase;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
124 static volatile uint32_t *pfb_vregs;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
125 static int pfb_buffer[3];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
126 static int pfb_stride[3];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
127 static int pfb_srcwidth, pfb_srcheight, pfb_dstwidth, pfb_dstheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
128 static int pfb_native_format=PFB_OV0_SCALE_YUV12;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
129 static int pfb_deinterlace_en=0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
130 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
131 static int pfb_xres,pfb_yres;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
132 static int pfb_free_top;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
133 static int pfb_fs;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
134 static int pfb_usecolorkey=0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
135 static uint32_t pfb_colorkey;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
138
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
139 void pfb_overlay_on(void) {
25524
28db88e2d50d Remove unused variable, fixes the warning:
diego
parents: 25220
diff changeset
140 int h_inc, h_step, ecp_div;
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
141
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
142 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
143 ecp_div = (pfb_vregs[PFB_CLOCK_CNTL_DATA] >> 8) & 0x3;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
144 h_inc = (pfb_srcwidth << (12 + ecp_div)) / pfb_dstwidth;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
145 h_step = 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
146
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
147 while (h_inc > 0x1fff) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
148 h_inc >>= 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
149 h_step++;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
152 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
153 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
154 usleep(100);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
155
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
156 pfb_vregs[PFB_DISP_MERGE_CNTL] = PFB_DISP_MERGE_EN;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
157 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
158 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
159 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
160 pfb_vregs[PFB_OV0_P1_V_ACCUM_INIT] = 0x00180001;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
161 pfb_vregs[PFB_OV0_P23_V_ACCUM_INIT] = 0x00180001;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
162 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
163 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
164 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
165 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
166 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
167 pfb_vregs[PFB_OV0_DEINTERLACE_PATTERN] = 0x000aaaaa;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 pfb_vregs[PFB_OV0_FILTER_CNTL] = PFB_OV0_FILTER_EN;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
176
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
177 if (pfb_usecolorkey) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
178 pfb_vregs[PFB_OV0_GRPH_KEY_CLR_LOW] = pfb_colorkey;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
179 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
180 pfb_vregs[PFB_OV0_KEY_CNTL] = PFB_OV0_KEY_EN;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
181 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
182 pfb_vregs[PFB_OV0_KEY_CNTL] = 0x010;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
185 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
186
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
187 pfb_vregs[PFB_OV0_REG_LOAD_CNTL] = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
188
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
189 pfb_vregs[PFB_OV0_BUF0_BASE_ADRS] = pfb_buffer[0];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
190 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
191 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
192
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
193 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
194 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
195
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
196 void pfb_overlay_off(void) {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
197 pfb_vregs[PFB_OV0_SCALE_CNTL] = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
198 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
199
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
200 void center_overlay(void) {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
201 if (pfb_xres > pfb_dstwidth) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
202 pfb_wx0 = (pfb_xres - pfb_dstwidth) / 2;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
203 pfb_wx1 = pfb_wx0 + pfb_dstwidth;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
204 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
205 else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
206 pfb_wx0 = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
207 pfb_wx1 = pfb_xres;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
210 if (pfb_yres > pfb_dstheight) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
211 pfb_wy0 = (pfb_yres - pfb_dstheight) / 2;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
212 pfb_wy1 = pfb_wy0 + pfb_dstheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
213 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
214 else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
215 pfb_wy0 = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
216 pfb_wy1 = pfb_yres;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
220 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
221 uint32_t d_height, uint32_t flags, char *title,
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
222 uint32_t format) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
223 int memsize;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
224
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
225 pfb_srcwidth=width;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
226 pfb_srcheight=height;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
227
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
228 if (pfb_srcwidth>1536)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
229 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
230
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
231 if (!(flags & VOFLAG_XOVERLAY_SUB_VO)) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
232 aspect_save_orig(width,height);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
233 aspect_save_prescale(d_width,d_height);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
234 aspect_save_screenres(pfb_xres,pfb_yres);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
235 if( flags&VOFLAG_FULLSCREEN) { /* -fs */
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
236 aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
237 pfb_fs = 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
238 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
239 aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
240 pfb_fs = 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
241 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
242 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
243 pfb_dstwidth=d_width;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
244 pfb_dstheight=d_height;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
247 center_overlay();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
248
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
249 pfb_stride[0]=(pfb_srcwidth+15) & ~15;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
250 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
251 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
252 if (memsize > pfb_free_top) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
253 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
254 return 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
255 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
256 pfb_buffer[0] = pfb_free_top - memsize;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
257 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
258 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
259
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
260 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
261
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
262 return 0;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
265 static int preinit(const char *arg) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
266 struct vis_identifier ident;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
267 struct fbgattr attr;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
268
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
269 if ((pfb_devfd = open(pfb_devname, O_RDWR)) < 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
270 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
271 return 1;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
274 if (ioctl(pfb_devfd, VIS_GETIDENTIFIER, &ident) < 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
275 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
276 return 1;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
279 if (strcmp("SUNWpfb", ident.name) == 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
280 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
281 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
282 else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
283 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
284 return 1;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
287 if (ioctl(pfb_devfd, FBIOGATTR, &attr) < 0) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
288 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
289 close(pfb_devfd);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
290 return 1;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
293 pfb_free_top = attr.fbtype.fb_size - 0x2000;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
294 pfb_xres = attr.fbtype.fb_width;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
295 pfb_yres = attr.fbtype.fb_height;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
296
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
297 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
298 MAP_SHARED, pfb_devfd, PFB_VRAM_MMAPBASE)) == MAP_FAILED) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
299 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
300 close(pfb_devfd);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
301 return 1;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
304 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
305 MAP_SHARED, pfb_devfd, PFB_REGS_MMAPBASE)) == MAP_FAILED) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
306 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
307 munmap(pfb_vbase, PFB_VRAM_MMAPLEN);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
308 close(pfb_devfd);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
309 return 1;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
312 return 0;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
315 static void uninit(void)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
316 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
317 if (!vo_config_count)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
318 return;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
319
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
320 pfb_overlay_off();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
321 munmap(pfb_vbase, PFB_VRAM_MMAPLEN);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
322 munmap(pfb_vregs, PFB_REGS_MMAPLEN);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
323 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
324
28232
8df85ad26746 Add missing 'void' keyword to parameterless function declarations.
diego
parents: 26739
diff changeset
325 static uint32_t pfb_fullscreen(void) {
23985
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
326 if (!pfb_fs) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
327 aspect(&pfb_dstwidth,&pfb_dstheight, A_ZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
328 pfb_fs = 1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
329 } else {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
330 aspect(&pfb_dstwidth,&pfb_dstheight, A_NOZOOM);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
331 pfb_fs = 0;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
334 center_overlay();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
335
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
336 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
337
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
338 return VO_TRUE;
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
341 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
342 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
343 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
344
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
345 static void draw_osd(void)
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
346 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
347 vo_draw_text(pfb_srcwidth, pfb_srcheight,draw_alpha);
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
350 static void check_events(void)
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
354 static void flip_page(void)
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
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
358 static uint32_t get_image(mp_image_t *mpi){
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
359 if (mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
360 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
361 if (!(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE)) return VO_FALSE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
362
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
363 mpi->planes[0]=pfb_vbase + pfb_buffer[0];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
364 mpi->planes[1]=pfb_vbase + pfb_buffer[1];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
365 mpi->planes[2]=pfb_vbase + pfb_buffer[2];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
366 mpi->stride[0]=pfb_stride[0];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
367 mpi->stride[1]=mpi->stride[2]=pfb_stride[1];
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
368 mpi->flags|=MP_IMGFLAG_DIRECT;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
369
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
370 return VO_TRUE;
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
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 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
375 {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
376 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
377 w>>=1; h>>=1; x>>=1; y>>=1;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
378 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
379 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
380
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
381 return 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
382 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
383
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
384
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
385 static uint32_t draw_image(mp_image_t *mpi){
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
386 // if -dr or -slices then do nothing:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
387 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
388
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
389 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
390
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
391 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
392 }
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 static uint32_t pfb_set_colorkey(mp_colorkey_t* colork) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
395 pfb_colorkey = colork->x11;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
396 pfb_usecolorkey = 1;
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 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
399
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
400 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
401 }
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 static uint32_t pfb_set_window(mp_win_t* w) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
404 pfb_dstwidth = w->w;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
405 pfb_dstheight = w->h;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
406 pfb_wx0 = w->x;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
407 pfb_wy0 = w->y;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
408 pfb_wx1 = w->x + pfb_dstwidth;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
409 pfb_wy1 = w->y + pfb_dstheight;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
410
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
411 pfb_overlay_on();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
412
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
413 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
414 }
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 static int query_format(uint32_t format)
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 switch(format){
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
419 case IMGFMT_YV12:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
420 case IMGFMT_I420:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
421 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
422 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
423 return 0;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
424 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
425
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 32467
diff changeset
426 static int control(uint32_t request, void *data)
23985
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 switch (request) {
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
429 case VOCTRL_GET_IMAGE:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
430 return get_image(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
431 case VOCTRL_QUERY_FORMAT:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
432 return query_format(*((uint32_t*)data));
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
433 case VOCTRL_DRAW_IMAGE:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
434 return draw_image(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
435 case VOCTRL_FULLSCREEN:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
436 return pfb_fullscreen();
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
437 case VOCTRL_XOVERLAY_SUPPORT:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
438 return VO_TRUE;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
439 case VOCTRL_XOVERLAY_SET_COLORKEY:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
440 return pfb_set_colorkey(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
441 case VOCTRL_XOVERLAY_SET_WIN:
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
442 return pfb_set_window(data);
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
443 }
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
444
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
445 return VO_NOTIMPL;
140cf1a3a7d6 Forgot to add the main vo_xvr100.c file
reimar
parents:
diff changeset
446 }