Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright © <2010>, Intel Corporation.
  3.  *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a
  5.  * copy of this software and associated documentation files (the
  6.  * "Software"), to deal in the Software without restriction, including
  7.  * without limitation the rights to use, copy, modify, merge, publish,
  8.  * distribute, sub license, and/or sell copies of the Software, and to
  9.  * permit persons to whom the Software is furnished to do so, subject to
  10.  * the following conditions:
  11.  *
  12.  * The above copyright notice and this permission notice (including the
  13.  * next paragraph) shall be included in all copies or substantial portions
  14.  * of the Software.
  15.  *
  16.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  19.  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
  20.  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21.  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22.  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23.  *
  24.  * This file was originally licensed under the following license
  25.  *
  26.  *  Licensed under the Apache License, Version 2.0 (the "License");
  27.  *  you may not use this file except in compliance with the License.
  28.  *  You may obtain a copy of the License at
  29.  *
  30.  *      http://www.apache.org/licenses/LICENSE-2.0
  31.  *
  32.  *  Unless required by applicable law or agreed to in writing, software
  33.  *  distributed under the License is distributed on an "AS IS" BASIS,
  34.  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  35.  *  See the License for the specific language governing permissions and
  36.  *  limitations under the License.
  37.  *
  38.  */
  39. /////////////////////////////////////////////////////////////////////////////////////
  40. // Kernel name: AVC_ILDB_Root_Mbaff.asm
  41. //
  42. //  Root kernel serves as a scheduler for child threads.
  43. //
  44. //
  45. //      ***** Note *****
  46. //      Initial design bundle MB pair for each thread, and share AVC_ILDB_MB_Dep_Check.asm
  47. //      with non mbaff kernels.
  48. //
  49. //      Optimization will be done later, putting top and bottom MBs on separate threads.
  50. //
  51. //
  52. /////////////////////////////////////////////////////////////////////////////////////
  53. //
  54. //  $Revision: 1 $
  55. //  $Date: 10/19/06 5:06p $
  56. //
  57.  
  58. // ----------------------------------------------------
  59. //  AVC_ILDB_ROOT_MBAFF_Y
  60. // ----------------------------------------------------
  61. #define AVC_ILDB
  62.  
  63. .kernel AVC_ILDB_ROOT_MBAFF_Y
  64. #if defined(COMBINED_KERNEL)
  65. ILDB_LABEL(AVC_ILDB_ROOT_Y):
  66. #endif
  67.  
  68. #include "SetupVPKernel.asm"
  69. #include "AVC_ILDB.inc"
  70.  
  71.  
  72. #if defined(_DEBUG)
  73.  
  74. /////////////////////////////////////////////////////////////////////////////////////
  75. // Init URB space for running on RTL.  It satisfies reading an unwritten URB entries.  
  76. // Will remove it for production release.
  77.  
  78.  
  79. //mov (8) m1:ud                 0x11111111:ud
  80. //mov (8) m2:ud                 0x22222222:ud
  81. //mov (8) m3:ud                 0x33333333:ud
  82. //mov (8) m4:ud                 0x44444444:ud
  83.  
  84. //mov (1)       Temp1_W:w       0:w
  85.  
  86. //ILDB_INIT_URB:
  87. //mul (1)       URBOffset:w                             Temp1_W:w               4:w
  88. //shl (1) URBWriteMsgDescLow:uw         URBOffset:w             4:w             // Msg descriptor: URB write dest offset (9:4)
  89. //mov (1) URBWriteMsgDescHigh:uw        0x0650:uw                               // Msg descriptor: URB write 5 MRFs (m0 - m4)
  90. //#include "writeURB.asm"
  91.  
  92. //add           (1)             Temp1_W:w       Temp1_W:w       1:w                             // Increase block count
  93. //cmp.l.f0.0 (1)        null            Temp1_W:w       MBsCntY:w               // Check the block count limit
  94. //(f0.0) jmpi           ILDB_INIT_URB                                                   // Loop back
  95.  
  96. /////////////////////////////////////////////////////////////////////////////////////
  97.  
  98.  
  99. mov             (1)             EntrySignature:w                        0xEFF0:w
  100.  
  101. #endif
  102. //----------------------------------------------------------------------------------------------------------------
  103.  
  104. // Set global variable
  105. mov (32)        ChildParam:uw                   0:uw                                                            // Reset local variables
  106. //mul   (1)             TotalBlocks:w                   MBsCntX:w               MBsCntY:w                       // Total # of MB pairs
  107. //add   (1)             GatewayApertureE:w              MBsCntY:w               GatewayApertureB:w      // Aperture End = aperture Head + BlockCntY
  108.  
  109.  
  110. // 2 URB entries for Y:
  111. // Entry 0 - Child thread R0Hdr
  112. // Entry 1 - input parameter to child kernel (child r1)
  113.  
  114. #undef          URB_ENTRIES_PER_MB
  115. #define         URB_ENTRIES_PER_MB              2
  116.  
  117. // URB_ENTRIES_PER_MB in differnt form, the final desired format is (URB_ENTRIES_PER_MB-1) << 10
  118. mov (1)         URB_EntriesPerMB_2:w            URB_ENTRIES_PER_MB-1:w
  119. shl (1)         URB_EntriesPerMB_2:w            URB_EntriesPerMB_2:w    10:w
  120.  
  121. mov     (1)             ChildThreadsID:uw               1:uw                                    // ChildThreadsID for chroma root
  122.  
  123. shr (1)         ThreadLimit:w           MaxThreads:w            1:w             // Initial luma thread limit to 50%
  124. mul     (1)             TotalBlocks:w           MBsCntX:w               MBsCntY:w       // MBs to be processed count down from TotalBlocks
  125.  
  126. //***** Init CT_R0Hdr fields that are common to all threads *************************
  127. mov (8)         CT_R0Hdr.0:ud                   r0.0<8;8,1>:ud                          // Init to root R0 header
  128. mov (1)         CT_R0Hdr.7:ud                   r0.6:ud                                         // Copy Parent Thread Cnt; JJ did the change on 06/20/2006
  129. mov (1)         CT_R0Hdr.31:ub                  0:w                                                     // Reset the highest byte
  130. mov (1)         CT_R0Hdr.3:ud                   0x00000000       
  131. mov (1)         CT_R0Hdr.6:uw                   sr0.0:uw                                        // sr0.0: state reg contains general thread states, e.g. EUID/TID.
  132.  
  133. //***** Init ChildParam fields that are common to all threads ***********************
  134. mov (8)         ChildParam<1>:ud        RootParam<8;8,1>:ud             // Copy all root parameters
  135. mov (4)         CurCol<1>:w                     0:w                                             // Reset CurCol, CurRow
  136. add     (2)             LastCol<1>:w            MBsCntX<2;2,1>:w                -1:w    // Get LastCol and LastRow
  137.  
  138. mov (1)         URBWriteMsgDesc:ud              MSG_LEN(2)+URBWMSGDSC:ud
  139.  
  140. //===================================================================================
  141.  
  142. #include "AVC_ILDB_OpenGateway.asm"             // Open root thread gateway for receiving notification
  143.  
  144. #if defined(DEV_CL)    
  145.         mov     (1)             URBOffset:uw            240:uw  // Use chroma URB offset to spawn chroma root
  146. #else
  147.         mov     (1)             URBOffset:uw            320:uw  // Use chroma URB offset to spawn chroma root
  148. #endif
  149.  
  150. #include "AVC_ILDB_SpawnChromaRoot.asm" // Spawn chroma root
  151.  
  152. mov     (1)             URBOffset:uw            0:uw    // Use luma URB offset to spawn luma child
  153. mov     (1)             ChildThreadsID:uw       2:uw    // Starting ChildThreadsID for luma child threads
  154.  
  155. #include "AVC_ILDB_Dep_Check.asm"       // Check dependency and spawn all MBs
  156.  
  157. // Wait for UV root thread to finish
  158. ILDB_LABEL(WAIT_FOR_UV):
  159. cmp.l.f0.0 (1) null:w   ThreadLimit:w           MaxThreads:w
  160. (f0.0)  jmpi    ILDB_LABEL(WAIT_FOR_UV)
  161.  
  162. #include "AVC_ILDB_CloseGateway.asm"    // Close root thread gateway
  163.  
  164. END_THREAD                                                              // End of root thread
  165.  
  166. #if !defined(COMBINED_KERNEL)           // For standalone kernel only
  167. .end_code
  168.  
  169. .end_kernel
  170. #endif
  171.