2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-22 21:29:38 +02:00
|
|
|
|
2009-02-11 07:52:01 +01:00
|
|
|
#define R300_PIO 0
|
2009-01-27 01:31:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
#define API_VERSION 0x01000100
|
|
|
|
|
|
|
|
#define SRV_GETVERSION 0
|
2008-10-22 21:29:38 +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>
|
|
|
|
|
2008-10-19 17:53:12 +02:00
|
|
|
#include "pci.h"
|
|
|
|
|
2008-10-13 23:02:35 +02:00
|
|
|
#include "syscall.h"
|
2008-10-12 23:59:52 +02:00
|
|
|
|
2008-10-19 17:53:12 +02:00
|
|
|
#include "radeon_reg.h"
|
|
|
|
|
2009-02-08 19:41:45 +01:00
|
|
|
#include "atihw.h"
|
|
|
|
|
2008-06-26 20:19:47 +02:00
|
|
|
#include "accel_2d.h"
|
|
|
|
|
2008-10-22 21:29:38 +02:00
|
|
|
RHD_t rhd __attribute__ ((aligned (128))); /* reduce cache lock */
|
2008-06-26 20:19:47 +02:00
|
|
|
|
|
|
|
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-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
|
|
|
{
|
2008-10-26 21:09:43 +01:00
|
|
|
RHDPtr rhdPtr;
|
|
|
|
u32_t retval;
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
int i;
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
if(action != 1)
|
|
|
|
return 0;
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2009-02-08 19:41:45 +01:00
|
|
|
if(!dbg_open("/bd0/2/ati2d.log"))
|
2008-10-26 21:09:43 +01:00
|
|
|
{
|
|
|
|
printf("Can't open /rd/1/drivers/ati2d.log\nExit\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if( GetScreenBpp() != 32)
|
|
|
|
{
|
|
|
|
dbgprintf("32 bpp dispaly mode required !\nExit\t");
|
|
|
|
return 0;
|
|
|
|
}
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
if((rhdPtr=FindPciDevice())==NULL)
|
|
|
|
{
|
|
|
|
dbgprintf("Device not found\n");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2009-02-11 07:52:01 +01:00
|
|
|
dbgprintf("detect %s GART\n",
|
|
|
|
rhd.gart_type == RADEON_IS_PCIE ? "PCIE":"PCI");
|
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
for(i=0;i<6;i++)
|
|
|
|
{
|
|
|
|
if(rhd.memBase[i])
|
2009-02-08 19:41:45 +01:00
|
|
|
dbgprintf("Memory base_%d 0x%x size 0x%x\n",
|
|
|
|
i,rhd.memBase[i],(1<<rhd.memsize[i]));
|
2008-10-26 21:09:43 +01:00
|
|
|
};
|
|
|
|
for(i=0;i<6;i++)
|
|
|
|
{
|
2009-02-08 19:41:45 +01:00
|
|
|
if(rhd.ioBase[i])
|
|
|
|
dbgprintf("Io base_%d 0x%x size 0x%x\n",
|
|
|
|
i,rhd.ioBase[i],(1<<rhd.memsize[i]));
|
2008-10-26 21:09:43 +01:00
|
|
|
};
|
|
|
|
if(!RHDPreInit())
|
|
|
|
return 0;
|
2008-10-13 23:02:35 +02:00
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
R5xx2DInit();
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
Init3DEngine(&rhd);
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
retval = RegService("HDRAW", srv_2d);
|
|
|
|
dbgprintf("reg service %s as: %x\n", "HDRAW", retval);
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2008-10-26 21:09:43 +01:00
|
|
|
return retval;
|
2008-06-26 20:19:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-10-16 14:00:10 +02:00
|
|
|
int __stdcall srv_2d(ioctl_t *io)
|
2008-06-26 20:19:47 +02:00
|
|
|
{
|
2009-02-08 19:41:45 +01:00
|
|
|
u32_t *inp;
|
|
|
|
u32_t *outp;
|
|
|
|
|
|
|
|
inp = io->input;
|
|
|
|
outp = io->output;
|
|
|
|
|
|
|
|
switch(io->io_code)
|
|
|
|
{
|
|
|
|
case SRV_GETVERSION:
|
|
|
|
if(io->out_size==4)
|
|
|
|
{
|
|
|
|
*outp = API_VERSION;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
case PX_CLEAR:
|
|
|
|
if(io->inp_size==2)
|
|
|
|
return ClearPixmap((io_clear_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_DRAW_RECT:
|
|
|
|
if(io->inp_size==7)
|
|
|
|
return DrawRect((io_draw_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_FILL_RECT:
|
|
|
|
if(io->inp_size==10)
|
|
|
|
return FillRect((io_fill_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_LINE:
|
|
|
|
if(io->inp_size==6)
|
|
|
|
return Line((io_draw_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_BLIT:
|
|
|
|
if(io->inp_size==8)
|
|
|
|
return Blit((io_blit_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_BLIT_TRANSPARENT:
|
|
|
|
if(io->inp_size==9)
|
|
|
|
return BlitTransparent((io_blit_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PX_BLIT_ALPHA:
|
|
|
|
if(io->inp_size==9)
|
|
|
|
return RadeonComposite((io_blit_t*)inp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return ERR_PARAM;
|
2008-06-26 20:19:47 +02:00
|
|
|
};
|
2009-02-08 19:41:45 +01:00
|
|
|
|
2008-06-26 20:19:47 +02:00
|
|
|
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"
|
2009-02-11 07:52:01 +01:00
|
|
|
#include "init_3d.inc"
|
|
|
|
#include "blend.inc"
|
2009-02-08 19:41:45 +01:00
|
|
|
|
|
|
|
#if !R300_PIO
|
|
|
|
|
2009-02-11 07:52:01 +01:00
|
|
|
#include "init_cp.c"
|
2008-06-26 20:19:47 +02:00
|
|
|
|
2009-02-08 19:41:45 +01:00
|
|
|
#endif
|
|
|
|
|
2008-06-26 20:19:47 +02:00
|
|
|
|