Subversion Repositories Kolibri OS

Rev

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