Subversion Repositories Kolibri OS

Rev

Rev 877 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. #include "types.h"
  3.  
  4. #include <stdio.h>
  5. #include <malloc.h>
  6. #include <memory.h>
  7.  
  8. #include "syscall.h"
  9.  
  10. #include "ati2d.h"
  11. #include "accel_2d.h"
  12.  
  13. RHD_t rhd;
  14.  
  15. static clip_t  clip;
  16.  
  17. static local_pixmap_t scr_pixmap;
  18.  
  19. static void Init3DEngine(RHDPtr rhdPtr);
  20.  
  21. int __stdcall srv_2d(ioctl_t *io);
  22.  
  23. u32_t __stdcall drvEntry(int action)
  24. {
  25.   RHDPtr rhdPtr;
  26.   u32_t retval;
  27.  
  28.   int i;
  29.  
  30.   if(action != 1)
  31.     return 0;
  32.  
  33.   if(!dbg_open("/hd0/2/ati2d.log"))
  34.   {
  35.      printf("Can't open /rd/1/drivers/ati2d.log\nExit\n");
  36.      return 0;
  37.   }
  38.   if( GetScreenBpp() != 32)
  39.   {
  40.      printf("32 bpp dispaly mode required !\nExit\t");
  41.      return 0;
  42.   }
  43.  
  44.   if((rhdPtr=FindPciDevice())==NULL)
  45.   {
  46.     dbgprintf("Device not found\n");
  47.     return 0;
  48.   };
  49.  
  50.   for(i=0;i<6;i++)
  51.   {
  52.     if(rhd.memBase[i])
  53.       dbgprintf("Memory base_%d 0x%x size 0x%x\n",
  54.                 i,rhd.memBase[i],(1<<rhd.memsize[i]));
  55.   };
  56.   for(i=0;i<6;i++)
  57.   {
  58.     if(rhd.ioBase[i])
  59.       dbgprintf("Io base_%d 0x%x size 0x%x\n",
  60.                 i,rhd.ioBase[i],(1<<rhd.memsize[i]));
  61.   };
  62.   if(!RHDPreInit())
  63.     return 0;
  64.  
  65.   R5xx2DInit();
  66.   rhd.has_tcl = 1;
  67.  
  68. //  Init3DEngine(&rhd);
  69.  
  70.   //init_r500();
  71.  
  72.  
  73.   retval = RegService("HDRAW", srv_2d);
  74.   dbgprintf("reg service %s as: %x\n", "HDRAW", retval);
  75.  
  76.   return retval;
  77. };
  78.  
  79.  
  80. #define API_VERSION     0x01000100
  81.  
  82. #define SRV_GETVERSION  0
  83.  
  84.  
  85. int _stdcall srv_2d(ioctl_t *io)
  86. {
  87.   u32_t *inp;
  88.   u32_t *outp;
  89.  
  90.   inp = io->input;
  91.   outp = io->output;
  92.  
  93.   switch(io->io_code)
  94.   {
  95.     case SRV_GETVERSION:
  96.       if(io->out_size==4)
  97.       {
  98.         *outp = API_VERSION;
  99.         return 0;
  100.       }
  101.       break;
  102.  
  103.       case PX_CREATE:
  104.         if(io->inp_size==7)
  105.           return CreatePixmap((pixmap_t*)inp);
  106.         break;
  107.  
  108.       case PX_DESTROY:
  109.         if(io->inp_size==7)
  110.           return DestroyPixmap((pixmap_t*)inp);
  111.         break;
  112.  
  113.       case PX_DRAW_RECT:
  114.         if(io->inp_size==7)
  115.           return DrawRect((draw_t*)inp);
  116.         break;
  117.  
  118.       case PX_FILL_RECT:
  119.         if(io->inp_size==9)
  120.           return FillRect((fill_t*)inp);
  121.         break;
  122.  
  123.       case PX_BLIT:
  124.         if(io->inp_size==8)
  125.           return PixBlit((pixblit_t*)inp);
  126.         break;
  127.  
  128.      case  PX_BLIT_TRANSPARENT:
  129.         if(io->inp_size==8)
  130.           return TransBlit((pixblit_t*)inp);
  131.         break;
  132.  
  133.       case PX_LINE:
  134.         if(io->inp_size==6)
  135.           return Line((draw_t*)inp);
  136.         break;
  137.  
  138. /*
  139.       case BLIT:
  140.         if(io->inp_size==6)
  141.           return Blit((blit_t*)inp);
  142.         break;
  143.  
  144.       case COMPIZ:
  145.         if(io->inp_size==6)
  146.           return RadeonComposite((blit_t*)inp);
  147.         break;
  148. */
  149.  
  150.     default:
  151.       return ERR_PARAM;
  152.   };
  153.   return ERR_PARAM;
  154. }
  155.  
  156.  
  157. #include "init.c"
  158. #include "pci.c"
  159. #include "ati_mem.c"
  160. //#include "cursor.inc"
  161.  
  162. #include "r500.inc"
  163.  
  164. #include "clip.inc"
  165. #include "pixmap.inc"
  166. #include "accel_2d.inc"
  167. #include "accel_3d.inc"
  168.  
  169.  
  170.