annotate src/video/xbios/SDL_xbios_sb3.c @ 1585:980d2a0dc2a3

Date: Tue, 4 Mar 2003 15:05:31 -0800 From: "Jim" Subject: [SDL] Frame Buffer patches... Okay I'm new at patch generation - so please tell me if there's a better way I could have done this. Attached are two patch files generated with 'cvs diff -u' SDL-fb-open-lock.patch applies to SDL_fbvideo.c Modifies the open loop to check /dev/fb/0 found on devfs... Modifies the lock code to return failure if the current virtual terminal is not the one opened for frame buffer writing... Lock would hang forever if switched away (ctrl-alt-F1) ... SDL-fb-mousedrv-screensave.patch applies to SDL_fbevents.c Switches default mouse mode based on SDL_MOUSEDRV - currently only accepts PS2 - otherwise default is MS Mouse. When the screen is switched - exisiting code (wrapped in ifdef SAVE_SCREEN_COTENTS) would save the wrong bit of the screen.... ( I run frame buffer 1600x1200, the size I requested was 800x600 - the save would save the top 800 lines (non biased) and restore them... Adding screen->offset fixed that ) However, if that option is not set, then a call to SDL_UpdateRect (full screen) is made. (which may have had it's contents changed since the screen is not entirely locked because of lock-failure patch) Jim [patches slightly tweaked for SDL 1.2.10]
author Sam Lantinga <slouken@libsdl.org>
date Wed, 22 Mar 2006 07:48:22 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
rev   line source
1040
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
1 /*
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
4
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
9
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
13 Library General Public License for more details.
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
14
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
18
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
19 Sam Lantinga
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
22 #include "SDL_config.h"
1040
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
23
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
24 /*
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
25 ScreenBlaster 3 functions
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
26
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
27 Patrice Mandin
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
28 */
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
29
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
30 /*--- Includes ---*/
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
31
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
32 #include "SDL_stdinc.h"
1040
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
33 #include "SDL_xbios.h"
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
34 #include "SDL_xbios_sb3.h"
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
35
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
36 /*--- Defines ---*/
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
37
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
38 const int SDL_XBIOS_scpn_planes_device[]={
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
39 SCPN_DEV_1BPP,
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
40 SCPN_DEV_4BPP,
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
41 SCPN_DEV_8BPP,
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
42 SCPN_DEV_16BPP,
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
43 SCPN_DEV_2BPP,
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
44 SCPN_DEV_4BPP,
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
45 SCPN_DEV_1BPP
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
46 };
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
47
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
48 /*--- Functions ---*/
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
49
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
50 int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn)
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
51 {
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
52 scpn_screeninfo_t *scrinfo;
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
53 int bpp;
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
54
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
55 /* Check if current SB3 mode is usable, i.e. 8 or 16bpp */
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
56 scrinfo = cookie_scpn->screen_info;
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
57 bpp = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]);
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
58
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
59 if ((bpp==8) || (bpp==16)) {
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
60 return 1;
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
61 }
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
62
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
63 return 0;
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
64 }
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
65
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
66 void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn)
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
67 {
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
68 scpn_screeninfo_t *scrinfo;
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
69
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
70 /* SB3 prevent changing video modes, we can only use current one */
1042
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
71 if (XBIOS_modelist) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1064
diff changeset
72 SDL_free(XBIOS_modelist);
1042
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
73 XBIOS_nummodes = 0;
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
74 XBIOS_modelist = NULL;
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
75 }
1040
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
76
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
77 scrinfo = cookie_scpn->screen_info;
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
78 scrinfo->h_pos = scrinfo->v_pos = 0;
1042
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
79
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
80 SDL_XBIOS_AddMode(this,
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
81 -1,
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
82 scrinfo->virtual_width, scrinfo->virtual_height,
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
83 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]),
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
84 SDL_FALSE
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
85 );
1040
c6ed27c7d47d Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
86 }