2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
#include "types.h"
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <memory.h>
|
|
|
|
|
|
|
|
#include "syscall.h"
|
2008-10-12 23:59:52 +02:00
|
|
|
|
2008-06-26 20:19:47 +02:00
|
|
|
#include "ati2d.h"
|
|
|
|
#include "accel_2d.h"
|
|
|
|
|
|
|
|
RHD_t rhd;
|
|
|
|
|
|
|
|
static clip_t clip;
|
|
|
|
|
2008-10-12 23:59:52 +02:00
|
|
|
static local_pixmap_t scr_pixmap;
|
2008-07-03 13:35:35 +02:00
|
|
|
|
2008-06-30 09:16:03 +02:00
|
|
|
static void Init3DEngine(RHDPtr rhdPtr);
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
int __stdcall srv_2d(ioctl_t *io);
|
|
|
|
|
|
|
|
u32_t __stdcall drvEntry(int action)
|
2008-06-26 20:19:47 +02:00
|
|
|
{
|
|
|
|
RHDPtr rhdPtr;
|
2008-10-13 23:02:35 +02:00
|
|
|
u32_t retval;
|
2008-06-26 20:19:47 +02:00
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if(action != 1)
|
|
|
|
return 0;
|
|
|
|
|
2008-10-16 14:00:10 +02:00
|
|
|
if(!dbg_open("/rd/1/drivers/ati2d.log"))
|
2008-06-26 20:19:47 +02:00
|
|
|
{
|
|
|
|
printf("Can't open /rd/1/drivers/ati2d.log\nExit\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2008-10-15 12:31:44 +02:00
|
|
|
if( GetScreenBpp() != 32)
|
|
|
|
{
|
2008-10-16 14:00:10 +02:00
|
|
|
dbgprintf("32 bpp dispaly mode required !\nExit\t");
|
2008-10-15 12:31:44 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2008-06-26 20:19:47 +02:00
|
|
|
|
|
|
|
if((rhdPtr=FindPciDevice())==NULL)
|
|
|
|
{
|
|
|
|
dbgprintf("Device not found\n");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
for(i=0;i<6;i++)
|
|
|
|
{
|
|
|
|
if(rhd.memBase[i])
|
|
|
|
dbgprintf("Memory base_%d 0x%x size 0x%x\n",
|
|
|
|
i,rhd.memBase[i],(1<<rhd.memsize[i]));
|
|
|
|
};
|
|
|
|
for(i=0;i<6;i++)
|
|
|
|
{
|
|
|
|
if(rhd.ioBase[i])
|
|
|
|
dbgprintf("Io base_%d 0x%x size 0x%x\n",
|
|
|
|
i,rhd.ioBase[i],(1<<rhd.memsize[i]));
|
|
|
|
};
|
|
|
|
if(!RHDPreInit())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
R5xx2DInit();
|
2008-07-02 14:41:34 +02:00
|
|
|
rhd.has_tcl = 1;
|
2008-10-13 23:02:35 +02:00
|
|
|
|
2008-09-24 16:30:07 +02:00
|
|
|
// Init3DEngine(&rhd);
|
2008-06-26 20:19:47 +02:00
|
|
|
|
|
|
|
//init_r500();
|
|
|
|
|
|
|
|
|
|
|
|
retval = RegService("HDRAW", srv_2d);
|
|
|
|
dbgprintf("reg service %s as: %x\n", "HDRAW", retval);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define API_VERSION 0x01000100
|
|
|
|
|
|
|
|
#define SRV_GETVERSION 0
|
|
|
|
|
|
|
|
|
2008-10-16 14:00:10 +02:00
|
|
|
int __stdcall srv_2d(ioctl_t *io)
|
2008-06-26 20:19:47 +02:00
|
|
|
{
|
2008-10-13 23:02:35 +02:00
|
|
|
u32_t *inp;
|
|
|
|
u32_t *outp;
|
2008-06-26 20:19:47 +02:00
|
|
|
|
|
|
|
inp = io->input;
|
|
|
|
outp = io->output;
|
|
|
|
|
|
|
|
switch(io->io_code)
|
|
|
|
{
|
|
|
|
case SRV_GETVERSION:
|
|
|
|
if(io->out_size==4)
|
|
|
|
{
|
|
|
|
*outp = API_VERSION;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
case PX_CREATE:
|
|
|
|
if(io->inp_size==7)
|
|
|
|
return CreatePixmap((pixmap_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_DESTROY:
|
|
|
|
if(io->inp_size==7)
|
|
|
|
return DestroyPixmap((pixmap_t*)inp);
|
|
|
|
break;
|
|
|
|
|
2008-10-16 14:00:10 +02:00
|
|
|
case PX_CLEAR:
|
|
|
|
if(io->inp_size==2)
|
|
|
|
return ClearPixmap((io_clear_t*)inp);
|
|
|
|
break;
|
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
case PX_DRAW_RECT:
|
2008-10-15 12:31:44 +02:00
|
|
|
if(io->inp_size==7)
|
2008-10-16 14:00:10 +02:00
|
|
|
return DrawRect((io_draw_t*)inp);
|
2008-06-26 20:19:47 +02:00
|
|
|
break;
|
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
case PX_FILL_RECT:
|
2008-10-16 14:00:10 +02:00
|
|
|
if(io->inp_size==10)
|
|
|
|
return FillRect((io_fill_t*)inp);
|
2008-06-27 12:46:14 +02:00
|
|
|
break;
|
2008-10-13 23:02:35 +02:00
|
|
|
|
|
|
|
case PX_BLIT:
|
|
|
|
if(io->inp_size==8)
|
2008-10-16 14:00:10 +02:00
|
|
|
return Blit((io_blit_t*)inp);
|
2008-10-13 23:02:35 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_BLIT_TRANSPARENT:
|
2008-10-16 14:00:10 +02:00
|
|
|
if(io->inp_size==9)
|
|
|
|
return BlitTransparent((io_blit_t*)inp);
|
2008-10-13 23:02:35 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_LINE:
|
2008-10-12 23:59:52 +02:00
|
|
|
if(io->inp_size==6)
|
2008-10-16 14:00:10 +02:00
|
|
|
return Line((io_draw_t*)inp);
|
2008-06-26 20:19:47 +02:00
|
|
|
break;
|
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
/*
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-07-02 14:41:34 +02:00
|
|
|
case COMPIZ:
|
|
|
|
if(io->inp_size==6)
|
|
|
|
return RadeonComposite((blit_t*)inp);
|
|
|
|
break;
|
2008-10-12 23:59:52 +02:00
|
|
|
*/
|
2008-07-23 12:25:40 +02:00
|
|
|
|
2008-06-26 20:19:47 +02:00
|
|
|
default:
|
|
|
|
return ERR_PARAM;
|
|
|
|
};
|
|
|
|
return ERR_PARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "init.c"
|
|
|
|
#include "pci.c"
|
|
|
|
#include "ati_mem.c"
|
|
|
|
|
|
|
|
#include "r500.inc"
|
2008-10-12 23:59:52 +02:00
|
|
|
|
|
|
|
#include "clip.inc"
|
2008-10-13 23:02:35 +02:00
|
|
|
#include "pixmap.inc"
|
2008-06-26 20:19:47 +02:00
|
|
|
#include "accel_2d.inc"
|
2008-10-16 14:00:10 +02:00
|
|
|
//#include "accel_3d.inc"
|
2008-06-26 20:19:47 +02:00
|
|
|
|
|
|
|
|