Start Milan video support SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sat, 19 Sep 2009 13:21:05 +0000
branchSDL-1.2
changeset 419513de8ea401db
parent 4194 05c9e942cc46
child 4196 89c7562eae9b
Start Milan video support
src/video/xbios/SDL_xbios.c
src/video/xbios/SDL_xbios.h
src/video/xbios/SDL_xbios_milan.c
src/video/xbios/SDL_xbios_milan.h
     1.1 --- a/src/video/xbios/SDL_xbios.c	Sat Sep 19 12:46:00 2009 +0000
     1.2 +++ b/src/video/xbios/SDL_xbios.c	Sat Sep 19 13:21:05 2009 +0000
     1.3 @@ -50,6 +50,7 @@
     1.4  #include "SDL_xbios_centscreen.h"
     1.5  #include "SDL_xbios_sb3.h"
     1.6  #include "SDL_xbios_tveille.h"
     1.7 +#include "SDL_xbios_milan.h"
     1.8  
     1.9  #define XBIOS_VID_DRIVER_NAME "xbios"
    1.10  
    1.11 @@ -183,6 +184,8 @@
    1.12  				}
    1.13  			}
    1.14  			break;
    1.15 +		case VDO_MILAN:
    1.16 +			break;
    1.17  		default:
    1.18  			return 0;
    1.19  	}
    1.20 @@ -488,6 +491,9 @@
    1.21  				}
    1.22  			}
    1.23  			break;
    1.24 +		case VDO_MILAN:
    1.25 +			SDL_XBIOS_ListMilanModes(this, 0);
    1.26 +			break;
    1.27  	}
    1.28  
    1.29  	for ( i=0; i<NUM_MODELISTS; ++i ) {
    1.30 @@ -552,6 +558,9 @@
    1.31  				}
    1.32  			}
    1.33  			break;
    1.34 +		case VDO_MILAN:
    1.35 +			SDL_XBIOS_ListMilanModes(this, 1);
    1.36 +			break;
    1.37  	}
    1.38  
    1.39  	XBIOS_screens[0]=NULL;
    1.40 @@ -694,7 +703,7 @@
    1.41  		XBIOS_screens[1]=(void *) (( (long) XBIOS_screensmem[1]+256) & 0xFFFFFF00UL);
    1.42  		modeflags |= SDL_DOUBLEBUF;
    1.43  	}
    1.44 -	
    1.45 +
    1.46  	/* Allocate the new pixel format for the screen */
    1.47  	if ( ! SDL_ReallocFormat(current, new_depth, 0, 0, 0, 0) ) {
    1.48  		XBIOS_FreeBuffers(this);
     2.1 --- a/src/video/xbios/SDL_xbios.h	Sat Sep 19 12:46:00 2009 +0000
     2.2 +++ b/src/video/xbios/SDL_xbios.h	Sat Sep 19 13:21:05 2009 +0000
     2.3 @@ -69,7 +69,8 @@
     2.4  	VDO_ST=0,
     2.5  	VDO_STE,
     2.6  	VDO_TT,
     2.7 -	VDO_F30
     2.8 +	VDO_F30,
     2.9 +	VDO_MILAN
    2.10  };
    2.11  
    2.12  /* Monitor types */
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/video/xbios/SDL_xbios_milan.c	Sat Sep 19 13:21:05 2009 +0000
     3.3 @@ -0,0 +1,87 @@
     3.4 +/*
     3.5 +    SDL - Simple DirectMedia Layer
     3.6 +    Copyright (C) 1997-2009 Sam Lantinga
     3.7 +
     3.8 +    This library is free software; you can redistribute it and/or
     3.9 +    modify it under the terms of the GNU Library General Public
    3.10 +    License as published by the Free Software Foundation; either
    3.11 +    version 2 of the License, or (at your option) any later version.
    3.12 +
    3.13 +    This library is distributed in the hope that it will be useful,
    3.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 +    Library General Public License for more details.
    3.17 +
    3.18 +    You should have received a copy of the GNU Library General Public
    3.19 +    License along with this library; if not, write to the Free
    3.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    3.21 +
    3.22 +    Sam Lantinga
    3.23 +    slouken@libsdl.org
    3.24 +*/
    3.25 +#include "SDL_config.h"
    3.26 +
    3.27 +/*
    3.28 +	Milan Xbios video functions
    3.29 +
    3.30 +	Patrice Mandin
    3.31 +*/
    3.32 +
    3.33 +#include <mint/cookie.h>
    3.34 +
    3.35 +#include "SDL_xbios.h"
    3.36 +#include "SDL_xbios_milan.h"
    3.37 +
    3.38 +#ifndef Validmode
    3.39 +#define Validmode(mode)	\
    3.40 +	(short)trap_14_ww((short)0x5f,(short)(mode))
    3.41 +#endif
    3.42 +
    3.43 +#define NUM_PREDEFINED_MODES 7
    3.44 +
    3.45 +typedef struct {
    3.46 +	Uint16 width, height;
    3.47 +} predefined_mode_t;
    3.48 +
    3.49 +static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
    3.50 +	{640,400},
    3.51 +	{640,480},
    3.52 +	{800,608},
    3.53 +	{1024,768},
    3.54 +	{1152,864},
    3.55 +	{1280,1024},
    3.56 +	{1600,1200}	
    3.57 +};
    3.58 +
    3.59 +static const Uint8 mode_bpp[4]={
    3.60 +	8, 15, 16, 32
    3.61 +};
    3.62 +
    3.63 +void SDL_XBIOS_ListMilanModes(_THIS, int actually_add)
    3.64 +{
    3.65 +	int i;
    3.66 +
    3.67 +	/* Read infos about current mode */ 
    3.68 +
    3.69 +	/* Read validated predefined modes */
    3.70 +	for (i=0; i<NUM_PREDEFINED_MODES; i++) {
    3.71 +		int j;
    3.72 +		Uint16 deviceid = 0x1000 + (i<<4);
    3.73 +
    3.74 +		for (j=1; j<4; j++) {
    3.75 +			if (Validmode(deviceid + j)) {
    3.76 +				xbiosmode_t modeinfo;
    3.77 +				
    3.78 +				modeinfo.number = deviceid + j;
    3.79 +				modeinfo.width = mode_list[i].width;
    3.80 +				modeinfo.height = mode_list[i].height;
    3.81 +				modeinfo.depth = mode_bpp[j-1];
    3.82 +				modeinfo.doubleline = SDL_FALSE;
    3.83 +
    3.84 +				SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
    3.85 +			}
    3.86 +		}
    3.87 +	}
    3.88 +
    3.89 +	/* Read custom created modes */
    3.90 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/video/xbios/SDL_xbios_milan.h	Sat Sep 19 13:21:05 2009 +0000
     4.3 @@ -0,0 +1,125 @@
     4.4 +/*
     4.5 +    SDL - Simple DirectMedia Layer
     4.6 +    Copyright (C) 1997-2009 Sam Lantinga
     4.7 +
     4.8 +    This library is free software; you can redistribute it and/or
     4.9 +    modify it under the terms of the GNU Library General Public
    4.10 +    License as published by the Free Software Foundation; either
    4.11 +    version 2 of the License, or (at your option) any later version.
    4.12 +
    4.13 +    This library is distributed in the hope that it will be useful,
    4.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.16 +    Library General Public License for more details.
    4.17 +
    4.18 +    You should have received a copy of the GNU Library General Public
    4.19 +    License along with this library; if not, write to the Free
    4.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.21 +
    4.22 +    Sam Lantinga
    4.23 +    slouken@libsdl.org
    4.24 +*/
    4.25 +#include "SDL_config.h"
    4.26 +
    4.27 +/*
    4.28 +	Milan Xbios video functions
    4.29 +
    4.30 +	Patrice Mandin
    4.31 +*/
    4.32 +
    4.33 +#ifndef _SDL_xbios_milan_h
    4.34 +#define _SDL_xbios_milan_h
    4.35 +
    4.36 +#include "SDL_xbios.h"
    4.37 +
    4.38 +/*--- Defines ---*/
    4.39 +
    4.40 +/* Cookies */
    4.41 +#ifndef C__MIL
    4.42 +#define C__MIL 0x5F4D494CL
    4.43 +#endif
    4.44 +
    4.45 +#ifndef C__VDI
    4.46 +#define C__VDI 0x5F564449L
    4.47 +#endif
    4.48 +
    4.49 +/* Vsetscreen() parameters */
    4.50 +#define MI_MAGIC	0x4D49 
    4.51 +
    4.52 +enum {
    4.53 +	CMD_GETMODE=0,
    4.54 +	CMD_SETMODE,
    4.55 +	CMD_GETINFO,
    4.56 +	CMD_ALLOCPAGE,
    4.57 +	CMD_FREEPAGE,
    4.58 +	CMD_FLIPPAGE,
    4.59 +	CMD_ALLOCMEM,
    4.60 +	CMD_FREEMEM,
    4.61 +	CMD_SETADR,
    4.62 +	CMD_ENUMMODES
    4.63 +};
    4.64 +
    4.65 +enum {
    4.66 +	ENUMMODE_EXIT=0,
    4.67 +	ENUMMODE_CONT
    4.68 +};
    4.69 +
    4.70 +enum {
    4.71 +	BLK_ERR=0,
    4.72 +	BLK_OK,
    4.73 +	BLK_CLEARED
    4.74 +};
    4.75 +
    4.76 +/* bitFlags */ 
    4.77 +#define STANDARD_BITS  1 
    4.78 +#define FALCON_BITS   2 
    4.79 +#define INTEL_BITS   8 
    4.80 +
    4.81 +/*--- Structures ---*/
    4.82 +
    4.83 +typedef struct _scrblk { 
    4.84 +	unsigned long	size;		/* size of strukture */ 
    4.85 +	unsigned long	blk_status;	/* status bits of blk */ 
    4.86 +	unsigned long	blk_start;	/* Start Adress */ 
    4.87 +	unsigned long	blk_len;	/* length of memblk */ 
    4.88 +	unsigned long	blk_x;		/* x pos in total screen*/ 
    4.89 +	unsigned long	blk_y;		/* y pos in total screen */ 
    4.90 +	unsigned long	blk_w;		/* width */ 
    4.91 +	unsigned long	blk_h;		/* height */ 
    4.92 +	unsigned long	blk_wrap;	/* width in bytes */ 
    4.93 +} __attribute__((packed)) SCRMEMBLK;
    4.94 +
    4.95 +typedef struct screeninfo { 
    4.96 +	unsigned long	size;		/* Size of structure */ 
    4.97 +	unsigned long	devID;		/* device id number */ 
    4.98 +	unsigned char	name[64];	/* Friendly name of Screen */ 
    4.99 +	unsigned long	scrFlags;	/* some Flags */ 
   4.100 +	unsigned long	frameadr;	/* Adress of framebuffer */ 
   4.101 +	unsigned long	scrHeight;	/* visible X res */ 
   4.102 +	unsigned long	scrWidth;	/* visible Y res */ 
   4.103 +	unsigned long	virtHeight;	/* virtual X res */ 
   4.104 +	unsigned long	virtWidth;	/* virtual Y res */ 
   4.105 +	unsigned long	scrPlanes;	/* color Planes */ 
   4.106 +	unsigned long	scrColors;	/* # of colors */ 
   4.107 +	unsigned long	lineWrap;	/* # of Bytes to next line */ 
   4.108 +	unsigned long	planeWarp;	/* # of Bytes to next plane */ 
   4.109 +	unsigned long	scrFormat;	/* screen Format */ 
   4.110 +	unsigned long	scrClut;	/* type of clut */ 
   4.111 +	unsigned long	redBits;	/* Mask of Red Bits */ 
   4.112 +	unsigned long	greenBits;	/* Mask of Green Bits */ 
   4.113 +	unsigned long	blueBits;	/* Mask of Blue Bits */ 
   4.114 +	unsigned long	alphaBits;	/* Mask of Alpha Bits */ 
   4.115 +	unsigned long	genlockBits;/* Mask of Genlock Bits */ 
   4.116 +	unsigned long	unusedBits;	/* Mask of unused Bits */ 
   4.117 +	unsigned long	bitFlags;	/* Bits organisation flags */ 
   4.118 +	unsigned long	maxmem;		/* max. memory in this mode */ 
   4.119 +	unsigned long	pagemem;	/* needed memory for one page */ 
   4.120 +	unsigned long	max_x;		/* max. possible width */ 
   4.121 +	unsigned long	max_y;		/* max. possible heigth */ 
   4.122 +} __attribute__((packed)) SCREENINFO; 
   4.123 +
   4.124 +/*--- Functions prototypes ---*/
   4.125 +
   4.126 +void SDL_XBIOS_ListMilanModes(_THIS, int actually_add);
   4.127 +
   4.128 +#endif /* _SDL_xbios_milan_h */