1 /*
2 * Copyright (c) 2020-2023, 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 "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file media_blt_copy_next.cpp
24 //! \brief Common interface used in Blitter Engine
25 //! \details Common interface used in Blitter Engine which are platform independent
26 //!
27
28 #define NOMINMAX
29 #include <algorithm>
30 #include "media_perf_profiler.h"
31 #include "media_blt_copy_next.h"
32 #include "mos_os_cp_interface_specific.h"
33 #include "renderhal.h"
34 #define BIT( n ) ( 1 << (n) )
35
36 #ifdef min
37 #undef min
38 #endif
39 //!
40 //! \brief BltStateNext constructor
41 //! \details Initialize the BltStateNext members.
42 //! \param osInterface
43 //! [in] Pointer to MOS_INTERFACE.
44 //!
BltStateNext(PMOS_INTERFACE osInterface)45 BltStateNext::BltStateNext(PMOS_INTERFACE osInterface) :
46 m_osInterface(osInterface),
47 m_mhwInterfaces(nullptr),
48 m_cpInterface(nullptr)
49 {
50 MhwInterfacesNext::CreateParams params;
51 MOS_ZeroMemory(¶ms, sizeof(params));
52 params.Flags.m_blt = 1;
53 m_mhwInterfaces = MhwInterfacesNext::CreateFactory(params, osInterface);
54 if (m_mhwInterfaces != nullptr)
55 {
56 m_miItf = m_mhwInterfaces->m_miItf;
57 m_bltItf = m_mhwInterfaces->m_bltItf;
58 }
59 }
60
61 //!
62 //! \brief BltStateNext constructor
63 //! \details Initialize the BltStateNext members.
64 //! \param osInterface
65 //! [in] Pointer to MOS_INTERFACE.
66 //!
BltStateNext(PMOS_INTERFACE osInterface,MhwInterfacesNext * mhwInterfaces)67 BltStateNext::BltStateNext(PMOS_INTERFACE osInterface, MhwInterfacesNext* mhwInterfaces) :
68 m_osInterface(osInterface),
69 m_mhwInterfaces(nullptr),
70 m_cpInterface(nullptr)
71 {
72 m_miItf = mhwInterfaces->m_miItf;
73 m_bltItf = mhwInterfaces->m_bltItf;
74 m_cpInterface = mhwInterfaces->m_cpInterface;
75 }
76
77
~BltStateNext()78 BltStateNext::~BltStateNext()
79 {
80 FreeResource();
81 if (pMainSurface)
82 {
83 MOS_FreeMemAndSetNull(pMainSurface);
84 }
85 if (pAuxSurface)
86 {
87 MOS_FreeMemAndSetNull(pAuxSurface);
88 }
89 //component interface will be relesed in media copy.
90 if (m_mhwInterfaces != nullptr)
91 {
92 m_mhwInterfaces->Destroy();
93 MOS_Delete(m_mhwInterfaces);
94 }
95 }
96
97 //!
98 //! \brief BltStateNext initialize
99 //! \details Initialize the BltStateNext, create BLT context.
100 //! \return MOS_STATUS
101 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
102 //!
Initialize()103 MOS_STATUS BltStateNext::Initialize()
104 {
105 return MOS_STATUS_SUCCESS;
106 }
107
108 //!
109 //! \brief Get control surface
110 //! \details BLT engine will copy aux data of source surface to destination
111 //! \param src
112 //! [in] Pointer to source surface
113 //! \param dst
114 //! [in] Pointer to destination buffer is created for aux data
115 //! \return MOS_STATUS
116 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
117 //!
GetCCS(PMOS_SURFACE src,PMOS_SURFACE dst)118 MOS_STATUS BltStateNext::GetCCS(
119 PMOS_SURFACE src,
120 PMOS_SURFACE dst)
121 {
122 BLT_STATE_PARAM bltStateParam;
123
124 BLT_CHK_NULL_RETURN(src);
125 BLT_CHK_NULL_RETURN(dst);
126 BLT_CHK_NULL_RETURN(&src->OsResource);
127 BLT_CHK_NULL_RETURN(&dst->OsResource);
128
129 MOS_ZeroMemory(&bltStateParam, sizeof(BLT_STATE_PARAM));
130 bltStateParam.bCopyCCS = true;
131 bltStateParam.ccsFlag = CCS_READ;
132 bltStateParam.pSrcCCS = src;
133 bltStateParam.pDstCCS = dst;
134
135 BLT_CHK_STATUS_RETURN(SubmitCMD(&bltStateParam));
136
137 // sync
138 MOS_LOCK_PARAMS flag;
139 flag.Value = 0;
140 flag.WriteOnly = 1;
141 BLT_CHK_STATUS_RETURN(m_osInterface->pfnLockSyncRequest(m_osInterface, &dst->OsResource, &flag));
142
143 return MOS_STATUS_SUCCESS;
144 }
145
146 //!
147 //! \brief Put control surface
148 //! \details BLT engine will copy aux data of source surface to destination
149 //! \param src
150 //! [in] Pointer to source surface
151 //! \param dst
152 //! [in] Pointer to destination buffer is created for aux data
153 //! \return MOS_STATUS
154 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
155 //!
PutCCS(PMOS_SURFACE src,PMOS_SURFACE dst)156 MOS_STATUS BltStateNext::PutCCS(
157 PMOS_SURFACE src,
158 PMOS_SURFACE dst)
159 {
160 BLT_STATE_PARAM bltStateParam;
161
162 BLT_CHK_NULL_RETURN(src);
163 BLT_CHK_NULL_RETURN(dst);
164 BLT_CHK_NULL_RETURN(&src->OsResource);
165 BLT_CHK_NULL_RETURN(&dst->OsResource);
166
167 MOS_ZeroMemory(&bltStateParam, sizeof(BLT_STATE_PARAM));
168 bltStateParam.bCopyCCS = true;
169 bltStateParam.ccsFlag = CCS_WRITE;
170 bltStateParam.pSrcCCS = src;
171 bltStateParam.pDstCCS = dst;
172
173 BLT_CHK_STATUS_RETURN(SubmitCMD(&bltStateParam));
174
175 // sync
176 MOS_LOCK_PARAMS flag;
177 flag.Value = 0;
178 flag.WriteOnly = 1;
179 BLT_CHK_STATUS_RETURN(m_osInterface->pfnLockSyncRequest(m_osInterface, &dst->OsResource, &flag));
180
181 return MOS_STATUS_SUCCESS;
182 }
183
184 //!
185 //! \brief Lock surface
186 //! \details Lock surface to get main surface and aux data
187 //! \param pSrcSurface
188 //! [in] Pointer to source surface
189 //! \return MOS_STATUS
190 //! MOS_STATUS_SUCCESS if success, otherwise error code
191 //!
LockSurface(PMOS_SURFACE pSurface)192 MOS_STATUS BltStateNext::LockSurface(
193 PMOS_SURFACE pSurface)
194 {
195 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
196 void* pTemp = nullptr;
197 do
198 {
199 if (pSurface==nullptr)
200 {
201 BLT_ASSERTMESSAGE("BLT: pSurface check nullptr fail in LockSurface.")
202 break;
203 }
204
205 // Initialize for the first time
206 if (!initialized)
207 {
208 if (Initialize() != MOS_STATUS_SUCCESS)
209 {
210 break;
211 }
212 }
213
214 // Allocate internel resource
215 if (AllocateResource (pSurface) != MOS_STATUS_SUCCESS)
216 {
217 break;
218 }
219
220 // Get main surface and CCS
221 // Currentlt main surface copy will cause page fault, which cause crash.
222 // BLT_CHK_STATUS(CopyMainSurface(pSurface, tempSurface));
223 if (GetCCS(pSurface, tempAuxSurface) != MOS_STATUS_SUCCESS)
224 {
225 break;
226 }
227
228 MOS_LOCK_PARAMS LockFlags;
229 LockFlags.Value = 0;
230 LockFlags.ReadOnly = 1;
231 LockFlags.TiledAsTiled = 1;
232 LockFlags.NoDecompress = 1;
233
234 // Lock main surface data
235 pTemp = (uint8_t *)m_osInterface->pfnLockResource(
236 m_osInterface,
237 &pSurface->OsResource,
238 &LockFlags);
239 if (pTemp == nullptr)
240 {
241 break;
242 }
243
244 MOS_SecureMemcpy(
245 pMainSurface,
246 surfaceSize,
247 pTemp,
248 surfaceSize);
249 if (m_osInterface->pfnUnlockResource(m_osInterface, &pSurface->OsResource) != MOS_STATUS_SUCCESS)
250 {
251 break;
252 }
253
254 // Lock CCS data
255 pTemp = (uint8_t *)m_osInterface->pfnLockResource(
256 m_osInterface,
257 &tempAuxSurface->OsResource,
258 &LockFlags);
259 if (pTemp == nullptr)
260 {
261 break;
262 }
263
264 MOS_SecureMemcpy(
265 pAuxSurface,
266 auxSize,
267 pTemp,
268 auxSize);
269 if (m_osInterface->pfnUnlockResource(m_osInterface, &tempAuxSurface->OsResource))
270 {
271 break;
272 }
273
274 return eStatus;
275 } while (false);
276
277 BLT_ASSERTMESSAGE("BLT: Lock surface failed.");
278 FreeResource();
279 return eStatus;
280 }
281
282 //!
283 //! \brief Unlock surface
284 //! \details Free resource created by lockSurface, must be called once call LockSurface
285 //! \return MOS_STATUS
286 //! MOS_STATUS_SUCCESS if success, otherwise error code
287 //!
UnLockSurface()288 MOS_STATUS BltStateNext::UnLockSurface()
289 {
290 FreeResource();
291 return MOS_STATUS_SUCCESS;
292 }
293
294 //!
295 //! \brief Write compressed surface
296 //! \details Write compressed surface data from system memory to GPU memory
297 //! \param pSysMemory
298 //! [in] Pointer to system memory
299 //! \param dataSize
300 //! [in] data size, including main surface data and aux data
301 //! \param pSurface
302 //! [in] Pointer to the destination surface
303 //! \return MOS_STATUS
304 //! MOS_STATUS_SUCCESS if success, otherwise error code
305 //!
WriteCompressedSurface(void * pSysMemory,uint32_t dataSize,PMOS_SURFACE pSurface)306 MOS_STATUS BltStateNext::WriteCompressedSurface(
307 void* pSysMemory,
308 uint32_t dataSize,
309 PMOS_SURFACE pSurface)
310 {
311 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
312 void* pTemp = nullptr;
313 uint32_t sizeAux = 0;
314 do
315 {
316 if (pSurface == nullptr)
317 {
318 BLT_ASSERTMESSAGE("BLT: pSurface check nullptr fail in WriteCompressedSurface.")
319 break;
320 }
321
322 // Initialize for the first time
323 if (!initialized)
324 {
325 if (Initialize() != MOS_STATUS_SUCCESS)
326 {
327 break;
328 }
329 }
330
331 // Allocate internel resource
332 if (AllocateResource(pSurface) != MOS_STATUS_SUCCESS)
333 {
334 break;
335 }
336
337 sizeAux = dataSize / 257;
338
339 MOS_LOCK_PARAMS LockFlags;
340 LockFlags.Value = 0;
341 LockFlags.WriteOnly = 1;
342 LockFlags.TiledAsTiled = 1;
343 LockFlags.NoDecompress = 1;
344
345 // Lock temp main surface
346 pTemp = (uint32_t *)m_osInterface->pfnLockResource(
347 m_osInterface,
348 &pSurface->OsResource,
349 &LockFlags);
350 // copy surface data to temp surface
351 MOS_SecureMemcpy(
352 pTemp,
353 sizeAux * 256,
354 pSysMemory,
355 sizeAux * 256);
356 if (m_osInterface->pfnUnlockResource(m_osInterface, &pSurface->OsResource) != MOS_STATUS_SUCCESS)
357 {
358 break;
359 }
360
361 // Lock temp aux surface
362 pTemp = (uint8_t *)m_osInterface->pfnLockResource(
363 m_osInterface,
364 &tempAuxSurface->OsResource,
365 &LockFlags);
366 // copy aux data to temp aux surface
367 MOS_SecureMemcpy(
368 pTemp,
369 sizeAux,
370 (uint8_t *)pSysMemory + sizeAux * 256,
371 sizeAux);
372 if (m_osInterface->pfnUnlockResource(m_osInterface, &tempAuxSurface->OsResource) != MOS_STATUS_SUCCESS)
373 {
374 break;
375 }
376 BLT_CHK_STATUS_RETURN(PutCCS(tempAuxSurface, pSurface));
377
378 FreeResource();
379 return eStatus;
380 } while (false);
381
382 BLT_ASSERTMESSAGE("BLT: Write compressed surface failed.");
383 FreeResource();
384 return eStatus;
385 }
386
387 //!
388 //! \brief Allocate resource
389 //! \details Allocate internel resource
390 //! \param pSrcSurface
391 //! [in] Pointer to source surface
392 //! \return MOS_STATUS
393 //! MOS_STATUS_SUCCESS if success, otherwise error code
394 //!
AllocateResource(PMOS_SURFACE pSurface)395 MOS_STATUS BltStateNext::AllocateResource(
396 PMOS_SURFACE pSurface)
397 {
398 MOS_ALLOC_GFXRES_PARAMS AllocParams;
399
400 tempSurface = (PMOS_SURFACE)MOS_AllocAndZeroMemory(sizeof(MOS_SURFACE));
401 tempAuxSurface = (PMOS_SURFACE)MOS_AllocAndZeroMemory(sizeof(MOS_SURFACE));
402 BLT_CHK_NULL_RETURN(tempSurface);
403 BLT_CHK_NULL_RETURN(tempAuxSurface);
404
405 // Always allocate the temp surface as compressible surface to make sure the size is correct.
406 MOS_ZeroMemory(&AllocParams, sizeof(MOS_ALLOC_GFXRES_PARAMS));
407 AllocParams.TileType = pSurface->TileType;
408 AllocParams.Type = MOS_GFXRES_2D;
409 AllocParams.dwWidth = pSurface->dwWidth;
410 AllocParams.dwHeight = pSurface->dwHeight;
411 AllocParams.Format = pSurface->Format;
412 AllocParams.bIsCompressible = true;
413 AllocParams.CompressionMode = pSurface->CompressionMode;
414 AllocParams.pBufName = "TempOutSurface";
415 AllocParams.dwArraySize = 1;
416
417 BLT_CHK_STATUS_RETURN(m_osInterface->pfnAllocateResource(
418 m_osInterface,
419 &AllocParams,
420 &tempSurface->OsResource));
421
422 tempSurface->dwPitch = pSurface->dwPitch;
423 tempSurface->dwWidth = pSurface->dwWidth;
424 tempSurface->dwHeight = pSurface->dwHeight;
425 tempSurface->Format = pSurface->Format;
426 tempSurface->TileType = pSurface->TileType;
427
428 MOS_ZeroMemory(&AllocParams, sizeof(MOS_ALLOC_GFXRES_PARAMS));
429 AllocParams.TileType = MOS_TILE_LINEAR;
430 AllocParams.Type = MOS_GFXRES_BUFFER;
431 AllocParams.dwWidth = (uint32_t)tempSurface->OsResource.pGmmResInfo->GetSizeMainSurface() / 256;
432 AllocParams.dwHeight = 1;
433 AllocParams.Format = Format_Buffer;
434 AllocParams.bIsCompressible = false;
435 AllocParams.CompressionMode = MOS_MMC_DISABLED;
436 AllocParams.pBufName = "TempCCS";
437 AllocParams.dwArraySize = 1;
438
439 BLT_CHK_STATUS_RETURN(m_osInterface->pfnAllocateResource(
440 m_osInterface,
441 &AllocParams,
442 &tempAuxSurface->OsResource));
443
444 surfaceSize = (uint32_t)tempSurface->OsResource.pGmmResInfo->GetSizeMainSurface();
445 auxSize = surfaceSize / 256;
446 pMainSurface = MOS_AllocAndZeroMemory(surfaceSize);
447 pAuxSurface = MOS_AllocAndZeroMemory(auxSize);
448 BLT_CHK_NULL_RETURN(pMainSurface);
449 BLT_CHK_NULL_RETURN(pAuxSurface);
450
451 allocated = true;
452
453 return MOS_STATUS_SUCCESS;
454 }
455 //!
456 //! \brief Free resource
457 //! \details Free internel resource, must be called once call AllocateResource
458 //! \return MOS_STATUS
459 //! MOS_STATUS_SUCCESS if success, otherwise error code
460 //!
FreeResource()461 MOS_STATUS BltStateNext::FreeResource()
462 {
463 if (allocated)
464 {
465 m_osInterface->pfnFreeResource(m_osInterface, &tempSurface->OsResource);
466 m_osInterface->pfnFreeResource(m_osInterface, &tempAuxSurface->OsResource);
467 allocated = false;
468 }
469 if (tempSurface)
470 {
471 MOS_FreeMemAndSetNull(tempSurface);
472 }
473 if (tempAuxSurface)
474 {
475 MOS_FreeMemAndSetNull(tempAuxSurface);
476 }
477
478 return MOS_STATUS_SUCCESS;
479 }
480 //!
481 //! \brief Setup control surface copy parameters
482 //! \details Setup control surface copy parameters for BLT Engine
483 //! \param mhwParams
484 //! [in/out] Pointer to MHW_CTRL_SURF_COPY_BLT_PARAM
485 //! \param inputSurface
486 //! [in] Pointer to input surface
487 //! \param outputSurface
488 //! [in] Pointer to output surface
489 //! \param flag
490 //! [in] Flag for read/write CCS
491 //! \return MOS_STATUS
492 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
493 //!
SetupCtrlSurfCopyBltParam(PMHW_CTRL_SURF_COPY_BLT_PARAM pMhwBltParams,PMOS_SURFACE inputSurface,PMOS_SURFACE outputSurface,uint32_t flag)494 MOS_STATUS BltStateNext::SetupCtrlSurfCopyBltParam(
495 PMHW_CTRL_SURF_COPY_BLT_PARAM pMhwBltParams,
496 PMOS_SURFACE inputSurface,
497 PMOS_SURFACE outputSurface,
498 uint32_t flag)
499 {
500 BLT_CHK_NULL_RETURN(pMhwBltParams);
501 BLT_CHK_NULL_RETURN(inputSurface);
502 BLT_CHK_NULL_RETURN(outputSurface);
503
504 if (flag == CCS_READ)
505 {
506 pMhwBltParams->dwSrcMemoryType = 0;
507 pMhwBltParams->dwDstMemoryType = 1;
508 pMhwBltParams->dwSizeofControlSurface = (uint32_t)inputSurface->OsResource.pGmmResInfo->GetSizeMainSurface() / 65536;
509 }
510 else
511 {
512 pMhwBltParams->dwSrcMemoryType = 1;
513 pMhwBltParams->dwDstMemoryType = 0;
514 pMhwBltParams->dwSizeofControlSurface = (uint32_t)outputSurface->OsResource.pGmmResInfo->GetSizeMainSurface() / 65536;
515 }
516
517 pMhwBltParams->pSrcOsResource = &inputSurface->OsResource;
518 pMhwBltParams->pDstOsResource = &outputSurface->OsResource;
519
520 return MOS_STATUS_SUCCESS;
521 }
522
523 //!
524 //! \brief Block copy buffer
525 //! \details BLT engine will copy source buffer to destination buffer
526 //! \param pBltStateParam
527 //! [in] Pointer to BLT_STATE_PARAM
528 //! \return MOS_STATUS
529 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
530 //!
BlockCopyBuffer(PBLT_STATE_PARAM pBltStateParam)531 MOS_STATUS BltStateNext::BlockCopyBuffer(PBLT_STATE_PARAM pBltStateParam)
532 {
533 PMOS_RESOURCE src = nullptr;
534 PMOS_RESOURCE dst = nullptr;
535 BLT_CHK_NULL_RETURN(pBltStateParam);
536 BLT_CHK_NULL_RETURN(pBltStateParam->pSrcSurface);
537 BLT_CHK_NULL_RETURN(pBltStateParam->pDstSurface);
538 BLT_CHK_NULL_RETURN(pBltStateParam->pSrcSurface->pGmmResInfo);
539 BLT_CHK_NULL_RETURN(pBltStateParam->pDstSurface->pGmmResInfo);
540
541 src = pBltStateParam->pSrcSurface;
542 dst = pBltStateParam->pDstSurface;
543
544 if ((src->pGmmResInfo->GetSizeMainSurface() > MAX_BLT_BLOCK_COPY_WIDTH * MAX_BLT_BLOCK_COPY_WIDTH) &&
545 (dst->pGmmResInfo->GetSizeMainSurface() > MAX_BLT_BLOCK_COPY_WIDTH * MAX_BLT_BLOCK_COPY_WIDTH))
546 {
547 BLT_ASSERTMESSAGE("Buffer size too large");
548 return MOS_STATUS_INVALID_PARAMETER;
549 }
550
551 if ((src->pGmmResInfo->GetSizeMainSurface() % 4096 != 0) &&
552 (src->pGmmResInfo->GetSizeMainSurface() % 4096 != 16))
553 {
554 BLT_ASSERTMESSAGE("Src buffer is not aligned to 4K");
555 return MOS_STATUS_INVALID_PARAMETER;
556 }
557
558 if ((dst->pGmmResInfo->GetSizeMainSurface() % 4096 != 0) &&
559 (dst->pGmmResInfo->GetSizeMainSurface() % 4096 != 16))
560 {
561 BLT_ASSERTMESSAGE("Dst buffer is not aligned to 4K");
562 return MOS_STATUS_INVALID_PARAMETER;
563 }
564
565 GMM_RESOURCE_FORMAT backupSrcFormat = src->pGmmResInfo->GetResourceFormat();
566 GMM_GFX_SIZE_T backupSrcWidth = src->pGmmResInfo->GetBaseWidth();
567 uint32_t backupSrcHeight = src->pGmmResInfo->GetBaseHeight();
568 GMM_RESOURCE_FORMAT backupDstFormat = dst->pGmmResInfo->GetResourceFormat();
569 GMM_GFX_SIZE_T backupDstWidth = dst->pGmmResInfo->GetBaseWidth();
570 uint32_t backupDstHeight = dst->pGmmResInfo->GetBaseHeight();
571
572 uint32_t pitch = 4096;
573 uint32_t size = static_cast<uint32_t>((std::min)(src->pGmmResInfo->GetSizeMainSurface(), dst->pGmmResInfo->GetSizeMainSurface()));
574 uint32_t height = static_cast<uint32_t>(size / pitch);
575 while (height > MAX_BLT_BLOCK_COPY_WIDTH)
576 {
577 pitch += 4096;
578 height = static_cast<uint32_t>(size / pitch);
579 }
580
581 src->pGmmResInfo->OverrideSurfaceFormat(GMM_FORMAT_R8_UINT);
582 src->pGmmResInfo->OverrideSurfaceType(RESOURCE_2D);
583 src->pGmmResInfo->OverrideBaseWidth(pitch);
584 src->pGmmResInfo->OverrideBaseHeight(height);
585 src->pGmmResInfo->OverridePitch(pitch);
586
587 dst->pGmmResInfo->OverrideSurfaceFormat(GMM_FORMAT_R8_UINT);
588 dst->pGmmResInfo->OverrideSurfaceType(RESOURCE_2D);
589 dst->pGmmResInfo->OverrideBaseWidth(pitch);
590 dst->pGmmResInfo->OverrideBaseHeight(height);
591 dst->pGmmResInfo->OverridePitch(pitch);
592
593 MOS_STATUS status = SubmitCMD(pBltStateParam);
594
595 src->pGmmResInfo->OverrideSurfaceFormat(backupSrcFormat);
596 src->pGmmResInfo->OverrideSurfaceType(RESOURCE_BUFFER);
597 src->pGmmResInfo->OverrideBaseWidth(backupSrcWidth);
598 src->pGmmResInfo->OverrideBaseHeight(backupSrcHeight);
599 src->pGmmResInfo->OverridePitch(backupSrcWidth);
600
601 dst->pGmmResInfo->OverrideSurfaceFormat(backupDstFormat);
602 dst->pGmmResInfo->OverrideSurfaceType(RESOURCE_BUFFER);
603 dst->pGmmResInfo->OverrideBaseWidth(backupDstWidth);
604 dst->pGmmResInfo->OverrideBaseHeight(backupDstHeight);
605 dst->pGmmResInfo->OverridePitch(backupDstWidth);
606
607 BLT_CHK_STATUS_RETURN(status);
608 return MOS_STATUS_SUCCESS;
609 }
610
611 //!
612 //! \brief Copy main surface
613 //! \details BLT engine will copy source surface to destination surface
614 //! \param src
615 //! [in] Pointer to source surface
616 //! \param dst
617 //! [in] Pointer to destination surface
618 //! \return MOS_STATUS
619 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
620 //!
CopyMainSurface(PMOS_SURFACE src,PMOS_SURFACE dst)621 MOS_STATUS BltStateNext::CopyMainSurface(
622 PMOS_SURFACE src,
623 PMOS_SURFACE dst)
624 {
625 BLT_CHK_STATUS_RETURN(CopyMainSurface(&src->OsResource, &dst->OsResource));
626 return MOS_STATUS_SUCCESS;
627 }
628
629 //!
630 //! \brief Copy main surface
631 //! \details BLT engine will copy source surface to destination surface
632 //! \param src
633 //! [in] Pointer to source resource
634 //! \param dst
635 //! [in] Pointer to destination resource
636 //! \return MOS_STATUS
637 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
638 //!
CopyMainSurface(PMOS_RESOURCE src,PMOS_RESOURCE dst)639 MOS_STATUS BltStateNext::CopyMainSurface(
640 PMOS_RESOURCE src,
641 PMOS_RESOURCE dst)
642 {
643 BLT_STATE_PARAM BltStateNextParam;
644
645 BLT_CHK_NULL_RETURN(src);
646 BLT_CHK_NULL_RETURN(dst);
647 BLT_CHK_NULL_RETURN(src->pGmmResInfo);
648 BLT_CHK_NULL_RETURN(dst->pGmmResInfo);
649
650 MOS_ZeroMemory(&BltStateNextParam, sizeof(BLT_STATE_PARAM));
651 BltStateNextParam.bCopyMainSurface = true;
652 BltStateNextParam.pSrcSurface = src;
653 BltStateNextParam.pDstSurface = dst;
654
655 // A workaround for oversized buffers.
656 // BLOCK_COPY_BLT can only receive (width-1) of up to 14 bits.
657 // The width of the internal buffer of a staging texture may exceed that limit.
658 if ((src->pGmmResInfo->GetResourceType() == RESOURCE_BUFFER) &&
659 (dst->pGmmResInfo->GetResourceType() == RESOURCE_BUFFER) &&
660 ((src->pGmmResInfo->GetBaseWidth() > MAX_BLT_BLOCK_COPY_WIDTH) || (dst->pGmmResInfo->GetBaseWidth() > MAX_BLT_BLOCK_COPY_WIDTH)))
661 {
662 BLT_CHK_STATUS_RETURN(BlockCopyBuffer(&BltStateNextParam));
663 }
664 else
665 {
666 BLT_CHK_STATUS_RETURN(SubmitCMD(&BltStateNextParam));
667 }
668
669 return MOS_STATUS_SUCCESS;
670
671 }
672
673 //!
674 //! \brief Setup fast copy parameters
675 //! \details Setup fast copy parameters for BLT Engine
676 //! \param mhwParams
677 //! [in/out] Pointer to MHW_FAST_COPY_BLT_PARAM
678 //! \param inputSurface
679 //! [in] Pointer to input surface
680 //! \param outputSurface
681 //! [in] Pointer to output surface
682 //! \param planeIndex
683 //! [in] Pointer to YUV(RGB) plane index
684 //! \return MOS_STATUS
685 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
686 //!
SetupBltCopyParam(PMHW_FAST_COPY_BLT_PARAM pMhwBltParams,PMOS_RESOURCE inputSurface,PMOS_RESOURCE outputSurface,int planeIndex)687 MOS_STATUS BltStateNext::SetupBltCopyParam(
688 PMHW_FAST_COPY_BLT_PARAM pMhwBltParams,
689 PMOS_RESOURCE inputSurface,
690 PMOS_RESOURCE outputSurface,
691 int planeIndex)
692 {
693 BLT_CHK_NULL_RETURN(pMhwBltParams);
694 BLT_CHK_NULL_RETURN(inputSurface);
695 BLT_CHK_NULL_RETURN(outputSurface);
696
697 MOS_SURFACE ResDetails;
698 MOS_ZeroMemory(&ResDetails, sizeof(MOS_SURFACE));
699 MOS_ZeroMemory(pMhwBltParams, sizeof(MHW_FAST_COPY_BLT_PARAM));
700 ResDetails.Format = Format_Invalid;
701 BLT_CHK_STATUS_RETURN(m_osInterface->pfnGetResourceInfo(m_osInterface, inputSurface, &ResDetails));
702
703 uint32_t inputHeight = ResDetails.dwHeight;
704 uint32_t inputWidth = ResDetails.dwWidth;
705 uint32_t inputPitch = ResDetails.dwPitch;
706
707 if (inputSurface->TileType != MOS_TILE_LINEAR)
708 { //for tiled surfaces, pitch is expressed in DWORDs
709 pMhwBltParams->dwSrcPitch = ResDetails.dwPitch / 4;
710 }
711 else
712 {
713 pMhwBltParams->dwSrcPitch = ResDetails.dwPitch;
714 }
715
716 pMhwBltParams->dwSrcTop = ResDetails.RenderOffset.YUV.Y.YOffset;
717 pMhwBltParams->dwSrcLeft = ResDetails.RenderOffset.YUV.Y.XOffset;
718
719 MOS_ZeroMemory(&ResDetails, sizeof(MOS_SURFACE));
720 ResDetails.Format = Format_Invalid;
721 BLT_CHK_STATUS_RETURN(m_osInterface->pfnGetResourceInfo(m_osInterface, outputSurface, &ResDetails));
722
723 uint32_t outputHeight = ResDetails.dwHeight;
724 uint32_t outputWidth = ResDetails.dwWidth;
725 uint32_t outputPitch = ResDetails.dwPitch;
726
727 if (outputSurface->TileType != MOS_TILE_LINEAR)
728 {// for tiled surfaces, pitch is expressed in DWORDs
729 pMhwBltParams->dwDstPitch = ResDetails.dwPitch/4;
730 }
731 else
732 {
733 pMhwBltParams->dwDstPitch = ResDetails.dwPitch;
734 }
735 pMhwBltParams->dwDstTop = ResDetails.RenderOffset.YUV.Y.YOffset;
736 pMhwBltParams->dwDstLeft = ResDetails.RenderOffset.YUV.Y.XOffset;
737
738 int planeNum = GetPlaneNum(ResDetails.Format);
739 pMhwBltParams->dwPlaneIndex = planeIndex;
740 pMhwBltParams->dwPlaneNum = planeNum;
741
742 // some upper layer has overwrite the format, so need get orignal BitsPerBlock
743 BLT_CHK_NULL_RETURN(inputSurface->pGmmResInfo);
744 BLT_CHK_NULL_RETURN(outputSurface->pGmmResInfo);
745 uint32_t inputBitsPerPixel = inputSurface->pGmmResInfo->GetBitsPerPixel();
746 uint32_t outputBitsPerPixel = outputSurface->pGmmResInfo->GetBitsPerPixel();
747 uint32_t BitsPerPixel = 8;
748 if (inputSurface->TileType != MOS_TILE_LINEAR)
749 {
750 BitsPerPixel = inputBitsPerPixel;
751 }
752 else if (outputSurface->TileType != MOS_TILE_LINEAR)
753 {
754 BitsPerPixel = outputBitsPerPixel;
755 }
756 else
757 {
758 // both input and output are linear surfaces.
759 // upper layer overwrite the format from buffer to 2D surfaces. Then the BitsPerPixel may different.
760 BitsPerPixel = inputBitsPerPixel >= outputBitsPerPixel ? inputBitsPerPixel : outputBitsPerPixel;
761 }
762 MCPY_NORMALMESSAGE("input BitsPerBlock %d, output BitsPerBlock %d, the vid mem BitsPerBlock %d",
763 inputBitsPerPixel,
764 outputBitsPerPixel,
765 BitsPerPixel);
766 pMhwBltParams->dwColorDepth = GetBlkCopyColorDepth(outputSurface->pGmmResInfo->GetResourceFormat(), BitsPerPixel);
767 pMhwBltParams->dwDstRight = std::min(inputWidth, outputWidth);
768 pMhwBltParams->dwDstBottom = std::min(inputHeight, outputHeight);
769
770 // The 2nd and 3nd layer.
771 if (planeNum == TWO_PLANES || planeNum == THREE_PLANES)
772 {
773 int bytePerTexelScaling = GetBytesPerTexelScaling(ResDetails.Format);
774
775 if (MCPY_PLANE_U == planeIndex || MCPY_PLANE_V == planeIndex)
776 {
777 pMhwBltParams->dwDstBottom = pMhwBltParams->dwDstBottom / bytePerTexelScaling;
778 if (ResDetails.Format == Format_I420 || ResDetails.Format == Format_YV12)
779 {
780 pMhwBltParams->dwDstPitch = pMhwBltParams->dwDstPitch / 2;
781 pMhwBltParams->dwSrcPitch = pMhwBltParams->dwSrcPitch / 2;
782 pMhwBltParams->dwDstRight = pMhwBltParams->dwDstRight / 2;
783 pMhwBltParams->dwDstBottom = pMhwBltParams->dwDstBottom / 2;
784 }
785 }
786 }
787 pMhwBltParams->pSrcOsResource = inputSurface;
788 pMhwBltParams->pDstOsResource = outputSurface;
789 MCPY_NORMALMESSAGE("BLT params:format %d, planeNum %d, planeIndex %d, dwColorDepth %d, dwSrcTop %d, dwSrcLeft %d, dwSrcPitch %d,"
790 "dwDstTop %d, dwDstLeft %d, dwDstRight %d, dwDstBottom %d, dwDstPitch %d",
791 ResDetails.Format, planeNum, planeIndex, pMhwBltParams->dwColorDepth, pMhwBltParams->dwSrcTop, pMhwBltParams->dwSrcLeft,
792 pMhwBltParams->dwSrcPitch, pMhwBltParams->dwDstTop, pMhwBltParams->dwDstLeft, pMhwBltParams->dwDstRight,
793 pMhwBltParams->dwDstBottom, pMhwBltParams->dwDstPitch);
794
795 return MOS_STATUS_SUCCESS;
796 }
797
798 //!
799 //! \brief Submit command2
800 //! \details Submit BLT command2
801 //! \param pBltStateParam
802 //! [in] Pointer to BLT_STATE_PARAM
803 //! \return MOS_STATUS
804 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
805 //!
SubmitCMD(PBLT_STATE_PARAM pBltStateParam)806 MOS_STATUS BltStateNext::SubmitCMD(
807 PBLT_STATE_PARAM pBltStateParam)
808 {
809 MOS_STATUS eStatus;
810 MOS_COMMAND_BUFFER cmdBuffer;
811 MHW_FAST_COPY_BLT_PARAM fastCopyBltParam;
812 MHW_CTRL_SURF_COPY_BLT_PARAM ctrlSurfCopyBltParam;
813 MOS_GPUCTX_CREATOPTIONS_ENHANCED createOption = {};
814 int planeNum = 1;
815
816 BLT_CHK_NULL_RETURN(m_miItf);
817 BLT_CHK_NULL_RETURN(m_bltItf);
818 BLT_CHK_NULL_RETURN(pBltStateParam);
819 BLT_CHK_NULL_RETURN(m_osInterface);
820 // need consolidate both input/output surface information to decide cp context.
821 PMOS_RESOURCE surfaceArray[2];
822 surfaceArray[0] = pBltStateParam->pSrcSurface;
823 surfaceArray[1] = pBltStateParam->pDstSurface;
824 if (m_osInterface->osCpInterface)
825 {
826 m_osInterface->osCpInterface->PrepareResources((void **)&surfaceArray, sizeof(surfaceArray) / sizeof(PMOS_RESOURCE), nullptr, 0);
827 }
828 // no gpucontext will be created if the gpu context has been created before.
829 BLT_CHK_STATUS_RETURN(m_osInterface->pfnCreateGpuContext(
830 m_osInterface,
831 MOS_GPU_CONTEXT_BLT,
832 MOS_GPU_NODE_BLT,
833 &createOption));
834 // Set GPU context
835 BLT_CHK_STATUS_RETURN(m_osInterface->pfnSetGpuContext(m_osInterface, MOS_GPU_CONTEXT_BLT));
836 // Register context with the Batch Buffer completion event
837 BLT_CHK_STATUS_RETURN(m_osInterface->pfnRegisterBBCompleteNotifyEvent(
838 m_osInterface,
839 MOS_GPU_CONTEXT_BLT));
840
841 // Initialize the command buffer struct
842 MOS_ZeroMemory(&cmdBuffer, sizeof(MOS_COMMAND_BUFFER));
843 BLT_CHK_STATUS_RETURN(m_osInterface->pfnGetCommandBuffer(m_osInterface, &cmdBuffer, 0));
844 BLT_CHK_STATUS_RETURN(SetPrologParamsforCmdbuffer(&cmdBuffer));
845
846 MOS_SURFACE srcResDetails;
847 MOS_SURFACE dstResDetails;
848 MOS_ZeroMemory(&srcResDetails, sizeof(MOS_SURFACE));
849 MOS_ZeroMemory(&dstResDetails, sizeof(MOS_SURFACE));
850 srcResDetails.Format = Format_Invalid;
851 dstResDetails.Format = Format_Invalid;
852 BLT_CHK_STATUS_RETURN(m_osInterface->pfnGetResourceInfo(m_osInterface, pBltStateParam->pSrcSurface, &srcResDetails));
853 BLT_CHK_STATUS_RETURN(m_osInterface->pfnGetResourceInfo(m_osInterface, pBltStateParam->pDstSurface, &dstResDetails));
854
855 if (srcResDetails.Format != dstResDetails.Format)
856 {
857 MCPY_ASSERTMESSAGE("BLT copy can't support CSC copy. input format = %d, output format = %d", srcResDetails.Format, dstResDetails.Format);
858 return MOS_STATUS_INVALID_PARAMETER;
859 }
860 planeNum = GetPlaneNum(dstResDetails.Format);
861 m_osInterface->pfnSetPerfTag(m_osInterface, BLT_COPY);
862 MediaPerfProfiler* perfProfiler = MediaPerfProfiler::Instance();
863 BLT_CHK_NULL_RETURN(perfProfiler);
864 BLT_CHK_STATUS_RETURN(perfProfiler->AddPerfCollectStartCmd((void*)this, m_osInterface, m_miItf, &cmdBuffer));
865
866 if (pBltStateParam->bCopyMainSurface)
867 {
868 BLT_CHK_STATUS_RETURN(SetupBltCopyParam(
869 &fastCopyBltParam,
870 pBltStateParam->pSrcSurface,
871 pBltStateParam->pDstSurface,
872 MCPY_PLANE_Y));
873
874 BLT_CHK_STATUS_RETURN(SetBCSSWCTR(&cmdBuffer));
875 BLT_CHK_STATUS_RETURN(m_miItf->AddBLTMMIOPrologCmd(&cmdBuffer));
876 BLT_CHK_STATUS_RETURN(m_bltItf->AddBlockCopyBlt(
877 &cmdBuffer,
878 &fastCopyBltParam,
879 srcResDetails.YPlaneOffset.iSurfaceOffset,
880 dstResDetails.YPlaneOffset.iSurfaceOffset));
881
882 if (planeNum == TWO_PLANES || planeNum == THREE_PLANES)
883 {
884 BLT_CHK_STATUS_RETURN(SetupBltCopyParam(
885 &fastCopyBltParam,
886 pBltStateParam->pSrcSurface,
887 pBltStateParam->pDstSurface,
888 MCPY_PLANE_U));
889 BLT_CHK_STATUS_RETURN(m_bltItf->AddBlockCopyBlt(
890 &cmdBuffer,
891 &fastCopyBltParam,
892 srcResDetails.UPlaneOffset.iSurfaceOffset,
893 dstResDetails.UPlaneOffset.iSurfaceOffset));
894
895 if (planeNum == THREE_PLANES)
896 {
897 BLT_CHK_STATUS_RETURN(SetupBltCopyParam(
898 &fastCopyBltParam,
899 pBltStateParam->pSrcSurface,
900 pBltStateParam->pDstSurface,
901 MCPY_PLANE_V));
902 BLT_CHK_STATUS_RETURN(m_bltItf->AddBlockCopyBlt(
903 &cmdBuffer,
904 &fastCopyBltParam,
905 srcResDetails.VPlaneOffset.iSurfaceOffset,
906 dstResDetails.VPlaneOffset.iSurfaceOffset));
907 }
908
909 }
910 }
911 BLT_CHK_STATUS_RETURN(perfProfiler->AddPerfCollectEndCmd((void*)this, m_osInterface, m_miItf, &cmdBuffer));
912
913 // Add flush DW
914 auto& flushDwParams = m_miItf->MHW_GETPAR_F(MI_FLUSH_DW)();
915 flushDwParams = {};
916 auto skuTable = m_osInterface->pfnGetSkuTable(m_osInterface);
917 if (skuTable && MEDIA_IS_SKU(skuTable, FtrEnablePPCFlush))
918 {
919 flushDwParams.bEnablePPCFlush = true;
920 }
921 BLT_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_FLUSH_DW)(&cmdBuffer));
922 // Add Batch Buffer end
923 BLT_CHK_STATUS_RETURN(m_miItf->AddMiBatchBufferEnd(&cmdBuffer, nullptr));
924
925 // Return unused command buffer space to OS
926 m_osInterface->pfnReturnCommandBuffer(m_osInterface, &cmdBuffer, 0);
927
928 // Flush the command buffer
929 BLT_CHK_STATUS_RETURN(m_osInterface->pfnSubmitCommandBuffer(m_osInterface, &cmdBuffer, false));
930
931 return MOS_STATUS_SUCCESS;
932 }
933
GetBlkCopyColorDepth(GMM_RESOURCE_FORMAT dstFormat,uint32_t BitsPerPixel)934 uint32_t BltStateNext::GetBlkCopyColorDepth(
935 GMM_RESOURCE_FORMAT dstFormat,
936 uint32_t BitsPerPixel)
937 {
938 if (dstFormat == GMM_FORMAT_YUY2_2x1 || dstFormat == GMM_FORMAT_Y216_TYPE || dstFormat == GMM_FORMAT_Y210)
939 {// GMM_FORMAT_YUY2_2x1 32bpe 2x1 pixel blocks instead of 16bpp 1x1 block
940 // GMM_FORMAT_Y216_TYPE/Y210 64bpe pixel blocks instead of 32bpp block.
941 BitsPerPixel = BitsPerPixel / 2;
942 }
943 switch (BitsPerPixel)
944 {
945 case 16:
946 switch (dstFormat)
947 {
948 case GMM_FORMAT_B5G5R5A1_UNORM:
949 return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_32BITCOLOR;
950 default:
951 return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_16BITCOLOR;
952 }
953 case 32:
954 return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_32BITCOLOR;
955 case 64:
956 return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_64BITCOLOR;
957 case 96:
958 MCPY_ASSERTMESSAGE("96 BitPerPixel support limimated as Linear format %d", dstFormat);
959 return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_96BITCOLOR_ONLYLINEARCASEISSUPPORTED;
960 case 128:
961 return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_128BITCOLOR;
962 case 8:
963 default:
964 return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_8BITCOLOR;
965 }
966 }
967
GetBytesPerTexelScaling(MOS_FORMAT format)968 int BltStateNext::GetBytesPerTexelScaling(MOS_FORMAT format)
969 {
970 int dstBytesPerTexel = 1;
971 switch (format)
972 {
973 case Format_NV12:
974 case Format_P010:
975 case Format_P016:
976 dstBytesPerTexel = 2;
977 break;
978 default:
979 dstBytesPerTexel = 1;
980 }
981 return dstBytesPerTexel;
982 }
983
GetPlaneNum(MOS_FORMAT format)984 int BltStateNext::GetPlaneNum(MOS_FORMAT format)
985 {
986
987 int planeNum = SINGLE_PLANE;
988
989 switch (format)
990 {
991 case Format_NV12:
992 case Format_P010:
993 case Format_P016:
994 planeNum = TWO_PLANES;
995 break;
996 case Format_YV12:
997 case Format_I420:
998 case Format_444P:
999 case Format_RGBP:
1000 case Format_BGRP:
1001 case Format_IMC3:
1002 case Format_411P:
1003 case Format_422V:
1004 case Format_422H:
1005 planeNum = THREE_PLANES;
1006 break;
1007 default:
1008 planeNum = SINGLE_PLANE;
1009 break;
1010 }
1011 return planeNum;
1012 }
1013
SetPrologParamsforCmdbuffer(PMOS_COMMAND_BUFFER cmdBuffer)1014 MOS_STATUS BltStateNext::SetPrologParamsforCmdbuffer(PMOS_COMMAND_BUFFER cmdBuffer)
1015 {
1016 PMOS_INTERFACE pOsInterface;
1017 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
1018 uint32_t iRemaining;
1019 RENDERHAL_GENERIC_PROLOG_PARAMS GenericPrologParams = {};
1020 PMOS_RESOURCE gpuStatusBuffer = nullptr;
1021
1022 //---------------------------------------------
1023 BLT_CHK_NULL_RETURN(cmdBuffer);
1024 BLT_CHK_NULL_RETURN(m_osInterface);
1025 //---------------------------------------------
1026
1027 eStatus = MOS_STATUS_SUCCESS;
1028 pOsInterface = m_osInterface;
1029
1030
1031 MOS_GPU_CONTEXT gpuContext = m_osInterface->pfnGetGpuContext(m_osInterface);
1032
1033 #ifndef EMUL
1034 if (pOsInterface->bEnableKmdMediaFrameTracking)
1035 {
1036 // Get GPU Status buffer
1037 BLT_CHK_STATUS_RETURN(pOsInterface->pfnGetGpuStatusBufferResource(pOsInterface, gpuStatusBuffer));
1038 BLT_CHK_NULL_RETURN(gpuStatusBuffer);
1039 // Register the buffer
1040 BLT_CHK_STATUS_RETURN(pOsInterface->pfnRegisterResource(pOsInterface, gpuStatusBuffer, true, true));
1041
1042 GenericPrologParams.bEnableMediaFrameTracking = true;
1043 GenericPrologParams.presMediaFrameTrackingSurface = gpuStatusBuffer;
1044 GenericPrologParams.dwMediaFrameTrackingTag = pOsInterface->pfnGetGpuStatusTag(pOsInterface, pOsInterface->CurrentGpuContextOrdinal);
1045 GenericPrologParams.dwMediaFrameTrackingAddrOffset = pOsInterface->pfnGetGpuStatusTagOffset(pOsInterface, pOsInterface->CurrentGpuContextOrdinal);
1046
1047 // Increment GPU Status Tag
1048 pOsInterface->pfnIncrementGpuStatusTag(pOsInterface, pOsInterface->CurrentGpuContextOrdinal);
1049 }
1050 #endif
1051
1052 if (GenericPrologParams.bEnableMediaFrameTracking)
1053 {
1054 BLT_CHK_NULL_RETURN(GenericPrologParams.presMediaFrameTrackingSurface);
1055 cmdBuffer->Attributes.bEnableMediaFrameTracking = GenericPrologParams.bEnableMediaFrameTracking;
1056 cmdBuffer->Attributes.dwMediaFrameTrackingTag = GenericPrologParams.dwMediaFrameTrackingTag;
1057 cmdBuffer->Attributes.dwMediaFrameTrackingAddrOffset = GenericPrologParams.dwMediaFrameTrackingAddrOffset;
1058 cmdBuffer->Attributes.resMediaFrameTrackingSurface = GenericPrologParams.presMediaFrameTrackingSurface;
1059 }
1060
1061 return eStatus;
1062 }
1063
SetBCSSWCTR(MOS_COMMAND_BUFFER * cmdBuffer)1064 MOS_STATUS BltStateNext::SetBCSSWCTR(MOS_COMMAND_BUFFER *cmdBuffer)
1065 {
1066 MOS_UNUSED(cmdBuffer);
1067 return MOS_STATUS_SUCCESS;
1068 }