1 /*
2 ************************************************************************************************************************
3 *
4 * Copyright (C) 2007-2022 Advanced Micro Devices, Inc. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE
23 *
24 ***********************************************************************************************************************/
25
26 /**
27 ****************************************************************************************************
28 * @file addrinterface.cpp
29 * @brief Contains the addrlib interface functions
30 ****************************************************************************************************
31 */
32 #include "addrinterface.h"
33 #include "addrlib1.h"
34 #include "addrlib2.h"
35
36 #include "addrcommon.h"
37
38 using namespace Addr;
39
40 ////////////////////////////////////////////////////////////////////////////////////////////////////
41 // Create/Destroy/Config functions
42 ////////////////////////////////////////////////////////////////////////////////////////////////////
43
44 /**
45 ****************************************************************************************************
46 * AddrCreate
47 *
48 * @brief
49 * Create address lib object
50 *
51 * @return
52 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
53 ****************************************************************************************************
54 */
AddrCreate(const ADDR_CREATE_INPUT * pAddrCreateIn,ADDR_CREATE_OUTPUT * pAddrCreateOut)55 ADDR_E_RETURNCODE ADDR_API AddrCreate(
56 const ADDR_CREATE_INPUT* pAddrCreateIn, ///< [in] infomation for creating address lib object
57 ADDR_CREATE_OUTPUT* pAddrCreateOut) ///< [out] address lib handle
58 {
59 ADDR_E_RETURNCODE returnCode = ADDR_OK;
60 {
61 returnCode = Lib::Create(pAddrCreateIn, pAddrCreateOut);
62 }
63
64 return returnCode;
65 }
66
67
68
69 /**
70 ****************************************************************************************************
71 * AddrDestroy
72 *
73 * @brief
74 * Destroy address lib object
75 *
76 * @return
77 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
78 ****************************************************************************************************
79 */
AddrDestroy(ADDR_HANDLE hLib)80 ADDR_E_RETURNCODE ADDR_API AddrDestroy(
81 ADDR_HANDLE hLib) ///< address lib handle
82 {
83 ADDR_E_RETURNCODE returnCode = ADDR_OK;
84
85 if (hLib)
86 {
87 Lib* pLib = Lib::GetLib(hLib);
88 pLib->Destroy();
89 }
90 else
91 {
92 returnCode = ADDR_ERROR;
93 }
94
95 return returnCode;
96 }
97
98
99
100 ////////////////////////////////////////////////////////////////////////////////////////////////////
101 // Surface functions
102 ////////////////////////////////////////////////////////////////////////////////////////////////////
103
104 /**
105 ****************************************************************************************************
106 * AddrComputeSurfaceInfo
107 *
108 * @brief
109 * Calculate surface width/height/depth/alignments and suitable tiling mode
110 *
111 * @return
112 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
113 ****************************************************************************************************
114 */
AddrComputeSurfaceInfo(ADDR_HANDLE hLib,const ADDR_COMPUTE_SURFACE_INFO_INPUT * pIn,ADDR_COMPUTE_SURFACE_INFO_OUTPUT * pOut)115 ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceInfo(
116 ADDR_HANDLE hLib, ///< address lib handle
117 const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] surface information
118 ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) ///< [out] surface parameters and alignments
119 {
120 V1::Lib* pLib = V1::Lib::GetLib(hLib);
121
122 ADDR_E_RETURNCODE returnCode = ADDR_OK;
123
124 if (pLib != NULL)
125 {
126 returnCode = pLib->ComputeSurfaceInfo(pIn, pOut);
127 }
128 else
129 {
130 returnCode = ADDR_ERROR;
131 }
132
133 return returnCode;
134 }
135
136
137
138 /**
139 ****************************************************************************************************
140 * AddrComputeSurfaceAddrFromCoord
141 *
142 * @brief
143 * Compute surface address according to coordinates
144 *
145 * @return
146 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
147 ****************************************************************************************************
148 */
AddrComputeSurfaceAddrFromCoord(ADDR_HANDLE hLib,const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT * pIn,ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT * pOut)149 ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceAddrFromCoord(
150 ADDR_HANDLE hLib, ///< address lib handle
151 const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn, ///< [in] surface info and coordinates
152 ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] surface address
153 {
154 V1::Lib* pLib = V1::Lib::GetLib(hLib);
155
156 ADDR_E_RETURNCODE returnCode = ADDR_OK;
157
158 if (pLib != NULL)
159 {
160 returnCode = pLib->ComputeSurfaceAddrFromCoord(pIn, pOut);
161 }
162 else
163 {
164 returnCode = ADDR_ERROR;
165 }
166
167 return returnCode;
168 }
169
170 /**
171 ****************************************************************************************************
172 * AddrComputeSurfaceCoordFromAddr
173 *
174 * @brief
175 * Compute coordinates according to surface address
176 *
177 * @return
178 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
179 ****************************************************************************************************
180 */
AddrComputeSurfaceCoordFromAddr(ADDR_HANDLE hLib,const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT * pIn,ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT * pOut)181 ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceCoordFromAddr(
182 ADDR_HANDLE hLib, ///< address lib handle
183 const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn, ///< [in] surface info and address
184 ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) ///< [out] coordinates
185 {
186 V1::Lib* pLib = V1::Lib::GetLib(hLib);
187
188 ADDR_E_RETURNCODE returnCode = ADDR_OK;
189
190 if (pLib != NULL)
191 {
192 returnCode = pLib->ComputeSurfaceCoordFromAddr(pIn, pOut);
193 }
194 else
195 {
196 returnCode = ADDR_ERROR;
197 }
198
199 return returnCode;
200 }
201
202
203
204 ////////////////////////////////////////////////////////////////////////////////////////////////////
205 // HTile functions
206 ////////////////////////////////////////////////////////////////////////////////////////////////////
207
208 /**
209 ****************************************************************************************************
210 * AddrComputeHtileInfo
211 *
212 * @brief
213 * Compute Htile pitch, height, base alignment and size in bytes
214 *
215 * @return
216 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
217 ****************************************************************************************************
218 */
AddrComputeHtileInfo(ADDR_HANDLE hLib,const ADDR_COMPUTE_HTILE_INFO_INPUT * pIn,ADDR_COMPUTE_HTILE_INFO_OUTPUT * pOut)219 ADDR_E_RETURNCODE ADDR_API AddrComputeHtileInfo(
220 ADDR_HANDLE hLib, ///< address lib handle
221 const ADDR_COMPUTE_HTILE_INFO_INPUT* pIn, ///< [in] Htile information
222 ADDR_COMPUTE_HTILE_INFO_OUTPUT* pOut) ///< [out] Htile pitch, height and size in bytes
223 {
224 V1::Lib* pLib = V1::Lib::GetLib(hLib);
225
226 ADDR_E_RETURNCODE returnCode = ADDR_OK;
227
228 if (pLib != NULL)
229 {
230 returnCode = pLib->ComputeHtileInfo(pIn, pOut);
231 }
232 else
233 {
234 returnCode = ADDR_ERROR;
235 }
236
237 return returnCode;
238 }
239
240 /**
241 ****************************************************************************************************
242 * AddrComputeHtileAddrFromCoord
243 *
244 * @brief
245 * Compute Htile address according to coordinates (of depth buffer)
246 *
247 * @return
248 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
249 ****************************************************************************************************
250 */
AddrComputeHtileAddrFromCoord(ADDR_HANDLE hLib,const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT * pIn,ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT * pOut)251 ADDR_E_RETURNCODE ADDR_API AddrComputeHtileAddrFromCoord(
252 ADDR_HANDLE hLib, ///< address lib handle
253 const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn, ///< [in] Htile info and coordinates
254 ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] Htile address
255 {
256 V1::Lib* pLib = V1::Lib::GetLib(hLib);
257
258 ADDR_E_RETURNCODE returnCode = ADDR_OK;
259
260 if (pLib != NULL)
261 {
262 returnCode = pLib->ComputeHtileAddrFromCoord(pIn, pOut);
263 }
264 else
265 {
266 returnCode = ADDR_ERROR;
267 }
268
269 return returnCode;
270 }
271
272 /**
273 ****************************************************************************************************
274 * AddrComputeHtileCoordFromAddr
275 *
276 * @brief
277 * Compute coordinates within depth buffer (1st pixel of a micro tile) according to
278 * Htile address
279 *
280 * @return
281 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
282 ****************************************************************************************************
283 */
AddrComputeHtileCoordFromAddr(ADDR_HANDLE hLib,const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT * pIn,ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT * pOut)284 ADDR_E_RETURNCODE ADDR_API AddrComputeHtileCoordFromAddr(
285 ADDR_HANDLE hLib, ///< address lib handle
286 const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn, ///< [in] Htile info and address
287 ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut) ///< [out] Htile coordinates
288 {
289 V1::Lib* pLib = V1::Lib::GetLib(hLib);
290
291 ADDR_E_RETURNCODE returnCode = ADDR_OK;
292
293 if (pLib != NULL)
294 {
295 returnCode = pLib->ComputeHtileCoordFromAddr(pIn, pOut);
296 }
297 else
298 {
299 returnCode = ADDR_ERROR;
300 }
301
302 return returnCode;
303 }
304
305
306
307 ////////////////////////////////////////////////////////////////////////////////////////////////////
308 // C-mask functions
309 ////////////////////////////////////////////////////////////////////////////////////////////////////
310
311 /**
312 ****************************************************************************************************
313 * AddrComputeCmaskInfo
314 *
315 * @brief
316 * Compute Cmask pitch, height, base alignment and size in bytes from color buffer
317 * info
318 *
319 * @return
320 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
321 ****************************************************************************************************
322 */
AddrComputeCmaskInfo(ADDR_HANDLE hLib,const ADDR_COMPUTE_CMASK_INFO_INPUT * pIn,ADDR_COMPUTE_CMASK_INFO_OUTPUT * pOut)323 ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskInfo(
324 ADDR_HANDLE hLib, ///< address lib handle
325 const ADDR_COMPUTE_CMASK_INFO_INPUT* pIn, ///< [in] Cmask pitch and height
326 ADDR_COMPUTE_CMASK_INFO_OUTPUT* pOut) ///< [out] Cmask pitch, height and size in bytes
327 {
328 V1::Lib* pLib = V1::Lib::GetLib(hLib);
329
330 ADDR_E_RETURNCODE returnCode = ADDR_OK;
331
332 if (pLib != NULL)
333 {
334 returnCode = pLib->ComputeCmaskInfo(pIn, pOut);
335 }
336 else
337 {
338 returnCode = ADDR_ERROR;
339 }
340
341 return returnCode;
342 }
343
344 /**
345 ****************************************************************************************************
346 * AddrComputeCmaskAddrFromCoord
347 *
348 * @brief
349 * Compute Cmask address according to coordinates (of MSAA color buffer)
350 *
351 * @return
352 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
353 ****************************************************************************************************
354 */
AddrComputeCmaskAddrFromCoord(ADDR_HANDLE hLib,const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT * pIn,ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT * pOut)355 ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskAddrFromCoord(
356 ADDR_HANDLE hLib, ///< address lib handle
357 const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn, ///< [in] Cmask info and coordinates
358 ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] Cmask address
359 {
360 V1::Lib* pLib = V1::Lib::GetLib(hLib);
361
362 ADDR_E_RETURNCODE returnCode = ADDR_OK;
363
364 if (pLib != NULL)
365 {
366 returnCode = pLib->ComputeCmaskAddrFromCoord(pIn, pOut);
367 }
368 else
369 {
370 returnCode = ADDR_ERROR;
371 }
372
373 return returnCode;
374 }
375
376 /**
377 ****************************************************************************************************
378 * AddrComputeCmaskCoordFromAddr
379 *
380 * @brief
381 * Compute coordinates within color buffer (1st pixel of a micro tile) according to
382 * Cmask address
383 *
384 * @return
385 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
386 ****************************************************************************************************
387 */
AddrComputeCmaskCoordFromAddr(ADDR_HANDLE hLib,const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT * pIn,ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT * pOut)388 ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskCoordFromAddr(
389 ADDR_HANDLE hLib, ///< address lib handle
390 const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT* pIn, ///< [in] Cmask info and address
391 ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut) ///< [out] Cmask coordinates
392 {
393 V1::Lib* pLib = V1::Lib::GetLib(hLib);
394
395 ADDR_E_RETURNCODE returnCode = ADDR_OK;
396
397 if (pLib != NULL)
398 {
399 returnCode = pLib->ComputeCmaskCoordFromAddr(pIn, pOut);
400 }
401 else
402 {
403 returnCode = ADDR_ERROR;
404 }
405
406 return returnCode;
407 }
408
409
410
411 ////////////////////////////////////////////////////////////////////////////////////////////////////
412 // F-mask functions
413 ////////////////////////////////////////////////////////////////////////////////////////////////////
414
415 /**
416 ****************************************************************************************************
417 * AddrComputeFmaskInfo
418 *
419 * @brief
420 * Compute Fmask pitch/height/depth/alignments and size in bytes
421 *
422 * @return
423 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
424 ****************************************************************************************************
425 */
AddrComputeFmaskInfo(ADDR_HANDLE hLib,const ADDR_COMPUTE_FMASK_INFO_INPUT * pIn,ADDR_COMPUTE_FMASK_INFO_OUTPUT * pOut)426 ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskInfo(
427 ADDR_HANDLE hLib, ///< address lib handle
428 const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn, ///< [in] Fmask information
429 ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut) ///< [out] Fmask pitch and height
430 {
431 V1::Lib* pLib = V1::Lib::GetLib(hLib);
432
433 ADDR_E_RETURNCODE returnCode = ADDR_OK;
434
435 if (pLib != NULL)
436 {
437 returnCode = pLib->ComputeFmaskInfo(pIn, pOut);
438 }
439 else
440 {
441 returnCode = ADDR_ERROR;
442 }
443
444 return returnCode;
445 }
446
447 /**
448 ****************************************************************************************************
449 * AddrComputeFmaskAddrFromCoord
450 *
451 * @brief
452 * Compute Fmask address according to coordinates (x,y,slice,sample,plane)
453 *
454 * @return
455 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
456 ****************************************************************************************************
457 */
AddrComputeFmaskAddrFromCoord(ADDR_HANDLE hLib,const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT * pIn,ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT * pOut)458 ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskAddrFromCoord(
459 ADDR_HANDLE hLib, ///< address lib handle
460 const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn, ///< [in] Fmask info and coordinates
461 ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] Fmask address
462 {
463 V1::Lib* pLib = V1::Lib::GetLib(hLib);
464
465 ADDR_E_RETURNCODE returnCode = ADDR_OK;
466
467 if (pLib != NULL)
468 {
469 returnCode = pLib->ComputeFmaskAddrFromCoord(pIn, pOut);
470 }
471 else
472 {
473 returnCode = ADDR_ERROR;
474 }
475
476 return returnCode;
477 }
478
479 /**
480 ****************************************************************************************************
481 * AddrComputeFmaskCoordFromAddr
482 *
483 * @brief
484 * Compute coordinates (x,y,slice,sample,plane) according to Fmask address
485 *
486 * @return
487 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
488 ****************************************************************************************************
489 */
AddrComputeFmaskCoordFromAddr(ADDR_HANDLE hLib,const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT * pIn,ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT * pOut)490 ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskCoordFromAddr(
491 ADDR_HANDLE hLib, ///< address lib handle
492 const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn, ///< [in] Fmask info and address
493 ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) ///< [out] Fmask coordinates
494 {
495 V1::Lib* pLib = V1::Lib::GetLib(hLib);
496
497 ADDR_E_RETURNCODE returnCode = ADDR_OK;
498
499 if (pLib != NULL)
500 {
501 returnCode = pLib->ComputeFmaskCoordFromAddr(pIn, pOut);
502 }
503 else
504 {
505 returnCode = ADDR_ERROR;
506 }
507
508 return returnCode;
509 }
510
511
512
513 ////////////////////////////////////////////////////////////////////////////////////////////////////
514 // DCC key functions
515 ////////////////////////////////////////////////////////////////////////////////////////////////////
516
517 /**
518 ****************************************************************************************************
519 * AddrComputeDccInfo
520 *
521 * @brief
522 * Compute DCC key size, base alignment based on color surface size, tile info or tile index
523 *
524 ****************************************************************************************************
525 */
AddrComputeDccInfo(ADDR_HANDLE hLib,const ADDR_COMPUTE_DCCINFO_INPUT * pIn,ADDR_COMPUTE_DCCINFO_OUTPUT * pOut)526 ADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo(
527 ADDR_HANDLE hLib, ///< handle of addrlib
528 const ADDR_COMPUTE_DCCINFO_INPUT* pIn, ///< [in] input
529 ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) ///< [out] output
530 {
531 ADDR_E_RETURNCODE returnCode;
532
533 V1::Lib* pLib = V1::Lib::GetLib(hLib);
534
535 if (pLib != NULL)
536 {
537 returnCode = pLib->ComputeDccInfo(pIn, pOut);
538 }
539 else
540 {
541 returnCode = ADDR_ERROR;
542 }
543
544 return returnCode;
545 }
546
547
548
549 ///////////////////////////////////////////////////////////////////////////////
550 // Below functions are element related or helper functions
551 ///////////////////////////////////////////////////////////////////////////////
552
553 /**
554 ****************************************************************************************************
555 * AddrGetVersion
556 *
557 * @brief
558 * Get AddrLib version number. Client may check this return value against ADDRLIB_VERSION
559 * defined in addrinterface.h to see if there is a mismatch.
560 ****************************************************************************************************
561 */
AddrGetVersion(ADDR_HANDLE hLib)562 UINT_32 ADDR_API AddrGetVersion(ADDR_HANDLE hLib)
563 {
564 UINT_32 version = 0;
565
566 Addr::Lib* pLib = Lib::GetLib(hLib);
567
568 ADDR_ASSERT(pLib != NULL);
569
570 if (pLib)
571 {
572 version = pLib->GetVersion();
573 }
574
575 return version;
576 }
577
578 /**
579 ****************************************************************************************************
580 * AddrUseTileIndex
581 *
582 * @brief
583 * Return TRUE if tileIndex is enabled in this address library
584 ****************************************************************************************************
585 */
AddrUseTileIndex(ADDR_HANDLE hLib)586 BOOL_32 ADDR_API AddrUseTileIndex(ADDR_HANDLE hLib)
587 {
588 BOOL_32 useTileIndex = FALSE;
589
590 V1::Lib* pLib = V1::Lib::GetLib(hLib);
591
592 ADDR_ASSERT(pLib != NULL);
593
594 if (pLib)
595 {
596 useTileIndex = pLib->UseTileIndex(0);
597 }
598
599 return useTileIndex;
600 }
601
602 /**
603 ****************************************************************************************************
604 * AddrUseCombinedSwizzle
605 *
606 * @brief
607 * Return TRUE if combined swizzle is enabled in this address library
608 ****************************************************************************************************
609 */
AddrUseCombinedSwizzle(ADDR_HANDLE hLib)610 BOOL_32 ADDR_API AddrUseCombinedSwizzle(ADDR_HANDLE hLib)
611 {
612 BOOL_32 useCombinedSwizzle = FALSE;
613
614 V1::Lib* pLib = V1::Lib::GetLib(hLib);
615
616 ADDR_ASSERT(pLib != NULL);
617
618 if (pLib)
619 {
620 useCombinedSwizzle = pLib->UseCombinedSwizzle();
621 }
622
623 return useCombinedSwizzle;
624 }
625
626 /**
627 ****************************************************************************************************
628 * AddrExtractBankPipeSwizzle
629 *
630 * @brief
631 * Extract Bank and Pipe swizzle from base256b
632 * @return
633 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
634 ****************************************************************************************************
635 */
AddrExtractBankPipeSwizzle(ADDR_HANDLE hLib,const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT * pIn,ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT * pOut)636 ADDR_E_RETURNCODE ADDR_API AddrExtractBankPipeSwizzle(
637 ADDR_HANDLE hLib, ///< addrlib handle
638 const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn, ///< [in] input structure
639 ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut) ///< [out] output structure
640 {
641 ADDR_E_RETURNCODE returnCode = ADDR_OK;
642
643 V1::Lib* pLib = V1::Lib::GetLib(hLib);
644
645 if (pLib != NULL)
646 {
647 returnCode = pLib->ExtractBankPipeSwizzle(pIn, pOut);
648 }
649 else
650 {
651 returnCode = ADDR_ERROR;
652 }
653
654 return returnCode;
655 }
656
657 /**
658 ****************************************************************************************************
659 * AddrCombineBankPipeSwizzle
660 *
661 * @brief
662 * Combine Bank and Pipe swizzle
663 * @return
664 * ADDR_E_RETURNCODE
665 ****************************************************************************************************
666 */
AddrCombineBankPipeSwizzle(ADDR_HANDLE hLib,const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT * pIn,ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT * pOut)667 ADDR_E_RETURNCODE ADDR_API AddrCombineBankPipeSwizzle(
668 ADDR_HANDLE hLib,
669 const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT* pIn,
670 ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT* pOut)
671 {
672 ADDR_E_RETURNCODE returnCode = ADDR_OK;
673
674 V1::Lib* pLib = V1::Lib::GetLib(hLib);
675
676 if (pLib != NULL)
677 {
678 returnCode = pLib->CombineBankPipeSwizzle(pIn, pOut);
679 }
680 else
681 {
682 returnCode = ADDR_ERROR;
683 }
684
685 return returnCode;
686 }
687
688 /**
689 ****************************************************************************************************
690 * AddrComputeSliceSwizzle
691 *
692 * @brief
693 * Compute a swizzle for slice from a base swizzle
694 * @return
695 * ADDR_OK if no error
696 ****************************************************************************************************
697 */
AddrComputeSliceSwizzle(ADDR_HANDLE hLib,const ADDR_COMPUTE_SLICESWIZZLE_INPUT * pIn,ADDR_COMPUTE_SLICESWIZZLE_OUTPUT * pOut)698 ADDR_E_RETURNCODE ADDR_API AddrComputeSliceSwizzle(
699 ADDR_HANDLE hLib,
700 const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn,
701 ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut)
702 {
703 ADDR_E_RETURNCODE returnCode = ADDR_OK;
704
705 V1::Lib* pLib = V1::Lib::GetLib(hLib);
706
707 if (pLib != NULL)
708 {
709 returnCode = pLib->ComputeSliceTileSwizzle(pIn, pOut);
710 }
711 else
712 {
713 returnCode = ADDR_ERROR;
714 }
715
716 return returnCode;
717 }
718
719 /**
720 ****************************************************************************************************
721 * AddrComputeBaseSwizzle
722 *
723 * @brief
724 * Return a Combined Bank and Pipe swizzle base on surface based on surface type/index
725 * @return
726 * ADDR_OK if no error
727 ****************************************************************************************************
728 */
AddrComputeBaseSwizzle(ADDR_HANDLE hLib,const ADDR_COMPUTE_BASE_SWIZZLE_INPUT * pIn,ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT * pOut)729 ADDR_E_RETURNCODE ADDR_API AddrComputeBaseSwizzle(
730 ADDR_HANDLE hLib,
731 const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn,
732 ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut)
733 {
734 ADDR_E_RETURNCODE returnCode = ADDR_OK;
735
736 V1::Lib* pLib = V1::Lib::GetLib(hLib);
737
738 if (pLib != NULL)
739 {
740 returnCode = pLib->ComputeBaseSwizzle(pIn, pOut);
741 }
742 else
743 {
744 returnCode = ADDR_ERROR;
745 }
746
747 return returnCode;
748 }
749
750 /**
751 ****************************************************************************************************
752 * ElemFlt32ToDepthPixel
753 *
754 * @brief
755 * Convert a FLT_32 value to a depth/stencil pixel value
756 *
757 * @return
758 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
759 *
760 ****************************************************************************************************
761 */
ElemFlt32ToDepthPixel(ADDR_HANDLE hLib,const ELEM_FLT32TODEPTHPIXEL_INPUT * pIn,ELEM_FLT32TODEPTHPIXEL_OUTPUT * pOut)762 ADDR_E_RETURNCODE ADDR_API ElemFlt32ToDepthPixel(
763 ADDR_HANDLE hLib, ///< addrlib handle
764 const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn, ///< [in] per-component value
765 ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut) ///< [out] final pixel value
766 {
767 ADDR_E_RETURNCODE returnCode = ADDR_OK;
768
769 Lib* pLib = Lib::GetLib(hLib);
770
771 if (pLib != NULL)
772 {
773 pLib->Flt32ToDepthPixel(pIn, pOut);
774 }
775 else
776 {
777 returnCode = ADDR_ERROR;
778 }
779
780 return returnCode;
781 }
782
783 /**
784 ****************************************************************************************************
785 * ElemFlt32ToColorPixel
786 *
787 * @brief
788 * Convert a FLT_32 value to a red/green/blue/alpha pixel value
789 *
790 * @return
791 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
792 *
793 ****************************************************************************************************
794 */
ElemFlt32ToColorPixel(ADDR_HANDLE hLib,const ELEM_FLT32TOCOLORPIXEL_INPUT * pIn,ELEM_FLT32TOCOLORPIXEL_OUTPUT * pOut)795 ADDR_E_RETURNCODE ADDR_API ElemFlt32ToColorPixel(
796 ADDR_HANDLE hLib, ///< addrlib handle
797 const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn, ///< [in] format, surface number and swap value
798 ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut) ///< [out] final pixel value
799 {
800 ADDR_E_RETURNCODE returnCode = ADDR_OK;
801
802 Lib* pLib = Lib::GetLib(hLib);
803
804 if (pLib != NULL)
805 {
806 pLib->Flt32ToColorPixel(pIn, pOut);
807 }
808 else
809 {
810 returnCode = ADDR_ERROR;
811 }
812
813 return returnCode;
814 }
815
816 /**
817 ****************************************************************************************************
818 * ElemGetExportNorm
819 *
820 * @brief
821 * Helper function to check one format can be EXPORT_NUM,
822 * which is a register CB_COLOR_INFO.SURFACE_FORMAT.
823 * FP16 can be reported as EXPORT_NORM for rv770 in r600
824 * family
825 *
826 ****************************************************************************************************
827 */
ElemGetExportNorm(ADDR_HANDLE hLib,const ELEM_GETEXPORTNORM_INPUT * pIn)828 BOOL_32 ADDR_API ElemGetExportNorm(
829 ADDR_HANDLE hLib, ///< addrlib handle
830 const ELEM_GETEXPORTNORM_INPUT* pIn) ///< [in] input structure
831 {
832 Addr::Lib* pLib = Lib::GetLib(hLib);
833 BOOL_32 enabled = FALSE;
834
835 ADDR_E_RETURNCODE returnCode = ADDR_OK;
836
837 if (pLib != NULL)
838 {
839 enabled = pLib->GetExportNorm(pIn);
840 }
841 else
842 {
843 returnCode = ADDR_ERROR;
844 }
845
846 ADDR_ASSERT(returnCode == ADDR_OK);
847
848 return enabled;
849 }
850
851 /**
852 ****************************************************************************************************
853 * ElemSize
854 *
855 * @brief
856 * Get bits-per-element for specified format
857 *
858 * @return
859 * Bits-per-element of specified format
860 *
861 ****************************************************************************************************
862 */
ElemSize(ADDR_HANDLE hLib,AddrFormat format)863 UINT_32 ADDR_API ElemSize(
864 ADDR_HANDLE hLib,
865 AddrFormat format)
866 {
867 UINT_32 bpe = 0;
868
869 Addr::Lib* pLib = Lib::GetLib(hLib);
870
871 if (pLib != NULL)
872 {
873 bpe = pLib->GetBpe(format);
874 }
875
876 return bpe;
877 }
878
879 /**
880 ****************************************************************************************************
881 * AddrConvertTileInfoToHW
882 *
883 * @brief
884 * Convert tile info from real value to hardware register value
885 *
886 * @return
887 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
888 ****************************************************************************************************
889 */
AddrConvertTileInfoToHW(ADDR_HANDLE hLib,const ADDR_CONVERT_TILEINFOTOHW_INPUT * pIn,ADDR_CONVERT_TILEINFOTOHW_OUTPUT * pOut)890 ADDR_E_RETURNCODE ADDR_API AddrConvertTileInfoToHW(
891 ADDR_HANDLE hLib, ///< address lib handle
892 const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, ///< [in] tile info with real value
893 ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut) ///< [out] tile info with HW register value
894 {
895 V1::Lib* pLib = V1::Lib::GetLib(hLib);
896
897 ADDR_E_RETURNCODE returnCode = ADDR_OK;
898
899 if (pLib != NULL)
900 {
901 returnCode = pLib->ConvertTileInfoToHW(pIn, pOut);
902 }
903 else
904 {
905 returnCode = ADDR_ERROR;
906 }
907
908 return returnCode;
909 }
910
911 /**
912 ****************************************************************************************************
913 * AddrConvertTileIndex
914 *
915 * @brief
916 * Convert tile index to tile mode/type/info
917 *
918 * @return
919 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
920 ****************************************************************************************************
921 */
AddrConvertTileIndex(ADDR_HANDLE hLib,const ADDR_CONVERT_TILEINDEX_INPUT * pIn,ADDR_CONVERT_TILEINDEX_OUTPUT * pOut)922 ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex(
923 ADDR_HANDLE hLib, ///< address lib handle
924 const ADDR_CONVERT_TILEINDEX_INPUT* pIn, ///< [in] input - tile index
925 ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) ///< [out] tile mode/type/info
926 {
927 V1::Lib* pLib = V1::Lib::GetLib(hLib);
928
929 ADDR_E_RETURNCODE returnCode = ADDR_OK;
930
931 if (pLib != NULL)
932 {
933 returnCode = pLib->ConvertTileIndex(pIn, pOut);
934 }
935 else
936 {
937 returnCode = ADDR_ERROR;
938 }
939
940 return returnCode;
941 }
942
943 /**
944 ****************************************************************************************************
945 * AddrGetMacroModeIndex
946 *
947 * @brief
948 * Get macro mode index based on input parameters
949 *
950 * @return
951 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
952 ****************************************************************************************************
953 */
AddrGetMacroModeIndex(ADDR_HANDLE hLib,const ADDR_GET_MACROMODEINDEX_INPUT * pIn,ADDR_GET_MACROMODEINDEX_OUTPUT * pOut)954 ADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex(
955 ADDR_HANDLE hLib, ///< address lib handle
956 const ADDR_GET_MACROMODEINDEX_INPUT* pIn, ///< [in] input
957 ADDR_GET_MACROMODEINDEX_OUTPUT* pOut) ///< [out] macro mode index
958 {
959 V1::Lib* pLib = V1::Lib::GetLib(hLib);
960
961 ADDR_E_RETURNCODE returnCode;
962
963 if (pLib != NULL)
964 {
965 returnCode = pLib->GetMacroModeIndex(pIn, pOut);
966 }
967 else
968 {
969 returnCode = ADDR_ERROR;
970 }
971
972 return returnCode;
973 }
974
975 /**
976 ****************************************************************************************************
977 * AddrConvertTileIndex1
978 *
979 * @brief
980 * Convert tile index to tile mode/type/info
981 *
982 * @return
983 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
984 ****************************************************************************************************
985 */
AddrConvertTileIndex1(ADDR_HANDLE hLib,const ADDR_CONVERT_TILEINDEX1_INPUT * pIn,ADDR_CONVERT_TILEINDEX_OUTPUT * pOut)986 ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1(
987 ADDR_HANDLE hLib, ///< address lib handle
988 const ADDR_CONVERT_TILEINDEX1_INPUT* pIn, ///< [in] input - tile index
989 ADDR_CONVERT_TILEINDEX_OUTPUT* pOut) ///< [out] tile mode/type/info
990 {
991 V1::Lib* pLib = V1::Lib::GetLib(hLib);
992
993 ADDR_E_RETURNCODE returnCode = ADDR_OK;
994
995 if (pLib != NULL)
996 {
997 returnCode = pLib->ConvertTileIndex1(pIn, pOut);
998 }
999 else
1000 {
1001 returnCode = ADDR_ERROR;
1002 }
1003
1004 return returnCode;
1005 }
1006
1007 /**
1008 ****************************************************************************************************
1009 * AddrGetTileIndex
1010 *
1011 * @brief
1012 * Get tile index from tile mode/type/info
1013 *
1014 * @return
1015 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1016 *
1017 * @note
1018 * Only meaningful for SI (and above)
1019 ****************************************************************************************************
1020 */
AddrGetTileIndex(ADDR_HANDLE hLib,const ADDR_GET_TILEINDEX_INPUT * pIn,ADDR_GET_TILEINDEX_OUTPUT * pOut)1021 ADDR_E_RETURNCODE ADDR_API AddrGetTileIndex(
1022 ADDR_HANDLE hLib,
1023 const ADDR_GET_TILEINDEX_INPUT* pIn,
1024 ADDR_GET_TILEINDEX_OUTPUT* pOut)
1025 {
1026 V1::Lib* pLib = V1::Lib::GetLib(hLib);
1027
1028 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1029
1030 if (pLib != NULL)
1031 {
1032 returnCode = pLib->GetTileIndex(pIn, pOut);
1033 }
1034 else
1035 {
1036 returnCode = ADDR_ERROR;
1037 }
1038
1039 return returnCode;
1040 }
1041
1042 /**
1043 ****************************************************************************************************
1044 * AddrComputePrtInfo
1045 *
1046 * @brief
1047 * Interface function for ComputePrtInfo
1048 *
1049 ****************************************************************************************************
1050 */
AddrComputePrtInfo(ADDR_HANDLE hLib,const ADDR_PRT_INFO_INPUT * pIn,ADDR_PRT_INFO_OUTPUT * pOut)1051 ADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo(
1052 ADDR_HANDLE hLib,
1053 const ADDR_PRT_INFO_INPUT* pIn,
1054 ADDR_PRT_INFO_OUTPUT* pOut)
1055 {
1056 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1057
1058 V1::Lib* pLib = V1::Lib::GetLib(hLib);
1059
1060 if (pLib != NULL)
1061 {
1062 returnCode = pLib->ComputePrtInfo(pIn, pOut);
1063 }
1064 else
1065 {
1066 returnCode = ADDR_ERROR;
1067 }
1068
1069 return returnCode;
1070 }
1071
1072 /**
1073 ****************************************************************************************************
1074 * AddrGetMaxAlignments
1075 *
1076 * @brief
1077 * Convert maximum alignments
1078 *
1079 * @return
1080 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1081 ****************************************************************************************************
1082 */
AddrGetMaxAlignments(ADDR_HANDLE hLib,ADDR_GET_MAX_ALIGNMENTS_OUTPUT * pOut)1083 ADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments(
1084 ADDR_HANDLE hLib, ///< address lib handle
1085 ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut) ///< [out] output structure
1086 {
1087 Addr::Lib* pLib = Lib::GetLib(hLib);
1088
1089 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1090
1091 if (pLib != NULL)
1092 {
1093 returnCode = pLib->GetMaxAlignments(pOut);
1094 }
1095 else
1096 {
1097 returnCode = ADDR_ERROR;
1098 }
1099
1100 return returnCode;
1101 }
1102
1103 /**
1104 ****************************************************************************************************
1105 * AddrGetMaxMetaAlignments
1106 *
1107 * @brief
1108 * Convert maximum alignments for metadata
1109 *
1110 * @return
1111 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1112 ****************************************************************************************************
1113 */
AddrGetMaxMetaAlignments(ADDR_HANDLE hLib,ADDR_GET_MAX_ALIGNMENTS_OUTPUT * pOut)1114 ADDR_E_RETURNCODE ADDR_API AddrGetMaxMetaAlignments(
1115 ADDR_HANDLE hLib, ///< address lib handle
1116 ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut) ///< [out] output structure
1117 {
1118 Addr::Lib* pLib = Lib::GetLib(hLib);
1119
1120 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1121
1122 if (pLib != NULL)
1123 {
1124 returnCode = pLib->GetMaxMetaAlignments(pOut);
1125 }
1126 else
1127 {
1128 returnCode = ADDR_ERROR;
1129 }
1130
1131 return returnCode;
1132 }
1133
1134
1135 ////////////////////////////////////////////////////////////////////////////////////////////////////
1136 // Surface functions for Addr2
1137 ////////////////////////////////////////////////////////////////////////////////////////////////////
1138
1139 /**
1140 ****************************************************************************************************
1141 * Addr2ComputeSurfaceInfo
1142 *
1143 * @brief
1144 * Calculate surface width/height/depth/alignments and suitable tiling mode
1145 *
1146 * @return
1147 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1148 ****************************************************************************************************
1149 */
Addr2ComputeSurfaceInfo(ADDR_HANDLE hLib,const ADDR2_COMPUTE_SURFACE_INFO_INPUT * pIn,ADDR2_COMPUTE_SURFACE_INFO_OUTPUT * pOut)1150 ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceInfo(
1151 ADDR_HANDLE hLib, ///< address lib handle
1152 const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn, ///< [in] surface information
1153 ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut) ///< [out] surface parameters and alignments
1154 {
1155 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1156
1157 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1158
1159 if (pLib != NULL)
1160 {
1161 returnCode = pLib->ComputeSurfaceInfo(pIn, pOut);
1162 }
1163 else
1164 {
1165 returnCode = ADDR_ERROR;
1166 }
1167
1168 return returnCode;
1169 }
1170
1171
1172 /**
1173 ****************************************************************************************************
1174 * Addr2ComputeSurfaceAddrFromCoord
1175 *
1176 * @brief
1177 * Compute surface address according to coordinates
1178 *
1179 * @return
1180 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1181 ****************************************************************************************************
1182 */
Addr2ComputeSurfaceAddrFromCoord(ADDR_HANDLE hLib,const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT * pIn,ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT * pOut)1183 ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceAddrFromCoord(
1184 ADDR_HANDLE hLib, ///< address lib handle
1185 const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn, ///< [in] surface info and coordinates
1186 ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] surface address
1187 {
1188 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1189
1190 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1191
1192 if (pLib != NULL)
1193 {
1194 returnCode = pLib->ComputeSurfaceAddrFromCoord(pIn, pOut);
1195 }
1196 else
1197 {
1198 returnCode = ADDR_ERROR;
1199 }
1200
1201 return returnCode;
1202 }
1203
1204
1205 /**
1206 ****************************************************************************************************
1207 * Addr2ComputeSurfaceCoordFromAddr
1208 *
1209 * @brief
1210 * Compute coordinates according to surface address
1211 *
1212 * @return
1213 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1214 ****************************************************************************************************
1215 */
Addr2ComputeSurfaceCoordFromAddr(ADDR_HANDLE hLib,const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT * pIn,ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT * pOut)1216 ADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceCoordFromAddr(
1217 ADDR_HANDLE hLib, ///< address lib handle
1218 const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn, ///< [in] surface info and address
1219 ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut) ///< [out] coordinates
1220 {
1221 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1222
1223 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1224
1225 if (pLib != NULL)
1226 {
1227 returnCode = pLib->ComputeSurfaceCoordFromAddr(pIn, pOut);
1228 }
1229 else
1230 {
1231 returnCode = ADDR_ERROR;
1232 }
1233
1234 return returnCode;
1235 }
1236
1237
1238
1239 ////////////////////////////////////////////////////////////////////////////////////////////////////
1240 // HTile functions for Addr2
1241 ////////////////////////////////////////////////////////////////////////////////////////////////////
1242
1243 /**
1244 ****************************************************************************************************
1245 * Addr2ComputeHtileInfo
1246 *
1247 * @brief
1248 * Compute Htile pitch, height, base alignment and size in bytes
1249 *
1250 * @return
1251 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1252 ****************************************************************************************************
1253 */
Addr2ComputeHtileInfo(ADDR_HANDLE hLib,const ADDR2_COMPUTE_HTILE_INFO_INPUT * pIn,ADDR2_COMPUTE_HTILE_INFO_OUTPUT * pOut)1254 ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileInfo(
1255 ADDR_HANDLE hLib, ///< address lib handle
1256 const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn, ///< [in] Htile information
1257 ADDR2_COMPUTE_HTILE_INFO_OUTPUT* pOut) ///< [out] Htile pitch, height and size in bytes
1258 {
1259 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1260
1261 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1262
1263 if (pLib != NULL)
1264 {
1265 returnCode = pLib->ComputeHtileInfo(pIn, pOut);
1266 }
1267 else
1268 {
1269 returnCode = ADDR_ERROR;
1270 }
1271
1272 return returnCode;
1273 }
1274
1275
1276 /**
1277 ****************************************************************************************************
1278 * Addr2ComputeHtileAddrFromCoord
1279 *
1280 * @brief
1281 * Compute Htile address according to coordinates (of depth buffer)
1282 *
1283 * @return
1284 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1285 ****************************************************************************************************
1286 */
Addr2ComputeHtileAddrFromCoord(ADDR_HANDLE hLib,const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT * pIn,ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT * pOut)1287 ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileAddrFromCoord(
1288 ADDR_HANDLE hLib, ///< address lib handle
1289 const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn, ///< [in] Htile info and coordinates
1290 ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] Htile address
1291 {
1292 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1293
1294 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1295
1296 if (pLib != NULL)
1297 {
1298 returnCode = pLib->ComputeHtileAddrFromCoord(pIn, pOut);
1299 }
1300 else
1301 {
1302 returnCode = ADDR_ERROR;
1303 }
1304
1305 return returnCode;
1306 }
1307
1308
1309 /**
1310 ****************************************************************************************************
1311 * Addr2ComputeHtileCoordFromAddr
1312 *
1313 * @brief
1314 * Compute coordinates within depth buffer (1st pixel of a micro tile) according to
1315 * Htile address
1316 *
1317 * @return
1318 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1319 ****************************************************************************************************
1320 */
Addr2ComputeHtileCoordFromAddr(ADDR_HANDLE hLib,const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT * pIn,ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT * pOut)1321 ADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileCoordFromAddr(
1322 ADDR_HANDLE hLib, ///< address lib handle
1323 const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn, ///< [in] Htile info and address
1324 ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut) ///< [out] Htile coordinates
1325 {
1326 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1327
1328 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1329
1330 if (pLib != NULL)
1331 {
1332 returnCode = pLib->ComputeHtileCoordFromAddr(pIn, pOut);
1333 }
1334 else
1335 {
1336 returnCode = ADDR_ERROR;
1337 }
1338
1339 return returnCode;
1340 }
1341
1342
1343
1344 ////////////////////////////////////////////////////////////////////////////////////////////////////
1345 // C-mask functions for Addr2
1346 ////////////////////////////////////////////////////////////////////////////////////////////////////
1347
1348 /**
1349 ****************************************************************************************************
1350 * Addr2ComputeCmaskInfo
1351 *
1352 * @brief
1353 * Compute Cmask pitch, height, base alignment and size in bytes from color buffer
1354 * info
1355 *
1356 * @return
1357 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1358 ****************************************************************************************************
1359 */
Addr2ComputeCmaskInfo(ADDR_HANDLE hLib,const ADDR2_COMPUTE_CMASK_INFO_INPUT * pIn,ADDR2_COMPUTE_CMASK_INFO_OUTPUT * pOut)1360 ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskInfo(
1361 ADDR_HANDLE hLib, ///< address lib handle
1362 const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn, ///< [in] Cmask pitch and height
1363 ADDR2_COMPUTE_CMASK_INFO_OUTPUT* pOut) ///< [out] Cmask pitch, height and size in bytes
1364 {
1365 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1366
1367 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1368
1369 if (pLib != NULL)
1370 {
1371 returnCode = pLib->ComputeCmaskInfo(pIn, pOut);
1372 }
1373 else
1374 {
1375 returnCode = ADDR_ERROR;
1376 }
1377
1378 return returnCode;
1379 }
1380
1381
1382 /**
1383 ****************************************************************************************************
1384 * Addr2ComputeCmaskAddrFromCoord
1385 *
1386 * @brief
1387 * Compute Cmask address according to coordinates (of MSAA color buffer)
1388 *
1389 * @return
1390 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1391 ****************************************************************************************************
1392 */
Addr2ComputeCmaskAddrFromCoord(ADDR_HANDLE hLib,const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT * pIn,ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT * pOut)1393 ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskAddrFromCoord(
1394 ADDR_HANDLE hLib, ///< address lib handle
1395 const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn, ///< [in] Cmask info and coordinates
1396 ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] Cmask address
1397 {
1398 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1399
1400 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1401
1402 if (pLib != NULL)
1403 {
1404 returnCode = pLib->ComputeCmaskAddrFromCoord(pIn, pOut);
1405 }
1406 else
1407 {
1408 returnCode = ADDR_ERROR;
1409 }
1410
1411 return returnCode;
1412 }
1413
1414
1415 /**
1416 ****************************************************************************************************
1417 * Addr2ComputeCmaskCoordFromAddr
1418 *
1419 * @brief
1420 * Compute coordinates within color buffer (1st pixel of a micro tile) according to
1421 * Cmask address
1422 *
1423 * @return
1424 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1425 ****************************************************************************************************
1426 */
Addr2ComputeCmaskCoordFromAddr(ADDR_HANDLE hLib,const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT * pIn,ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT * pOut)1427 ADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskCoordFromAddr(
1428 ADDR_HANDLE hLib, ///< address lib handle
1429 const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT* pIn, ///< [in] Cmask info and address
1430 ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut) ///< [out] Cmask coordinates
1431 {
1432 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1433
1434 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1435
1436 if (pLib != NULL)
1437 {
1438 returnCode = pLib->ComputeCmaskCoordFromAddr(pIn, pOut);
1439 }
1440 else
1441 {
1442 returnCode = ADDR_ERROR;
1443 }
1444
1445 return returnCode;
1446 }
1447
1448
1449
1450 ////////////////////////////////////////////////////////////////////////////////////////////////////
1451 // F-mask functions for Addr2
1452 ////////////////////////////////////////////////////////////////////////////////////////////////////
1453
1454 /**
1455 ****************************************************************************************************
1456 * Addr2ComputeFmaskInfo
1457 *
1458 * @brief
1459 * Compute Fmask pitch/height/depth/alignments and size in bytes
1460 *
1461 * @return
1462 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1463 ****************************************************************************************************
1464 */
Addr2ComputeFmaskInfo(ADDR_HANDLE hLib,const ADDR2_COMPUTE_FMASK_INFO_INPUT * pIn,ADDR2_COMPUTE_FMASK_INFO_OUTPUT * pOut)1465 ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskInfo(
1466 ADDR_HANDLE hLib, ///< address lib handle
1467 const ADDR2_COMPUTE_FMASK_INFO_INPUT* pIn, ///< [in] Fmask information
1468 ADDR2_COMPUTE_FMASK_INFO_OUTPUT* pOut) ///< [out] Fmask pitch and height
1469 {
1470 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1471
1472 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1473
1474 if (pLib != NULL)
1475 {
1476 returnCode = pLib->ComputeFmaskInfo(pIn, pOut);
1477 }
1478 else
1479 {
1480 returnCode = ADDR_ERROR;
1481 }
1482
1483 return returnCode;
1484 }
1485
1486
1487 /**
1488 ****************************************************************************************************
1489 * Addr2ComputeFmaskAddrFromCoord
1490 *
1491 * @brief
1492 * Compute Fmask address according to coordinates (x,y,slice,sample,plane)
1493 *
1494 * @return
1495 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1496 ****************************************************************************************************
1497 */
Addr2ComputeFmaskAddrFromCoord(ADDR_HANDLE hLib,const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT * pIn,ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT * pOut)1498 ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskAddrFromCoord(
1499 ADDR_HANDLE hLib, ///< address lib handle
1500 const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn, ///< [in] Fmask info and coordinates
1501 ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] Fmask address
1502 {
1503 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1504
1505 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1506
1507 if (pLib != NULL)
1508 {
1509 returnCode = pLib->ComputeFmaskAddrFromCoord(pIn, pOut);
1510 }
1511 else
1512 {
1513 returnCode = ADDR_ERROR;
1514 }
1515
1516 return returnCode;
1517 }
1518
1519
1520 /**
1521 ****************************************************************************************************
1522 * Addr2ComputeFmaskCoordFromAddr
1523 *
1524 * @brief
1525 * Compute coordinates (x,y,slice,sample,plane) according to Fmask address
1526 *
1527 * @return
1528 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1529 ****************************************************************************************************
1530 */
Addr2ComputeFmaskCoordFromAddr(ADDR_HANDLE hLib,const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT * pIn,ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT * pOut)1531 ADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskCoordFromAddr(
1532 ADDR_HANDLE hLib, ///< address lib handle
1533 const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn, ///< [in] Fmask info and address
1534 ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut) ///< [out] Fmask coordinates
1535 {
1536 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1537
1538 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1539
1540 if (pLib != NULL)
1541 {
1542 returnCode = pLib->ComputeFmaskCoordFromAddr(pIn, pOut);
1543 }
1544 else
1545 {
1546 returnCode = ADDR_ERROR;
1547 }
1548
1549 return returnCode;
1550 }
1551
1552
1553
1554 ////////////////////////////////////////////////////////////////////////////////////////////////////
1555 // DCC key functions for Addr2
1556 ////////////////////////////////////////////////////////////////////////////////////////////////////
1557
1558 /**
1559 ****************************************************************************************************
1560 * Addr2ComputeDccInfo
1561 *
1562 * @brief
1563 * Compute DCC key size, base alignment based on color surface size, tile info or tile index
1564 *
1565 ****************************************************************************************************
1566 */
Addr2ComputeDccInfo(ADDR_HANDLE hLib,const ADDR2_COMPUTE_DCCINFO_INPUT * pIn,ADDR2_COMPUTE_DCCINFO_OUTPUT * pOut)1567 ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccInfo(
1568 ADDR_HANDLE hLib, ///< handle of addrlib
1569 const ADDR2_COMPUTE_DCCINFO_INPUT* pIn, ///< [in] input
1570 ADDR2_COMPUTE_DCCINFO_OUTPUT* pOut) ///< [out] output
1571 {
1572 ADDR_E_RETURNCODE returnCode;
1573
1574 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1575
1576 if (pLib != NULL)
1577 {
1578 returnCode = pLib->ComputeDccInfo(pIn, pOut);
1579 }
1580 else
1581 {
1582 returnCode = ADDR_ERROR;
1583 }
1584
1585 return returnCode;
1586 }
1587
1588 /**
1589 ****************************************************************************************************
1590 * Addr2ComputeDccAddrFromCoord
1591 *
1592 * @brief
1593 * Compute DCC key address according to coordinates
1594 *
1595 * @return
1596 * ADDR_OK if successful, otherwise an error code of ADDR_E_RETURNCODE
1597 ****************************************************************************************************
1598 */
Addr2ComputeDccAddrFromCoord(ADDR_HANDLE hLib,const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT * pIn,ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT * pOut)1599 ADDR_E_RETURNCODE ADDR_API Addr2ComputeDccAddrFromCoord(
1600 ADDR_HANDLE hLib, ///< address lib handle
1601 const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn, ///< [in] Dcc info and coordinates
1602 ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut) ///< [out] Dcc address
1603 {
1604 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1605
1606 ADDR_E_RETURNCODE returnCode = ADDR_OK;
1607
1608 if (pLib != NULL)
1609 {
1610 returnCode = pLib->ComputeDccAddrFromCoord(pIn, pOut);
1611 }
1612 else
1613 {
1614 returnCode = ADDR_ERROR;
1615 }
1616
1617 return returnCode;
1618 }
1619
1620 /**
1621 ****************************************************************************************************
1622 * Addr2ComputePipeBankXor
1623 *
1624 * @brief
1625 * Calculate a valid bank pipe xor value for client to use.
1626 ****************************************************************************************************
1627 */
Addr2ComputePipeBankXor(ADDR_HANDLE hLib,const ADDR2_COMPUTE_PIPEBANKXOR_INPUT * pIn,ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT * pOut)1628 ADDR_E_RETURNCODE ADDR_API Addr2ComputePipeBankXor(
1629 ADDR_HANDLE hLib, ///< handle of addrlib
1630 const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn, ///< [in] input
1631 ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut) ///< [out] output
1632 {
1633 ADDR_E_RETURNCODE returnCode;
1634
1635 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1636
1637 if (pLib != NULL)
1638 {
1639 returnCode = pLib->ComputePipeBankXor(pIn, pOut);
1640 }
1641 else
1642 {
1643 returnCode = ADDR_ERROR;
1644 }
1645
1646 return returnCode;
1647 }
1648
1649 /**
1650 ****************************************************************************************************
1651 * Addr2ComputeSlicePipeBankXor
1652 *
1653 * @brief
1654 * Calculate slice pipe bank xor value based on base pipe bank xor and slice id.
1655 ****************************************************************************************************
1656 */
Addr2ComputeSlicePipeBankXor(ADDR_HANDLE hLib,const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT * pIn,ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT * pOut)1657 ADDR_E_RETURNCODE ADDR_API Addr2ComputeSlicePipeBankXor(
1658 ADDR_HANDLE hLib, ///< handle of addrlib
1659 const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn, ///< [in] input
1660 ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT* pOut) ///< [out] output
1661 {
1662 ADDR_E_RETURNCODE returnCode;
1663
1664 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1665
1666 if (pLib != NULL)
1667 {
1668 returnCode = pLib->ComputeSlicePipeBankXor(pIn, pOut);
1669 }
1670 else
1671 {
1672 returnCode = ADDR_ERROR;
1673 }
1674
1675 return returnCode;
1676 }
1677
1678 /**
1679 ****************************************************************************************************
1680 * Addr2ComputeSubResourceOffsetForSwizzlePattern
1681 *
1682 * @brief
1683 * Calculate sub resource offset for swizzle pattern.
1684 ****************************************************************************************************
1685 */
Addr2ComputeSubResourceOffsetForSwizzlePattern(ADDR_HANDLE hLib,const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT * pIn,ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT * pOut)1686 ADDR_E_RETURNCODE ADDR_API Addr2ComputeSubResourceOffsetForSwizzlePattern(
1687 ADDR_HANDLE hLib, ///< handle of addrlib
1688 const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn, ///< [in] input
1689 ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT* pOut) ///< [out] output
1690 {
1691 ADDR_E_RETURNCODE returnCode;
1692
1693 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1694
1695 if (pLib != NULL)
1696 {
1697 returnCode = pLib->ComputeSubResourceOffsetForSwizzlePattern(pIn, pOut);
1698 }
1699 else
1700 {
1701 returnCode = ADDR_ERROR;
1702 }
1703
1704 return returnCode;
1705 }
1706
1707 /**
1708 ****************************************************************************************************
1709 * Addr2ComputeNonBlockCompressedView
1710 *
1711 * @brief
1712 * Compute non-block-compressed view for a given mipmap level/slice.
1713 ****************************************************************************************************
1714 */
Addr2ComputeNonBlockCompressedView(ADDR_HANDLE hLib,const ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_INPUT * pIn,ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_OUTPUT * pOut)1715 ADDR_E_RETURNCODE ADDR_API Addr2ComputeNonBlockCompressedView(
1716 ADDR_HANDLE hLib, ///< handle of addrlib
1717 const ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_INPUT* pIn, ///< [in] input
1718 ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_OUTPUT* pOut) ///< [out] output
1719 {
1720 ADDR_E_RETURNCODE returnCode;
1721
1722 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1723
1724 if (pLib != NULL)
1725 {
1726 returnCode = pLib->ComputeNonBlockCompressedView(pIn, pOut);
1727 }
1728 else
1729 {
1730 returnCode = ADDR_ERROR;
1731 }
1732
1733 return returnCode;
1734 }
1735
1736 /**
1737 ****************************************************************************************************
1738 * Addr2GetPreferredSurfaceSetting
1739 *
1740 * @brief
1741 * Suggest a preferred setting for client driver to program HW register
1742 ****************************************************************************************************
1743 */
Addr2GetPreferredSurfaceSetting(ADDR_HANDLE hLib,const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT * pIn,ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT * pOut)1744 ADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting(
1745 ADDR_HANDLE hLib, ///< handle of addrlib
1746 const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn, ///< [in] input
1747 ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut) ///< [out] output
1748 {
1749 ADDR_E_RETURNCODE returnCode;
1750
1751 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1752
1753 if (pLib != NULL)
1754 {
1755 returnCode = pLib->Addr2GetPreferredSurfaceSetting(pIn, pOut);
1756 }
1757 else
1758 {
1759 returnCode = ADDR_ERROR;
1760 }
1761
1762 return returnCode;
1763 }
1764
1765 /**
1766 ****************************************************************************************************
1767 * Addr2IsValidDisplaySwizzleMode
1768 *
1769 * @brief
1770 * Return whether the swizzle mode is supported by display engine
1771 ****************************************************************************************************
1772 */
Addr2IsValidDisplaySwizzleMode(ADDR_HANDLE hLib,AddrSwizzleMode swizzleMode,UINT_32 bpp,BOOL_32 * pResult)1773 ADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode(
1774 ADDR_HANDLE hLib,
1775 AddrSwizzleMode swizzleMode,
1776 UINT_32 bpp,
1777 BOOL_32 *pResult)
1778 {
1779 ADDR_E_RETURNCODE returnCode;
1780
1781 V2::Lib* pLib = V2::Lib::GetLib(hLib);
1782
1783 if (pLib != NULL)
1784 {
1785 ADDR2_COMPUTE_SURFACE_INFO_INPUT in = {};
1786 in.resourceType = ADDR_RSRC_TEX_2D;
1787 in.swizzleMode = swizzleMode;
1788 in.bpp = bpp;
1789
1790 *pResult = pLib->IsValidDisplaySwizzleMode(&in);
1791 returnCode = ADDR_OK;
1792 }
1793 else
1794 {
1795 returnCode = ADDR_ERROR;
1796 }
1797
1798 return returnCode;
1799 }
1800