Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright © <2010>, Intel Corporation.
  3.  *
  4.  * This program is licensed under the terms and conditions of the
  5.  * Eclipse Public License (EPL), version 1.0.  The full text of the EPL is at
  6.  * http://www.opensource.org/licenses/eclipse-1.0.php.
  7.  *
  8.  */
  9. // Kernel name: AVC_ILDB_Root_UV.asm
  10. //
  11. //  Root kernel serves as a scheduler for child threads
  12. //
  13. //  $Revision: 1 $
  14. //  $Date: 10/19/06 5:06p $
  15. //
  16.  
  17. // ----------------------------------------------------
  18. //  AVC_ILDB_ROOT_UV
  19. // ----------------------------------------------------
  20. #define AVC_ILDB
  21.  
  22. .kernel AVC_ILDB_ROOT_UV
  23. #if defined(COMBINED_KERNEL)
  24. ILDB_LABEL(AVC_ILDB_ROOT_UV):
  25. #endif
  26.  
  27. #include "SetupVPKernel.asm"
  28. #include "AVC_ILDB.inc"
  29.  
  30. #if defined(_DEBUG)
  31. mov             (1)             EntrySignature:w                        0xFF11:w
  32. #endif
  33.  
  34. /////////////////////////////////////////////////////////////////////////////////////
  35. #if defined(_DEBUG)
  36.  
  37. // Init URB space for running on RTL.  It satisfies reading an unwritten URB entries.  
  38. // Will remove it for production release.
  39.  
  40. mov (8) m1:ud           0x55555555:ud
  41. mov (8) m2:ud           0x66666666:ud
  42. mov (8) m3:ud           0x77777777:ud
  43. mov (8) m4:ud           0x88888888:ud
  44.  
  45. mov (1) Temp1_W:w       MBsCntY:w
  46. shl (1) Temp2_W:w       MBsCntY:w               1:w
  47.  
  48. ILDB_LABEL(ILDB_INIT_URB_UV):
  49. mul (1) URBOffset:uw                    Temp1_W:uw              4:w             // Each thread uses 4 URB entries (1 r0 + 1 inline + 2 data)
  50. mov (1) URBWriteMsgDesc:ud              MSG_LEN(4)+URBWMSGDSC:ud                        // Msg descriptor: URB write msg length = 5
  51. #include "writeURB.asm"
  52.  
  53. add             (1)             Temp1_W:w       Temp1_W:w       1:w                             // Increase block count
  54. cmp.l.f0.0 (1)  null            Temp1_W:w       Temp2_W:w               // Check the block count limit
  55. (f0.0) jmpi             ILDB_LABEL(ILDB_INIT_URB_UV)                    // Loop back
  56.  
  57. mov             (1)             EntrySignature:w                        0xFFF0:w
  58.  
  59. #endif
  60. /////////////////////////////////////////////////////////////////////////////////////
  61.  
  62. // Set global variable
  63. mov (32)        ChildParam:uw                   0:uw                                                            // Reset local variables, 2 GRFs
  64. //mul   (1)             TotalBlocks:w                   MBsCntX:w               MBsCntY:w                       // Total # of blocks
  65. //add   (1)             GatewayApertureE:w              MBsCntY:w               GatewayApertureB:w      // Aperture End = aperture Head + BlockCntY
  66.  
  67. // 4 URB entries for Y:
  68. // Entry 0 - Child thread R0Hdr
  69. // Entry 1 - input parameter to child kernel (child r1)
  70. // Entry 2 - Prev MB data UV 2x8
  71. // Entry 3 - Unused
  72.  
  73. #define         URB_ENTRIES_PER_MB      4
  74.  
  75. // URB_ENTRIES_PER_MB in differnt form, the final desired format is (URB_ENTRIES_PER_MB-1) << 10
  76. mov (1)         URB_EntriesPerMB_2:w            URB_ENTRIES_PER_MB-1:w
  77. shl (1)         URB_EntriesPerMB_2:w            URB_EntriesPerMB_2:w    10:w
  78.  
  79. #define         CHROMA_ROOT                                                                                                     // Compiling flag for chroma only
  80.  
  81. // URB base for UV kernels
  82. #if defined(DEV_CL)    
  83.         mov (1)         URBOffsetUVBase:w               240:w
  84. #else
  85.         mov (1)         URBOffsetUVBase:w               320:w
  86. #endif
  87.  
  88.  
  89. mov     (1)             ChildThreadsID:uw               3:uw
  90.  
  91. shr (1)         ThreadLimit:w           MaxThreads:w            1:w             // Initial luma thread limit to 50%
  92. mul     (1)             TotalBlocks:w           MBsCntX:w               MBsCntY:w       // MBs to be processed count down from TotalBlocks
  93.  
  94. //***** Init CT_R0Hdr fields that are common to all threads *************************
  95. mov (8)         CT_R0Hdr.0:ud           r0.0<8;8,1>:ud                          // Init to root R0 header
  96. mov (1)         CT_R0Hdr.7:ud           r0.6:ud                                         // Copy Parent Thread Cnt; JJ did the change on 06/20/2006
  97. mov (1)         CT_R0Hdr.31:ub          0:w                                                     // Reset the highest byte
  98. mov (1)         CT_R0Hdr.3:ud           0x00000000       
  99. mov (1)         CT_R0Hdr.6:uw           sr0.0:uw                                        // sr0.0: state reg contains general thread states, e.g. EUID/TID.
  100.  
  101. //***** Init ChildParam fields that are common to all threads ***********************
  102. mov (8)         ChildParam<1>:ud        RootParam<8;8,1>:ud             // Copy all root parameters
  103. mov (4)         CurCol<1>:w                     0:w                                             // Reset CurCol, CurRow,
  104. add     (2)             LastCol<1>:w            MBsCntX<2;2,1>:w                -1:w    // Get LastCol and LastRow
  105.  
  106. mov (1)         URBWriteMsgDesc:ud              MSG_LEN(2)+URBWMSGDSC:ud
  107.  
  108. //===================================================================================
  109.  
  110. #include "AVC_ILDB_OpenGateway.asm"             // Open gateway for receiving notification
  111.  
  112. #include "AVC_ILDB_Dep_Check.asm"               // Check dependency and spawn all luma child threads in parallel with chroma root
  113.  
  114. //#include "AVC_ILDB_LumaThrdLimit.asm" // Update thread limit in luma root thread via gateway
  115.  
  116. #include "AVC_ILDB_CloseGateway.asm"    // Close root thread gateway
  117.  
  118. // Chroma root EOT = child send EOT : Request type = 1
  119.         END_CHILD_THREAD
  120.        
  121. #undef  CHROMA_ROOT
  122.  
  123. #if !defined(COMBINED_KERNEL)           // For standalone kernel only
  124. .end_code
  125.  
  126. .end_kernel
  127. #endif
  128.