Debian Codegraph @

src/shaders/h264/ildb/AVC_ILDB_Root_UV.asm

raw
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 // Kernel name: AVC_ILDB_Root_UV.asm
40 //
41 // Root kernel serves as a scheduler for child threads
42 //
43 // $Revision: 1 $
44 // $Date: 10/19/06 5:06p $
45 //
46
47 // ----------------------------------------------------
48 // AVC_ILDB_ROOT_UV
49 // ----------------------------------------------------
50 #define AVC_ILDB
51
52 .kernel AVC_ILDB_ROOT_UV
53 #if defined(COMBINED_KERNEL)
54 ILDB_LABEL(AVC_ILDB_ROOT_UV):
55 #endif
56
57 #include "SetupVPKernel.asm"
58 #include "AVC_ILDB.inc"
59
60 #if defined(_DEBUG)
61 mov (1) EntrySignature:w 0xFF11:w
62 #endif
63
64 /////////////////////////////////////////////////////////////////////////////////////
65 #if defined(_DEBUG)
66
67 // Init URB space for running on RTL. It satisfies reading an unwritten URB entries.
68 // Will remove it for production release.
69
70 mov (8) m1:ud 0x55555555:ud
71 mov (8) m2:ud 0x66666666:ud
72 mov (8) m3:ud 0x77777777:ud
73 mov (8) m4:ud 0x88888888:ud
74
75 mov (1) Temp1_W:w MBsCntY:w
76 shl (1) Temp2_W:w MBsCntY:w 1:w
77
78 ILDB_LABEL(ILDB_INIT_URB_UV):
79 mul (1) URBOffset:uw Temp1_W:uw 4:w // Each thread uses 4 URB entries (1 r0 + 1 inline + 2 data)
80 mov (1) URBWriteMsgDesc:ud MSG_LEN(4)+URBWMSGDSC:ud // Msg descriptor: URB write msg length = 5
81 #include "writeURB.asm"
82
83 add (1) Temp1_W:w Temp1_W:w 1:w // Increase block count
84 cmp.l.f0.0 (1) null Temp1_W:w Temp2_W:w // Check the block count limit
85 (f0.0) jmpi ILDB_LABEL(ILDB_INIT_URB_UV) // Loop back
86
87 mov (1) EntrySignature:w 0xFFF0:w
88
89 #endif
90 /////////////////////////////////////////////////////////////////////////////////////
91
92 // Set global variable
93 mov (32) ChildParam:uw 0:uw // Reset local variables, 2 GRFs
94 //mul (1) TotalBlocks:w MBsCntX:w MBsCntY:w // Total # of blocks
95 //add (1) GatewayApertureE:w MBsCntY:w GatewayApertureB:w // Aperture End = aperture Head + BlockCntY
96
97 // 4 URB entries for Y:
98 // Entry 0 - Child thread R0Hdr
99 // Entry 1 - input parameter to child kernel (child r1)
100 // Entry 2 - Prev MB data UV 2x8
101 // Entry 3 - Unused
102
103 #define URB_ENTRIES_PER_MB 4
104
105 // URB_ENTRIES_PER_MB in differnt form, the final desired format is (URB_ENTRIES_PER_MB-1) << 10
106 mov (1) URB_EntriesPerMB_2:w URB_ENTRIES_PER_MB-1:w
107 shl (1) URB_EntriesPerMB_2:w URB_EntriesPerMB_2:w 10:w
108
109 #define CHROMA_ROOT // Compiling flag for chroma only
110
111 // URB base for UV kernels
112 #if defined(DEV_CL)
113 mov (1) URBOffsetUVBase:w 240:w
114 #else
115 mov (1) URBOffsetUVBase:w 320:w
116 #endif
117
118
119 mov (1) ChildThreadsID:uw 3:uw
120
121 shr (1) ThreadLimit:w MaxThreads:w 1:w // Initial luma thread limit to 50%
122 mul (1) TotalBlocks:w MBsCntX:w MBsCntY:w // MBs to be processed count down from TotalBlocks
123
124 //***** Init CT_R0Hdr fields that are common to all threads *************************
125 mov (8) CT_R0Hdr.0:ud r0.0<8;8,1>:ud // Init to root R0 header
126 mov (1) CT_R0Hdr.7:ud r0.6:ud // Copy Parent Thread Cnt; JJ did the change on 06/20/2006
127 mov (1) CT_R0Hdr.31:ub 0:w // Reset the highest byte
128 mov (1) CT_R0Hdr.3:ud 0x00000000
129 mov (1) CT_R0Hdr.6:uw sr0.0:uw // sr0.0: state reg contains general thread states, e.g. EUID/TID.
130
131 //***** Init ChildParam fields that are common to all threads ***********************
132 mov (8) ChildParam<1>:ud RootParam<8;8,1>:ud // Copy all root parameters
133 mov (4) CurCol<1>:w 0:w // Reset CurCol, CurRow,
134 add (2) LastCol<1>:w MBsCntX<2;2,1>:w -1:w // Get LastCol and LastRow
135
136 mov (1) URBWriteMsgDesc:ud MSG_LEN(2)+URBWMSGDSC:ud
137
138 //===================================================================================
139
140 #include "AVC_ILDB_OpenGateway.asm" // Open gateway for receiving notification
141
142 #include "AVC_ILDB_Dep_Check.asm" // Check dependency and spawn all luma child threads in parallel with chroma root
143
144 //#include "AVC_ILDB_LumaThrdLimit.asm" // Update thread limit in luma root thread via gateway
145
146 #include "AVC_ILDB_CloseGateway.asm" // Close root thread gateway
147
148 // Chroma root EOT = child send EOT : Request type = 1
149 END_CHILD_THREAD
150
151 #undef CHROMA_ROOT
152
153 #if !defined(COMBINED_KERNEL) // For standalone kernel only
154 .end_code
155
156 .end_kernel
157 #endif