Subversion Repositories Kolibri OS

Rev

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

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