Skip to content

Commit

Permalink
Preliminary work to support the Milan video bios, that will gives acc…
Browse files Browse the repository at this point in the history
…ess to 24 or 32 bpp modes. I used the svga driver as model to dynamically build video modes list.
  • Loading branch information
pmandin committed Sep 19, 2009
1 parent f0fe510 commit 2165b0b
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 250 deletions.
443 changes: 254 additions & 189 deletions src/video/xbios/SDL_xbios.c

Large diffs are not rendered by default.

24 changes: 7 additions & 17 deletions src/video/xbios/SDL_xbios.h
Expand Up @@ -30,13 +30,6 @@
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this

/* TT video modes: 2
Falcon RVB: 16 (could be *2 by adding PAL/NTSC modes)
Falcon VGA: 6
ST low: 1
*/
#define SDL_NUMMODES 16

typedef struct
{
Uint16 number; /* Video mode number */
Expand All @@ -47,16 +40,14 @@ typedef struct
} xbiosmode_t;

/* Private display data */
#define NUM_MODELISTS 2 /* 8 and 16 bits-per-pixel */
#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */

struct SDL_PrivateVideoData {
long cookie_vdo;
int old_video_mode; /* Old video mode before entering SDL */
void *old_video_base; /* Old pointer to screen buffer */
void *old_palette; /* Old palette */
Uint32 old_num_colors; /* Nb of colors in saved palette */
int num_modes; /* Number of xbios video modes */
xbiosmode_t *mode_list; /* List of xbios video modes */

void *screens[2]; /* Pointers to aligned screen buffer */
void *screensmem[2]; /* Pointers to screen buffer */
Expand All @@ -68,8 +59,9 @@ struct SDL_PrivateVideoData {

SDL_bool centscreen; /* Centscreen extension present ? */

SDL_Rect *SDL_modelist[NUM_MODELISTS][SDL_NUMMODES+1];
xbiosmode_t *videomodes[NUM_MODELISTS][SDL_NUMMODES+1];
int SDL_nummodes[NUM_MODELISTS];
SDL_Rect **SDL_modelist[NUM_MODELISTS];
xbiosmode_t **SDL_xbiosmode[NUM_MODELISTS];
};

/* _VDO cookie values */
Expand Down Expand Up @@ -102,19 +94,18 @@ enum {
#endif

/* Hidden structure -> variables names */
#define SDL_nummodes (this->hidden->SDL_nummodes)
#define SDL_modelist (this->hidden->SDL_modelist)
#define SDL_xbiosmode (this->hidden->SDL_xbiosmode)
#define XBIOS_mutex (this->hidden->mutex)
#define XBIOS_cvdo (this->hidden->cookie_vdo)
#define XBIOS_oldpalette (this->hidden->old_palette)
#define XBIOS_oldnumcol (this->hidden->old_num_colors)
#define XBIOS_oldvbase (this->hidden->old_video_base)
#define XBIOS_oldvmode (this->hidden->old_video_mode)
#define XBIOS_nummodes (this->hidden->num_modes)
#define XBIOS_modelist (this->hidden->mode_list)
#define XBIOS_screens (this->hidden->screens)
#define XBIOS_screensmem (this->hidden->screensmem)
#define XBIOS_shadowscreen (this->hidden->shadowscreen)
#define XBIOS_videomodes (this->hidden->videomodes)
#define XBIOS_doubleline (this->hidden->doubleline)
#define XBIOS_fbnum (this->hidden->frame_number)
#define XBIOS_pitch (this->hidden->pitch)
Expand All @@ -124,7 +115,6 @@ enum {

/*--- Functions prototypes ---*/

void SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height,
Uint16 depth, SDL_bool flags);
void SDL_XBIOS_AddMode(_THIS, int actually_add, const xbiosmode_t *modeinfo);

#endif /* _SDL_xbios_h */
31 changes: 19 additions & 12 deletions src/video/xbios/SDL_xbios_blowup.c
Expand Up @@ -32,14 +32,21 @@
#include "SDL_xbios.h"
#include "SDL_xbios_blowup.h"

void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow)
void SDL_XBIOS_ListBlowupModes(_THIS, int actually_add, blow_cookie_t *cookie_blow)
{
int i, num_mode, bank;
int i, j, num_mode, bank;
blow_mode_t *blow_mode;
xbiosmode_t modeinfo;

/* Add bit 15 for old modes */
for (i=0;i<XBIOS_nummodes;i++) {
XBIOS_modelist[i].number |= 1<<15;
if (actually_add) {
/* Set bit 15 for old modes */
for (i=0;i<NUM_MODELISTS;i++) {
if ( SDL_xbiosmode[i] != NULL ) {
for ( j=0; SDL_xbiosmode[i][j]; ++j ) {
SDL_xbiosmode[i][j]->number |= 1<<15;
}
}
}
}

/* Add Blowup modes for 8 and 16 bpp */
Expand All @@ -57,13 +64,13 @@ void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow)
&& (cookie_blow->montype == MONITOR_TV)))
{
/* we can use this extended mode */
SDL_XBIOS_AddMode(this,
num_mode == 3 ? BPS8 : BPS16,
blow_mode->width + 1,
blow_mode->height + 1,
num_mode == 3 ? 8 : 16,
SDL_FALSE
);
modeinfo.number = (num_mode == 3 ? BPS8 : BPS16);
modeinfo.width = blow_mode->width + 1;
modeinfo.height = blow_mode->height + 1;
modeinfo.depth = (num_mode == 3 ? 8 : 16);
modeinfo.doubleline = SDL_FALSE;

SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/video/xbios/SDL_xbios_blowup.h
Expand Up @@ -81,6 +81,6 @@ typedef struct {

/*--- Functions prototypes ---*/

void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow);
void SDL_XBIOS_ListBlowupModes(_THIS, int actually_add, blow_cookie_t *cookie_blow);

#endif /* _SDL_xbios_blowup_h */
27 changes: 13 additions & 14 deletions src/video/xbios/SDL_xbios_centscreen.c
Expand Up @@ -32,19 +32,12 @@
#include "SDL_xbios.h"
#include "SDL_xbios_centscreen.h"

int SDL_XBIOS_CentscreenInit(_THIS)
int SDL_XBIOS_ListCentscreenModes(_THIS, int actually_add)
{
centscreen_mode_t curmode, listedmode;
centscreen_mode_t curmode, listedmode;
unsigned long result;
int cur_handle; /* Current Centscreen mode handle */

/* Reset current mode list */
if (XBIOS_modelist) {
SDL_free(XBIOS_modelist);
XBIOS_nummodes = 0;
XBIOS_modelist = NULL;
}

/* Add Centscreen modes */
Vread(&curmode);
cur_handle = curmode.handle;
Expand All @@ -58,9 +51,15 @@ int SDL_XBIOS_CentscreenInit(_THIS)
if ((listedmode.mode & CSCREEN_VIRTUAL)==0) {
/* Don't add modes with bpp<8 */
if (listedmode.plan>=8) {
SDL_XBIOS_AddMode(this, listedmode.mode, listedmode.physx,
listedmode.physy, listedmode.plan, SDL_FALSE
);
xbiosmode_t modeinfo;

modeinfo.number = listedmode.mode;
modeinfo.width = listedmode.physx;
modeinfo.height = listedmode.physy;
modeinfo.depth = listedmode.plan;
modeinfo.doubleline = SDL_FALSE;

SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
}
}
SDL_memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t));
Expand All @@ -77,7 +76,7 @@ int SDL_XBIOS_CentscreenInit(_THIS)

void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes)
{
centscreen_mode_t newmode, curmode;
centscreen_mode_t newmode, curmode;

newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1;
newmode.physx = width;
Expand All @@ -95,7 +94,7 @@ void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes)

void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle)
{
centscreen_mode_t newmode, curmode;
centscreen_mode_t newmode, curmode;

/* Restore old video mode */
newmode.handle = prev_handle;
Expand Down
2 changes: 1 addition & 1 deletion src/video/xbios/SDL_xbios_centscreen.h
Expand Up @@ -111,7 +111,7 @@ typedef struct {

/*--- Functions prototypes ---*/

int SDL_XBIOS_CentscreenInit(_THIS);
int SDL_XBIOS_ListCentscreenModes(_THIS, int actually_add);
void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes);
void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle);

Expand Down
27 changes: 12 additions & 15 deletions src/video/xbios/SDL_xbios_sb3.c
Expand Up @@ -63,24 +63,21 @@ int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn)
return 0;
}

void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn)
void SDL_XBIOS_ListSB3Modes(_THIS, int actually_add, scpn_cookie_t *cookie_scpn)
{
scpn_screeninfo_t *scrinfo;
xbiosmode_t modeinfo;

/* SB3 prevent changing video modes, we can only use current one */
if (XBIOS_modelist) {
SDL_free(XBIOS_modelist);
XBIOS_nummodes = 0;
XBIOS_modelist = NULL;
scrinfo = cookie_scpn->screen_info;
if (actually_add) {
scrinfo->h_pos = scrinfo->v_pos = 0;
}

scrinfo = cookie_scpn->screen_info;
scrinfo->h_pos = scrinfo->v_pos = 0;

SDL_XBIOS_AddMode(this,
-1,
scrinfo->virtual_width, scrinfo->virtual_height,
1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]),
SDL_FALSE
);
modeinfo.number = -1;
modeinfo.width = scrinfo->virtual_width;
modeinfo.height = scrinfo->virtual_height;
modeinfo.depth = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]);
modeinfo.doubleline = SDL_FALSE;

SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
}
2 changes: 1 addition & 1 deletion src/video/xbios/SDL_xbios_sb3.h
Expand Up @@ -77,6 +77,6 @@ typedef struct {

int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn);

void SDL_XBIOS_SB3Init(_THIS, scpn_cookie_t *cookie_scpn);
void SDL_XBIOS_ListSB3Modes(_THIS, int actually_add, scpn_cookie_t *cookie_scpn);

#endif /* _SDL_xbios_sb3_h_ */

0 comments on commit 2165b0b

Please sign in to comment.