2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-22 23:29:38 +04:00
|
|
|
|
2009-02-11 09:52:01 +03:00
|
|
|
#define R300_PIO 0
|
2009-01-27 03:31:09 +03:00
|
|
|
|
|
|
|
|
|
|
|
#define API_VERSION 0x01000100
|
|
|
|
|
|
|
|
#define SRV_GETVERSION 0
|
2008-10-22 23:29:38 +04:00
|
|
|
|
|
|
|
|
2008-10-14 01:02:35 +04:00
|
|
|
#include "types.h"
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-14 01:02:35 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <memory.h>
|
|
|
|
|
2008-10-19 19:53:12 +04:00
|
|
|
#include "pci.h"
|
|
|
|
|
2008-10-14 01:02:35 +04:00
|
|
|
#include "syscall.h"
|
2008-10-13 01:59:52 +04:00
|
|
|
|
2008-10-19 19:53:12 +04:00
|
|
|
#include "radeon_reg.h"
|
|
|
|
|
2009-02-08 21:41:45 +03:00
|
|
|
#include "atihw.h"
|
|
|
|
|
2008-06-26 22:19:47 +04:00
|
|
|
#include "accel_2d.h"
|
|
|
|
|
2008-10-22 23:29:38 +04:00
|
|
|
RHD_t rhd __attribute__ ((aligned (128))); /* reduce cache lock */
|
2008-06-26 22:19:47 +04:00
|
|
|
|
|
|
|
static clip_t clip;
|
|
|
|
|
2008-10-13 01:59:52 +04:00
|
|
|
static local_pixmap_t scr_pixmap;
|
2008-07-03 15:35:35 +04:00
|
|
|
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-14 01:02:35 +04:00
|
|
|
int __stdcall srv_2d(ioctl_t *io);
|
|
|
|
|
|
|
|
u32_t __stdcall drvEntry(int action)
|
2008-06-26 22:19:47 +04:00
|
|
|
{
|
2008-10-26 23:09:43 +03:00
|
|
|
RHDPtr rhdPtr;
|
|
|
|
u32_t retval;
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
int i;
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
if(action != 1)
|
|
|
|
return 0;
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2009-02-08 21:41:45 +03:00
|
|
|
if(!dbg_open("/bd0/2/ati2d.log"))
|
2008-10-26 23:09:43 +03: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 22:19:47 +04:00
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
if((rhdPtr=FindPciDevice())==NULL)
|
|
|
|
{
|
|
|
|
dbgprintf("Device not found\n");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2009-02-11 09:52:01 +03:00
|
|
|
dbgprintf("detect %s GART\n",
|
|
|
|
rhd.gart_type == RADEON_IS_PCIE ? "PCIE":"PCI");
|
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
for(i=0;i<6;i++)
|
|
|
|
{
|
|
|
|
if(rhd.memBase[i])
|
2009-02-08 21:41:45 +03:00
|
|
|
dbgprintf("Memory base_%d 0x%x size 0x%x\n",
|
|
|
|
i,rhd.memBase[i],(1<<rhd.memsize[i]));
|
2008-10-26 23:09:43 +03:00
|
|
|
};
|
|
|
|
for(i=0;i<6;i++)
|
|
|
|
{
|
2009-02-08 21:41:45 +03: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 23:09:43 +03:00
|
|
|
};
|
|
|
|
if(!RHDPreInit())
|
|
|
|
return 0;
|
2008-10-14 01:02:35 +04:00
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
R5xx2DInit();
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
Init3DEngine(&rhd);
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
retval = RegService("HDRAW", srv_2d);
|
|
|
|
dbgprintf("reg service %s as: %x\n", "HDRAW", retval);
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2008-10-26 23:09:43 +03:00
|
|
|
return retval;
|
2008-06-26 22:19:47 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-10-16 16:00:10 +04:00
|
|
|
int __stdcall srv_2d(ioctl_t *io)
|
2008-06-26 22:19:47 +04:00
|
|
|
{
|
2009-02-08 21:41:45 +03: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 22:19:47 +04:00
|
|
|
};
|
2009-02-08 21:41:45 +03:00
|
|
|
|
2008-06-26 22:19:47 +04:00
|
|
|
return ERR_PARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "init.c"
|
|
|
|
#include "pci.c"
|
|
|
|
#include "ati_mem.c"
|
|
|
|
|
|
|
|
#include "r500.inc"
|
2008-10-13 01:59:52 +04:00
|
|
|
|
|
|
|
#include "clip.inc"
|
2008-10-14 01:02:35 +04:00
|
|
|
#include "pixmap.inc"
|
2008-06-26 22:19:47 +04:00
|
|
|
#include "accel_2d.inc"
|
2009-02-11 09:52:01 +03:00
|
|
|
#include "init_3d.inc"
|
|
|
|
#include "blend.inc"
|
2009-02-08 21:41:45 +03:00
|
|
|
|
|
|
|
#if !R300_PIO
|
|
|
|
|
2009-02-11 09:52:01 +03:00
|
|
|
#include "init_cp.c"
|
2008-06-26 22:19:47 +04:00
|
|
|
|
2009-02-08 21:41:45 +03:00
|
|
|
#endif
|
|
|
|
|
2008-06-26 22:19:47 +04:00
|
|
|
|