| 1 |
/* |
| 2 |
* Copyright (c) 2018-2024, 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 vp_dumper.cpp |
| 24 |
//! \brief Implementation of functions for debugging |
| 25 |
//! \details This file contains the Implementation of functions for |
| 26 |
//! surface dumper and parameter dumper |
| 27 |
//! |
| 28 |
|
| 29 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 30 |
#include <stdio.h> |
| 31 |
|
| 32 |
#include "mos_os.h" |
| 33 |
#include "vp_dumper.h" |
| 34 |
#include "mos_context_next.h" |
| 35 |
#include "vp_utils.h" |
| 36 |
|
| 37 |
#define ALLOC_GRANULARITY 5000000 |
| 38 |
|
| 39 |
//==<Dump Surface>============================================================== |
| 40 |
#define VPHAL_SURF_DUMP_OUTFILE_KEY_NAME "outfileLocation" |
| 41 |
#define VPHAL_SURF_DUMP_LOCATION_KEY_NAME "dumpLocations" |
| 42 |
#define VPHAL_SURF_DUMP_START_FRAME_KEY_NAME "startFrame" |
| 43 |
#define VPHAL_SURF_DUMP_END_FRAME_KEY_NAME "endFrame" |
| 44 |
#define VPHAL_SURF_DUMP_MAX_DATA_LEN 200 |
| 45 |
#define VPHAL_SURF_DUMP_TYPE_BACKGROUND "background" |
| 46 |
#define VPHAL_SURF_DUMP_TYPE_PRIMARY "primary" |
| 47 |
#define VPHAL_SURF_DUMP_TYPE_SUBSTREAM "substream" |
| 48 |
#define VPHAL_SURF_DUMP_TYPE_REFERENCE "reference" |
| 49 |
#define VPHAL_SURF_DUMP_TYPE_RENDERTARGET "rendertarget" |
| 50 |
#define VPHAL_SURF_DUMP_LOC_PREALL "preall" |
| 51 |
#define VPHAL_SURF_DUMP_LOC_PREDNDI "predndi" |
| 52 |
#define VPHAL_SURF_DUMP_LOC_POSTDNDI "postdndi" |
| 53 |
#define VPHAL_SURF_DUMP_LOC_PRECOMP "precomp" |
| 54 |
#define VPHAL_SURF_DUMP_LOC_POSTCOMP "postcomp" |
| 55 |
#define VPHAL_SURF_DUMP_LOC_PREMEMDECOMP "prememdecomp" |
| 56 |
#define VPHAL_SURF_DUMP_LOC_POSTMEMDECOMP "postmemdecomp" |
| 57 |
#define VPHAL_SURF_DUMP_LOC_VEBOX_DRIVERHEAP "veboxdriverheap" |
| 58 |
#define VPHAL_SURF_DUMP_LOC_VEBOX_KERNELHEAP "veboxkernelheap" |
| 59 |
#define VPHAL_SURF_DUMP_LOC_POSTALL "postall" |
| 60 |
|
| 61 |
//==<Dump Parameters>==================================================== |
| 62 |
#define VPHAL_PARAMS_DUMP_OUTFILE_KEY_NAME "outxmlLocation" |
| 63 |
#define VPHAL_PARAMS_DUMP_START_FRAME_KEY_NAME "startxmlFrame" |
| 64 |
#define VPHAL_PARAMS_DUMP_END_FRAME_KEY_NAME "endxmlFrame" |
| 65 |
|
| 66 |
//==<Dump DDI>==================================================== |
| 67 |
#define VPHAL_PARAMS_DUMP_DDI_UNKNOWN "unknown" |
| 68 |
#define VPHAL_PARAMS_DUMP_DDI_VP_BLT "vpblt" |
| 69 |
#define VPHAL_PARAMS_DUMP_DDI_CLEAR_VIEW "clearview" |
| 70 |
|
| 71 |
void VpDumperTool::GetOsFilePath( |
| 72 |
const char* pcFilePath, |
| 73 |
char* pOsFilePath) |
| 74 |
{ |
| 75 |
VP_FUNC_CALL(); |
| 76 |
|
| 77 |
MOS_SecureMemcpy(pOsFilePath, MAX_PATH, (void*)pcFilePath, strlen(pcFilePath)); |
| 78 |
} |
| 79 |
|
| 80 |
void VpSurfaceDumper::CopyScanlineWithHoleStripping( |
| 81 |
uint8_t *pDst, |
| 82 |
const uint8_t *pSrc, |
| 83 |
uint32_t dwWidth, |
| 84 |
MOS_FORMAT format, |
| 85 |
MEDIA_FEATURE_TABLE *skuTable) |
| 86 |
{ |
| 87 |
VP_FUNC_CALL(); |
| 88 |
|
| 89 |
// For RGB24 format on older platforms, need to remove one invalid zero every 64 bytes |
| 90 |
// which is designed to avoid splitting two cache lines. |
| 91 |
// On newer platforms (FtrSFCRGB24OutNoPadding), RGB24 is continuous packed — no holes to strip. |
| 92 |
if (format == Format_R8G8B8 && |
| 93 |
!(skuTable && MEDIA_IS_SKU(skuTable, FtrSFCRGB24OutNoPadding))) |
| 94 |
{ |
| 95 |
int dummyBytesPerLine = dwWidth / 63; |
| 96 |
int resPixel = dwWidth - 63 * dummyBytesPerLine; |
| 97 |
for (int p = 0; p < dummyBytesPerLine; p++) |
| 98 |
{ |
| 99 |
MOS_SecureMemcpy( |
| 100 |
&pDst[p * 63], |
| 101 |
63, |
| 102 |
&pSrc[p * 64], |
| 103 |
63); |
| 104 |
} |
| 105 |
if (resPixel > 0) |
| 106 |
{ |
| 107 |
MOS_SecureMemcpy( |
| 108 |
&pDst[dummyBytesPerLine * 63], |
| 109 |
resPixel, |
| 110 |
&pSrc[dummyBytesPerLine * 64], |
| 111 |
resPixel); |
| 112 |
} |
| 113 |
} |
| 114 |
else |
| 115 |
{ |
| 116 |
MOS_SecureMemcpy( |
| 117 |
pDst, |
| 118 |
dwWidth, |
| 119 |
pSrc, |
| 120 |
dwWidth); |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
MOS_STATUS VpSurfaceDumper::GetPlaneDefs( |
| 125 |
PVPHAL_SURFACE pSurface, |
| 126 |
VPHAL_SURF_DUMP_SURFACE_DEF *pPlanes, |
| 127 |
uint32_t *pdwNumPlanes, |
| 128 |
uint32_t *pdwSize, |
| 129 |
bool auxEnable, |
| 130 |
bool isDeswizzled) |
| 131 |
{ |
| 132 |
VP_FUNC_CALL(); |
| 133 |
|
| 134 |
MOS_STATUS eStatus; |
| 135 |
uint32_t i; |
| 136 |
bool PaddingEnable = false; |
| 137 |
|
| 138 |
eStatus = MOS_STATUS_SUCCESS; |
| 139 |
|
| 140 |
// Caller should supply this much! |
| 141 |
MOS_ZeroMemory(pPlanes, sizeof(VPHAL_SURF_DUMP_SURFACE_DEF) * 3); |
| 142 |
|
| 143 |
switch (pSurface->Format) |
| 144 |
{ |
| 145 |
case Format_AI44: |
| 146 |
case Format_IA44: |
| 147 |
case Format_A4L4: |
| 148 |
case Format_P8: |
| 149 |
case Format_L8: |
| 150 |
case Format_A8: |
| 151 |
case Format_Buffer: |
| 152 |
case Format_STMM: |
| 153 |
case Format_IRW4: |
| 154 |
case Format_IRW5: |
| 155 |
case Format_IRW6: |
| 156 |
case Format_IRW7: |
| 157 |
case Format_RAW: |
| 158 |
case Format_Y8: |
| 159 |
*pdwNumPlanes = 1; |
| 160 |
|
| 161 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 162 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 163 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 164 |
break; |
| 165 |
|
| 166 |
case Format_R5G6B5: |
| 167 |
case Format_A8P8: |
| 168 |
case Format_A8L8: |
| 169 |
case Format_YUY2: |
| 170 |
case Format_YUYV: |
| 171 |
case Format_YVYU: |
| 172 |
case Format_UYVY: |
| 173 |
case Format_VYUY: |
| 174 |
case Format_IRW0: |
| 175 |
case Format_IRW1: |
| 176 |
case Format_IRW2: |
| 177 |
case Format_IRW3: |
| 178 |
case Format_V8U8: |
| 179 |
case Format_R16F: |
| 180 |
case Format_Y16S: |
| 181 |
case Format_Y16U: |
| 182 |
case Format_R16UN: |
| 183 |
*pdwNumPlanes = 1; |
| 184 |
|
| 185 |
pPlanes[0].dwWidth = pSurface->dwWidth * 2; |
| 186 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 187 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 188 |
break; |
| 189 |
|
| 190 |
case Format_R32U: |
| 191 |
case Format_R32F: |
| 192 |
case Format_A8R8G8B8: |
| 193 |
case Format_X8R8G8B8: |
| 194 |
case Format_A8B8G8R8: |
| 195 |
case Format_X8B8G8R8: |
| 196 |
case Format_AYUV: |
| 197 |
case Format_AUYV: |
| 198 |
case Format_R10G10B10A2: |
| 199 |
case Format_B10G10R10A2: |
| 200 |
case Format_Y410: |
| 201 |
case Format_R16G16F: |
| 202 |
*pdwNumPlanes = 1; |
| 203 |
|
| 204 |
pPlanes[0].dwWidth = pSurface->dwWidth * 4; |
| 205 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 206 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 207 |
break; |
| 208 |
case Format_R8G8B8: |
| 209 |
*pdwNumPlanes = 1; |
| 210 |
pPlanes[0].dwWidth = pSurface->dwWidth * 3; |
| 211 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 212 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 213 |
break; |
| 214 |
|
| 215 |
case Format_Y416: |
| 216 |
case Format_A16B16G16R16: |
| 217 |
case Format_A16R16G16B16: |
| 218 |
case Format_A16B16G16R16F: |
| 219 |
case Format_A16R16G16B16F: |
| 220 |
*pdwNumPlanes = 1; |
| 221 |
|
| 222 |
pPlanes[0].dwWidth = pSurface->dwWidth * 8; |
| 223 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 224 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 225 |
break; |
| 226 |
|
| 227 |
case Format_NV12: |
| 228 |
*pdwNumPlanes = 2; |
| 229 |
|
| 230 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 231 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 232 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 233 |
|
| 234 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 235 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 236 |
pPlanes[1].dwPitch = pSurface->dwPitch; |
| 237 |
break; |
| 238 |
|
| 239 |
case Format_P010: |
| 240 |
case Format_P016: |
| 241 |
*pdwNumPlanes = 2; |
| 242 |
|
| 243 |
pPlanes[0].dwWidth = pSurface->dwWidth * 2; |
| 244 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 245 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 246 |
|
| 247 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 248 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 249 |
pPlanes[1].dwPitch = pSurface->dwPitch; |
| 250 |
break; |
| 251 |
|
| 252 |
case Format_IMC2: |
| 253 |
case Format_IMC4: |
| 254 |
*pdwNumPlanes = 2; |
| 255 |
|
| 256 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 257 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 258 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 259 |
|
| 260 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 261 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 262 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 263 |
break; |
| 264 |
|
| 265 |
case Format_YVU9: |
| 266 |
*pdwNumPlanes = 3; |
| 267 |
|
| 268 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 269 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 270 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 271 |
|
| 272 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 4; |
| 273 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 4; |
| 274 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 275 |
|
| 276 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 4; |
| 277 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 4; |
| 278 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 279 |
break; |
| 280 |
|
| 281 |
case Format_IMC1: |
| 282 |
case Format_IMC3: |
| 283 |
*pdwNumPlanes = 3; |
| 284 |
|
| 285 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 286 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 287 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 288 |
|
| 289 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 2; |
| 290 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 291 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 292 |
|
| 293 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 2; |
| 294 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 2; |
| 295 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 296 |
break; |
| 297 |
|
| 298 |
case Format_I420: |
| 299 |
case Format_IYUV: |
| 300 |
case Format_YV12: |
| 301 |
*pdwNumPlanes = 3; |
| 302 |
|
| 303 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 304 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 305 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 306 |
|
| 307 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 2; |
| 308 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 309 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch / 2; |
| 310 |
|
| 311 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 2; |
| 312 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 2; |
| 313 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch / 2; |
| 314 |
break; |
| 315 |
case Format_400P: |
| 316 |
*pdwNumPlanes = 1; |
| 317 |
|
| 318 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 319 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 320 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 321 |
break; |
| 322 |
|
| 323 |
case Format_411P: |
| 324 |
*pdwNumPlanes = 3; |
| 325 |
|
| 326 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 327 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 328 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 329 |
|
| 330 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 4; |
| 331 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight; |
| 332 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 333 |
|
| 334 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 4; |
| 335 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight; |
| 336 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 337 |
break; |
| 338 |
|
| 339 |
case Format_411R: |
| 340 |
*pdwNumPlanes = 3; |
| 341 |
|
| 342 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 343 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 344 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 345 |
|
| 346 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 347 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 4; |
| 348 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 349 |
|
| 350 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth; |
| 351 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 4; |
| 352 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 353 |
break; |
| 354 |
|
| 355 |
case Format_422H: |
| 356 |
*pdwNumPlanes = 3; |
| 357 |
|
| 358 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 359 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 360 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 361 |
|
| 362 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 2; |
| 363 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight; |
| 364 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 365 |
|
| 366 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 2; |
| 367 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight; |
| 368 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 369 |
break; |
| 370 |
|
| 371 |
case Format_422V: |
| 372 |
*pdwNumPlanes = 3; |
| 373 |
|
| 374 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 375 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 376 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 377 |
|
| 378 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 379 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 380 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 381 |
|
| 382 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth; |
| 383 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 2; |
| 384 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 385 |
break; |
| 386 |
|
| 387 |
case Format_444P: |
| 388 |
case Format_RGBP: |
| 389 |
case Format_BGRP: |
| 390 |
*pdwNumPlanes = 3; |
| 391 |
|
| 392 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 393 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 394 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 395 |
|
| 396 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 397 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight; |
| 398 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 399 |
|
| 400 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth; |
| 401 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight; |
| 402 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 403 |
break; |
| 404 |
|
| 405 |
case Format_Y210: |
| 406 |
case Format_Y216: |
| 407 |
*pdwNumPlanes = 1; |
| 408 |
|
| 409 |
pPlanes[0].dwWidth = pSurface->dwWidth * 4; |
| 410 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 411 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 412 |
break; |
| 413 |
|
| 414 |
case Format_P210: |
| 415 |
case Format_P216: |
| 416 |
*pdwNumPlanes = 2; |
| 417 |
|
| 418 |
pPlanes[0].dwWidth = pSurface->dwWidth * 2; |
| 419 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 420 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 421 |
|
| 422 |
pPlanes[1].dwWidth = pSurface->dwWidth * 2; |
| 423 |
pPlanes[1].dwHeight = pSurface->dwHeight; |
| 424 |
pPlanes[1].dwPitch = pSurface->dwPitch; |
| 425 |
break; |
| 426 |
|
| 427 |
default: |
| 428 |
VP_DEBUG_NORMALMESSAGE("Format '%d' not supported in current driver, using default 1 plane for dump", pSurface->Format); |
| 429 |
*pdwNumPlanes = 1; |
| 430 |
pPlanes[0].dwWidth = pSurface->dwWidth; |
| 431 |
pPlanes[0].dwHeight = pSurface->dwHeight; |
| 432 |
pPlanes[0].dwPitch = pSurface->dwPitch; |
| 433 |
break; |
| 434 |
} |
| 435 |
|
| 436 |
if (MOS_TILE_LINEAR != pSurface->TileType && (Format_RGBP == pSurface->Format || Format_BGRP == pSurface->Format)) |
| 437 |
{ |
| 438 |
for (i = 0; i < *pdwNumPlanes; i++) |
| 439 |
{ |
| 440 |
pPlanes[i].dwHeight = MOS_ALIGN_CEIL(pPlanes[i].dwHeight, 16); |
| 441 |
} |
| 442 |
} |
| 443 |
// For Deswizzled surfaces, Mos_Specific_LockResource() already do the de-padding between Y and UV surf. |
| 444 |
// so, don't use the info of U/V PlaneOffset, as the padding is already removed. |
| 445 |
for (i = 0; i < *pdwNumPlanes; i++) |
| 446 |
{ |
| 447 |
switch (i) |
| 448 |
{ |
| 449 |
case 0: |
| 450 |
pPlanes[i].dwOffset = pSurface->YPlaneOffset.iSurfaceOffset + |
| 451 |
(pSurface->YPlaneOffset.iYOffset * pSurface->dwPitch) + |
| 452 |
pSurface->YPlaneOffset.iXOffset; |
| 453 |
break; |
| 454 |
case 1: |
| 455 |
if (pSurface->Format == Format_YV12) |
| 456 |
{ |
| 457 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[0].dwPitch * pPlanes[0].dwHeight + pPlanes[0].dwOffset : pSurface->VPlaneOffset.iSurfaceOffset) + |
| 458 |
(pSurface->VPlaneOffset.iYOffset * pSurface->dwPitch) + |
| 459 |
pSurface->VPlaneOffset.iXOffset; |
| 460 |
} |
| 461 |
else |
| 462 |
{ |
| 463 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[0].dwPitch * pPlanes[0].dwHeight + pPlanes[0].dwOffset : pSurface->UPlaneOffset.iSurfaceOffset) + |
| 464 |
(pSurface->UPlaneOffset.iYOffset * pSurface->dwPitch) + |
| 465 |
pSurface->UPlaneOffset.iXOffset; |
| 466 |
} |
| 467 |
break; |
| 468 |
case 2: |
| 469 |
if (pSurface->Format == Format_YV12) |
| 470 |
{ |
| 471 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[1].dwOffset + pPlanes[1].dwPitch * pPlanes[1].dwHeight : pSurface->UPlaneOffset.iSurfaceOffset) + |
| 472 |
(pSurface->UPlaneOffset.iYOffset * pSurface->dwPitch) + |
| 473 |
pSurface->UPlaneOffset.iXOffset; |
| 474 |
} |
| 475 |
else |
| 476 |
{ |
| 477 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[1].dwOffset + pPlanes[1].dwPitch * pPlanes[1].dwHeight : pSurface->VPlaneOffset.iSurfaceOffset) + |
| 478 |
(pSurface->VPlaneOffset.iYOffset * pSurface->dwPitch) + |
| 479 |
pSurface->VPlaneOffset.iXOffset; |
| 480 |
} |
| 481 |
break; |
| 482 |
default: |
| 483 |
VP_DEBUG_ASSERTMESSAGE("More than 3 planes not supported."); |
| 484 |
} |
| 485 |
} |
| 486 |
|
| 487 |
//compressed surface need 32 align on height |
| 488 |
if (auxEnable && !isDeswizzled) |
| 489 |
{ |
| 490 |
for (i = 0; i < *pdwNumPlanes; i++) |
| 491 |
{ |
| 492 |
pPlanes[i].dwHeight = MOS_ALIGN_CEIL(pPlanes[i].dwHeight, 32); |
| 493 |
} |
| 494 |
} |
| 495 |
|
| 496 |
// For uncompressed surface, padding data is not needed. For compressed surface, padding data is needed for offline check |
| 497 |
if (auxEnable) |
| 498 |
{ |
| 499 |
*pdwSize = (pPlanes[0].dwPitch * pPlanes[0].dwHeight) + |
| 500 |
(pPlanes[1].dwPitch * pPlanes[1].dwHeight) + |
| 501 |
(pPlanes[2].dwPitch * pPlanes[2].dwHeight); |
| 502 |
} |
| 503 |
else |
| 504 |
{ |
| 505 |
*pdwSize = (pPlanes[0].dwWidth * pPlanes[0].dwHeight) + |
| 506 |
(pPlanes[1].dwWidth * pPlanes[1].dwHeight) + |
| 507 |
(pPlanes[2].dwWidth * pPlanes[2].dwHeight); |
| 508 |
} |
| 509 |
|
| 510 |
return eStatus; |
| 511 |
} |
| 512 |
|
| 513 |
MOS_STATUS VpSurfaceDumper::GetPlaneDefs( |
| 514 |
PVP_SURFACE pSurface, |
| 515 |
VPHAL_SURF_DUMP_SURFACE_DEF* pPlanes, |
| 516 |
uint32_t* pdwNumPlanes, |
| 517 |
uint32_t* pdwSize, |
| 518 |
bool auxEnable, |
| 519 |
bool isDeswizzled) |
| 520 |
{ |
| 521 |
VP_FUNC_CALL(); |
| 522 |
|
| 523 |
MOS_STATUS eStatus; |
| 524 |
uint32_t i; |
| 525 |
bool PaddingEnable = false; |
| 526 |
|
| 527 |
eStatus = MOS_STATUS_SUCCESS; |
| 528 |
|
| 529 |
// Caller should supply this much! |
| 530 |
MOS_ZeroMemory(pPlanes, sizeof(VPHAL_SURF_DUMP_SURFACE_DEF) * 3); |
| 531 |
|
| 532 |
switch (pSurface->osSurface->Format) |
| 533 |
{ |
| 534 |
case Format_AI44: |
| 535 |
case Format_IA44: |
| 536 |
case Format_A4L4: |
| 537 |
case Format_P8: |
| 538 |
case Format_L8: |
| 539 |
case Format_A8: |
| 540 |
case Format_Buffer: |
| 541 |
case Format_STMM: |
| 542 |
case Format_IRW4: |
| 543 |
case Format_IRW5: |
| 544 |
case Format_IRW6: |
| 545 |
case Format_IRW7: |
| 546 |
case Format_RAW: |
| 547 |
case Format_Y8: |
| 548 |
*pdwNumPlanes = 1; |
| 549 |
|
| 550 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 551 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 552 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 553 |
break; |
| 554 |
|
| 555 |
case Format_R5G6B5: |
| 556 |
case Format_A8P8: |
| 557 |
case Format_A8L8: |
| 558 |
case Format_YUY2: |
| 559 |
case Format_YUYV: |
| 560 |
case Format_YVYU: |
| 561 |
case Format_UYVY: |
| 562 |
case Format_VYUY: |
| 563 |
case Format_IRW0: |
| 564 |
case Format_IRW1: |
| 565 |
case Format_IRW2: |
| 566 |
case Format_IRW3: |
| 567 |
case Format_V8U8: |
| 568 |
case Format_R16F: |
| 569 |
case Format_Y16S: |
| 570 |
case Format_Y16U: |
| 571 |
*pdwNumPlanes = 1; |
| 572 |
|
| 573 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth * 2; |
| 574 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 575 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 576 |
break; |
| 577 |
|
| 578 |
case Format_R32U: |
| 579 |
case Format_R32F: |
| 580 |
case Format_A8R8G8B8: |
| 581 |
case Format_X8R8G8B8: |
| 582 |
case Format_A8B8G8R8: |
| 583 |
case Format_X8B8G8R8: |
| 584 |
case Format_AYUV: |
| 585 |
case Format_AUYV: |
| 586 |
case Format_R10G10B10A2: |
| 587 |
case Format_B10G10R10A2: |
| 588 |
case Format_Y410: |
| 589 |
case Format_R16G16F: |
| 590 |
*pdwNumPlanes = 1; |
| 591 |
|
| 592 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth * 4; |
| 593 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 594 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 595 |
break; |
| 596 |
|
| 597 |
case Format_R8G8B8: |
| 598 |
*pdwNumPlanes = 1; |
| 599 |
|
| 600 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth * 3; |
| 601 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 602 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 603 |
break; |
| 604 |
|
| 605 |
case Format_Y416: |
| 606 |
case Format_A16B16G16R16: |
| 607 |
case Format_A16R16G16B16: |
| 608 |
case Format_A16B16G16R16F: |
| 609 |
case Format_A16R16G16B16F: |
| 610 |
*pdwNumPlanes = 1; |
| 611 |
|
| 612 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth * 8; |
| 613 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 614 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 615 |
break; |
| 616 |
|
| 617 |
case Format_NV12: |
| 618 |
*pdwNumPlanes = 2; |
| 619 |
|
| 620 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 621 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 622 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 623 |
|
| 624 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 625 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 626 |
pPlanes[1].dwPitch = pSurface->osSurface->dwPitch; |
| 627 |
break; |
| 628 |
|
| 629 |
case Format_P010: |
| 630 |
case Format_P016: |
| 631 |
*pdwNumPlanes = 2; |
| 632 |
|
| 633 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth * 2; |
| 634 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 635 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 636 |
|
| 637 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 638 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 639 |
pPlanes[1].dwPitch = pSurface->osSurface->dwPitch; |
| 640 |
break; |
| 641 |
|
| 642 |
case Format_IMC2: |
| 643 |
case Format_IMC4: |
| 644 |
*pdwNumPlanes = 2; |
| 645 |
|
| 646 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 647 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 648 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 649 |
|
| 650 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 651 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 652 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 653 |
break; |
| 654 |
|
| 655 |
case Format_YVU9: |
| 656 |
*pdwNumPlanes = 3; |
| 657 |
|
| 658 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 659 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 660 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 661 |
|
| 662 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 4; |
| 663 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 4; |
| 664 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 665 |
|
| 666 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 4; |
| 667 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 4; |
| 668 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 669 |
break; |
| 670 |
|
| 671 |
case Format_IMC1: |
| 672 |
case Format_IMC3: |
| 673 |
*pdwNumPlanes = 3; |
| 674 |
|
| 675 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 676 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 677 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 678 |
|
| 679 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 2; |
| 680 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 681 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 682 |
|
| 683 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 2; |
| 684 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 2; |
| 685 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 686 |
break; |
| 687 |
|
| 688 |
case Format_I420: |
| 689 |
case Format_IYUV: |
| 690 |
case Format_YV12: |
| 691 |
*pdwNumPlanes = 3; |
| 692 |
|
| 693 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 694 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 695 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 696 |
|
| 697 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 2; |
| 698 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 699 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch / 2; |
| 700 |
|
| 701 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 2; |
| 702 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 2; |
| 703 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch / 2; |
| 704 |
break; |
| 705 |
case Format_400P: |
| 706 |
*pdwNumPlanes = 1; |
| 707 |
|
| 708 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 709 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 710 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 711 |
break; |
| 712 |
|
| 713 |
case Format_411P: |
| 714 |
*pdwNumPlanes = 3; |
| 715 |
|
| 716 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 717 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 718 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 719 |
|
| 720 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 4; |
| 721 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight; |
| 722 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 723 |
|
| 724 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 4; |
| 725 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight; |
| 726 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 727 |
break; |
| 728 |
|
| 729 |
case Format_411R: |
| 730 |
*pdwNumPlanes = 3; |
| 731 |
|
| 732 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 733 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 734 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 735 |
|
| 736 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 737 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 4; |
| 738 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 739 |
|
| 740 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth; |
| 741 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 4; |
| 742 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 743 |
break; |
| 744 |
|
| 745 |
case Format_422H: |
| 746 |
*pdwNumPlanes = 3; |
| 747 |
|
| 748 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 749 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 750 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 751 |
|
| 752 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth / 2; |
| 753 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight; |
| 754 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 755 |
|
| 756 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth / 2; |
| 757 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight; |
| 758 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 759 |
break; |
| 760 |
|
| 761 |
case Format_422V: |
| 762 |
*pdwNumPlanes = 3; |
| 763 |
|
| 764 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 765 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 766 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 767 |
|
| 768 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 769 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight / 2; |
| 770 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 771 |
|
| 772 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth; |
| 773 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight / 2; |
| 774 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 775 |
break; |
| 776 |
|
| 777 |
case Format_444P: |
| 778 |
case Format_RGBP: |
| 779 |
case Format_BGRP: |
| 780 |
*pdwNumPlanes = 3; |
| 781 |
|
| 782 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 783 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 784 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 785 |
|
| 786 |
pPlanes[1].dwWidth = pPlanes[0].dwWidth; |
| 787 |
pPlanes[1].dwHeight = pPlanes[0].dwHeight; |
| 788 |
pPlanes[1].dwPitch = pPlanes[0].dwPitch; |
| 789 |
|
| 790 |
pPlanes[2].dwWidth = pPlanes[0].dwWidth; |
| 791 |
pPlanes[2].dwHeight = pPlanes[0].dwHeight; |
| 792 |
pPlanes[2].dwPitch = pPlanes[0].dwPitch; |
| 793 |
break; |
| 794 |
|
| 795 |
case Format_Y210: |
| 796 |
case Format_Y216: |
| 797 |
*pdwNumPlanes = 1; |
| 798 |
|
| 799 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth * 4; |
| 800 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 801 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 802 |
break; |
| 803 |
|
| 804 |
case Format_P210: |
| 805 |
case Format_P216: |
| 806 |
*pdwNumPlanes = 2; |
| 807 |
|
| 808 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth * 2; |
| 809 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 810 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 811 |
|
| 812 |
pPlanes[1].dwWidth = pSurface->osSurface->dwWidth * 2; |
| 813 |
pPlanes[1].dwHeight = pSurface->osSurface->dwHeight; |
| 814 |
pPlanes[1].dwPitch = pSurface->osSurface->dwPitch; |
| 815 |
break; |
| 816 |
|
| 817 |
default: |
| 818 |
VP_DEBUG_NORMALMESSAGE("Format '%d' not supported in current driver, using default 1 plane for dump", pSurface->osSurface->Format); |
| 819 |
*pdwNumPlanes = 1; |
| 820 |
|
| 821 |
pPlanes[0].dwWidth = pSurface->osSurface->dwWidth; |
| 822 |
pPlanes[0].dwHeight = pSurface->osSurface->dwHeight; |
| 823 |
pPlanes[0].dwPitch = pSurface->osSurface->dwPitch; |
| 824 |
break; |
| 825 |
} |
| 826 |
|
| 827 |
// For Deswizzled surfaces, Mos_Specific_LockResource() already do the de-padding between Y and UV surf. |
| 828 |
// so, don't use the info of U/V PlaneOffset, as the padding is already removed. |
| 829 |
for (i = 0; i < *pdwNumPlanes; i++) |
| 830 |
{ |
| 831 |
switch (i) |
| 832 |
{ |
| 833 |
case 0: |
| 834 |
pPlanes[i].dwOffset = pSurface->osSurface->YPlaneOffset.iSurfaceOffset + |
| 835 |
(pSurface->osSurface->YPlaneOffset.iYOffset * pSurface->osSurface->dwPitch) + |
| 836 |
pSurface->osSurface->YPlaneOffset.iXOffset; |
| 837 |
break; |
| 838 |
case 1: |
| 839 |
if (pSurface->osSurface->Format == Format_YV12) |
| 840 |
{ |
| 841 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[0].dwPitch * pPlanes[0].dwHeight + pPlanes[0].dwOffset : pSurface->osSurface->VPlaneOffset.iSurfaceOffset) + |
| 842 |
(pSurface->osSurface->VPlaneOffset.iYOffset * pSurface->osSurface->dwPitch) + |
| 843 |
pSurface->osSurface->VPlaneOffset.iXOffset; |
| 844 |
} |
| 845 |
else |
| 846 |
{ |
| 847 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[0].dwPitch * pPlanes[0].dwHeight + pPlanes[0].dwOffset : pSurface->osSurface->UPlaneOffset.iSurfaceOffset) + |
| 848 |
(pSurface->osSurface->UPlaneOffset.iYOffset * pSurface->osSurface->dwPitch) + |
| 849 |
pSurface->osSurface->UPlaneOffset.iXOffset; |
| 850 |
} |
| 851 |
break; |
| 852 |
case 2: |
| 853 |
if (pSurface->osSurface->Format == Format_YV12) |
| 854 |
{ |
| 855 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[1].dwOffset + pPlanes[1].dwPitch * pPlanes[1].dwHeight : pSurface->osSurface->UPlaneOffset.iSurfaceOffset) + |
| 856 |
(pSurface->osSurface->UPlaneOffset.iYOffset * pSurface->osSurface->dwPitch) + |
| 857 |
pSurface->osSurface->UPlaneOffset.iXOffset; |
| 858 |
} |
| 859 |
else |
| 860 |
{ |
| 861 |
pPlanes[i].dwOffset = (isDeswizzled ? pPlanes[1].dwOffset + pPlanes[1].dwPitch * pPlanes[1].dwHeight : pSurface->osSurface->VPlaneOffset.iSurfaceOffset) + |
| 862 |
(pSurface->osSurface->VPlaneOffset.iYOffset * pSurface->osSurface->dwPitch) + |
| 863 |
pSurface->osSurface->VPlaneOffset.iXOffset; |
| 864 |
} |
| 865 |
break; |
| 866 |
default: |
| 867 |
VP_DEBUG_ASSERTMESSAGE("More than 3 planes not supported."); |
| 868 |
} |
| 869 |
} |
| 870 |
|
| 871 |
//compressed surface need 32 align on height |
| 872 |
if (auxEnable && !isDeswizzled) |
| 873 |
{ |
| 874 |
for (i = 0; i < *pdwNumPlanes; i++) |
| 875 |
{ |
| 876 |
pPlanes[i].dwHeight = MOS_ALIGN_CEIL(pPlanes[i].dwHeight, 32); |
| 877 |
} |
| 878 |
} |
| 879 |
|
| 880 |
// For uncompressed surface, padding data is not needed. For compressed surface, padding data is needed for offline check |
| 881 |
if (auxEnable) |
| 882 |
{ |
| 883 |
*pdwSize = (pPlanes[0].dwPitch * pPlanes[0].dwHeight) + |
| 884 |
(pPlanes[1].dwPitch * pPlanes[1].dwHeight) + |
| 885 |
(pPlanes[2].dwPitch * pPlanes[2].dwHeight); |
| 886 |
} |
| 887 |
else |
| 888 |
{ |
| 889 |
*pdwSize = (pPlanes[0].dwWidth * pPlanes[0].dwHeight) + |
| 890 |
(pPlanes[1].dwWidth * pPlanes[1].dwHeight) + |
| 891 |
(pPlanes[2].dwWidth * pPlanes[2].dwHeight); |
| 892 |
} |
| 893 |
|
| 894 |
return eStatus; |
| 895 |
} |
| 896 |
|
| 897 |
bool VpSurfaceDumper::HasAuxSurf( |
| 898 |
PMOS_RESOURCE osResource) |
| 899 |
{ |
| 900 |
VP_FUNC_CALL(); |
| 901 |
|
| 902 |
bool hasAuxSurf = false; |
| 903 |
#if !EMUL |
| 904 |
GMM_RESOURCE_FLAG gmmFlags; |
| 905 |
MOS_ZeroMemory(&gmmFlags, sizeof(gmmFlags)); |
| 906 |
gmmFlags = osResource->pGmmResInfo->GetResFlags(); |
| 907 |
hasAuxSurf = (gmmFlags.Gpu.MMC && gmmFlags.Gpu.UnifiedAuxSurface) || |
| 908 |
(gmmFlags.Gpu.CCS && gmmFlags.Gpu.UnifiedAuxSurface && gmmFlags.Info.MediaCompressed); |
| 909 |
#endif |
| 910 |
return hasAuxSurf; |
| 911 |
} |
| 912 |
|
| 913 |
MOS_STATUS VpSurfaceDumper::CopyThenLockResources( |
| 914 |
PMOS_INTERFACE pOsInterface, |
| 915 |
PVPHAL_SURFACE pSurface, |
| 916 |
PVPHAL_SURFACE &temp2DSurfForCopy, |
| 917 |
bool hasAuxSurf, |
| 918 |
bool enableAuxDump, |
| 919 |
PMOS_LOCK_PARAMS pLockFlags, |
| 920 |
PMOS_RESOURCE &pLockedResource, |
| 921 |
VPHAL_SURF_DUMP_SURFACE_DEF *pPlanes, |
| 922 |
uint32_t *pdwNumPlanes, |
| 923 |
uint32_t *pdwSize, |
| 924 |
uint8_t *&pData, |
| 925 |
const char *psPathPrefix, |
| 926 |
uint64_t iCounter) |
| 927 |
{ |
| 928 |
VP_FUNC_CALL(); |
| 929 |
|
| 930 |
bool bAllocated; |
| 931 |
|
| 932 |
Mos_MemPool memType = MOS_MEMPOOL_SYSTEMMEMORY; |
| 933 |
#if !EMUL |
| 934 |
if (pSurface->OsResource.pGmmResInfo->GetSetCpSurfTag(false, 0) != 0) |
| 935 |
{ |
| 936 |
memType = MOS_MEMPOOL_VIDEOMEMORY; |
| 937 |
} |
| 938 |
#endif |
| 939 |
|
| 940 |
temp2DSurfForCopy = (PVPHAL_SURFACE)MOS_AllocAndZeroMemory(sizeof(VPHAL_SURFACE)); |
| 941 |
VP_DEBUG_CHK_NULL_RETURN(temp2DSurfForCopy); |
| 942 |
VP_DEBUG_CHK_STATUS_RETURN(VpUtils::ReAllocateSurface( |
| 943 |
pOsInterface, |
| 944 |
temp2DSurfForCopy, |
| 945 |
"Temp2DSurfForSurfDumper", |
| 946 |
pSurface->Format, |
| 947 |
MOS_GFXRES_2D, |
| 948 |
MOS_TILE_LINEAR, |
| 949 |
pSurface->dwWidth, |
| 950 |
pSurface->dwHeight, |
| 951 |
false, |
| 952 |
MOS_MMC_DISABLED, |
| 953 |
&bAllocated, |
| 954 |
MOS_HW_RESOURCE_DEF_MAX, |
| 955 |
MOS_TILE_UNSET_GMM, |
| 956 |
memType)); |
| 957 |
|
| 958 |
pOsInterface->pfnDoubleBufferCopyResource( |
| 959 |
pOsInterface, |
| 960 |
&pSurface->OsResource, |
| 961 |
&temp2DSurfForCopy->OsResource, |
| 962 |
false); |
| 963 |
|
| 964 |
if (pOsInterface->pfnIsAsynDevice(pOsInterface)) |
| 965 |
{ |
| 966 |
MOS_LOCK_PARAMS LockFlags; |
| 967 |
char sPath[MAX_PATH]; |
| 968 |
MOS_ZeroMemory(sPath, MAX_PATH); |
| 969 |
MOS_SecureStringPrint( |
| 970 |
sPath, |
| 971 |
MAX_PATH, |
| 972 |
sizeof(sPath), |
| 973 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].%s", |
| 974 |
psPathPrefix, |
| 975 |
iCounter, |
| 976 |
temp2DSurfForCopy->dwWidth, |
| 977 |
pPlanes[0].dwHeight, |
| 978 |
temp2DSurfForCopy->dwPitch, |
| 979 |
VpDumperTool::GetFormatStr(temp2DSurfForCopy->Format)); |
| 980 |
LockFlags.DumpAfterSubmit = true; |
| 981 |
ResourceDumpAttri resDumpAttri = {}; |
| 982 |
MOS_GFXRES_FREE_FLAGS resFreeFlags = {0}; |
| 983 |
if (VpUtils::IsSyncFreeNeededForMMCSurface(temp2DSurfForCopy, pOsInterface)) |
| 984 |
{ |
| 985 |
resFreeFlags.SynchronousDestroy = 1; |
| 986 |
} |
| 987 |
resDumpAttri.lockFlags = LockFlags; |
| 988 |
resDumpAttri.res = temp2DSurfForCopy->OsResource; |
| 989 |
resDumpAttri.res.Format = temp2DSurfForCopy->Format; |
| 990 |
resDumpAttri.fullFileName = sPath; |
| 991 |
resDumpAttri.width = temp2DSurfForCopy->dwWidth; |
| 992 |
resDumpAttri.height = temp2DSurfForCopy->dwHeight; |
| 993 |
resDumpAttri.pitch = temp2DSurfForCopy->dwPitch; |
| 994 |
resDumpAttri.resFreeFlags = resFreeFlags; |
| 995 |
pOsInterface->resourceDumpAttriArray.push_back(resDumpAttri); |
| 996 |
|
| 997 |
return MOS_STATUS_SUCCESS; |
| 998 |
} |
| 999 |
|
| 1000 |
pData = (uint8_t *)pOsInterface->pfnLockResource( |
| 1001 |
pOsInterface, |
| 1002 |
&temp2DSurfForCopy->OsResource, |
| 1003 |
pLockFlags); |
| 1004 |
pLockedResource = &temp2DSurfForCopy->OsResource; |
| 1005 |
|
| 1006 |
// get plane definitions |
| 1007 |
VP_DEBUG_CHK_STATUS_RETURN(GetPlaneDefs( |
| 1008 |
temp2DSurfForCopy, |
| 1009 |
pPlanes, |
| 1010 |
pdwNumPlanes, |
| 1011 |
pdwSize, |
| 1012 |
hasAuxSurf, //(hasAuxSurf && enableAuxDump), |
| 1013 |
!enableAuxDump)); // !(hasAuxSurf && enableAuxDump))); |
| 1014 |
|
| 1015 |
return MOS_STATUS_SUCCESS; |
| 1016 |
} |
| 1017 |
|
| 1018 |
MOS_STATUS VpSurfaceDumper::CopyThenLockResources( |
| 1019 |
PMOS_INTERFACE pOsInterface, |
| 1020 |
PVP_SURFACE pSurface, |
| 1021 |
PVPHAL_SURFACE &temp2DSurfForCopy, |
| 1022 |
bool hasAuxSurf, |
| 1023 |
bool enableAuxDump, |
| 1024 |
PMOS_LOCK_PARAMS pLockFlags, |
| 1025 |
PMOS_RESOURCE &pLockedResource, |
| 1026 |
VPHAL_SURF_DUMP_SURFACE_DEF *pPlanes, |
| 1027 |
uint32_t *pdwNumPlanes, |
| 1028 |
uint32_t *pdwSize, |
| 1029 |
uint8_t *&pData, |
| 1030 |
const char *psPathPrefix, |
| 1031 |
uint64_t iCounter) |
| 1032 |
{ |
| 1033 |
VP_FUNC_CALL(); |
| 1034 |
|
| 1035 |
bool bAllocated; |
| 1036 |
|
| 1037 |
Mos_MemPool memType = MOS_MEMPOOL_SYSTEMMEMORY; |
| 1038 |
#if !EMUL |
| 1039 |
if (pSurface->osSurface->OsResource.pGmmResInfo->GetSetCpSurfTag(false, 0) != 0) |
| 1040 |
{ |
| 1041 |
memType = MOS_MEMPOOL_VIDEOMEMORY; |
| 1042 |
} |
| 1043 |
#endif |
| 1044 |
|
| 1045 |
temp2DSurfForCopy = (PVPHAL_SURFACE)MOS_AllocAndZeroMemory(sizeof(VPHAL_SURFACE)); |
| 1046 |
VP_DEBUG_CHK_NULL_RETURN(temp2DSurfForCopy); |
| 1047 |
VP_DEBUG_CHK_STATUS_RETURN(VpUtils::ReAllocateSurface( |
| 1048 |
pOsInterface, |
| 1049 |
temp2DSurfForCopy, |
| 1050 |
"Temp2DSurfForSurfDumper", |
| 1051 |
pSurface->osSurface->Format, |
| 1052 |
MOS_GFXRES_2D, |
| 1053 |
MOS_TILE_LINEAR, |
| 1054 |
pSurface->osSurface->dwWidth, |
| 1055 |
pSurface->osSurface->dwHeight, |
| 1056 |
false, |
| 1057 |
MOS_MMC_DISABLED, |
| 1058 |
&bAllocated, |
| 1059 |
MOS_HW_RESOURCE_DEF_MAX, |
| 1060 |
MOS_TILE_UNSET_GMM, |
| 1061 |
memType)); |
| 1062 |
|
| 1063 |
pOsInterface->pfnDoubleBufferCopyResource( |
| 1064 |
pOsInterface, |
| 1065 |
&pSurface->osSurface->OsResource, |
| 1066 |
&temp2DSurfForCopy->OsResource, |
| 1067 |
false); |
| 1068 |
|
| 1069 |
if (pOsInterface->pfnIsAsynDevice(pOsInterface)) |
| 1070 |
{ |
| 1071 |
MOS_LOCK_PARAMS LockFlags; |
| 1072 |
char sPath[MAX_PATH]; |
| 1073 |
MOS_ZeroMemory(sPath, MAX_PATH); |
| 1074 |
MOS_SecureStringPrint( |
| 1075 |
sPath, |
| 1076 |
MAX_PATH, |
| 1077 |
sizeof(sPath), |
| 1078 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].%s", |
| 1079 |
psPathPrefix, |
| 1080 |
iCounter, |
| 1081 |
temp2DSurfForCopy->dwWidth, |
| 1082 |
pPlanes[0].dwHeight, |
| 1083 |
temp2DSurfForCopy->dwPitch, |
| 1084 |
VpDumperTool::GetFormatStr(temp2DSurfForCopy->Format)); |
| 1085 |
LockFlags.DumpAfterSubmit = true; |
| 1086 |
ResourceDumpAttri resDumpAttri = {}; |
| 1087 |
MOS_GFXRES_FREE_FLAGS resFreeFlags = {0}; |
| 1088 |
if (VpUtils::IsSyncFreeNeededForMMCSurface(temp2DSurfForCopy, pOsInterface)) |
| 1089 |
{ |
| 1090 |
resFreeFlags.SynchronousDestroy = 1; |
| 1091 |
} |
| 1092 |
resDumpAttri.lockFlags = LockFlags; |
| 1093 |
resDumpAttri.res = temp2DSurfForCopy->OsResource; |
| 1094 |
resDumpAttri.res.Format = temp2DSurfForCopy->Format; |
| 1095 |
resDumpAttri.fullFileName = sPath; |
| 1096 |
resDumpAttri.width = temp2DSurfForCopy->dwWidth; |
| 1097 |
resDumpAttri.height = temp2DSurfForCopy->dwHeight; |
| 1098 |
resDumpAttri.pitch = temp2DSurfForCopy->dwPitch; |
| 1099 |
resDumpAttri.resFreeFlags = resFreeFlags; |
| 1100 |
pOsInterface->resourceDumpAttriArray.push_back(resDumpAttri); |
| 1101 |
|
| 1102 |
return MOS_STATUS_SUCCESS; |
| 1103 |
} |
| 1104 |
|
| 1105 |
pData = (uint8_t *)pOsInterface->pfnLockResource( |
| 1106 |
pOsInterface, |
| 1107 |
&temp2DSurfForCopy->OsResource, |
| 1108 |
pLockFlags); |
| 1109 |
pLockedResource = &temp2DSurfForCopy->OsResource; |
| 1110 |
|
| 1111 |
// get plane definitions |
| 1112 |
VP_DEBUG_CHK_STATUS_RETURN(GetPlaneDefs( |
| 1113 |
temp2DSurfForCopy, |
| 1114 |
pPlanes, |
| 1115 |
pdwNumPlanes, |
| 1116 |
pdwSize, |
| 1117 |
hasAuxSurf, //(hasAuxSurf && enableAuxDump), |
| 1118 |
!enableAuxDump)); // !(hasAuxSurf && enableAuxDump))); |
| 1119 |
|
| 1120 |
return MOS_STATUS_SUCCESS; |
| 1121 |
} |
| 1122 |
|
| 1123 |
void VpSurfaceDumper::UnlockAndDestroyResource( |
| 1124 |
PMOS_INTERFACE osInterface, |
| 1125 |
PVPHAL_SURFACE tempSurf, |
| 1126 |
PMOS_RESOURCE lockedResource, |
| 1127 |
bool bLockSurface) |
| 1128 |
{ |
| 1129 |
VP_FUNC_CALL(); |
| 1130 |
|
| 1131 |
if (bLockSurface && lockedResource != nullptr) |
| 1132 |
{ |
| 1133 |
osInterface->pfnUnlockResource(osInterface, lockedResource); |
| 1134 |
} |
| 1135 |
|
| 1136 |
if (tempSurf && osInterface && !osInterface->pfnIsAsynDevice(osInterface)) |
| 1137 |
{ |
| 1138 |
MOS_GFXRES_FREE_FLAGS resFreeFlags = {0}; |
| 1139 |
if (VpUtils::IsSyncFreeNeededForMMCSurface(tempSurf, osInterface)) |
| 1140 |
{ |
| 1141 |
resFreeFlags.SynchronousDestroy = 1; |
| 1142 |
} |
| 1143 |
osInterface->pfnFreeResourceWithFlag(osInterface, &tempSurf->OsResource, resFreeFlags.Value); |
| 1144 |
} |
| 1145 |
MOS_SafeFreeMemory(tempSurf); |
| 1146 |
} |
| 1147 |
|
| 1148 |
MOS_STATUS VpSurfaceDumper::DumpSurfaceToFile( |
| 1149 |
PMOS_INTERFACE pOsInterface, |
| 1150 |
PVPHAL_SURFACE pSurface, |
| 1151 |
const char *psPathPrefix, |
| 1152 |
uint64_t iCounter, |
| 1153 |
bool bLockSurface, |
| 1154 |
bool bNoDecompWhenLock, |
| 1155 |
uint8_t* pData) |
| 1156 |
{ |
| 1157 |
VP_FUNC_CALL(); |
| 1158 |
|
| 1159 |
MOS_STATUS eStatus; |
| 1160 |
char sPath[MAX_PATH], sOsPath[MAX_PATH]; |
| 1161 |
uint8_t *pDst, *pTmpSrc, *pTmpDst; |
| 1162 |
uint32_t dwNumPlanes, dwSize, j, i; |
| 1163 |
VPHAL_SURF_DUMP_SURFACE_DEF planes[3]; |
| 1164 |
uint32_t dstPlaneOffset[3] = {0}; |
| 1165 |
MOS_LOCK_PARAMS LockFlags; |
| 1166 |
bool hasAuxSurf; |
| 1167 |
MEDIA_FEATURE_TABLE *skuTable = nullptr; |
| 1168 |
bool enableAuxDump; |
| 1169 |
bool enablePlaneDump = false; |
| 1170 |
PMOS_RESOURCE pLockedResource = nullptr; |
| 1171 |
PVPHAL_SURFACE temp2DSurfForCopy = nullptr; |
| 1172 |
|
| 1173 |
VP_DEBUG_ASSERT(pSurface); |
| 1174 |
VP_DEBUG_ASSERT(pOsInterface); |
| 1175 |
VP_DEBUG_ASSERT(psPathPrefix); |
| 1176 |
|
| 1177 |
eStatus = MOS_STATUS_SUCCESS; |
| 1178 |
hasAuxSurf = false; |
| 1179 |
pDst = nullptr; |
| 1180 |
enableAuxDump = m_dumpSpec.enableAuxDump; |
| 1181 |
MOS_ZeroMemory(sPath, MAX_PATH); |
| 1182 |
MOS_ZeroMemory(sOsPath, MAX_PATH); |
| 1183 |
dwNumPlanes = 0; |
| 1184 |
enablePlaneDump = m_dumpSpec.enablePlaneDump; |
| 1185 |
|
| 1186 |
if (pSurface->dwDepth == 0) |
| 1187 |
{ |
| 1188 |
pSurface->dwDepth = 1; |
| 1189 |
} |
| 1190 |
|
| 1191 |
hasAuxSurf = HasAuxSurf(&pSurface->OsResource); |
| 1192 |
|
| 1193 |
// get plane definitions |
| 1194 |
VP_DEBUG_CHK_STATUS(GetPlaneDefs( |
| 1195 |
pSurface, |
| 1196 |
planes, |
| 1197 |
&dwNumPlanes, |
| 1198 |
&dwSize, |
| 1199 |
hasAuxSurf, //(hasAuxSurf && enableAuxDump), |
| 1200 |
!enableAuxDump));// !(hasAuxSurf && enableAuxDump))); |
| 1201 |
|
| 1202 |
VP_DEBUG_CHK_NULL(pOsInterface->pfnGetSkuTable); |
| 1203 |
skuTable = pOsInterface->pfnGetSkuTable(pOsInterface); |
| 1204 |
|
| 1205 |
if (bLockSurface) |
| 1206 |
{ |
| 1207 |
// Caller should not give pData when it expect the function to lock surf |
| 1208 |
VP_DEBUG_ASSERT(pData = nullptr); |
| 1209 |
|
| 1210 |
LockFlags.Value = 0; |
| 1211 |
LockFlags.ReadOnly = 1; |
| 1212 |
|
| 1213 |
// If aux data exist and enable aux dump, no swizzle and no decompress |
| 1214 |
if (hasAuxSurf && enableAuxDump) |
| 1215 |
{ |
| 1216 |
LockFlags.TiledAsTiled = 1; |
| 1217 |
LockFlags.NoDecompress = 1; |
| 1218 |
} |
| 1219 |
|
| 1220 |
if (bNoDecompWhenLock) |
| 1221 |
{ |
| 1222 |
LockFlags.NoDecompress = 1; |
| 1223 |
} |
| 1224 |
|
| 1225 |
bool isPlanar = false; |
| 1226 |
#if !EMUL |
| 1227 |
isPlanar = (pSurface->Format == Format_NV12) || (pSurface->Format == Format_P010) || (pSurface->Format == Format_P016); |
| 1228 |
#endif |
| 1229 |
VP_DEBUG_CHK_NULL(pOsInterface); |
| 1230 |
|
| 1231 |
// RGBP and BGRP support tile output but should not transfer to linear surface due to height 16 align issue. |
| 1232 |
if (((skuTable && MEDIA_IS_SKU(skuTable, FtrE2ECompression) || isPlanar) && |
| 1233 |
(pSurface->TileType != MOS_TILE_LINEAR) && |
| 1234 |
!(pSurface->Format == Format_RGBP || pSurface->Format == Format_BGRP)) || |
| 1235 |
(pOsInterface->pfnIsAsynDevice(pOsInterface) && pSurface->OsResource.bConvertedFromDDIResource)) |
| 1236 |
{ |
| 1237 |
CopyThenLockResources(pOsInterface, pSurface, temp2DSurfForCopy, hasAuxSurf, enableAuxDump, &LockFlags, pLockedResource, planes, &dwNumPlanes, &dwSize, pData, psPathPrefix, iCounter); |
| 1238 |
if (pOsInterface->pfnIsAsynDevice(pOsInterface)) |
| 1239 |
{ |
| 1240 |
UnlockAndDestroyResource(pOsInterface, temp2DSurfForCopy, pLockedResource, true); |
| 1241 |
return eStatus; |
| 1242 |
} |
| 1243 |
} |
| 1244 |
else |
| 1245 |
{ |
| 1246 |
if (pOsInterface->pfnIsAsynDevice(pOsInterface)) |
| 1247 |
{ |
| 1248 |
MOS_SecureStringPrint( |
| 1249 |
sPath, |
| 1250 |
MAX_PATH, |
| 1251 |
sizeof(sPath), |
| 1252 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].%s", |
| 1253 |
psPathPrefix, |
| 1254 |
iCounter, |
| 1255 |
pSurface->dwWidth, |
| 1256 |
planes[0].dwHeight, |
| 1257 |
pSurface->dwPitch, |
| 1258 |
VpDumperTool::GetFormatStr(pSurface->Format)); |
| 1259 |
LockFlags.DumpAfterSubmit = true; |
| 1260 |
ResourceDumpAttri resDumpAttri = {}; |
| 1261 |
resDumpAttri.lockFlags = LockFlags; |
| 1262 |
resDumpAttri.res = pSurface->OsResource; |
| 1263 |
resDumpAttri.res.Format = pSurface->Format; |
| 1264 |
resDumpAttri.fullFileName = sPath; |
| 1265 |
resDumpAttri.width = pSurface->dwWidth; |
| 1266 |
resDumpAttri.height = pSurface->dwHeight; |
| 1267 |
resDumpAttri.pitch = pSurface->dwPitch; |
| 1268 |
pOsInterface->resourceDumpAttriArray.push_back(resDumpAttri); |
| 1269 |
|
| 1270 |
return eStatus; |
| 1271 |
} |
| 1272 |
else |
| 1273 |
{ |
| 1274 |
pData = (uint8_t *)pOsInterface->pfnLockResource( |
| 1275 |
pOsInterface, |
| 1276 |
&pSurface->OsResource, |
| 1277 |
&LockFlags); |
| 1278 |
pLockedResource = &pSurface->OsResource; |
| 1279 |
// if lock failed, fallback to DoubleBufferCopy |
| 1280 |
if (nullptr == pData) |
| 1281 |
{ |
| 1282 |
pLockedResource = nullptr; |
| 1283 |
CopyThenLockResources(pOsInterface, pSurface, temp2DSurfForCopy, hasAuxSurf, enableAuxDump, &LockFlags, pLockedResource, planes, &dwNumPlanes, &dwSize, pData); |
| 1284 |
} |
| 1285 |
} |
| 1286 |
} |
| 1287 |
VP_DEBUG_CHK_NULL(pData); |
| 1288 |
|
| 1289 |
// Write error to user feauture key |
| 1290 |
eStatus = ReportUserSettingForDebug( |
| 1291 |
m_userSettingPtr, |
| 1292 |
__VPHAL_DBG_SURF_DUMPER_RESOURCE_LOCK, |
| 1293 |
1, |
| 1294 |
MediaUserSetting::Group::Device); |
| 1295 |
|
| 1296 |
VP_DEBUG_ASSERT(eStatus == MOS_STATUS_SUCCESS); |
| 1297 |
} |
| 1298 |
|
| 1299 |
MOS_SecureStringPrint( |
| 1300 |
sPath, |
| 1301 |
MAX_PATH, |
| 1302 |
sizeof(sPath), |
| 1303 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].%s", |
| 1304 |
psPathPrefix, |
| 1305 |
iCounter, |
| 1306 |
pSurface->dwWidth, |
| 1307 |
planes[0].dwHeight, |
| 1308 |
pSurface->dwPitch, |
| 1309 |
VpDumperTool::GetFormatStr(pSurface->Format)); |
| 1310 |
|
| 1311 |
VpDumperTool::GetOsFilePath(sPath, sOsPath); |
| 1312 |
|
| 1313 |
pDst = (uint8_t*)MOS_AllocAndZeroMemory(dwSize); |
| 1314 |
VP_DEBUG_CHK_NULL(pDst); |
| 1315 |
VP_DEBUG_CHK_NULL(pData); |
| 1316 |
pTmpSrc = pData; |
| 1317 |
pTmpDst = pDst; |
| 1318 |
|
| 1319 |
for (j = 0; j < dwNumPlanes; j++) |
| 1320 |
{ |
| 1321 |
pTmpSrc = pData + planes[j].dwOffset; |
| 1322 |
for (i = 0; i < planes[j].dwHeight; i++) |
| 1323 |
{ |
| 1324 |
if (hasAuxSurf && enableAuxDump) |
| 1325 |
{ |
| 1326 |
MOS_SecureMemcpy( |
| 1327 |
pTmpDst, |
| 1328 |
planes[j].dwPitch, |
| 1329 |
pTmpSrc, |
| 1330 |
planes[j].dwPitch); |
| 1331 |
|
| 1332 |
pTmpSrc += planes[j].dwPitch; |
| 1333 |
pTmpDst += planes[j].dwPitch; |
| 1334 |
|
| 1335 |
dstPlaneOffset[j+1] += planes[j].dwPitch; |
| 1336 |
} |
| 1337 |
else |
| 1338 |
{ |
| 1339 |
CopyScanlineWithHoleStripping(pTmpDst, pTmpSrc, planes[j].dwWidth, pSurface->Format, skuTable); |
| 1340 |
pTmpSrc += planes[j].dwPitch; |
| 1341 |
pTmpDst += planes[j].dwWidth; |
| 1342 |
|
| 1343 |
dstPlaneOffset[j + 1] += planes[j].dwWidth; |
| 1344 |
} |
| 1345 |
} |
| 1346 |
|
| 1347 |
//if more than 1 plane, dump each plane's surface for offline analysis |
| 1348 |
if (enablePlaneDump) |
| 1349 |
{ |
| 1350 |
if ((dwNumPlanes > 1) && (dwNumPlanes <= 3)) |
| 1351 |
{ |
| 1352 |
char sPlanePath[MAX_PATH], sPlaneOsPath[MAX_PATH]; |
| 1353 |
MOS_ZeroMemory(sPlanePath, MAX_PATH); |
| 1354 |
MOS_ZeroMemory(sPlaneOsPath, MAX_PATH); |
| 1355 |
|
| 1356 |
MOS_SecureStringPrint( |
| 1357 |
sPlanePath, |
| 1358 |
MAX_PATH, |
| 1359 |
sizeof(sPlanePath), |
| 1360 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].%s", |
| 1361 |
psPathPrefix, |
| 1362 |
iCounter, |
| 1363 |
planes[j].dwWidth, |
| 1364 |
planes[j].dwHeight, |
| 1365 |
planes[j].dwPitch, |
| 1366 |
(j == 0 ? "Y" : ((dwNumPlanes == 2) ? "UV" : ((j == 1) ? "U" : "V")))); |
| 1367 |
|
| 1368 |
VpDumperTool::GetOsFilePath(sPlanePath, sPlaneOsPath); |
| 1369 |
|
| 1370 |
VP_DEBUG_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(sPlaneOsPath, pDst + dstPlaneOffset[j], dstPlaneOffset[j + 1])); |
| 1371 |
} |
| 1372 |
else |
| 1373 |
{ |
| 1374 |
VP_DEBUG_ASSERTMESSAGE("More than 3 planes not supported during plane dump."); |
| 1375 |
} |
| 1376 |
} |
| 1377 |
} |
| 1378 |
|
| 1379 |
VP_DEBUG_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(sOsPath, pDst, dwSize)); |
| 1380 |
VP_PUBLIC_NORMALMESSAGE("VP surface dump to %s", sOsPath); |
| 1381 |
#if !EMUL |
| 1382 |
// Dump Aux surface data |
| 1383 |
if (hasAuxSurf && enableAuxDump) |
| 1384 |
{ |
| 1385 |
uint32_t resourceIndex; |
| 1386 |
bool isPlanar; |
| 1387 |
uint8_t *auxDataY; |
| 1388 |
uint8_t *auxDataUV; |
| 1389 |
uint32_t auxSizeY; |
| 1390 |
uint32_t auxSizeUV; |
| 1391 |
uint8_t *pSurfaceBase; |
| 1392 |
|
| 1393 |
resourceIndex = 0; |
| 1394 |
pSurfaceBase = pData; |
| 1395 |
isPlanar = (pOsInterface->pfnGetGmmClientContext(pOsInterface)->IsPlanar(pSurface->OsResource.pGmmResInfo->GetResourceFormat()) != 0); |
| 1396 |
auxDataY = (uint8_t*)pSurfaceBase + pSurface->OsResource.pGmmResInfo->GetPlanarAuxOffset(resourceIndex, GMM_AUX_Y_CCS); |
| 1397 |
auxDataUV = (uint8_t*)pSurfaceBase + pSurface->OsResource.pGmmResInfo->GetPlanarAuxOffset(resourceIndex, GMM_AUX_UV_CCS); |
| 1398 |
if (isPlanar) |
| 1399 |
{ |
| 1400 |
auxSizeY = (uint32_t)(pSurface->OsResource.pGmmResInfo->GetPlanarAuxOffset(resourceIndex, GMM_AUX_UV_CCS) - |
| 1401 |
pSurface->OsResource.pGmmResInfo->GetPlanarAuxOffset(resourceIndex, GMM_AUX_Y_CCS)); |
| 1402 |
}else |
| 1403 |
{ |
| 1404 |
auxSizeY = (uint32_t)(pSurface->OsResource.pGmmResInfo->GetSizeAuxSurface(GMM_AUX_CCS)); |
| 1405 |
} |
| 1406 |
|
| 1407 |
auxSizeUV = (uint32_t)(pSurface->OsResource.pGmmResInfo->GetPlanarAuxOffset(resourceIndex, GMM_AUX_COMP_STATE) - |
| 1408 |
pSurface->OsResource.pGmmResInfo->GetPlanarAuxOffset(resourceIndex, GMM_AUX_UV_CCS)); |
| 1409 |
|
| 1410 |
if (auxSizeUV == 0) |
| 1411 |
{ |
| 1412 |
auxSizeUV = (uint32_t)(pSurface->OsResource.pGmmResInfo->GetSizeAuxSurface(GMM_AUX_SURF)) / |
| 1413 |
(pSurface->OsResource.pGmmResInfo)->GetArraySize() - auxSizeY; |
| 1414 |
} |
| 1415 |
|
| 1416 |
// Dump Y Aux data |
| 1417 |
MOS_SecureStringPrint( |
| 1418 |
sPath, |
| 1419 |
MAX_PATH, |
| 1420 |
sizeof(sPath), |
| 1421 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].Yaux", |
| 1422 |
psPathPrefix, |
| 1423 |
iCounter, |
| 1424 |
pSurface->dwWidth, |
| 1425 |
pSurface->dwHeight, |
| 1426 |
pSurface->dwPitch); |
| 1427 |
|
| 1428 |
VpDumperTool::GetOsFilePath(sPath, sOsPath); |
| 1429 |
|
| 1430 |
uint8_t *pDstAux = (uint8_t*)MOS_AllocAndZeroMemory(auxSizeY); |
| 1431 |
VP_DEBUG_CHK_NULL(pDstAux); |
| 1432 |
|
| 1433 |
MOS_SecureMemcpy( |
| 1434 |
pDstAux, |
| 1435 |
auxSizeY, |
| 1436 |
auxDataY, |
| 1437 |
auxSizeY); |
| 1438 |
|
| 1439 |
VP_DEBUG_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(sOsPath, pDstAux, auxSizeY)); |
| 1440 |
MOS_SafeFreeMemory(pDstAux); |
| 1441 |
|
| 1442 |
if (auxSizeUV && isPlanar) |
| 1443 |
{ |
| 1444 |
// Dump UV Aux data |
| 1445 |
MOS_SecureStringPrint( |
| 1446 |
sPath, |
| 1447 |
MAX_PATH, |
| 1448 |
sizeof(sPath), |
| 1449 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].UVaux", |
| 1450 |
psPathPrefix, |
| 1451 |
iCounter, |
| 1452 |
pSurface->dwWidth, |
| 1453 |
pSurface->dwHeight, |
| 1454 |
pSurface->dwPitch); |
| 1455 |
|
| 1456 |
VpDumperTool::GetOsFilePath(sPath, sOsPath); |
| 1457 |
|
| 1458 |
uint8_t *pDstUVAux = (uint8_t*)MOS_AllocAndZeroMemory(auxSizeUV); |
| 1459 |
VP_DEBUG_CHK_NULL(pDstUVAux); |
| 1460 |
|
| 1461 |
MOS_SecureMemcpy( |
| 1462 |
pDstUVAux, |
| 1463 |
auxSizeUV, |
| 1464 |
auxDataUV, |
| 1465 |
auxSizeUV); |
| 1466 |
|
| 1467 |
VP_DEBUG_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(sOsPath, pDstUVAux, auxSizeUV)); |
| 1468 |
MOS_SafeFreeMemory(pDstUVAux); |
| 1469 |
} |
| 1470 |
} |
| 1471 |
#endif |
| 1472 |
|
| 1473 |
finish: |
| 1474 |
MOS_SafeFreeMemory(pDst); |
| 1475 |
|
| 1476 |
UnlockAndDestroyResource(pOsInterface, temp2DSurfForCopy, pLockedResource, bLockSurface); |
| 1477 |
|
| 1478 |
return eStatus; |
| 1479 |
} |
| 1480 |
|
| 1481 |
MOS_STATUS VpSurfaceDumper::DumpSurfaceToFile( |
| 1482 |
PMOS_INTERFACE pOsInterface, |
| 1483 |
PVP_SURFACE pSurface, |
| 1484 |
const char *psPathPrefix, |
| 1485 |
uint64_t iCounter, |
| 1486 |
bool bLockSurface, |
| 1487 |
bool bNoDecompWhenLock, |
| 1488 |
uint8_t* pData) |
| 1489 |
{ |
| 1490 |
VP_FUNC_CALL(); |
| 1491 |
|
| 1492 |
MOS_STATUS eStatus; |
| 1493 |
bool isSurfaceLocked; |
| 1494 |
char sPath[MAX_PATH], sOsPath[MAX_PATH]; |
| 1495 |
uint8_t *pDst, *pTmpSrc, *pTmpDst; |
| 1496 |
uint32_t dwNumPlanes, dwSize, j, i; |
| 1497 |
VPHAL_SURF_DUMP_SURFACE_DEF planes[3]; |
| 1498 |
uint32_t dstPlaneOffset[3] = {0}; |
| 1499 |
MOS_LOCK_PARAMS LockFlags; |
| 1500 |
bool hasAuxSurf; |
| 1501 |
bool enableAuxDump; |
| 1502 |
bool enablePlaneDump = false; |
| 1503 |
PMOS_RESOURCE pLockedResource = nullptr; |
| 1504 |
PVPHAL_SURFACE temp2DSurfForCopy = nullptr; |
| 1505 |
MEDIA_FEATURE_TABLE *skuTable = nullptr; |
| 1506 |
|
| 1507 |
VP_DEBUG_ASSERT(pSurface); |
| 1508 |
VP_DEBUG_ASSERT(pOsInterface); |
| 1509 |
VP_DEBUG_ASSERT(psPathPrefix); |
| 1510 |
|
| 1511 |
eStatus = MOS_STATUS_SUCCESS; |
| 1512 |
isSurfaceLocked = false; |
| 1513 |
hasAuxSurf = false; |
| 1514 |
pDst = nullptr; |
| 1515 |
enableAuxDump = m_dumpSpec.enableAuxDump; |
| 1516 |
MOS_ZeroMemory(sPath, MAX_PATH); |
| 1517 |
MOS_ZeroMemory(sOsPath, MAX_PATH); |
| 1518 |
dwNumPlanes = 0; |
| 1519 |
enablePlaneDump = m_dumpSpec.enablePlaneDump; |
| 1520 |
|
| 1521 |
VPHAL_SURF_DUMP_SPEC *pDumpSpec = &m_dumpSpec; |
| 1522 |
|
| 1523 |
ReadUserSettingForDebug( |
| 1524 |
m_userSettingPtr, |
| 1525 |
pDumpSpec->enablePostCompCopy, |
| 1526 |
__VPHAL_DBG_SURF_DUMP_POSTCOMP_RESOURCE_COPY, |
| 1527 |
MediaUserSetting::Group::Device); |
| 1528 |
VP_DEBUG_NORMALMESSAGE("enablePostCompCopy is %d", pDumpSpec->enablePostCompCopy); |
| 1529 |
|
| 1530 |
if (pSurface->osSurface->dwDepth == 0) |
| 1531 |
{ |
| 1532 |
pSurface->osSurface->dwDepth = 1; |
| 1533 |
} |
| 1534 |
|
| 1535 |
hasAuxSurf = HasAuxSurf(&pSurface->osSurface->OsResource); |
| 1536 |
|
| 1537 |
// get plane definitions |
| 1538 |
VP_DEBUG_CHK_STATUS(GetPlaneDefs( |
| 1539 |
pSurface, |
| 1540 |
planes, |
| 1541 |
&dwNumPlanes, |
| 1542 |
&dwSize, |
| 1543 |
hasAuxSurf, //(hasAuxSurf && enableAuxDump), |
| 1544 |
!enableAuxDump));// !(hasAuxSurf && enableAuxDump))); |
| 1545 |
|
| 1546 |
if (bLockSurface) |
| 1547 |
{ |
| 1548 |
// Caller should not give pData when it expect the function to lock surf |
| 1549 |
VP_DEBUG_ASSERT(pData = nullptr); |
| 1550 |
|
| 1551 |
LockFlags.Value = 0; |
| 1552 |
LockFlags.ReadOnly = 1; |
| 1553 |
|
| 1554 |
// If aux data exist and enable aux dump, no swizzle and no decompress |
| 1555 |
if (hasAuxSurf && enableAuxDump) |
| 1556 |
{ |
| 1557 |
LockFlags.TiledAsTiled = 1; |
| 1558 |
LockFlags.NoDecompress = 1; |
| 1559 |
} |
| 1560 |
|
| 1561 |
if (bNoDecompWhenLock) |
| 1562 |
{ |
| 1563 |
LockFlags.NoDecompress = 1; |
| 1564 |
} |
| 1565 |
bool isPlanar = false; |
| 1566 |
#if !EMUL |
| 1567 |
isPlanar = (pSurface->osSurface->Format == Format_NV12) || (pSurface->osSurface->Format == Format_P010) || (pSurface->osSurface->Format == Format_P016); |
| 1568 |
#endif |
| 1569 |
VP_DEBUG_CHK_NULL(pOsInterface); |
| 1570 |
VP_DEBUG_CHK_NULL(pOsInterface->pfnGetSkuTable); |
| 1571 |
skuTable = pOsInterface->pfnGetSkuTable(pOsInterface); |
| 1572 |
|
| 1573 |
// RGBP and BGRP support tile output but should not transfer to linear surface due to height 16 align issue. |
| 1574 |
if (((skuTable && MEDIA_IS_SKU(skuTable, FtrE2ECompression) || isPlanar) && |
| 1575 |
(pSurface->osSurface->TileType != MOS_TILE_LINEAR) && |
| 1576 |
!(pSurface->osSurface->Format == Format_RGBP || pSurface->osSurface->Format == Format_BGRP) && |
| 1577 |
pDumpSpec->enablePostCompCopy) || |
| 1578 |
(pOsInterface->pfnIsAsynDevice(pOsInterface) && pSurface->osSurface->OsResource.bConvertedFromDDIResource)) |
| 1579 |
{ |
| 1580 |
VP_DEBUG_NORMALMESSAGE("use CopyThenLockResources to dump postcomp surface"); |
| 1581 |
VP_DEBUG_CHK_STATUS(CopyThenLockResources(pOsInterface, pSurface, temp2DSurfForCopy, hasAuxSurf, enableAuxDump, &LockFlags, pLockedResource, planes, &dwNumPlanes, &dwSize, pData, psPathPrefix, iCounter)); |
| 1582 |
if (pOsInterface->pfnIsAsynDevice(pOsInterface)) |
| 1583 |
{ |
| 1584 |
UnlockAndDestroyResource(pOsInterface, temp2DSurfForCopy, pLockedResource, true); |
| 1585 |
return eStatus; |
| 1586 |
} |
| 1587 |
} |
| 1588 |
else |
| 1589 |
{ |
| 1590 |
pData = (uint8_t *)pOsInterface->pfnLockResource( |
| 1591 |
pOsInterface, |
| 1592 |
&pSurface->osSurface->OsResource, |
| 1593 |
&LockFlags); |
| 1594 |
pLockedResource = &pSurface->osSurface->OsResource; |
| 1595 |
} |
| 1596 |
VP_DEBUG_CHK_NULL(pData); |
| 1597 |
|
| 1598 |
// Write error to user feauture key |
| 1599 |
eStatus = ReportUserSettingForDebug( |
| 1600 |
m_userSettingPtr, |
| 1601 |
__VPHAL_DBG_SURF_DUMPER_RESOURCE_LOCK, |
| 1602 |
1, |
| 1603 |
MediaUserSetting::Group::Device); |
| 1604 |
|
| 1605 |
VP_DEBUG_ASSERT(eStatus == MOS_STATUS_SUCCESS); |
| 1606 |
isSurfaceLocked = true; |
| 1607 |
} |
| 1608 |
|
| 1609 |
MOS_SecureStringPrint( |
| 1610 |
sPath, |
| 1611 |
MAX_PATH, |
| 1612 |
sizeof(sPath), |
| 1613 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].%s", |
| 1614 |
psPathPrefix, |
| 1615 |
iCounter, |
| 1616 |
pSurface->osSurface->dwWidth, |
| 1617 |
pSurface->osSurface->dwHeight, |
| 1618 |
pSurface->osSurface->dwPitch, |
| 1619 |
VpDumperTool::GetFormatStr(pSurface->osSurface->Format)); |
| 1620 |
|
| 1621 |
VpDumperTool::GetOsFilePath(sPath, sOsPath); |
| 1622 |
|
| 1623 |
pDst = (uint8_t*)MOS_AllocAndZeroMemory(dwSize); |
| 1624 |
VP_DEBUG_CHK_NULL(pDst); |
| 1625 |
VP_DEBUG_CHK_NULL(pData); |
| 1626 |
pTmpSrc = pData; |
| 1627 |
pTmpDst = pDst; |
| 1628 |
|
| 1629 |
for (j = 0; j < dwNumPlanes; j++) |
| 1630 |
{ |
| 1631 |
for (i = 0; i < planes[j].dwHeight; i++) |
| 1632 |
{ |
| 1633 |
if (hasAuxSurf && enableAuxDump) |
| 1634 |
{ |
| 1635 |
MOS_SecureMemcpy( |
| 1636 |
pTmpDst, |
| 1637 |
planes[j].dwPitch, |
| 1638 |
pTmpSrc, |
| 1639 |
planes[j].dwPitch); |
| 1640 |
|
| 1641 |
pTmpSrc += planes[j].dwPitch; |
| 1642 |
pTmpDst += planes[j].dwPitch; |
| 1643 |
|
| 1644 |
dstPlaneOffset[j+1] += planes[j].dwPitch; |
| 1645 |
} |
| 1646 |
else |
| 1647 |
{ |
| 1648 |
MOS_SecureMemcpy( |
| 1649 |
pTmpDst, |
| 1650 |
planes[j].dwWidth, |
| 1651 |
pTmpSrc, |
| 1652 |
planes[j].dwWidth); |
| 1653 |
|
| 1654 |
pTmpSrc += planes[j].dwPitch; |
| 1655 |
pTmpDst += planes[j].dwWidth; |
| 1656 |
|
| 1657 |
dstPlaneOffset[j+1] += planes[j].dwWidth; |
| 1658 |
} |
| 1659 |
} |
| 1660 |
|
| 1661 |
//if more than 1 plane, dump each plane's surface for offline analysis |
| 1662 |
if (enablePlaneDump) |
| 1663 |
{ |
| 1664 |
if ((dwNumPlanes > 1) && (dwNumPlanes <= 3)) |
| 1665 |
{ |
| 1666 |
char sPlanePath[MAX_PATH], sPlaneOsPath[MAX_PATH]; |
| 1667 |
MOS_ZeroMemory(sPlanePath, MAX_PATH); |
| 1668 |
MOS_ZeroMemory(sPlaneOsPath, MAX_PATH); |
| 1669 |
|
| 1670 |
MOS_SecureStringPrint( |
| 1671 |
sPlanePath, |
| 1672 |
MAX_PATH, |
| 1673 |
sizeof(sPlanePath), |
| 1674 |
"%s_f[%04lld]_w[%d]_h[%d]_p[%d].%s", |
| 1675 |
psPathPrefix, |
| 1676 |
iCounter, |
| 1677 |
planes[j].dwWidth, |
| 1678 |
planes[j].dwHeight, |
| 1679 |
planes[j].dwPitch, |
| 1680 |
(j == 0 ? "Y" : ((dwNumPlanes == 2) ? "UV" : ((j == 1) ? "U" : "V")))); |
| 1681 |
|
| 1682 |
VpDumperTool::GetOsFilePath(sPlanePath, sPlaneOsPath); |
| 1683 |
|
| 1684 |
VP_DEBUG_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(sPlaneOsPath, pDst + dstPlaneOffset[j], dstPlaneOffset[j + 1])); |
| 1685 |
} |
| 1686 |
else |
| 1687 |
{ |
| 1688 |
VP_DEBUG_ASSERTMESSAGE("More than 3 planes not supported during plane dump."); |
| 1689 |
} |
| 1690 |
} |
| 1691 |
} |
| 1692 |
|
| 1693 |
VP_DEBUG_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(sOsPath, pDst, dwSize)); |
| 1694 |
VP_PUBLIC_NORMALMESSAGE("VP surface dump to %s", sOsPath); |
| 1695 |
finish: |
| 1696 |
MOS_SafeFreeMemory(pDst); |
| 1697 |
|
| 1698 |
if (isSurfaceLocked && pLockedResource != nullptr) |
| 1699 |
{ |
| 1700 |
eStatus = (MOS_STATUS)pOsInterface->pfnUnlockResource(pOsInterface, pLockedResource); |
| 1701 |
VP_DEBUG_ASSERT(eStatus == MOS_STATUS_SUCCESS); |
| 1702 |
} |
| 1703 |
|
| 1704 |
UnlockAndDestroyResource(pOsInterface, temp2DSurfForCopy, pLockedResource, bLockSurface); |
| 1705 |
|
| 1706 |
return eStatus; |
| 1707 |
} |
| 1708 |
|
| 1709 |
char* VpSurfaceDumper::WhitespaceTrim( |
| 1710 |
char* ptr) |
| 1711 |
{ |
| 1712 |
VP_FUNC_CALL(); |
| 1713 |
|
| 1714 |
char* pcTemp; // pointer to temp string to remove spces |
| 1715 |
|
| 1716 |
VP_DEBUG_ASSERT(ptr); |
| 1717 |
|
| 1718 |
if(strlen(ptr) == 0) |
| 1719 |
{ |
| 1720 |
goto finish; |
| 1721 |
} |
| 1722 |
|
| 1723 |
//remove left spaces |
| 1724 |
while (*ptr == ' ' || *ptr == '\t') |
| 1725 |
{ |
| 1726 |
ptr++; |
| 1727 |
} |
| 1728 |
|
| 1729 |
//remove right spaces |
| 1730 |
pcTemp = ptr + strlen(ptr)-1; |
| 1731 |
while(*pcTemp == ' '|| *pcTemp == '\t') |
| 1732 |
{ |
| 1733 |
pcTemp--; |
| 1734 |
} |
| 1735 |
*(++pcTemp) = '\0'; |
| 1736 |
|
| 1737 |
finish: |
| 1738 |
return ptr; |
| 1739 |
} |
| 1740 |
|
| 1741 |
void VpDumperTool::StringToLower( |
| 1742 |
char* pcString) |
| 1743 |
{ |
| 1744 |
VP_FUNC_CALL(); |
| 1745 |
|
| 1746 |
size_t stStrLen; // length of string |
| 1747 |
size_t i; // loop iterator |
| 1748 |
|
| 1749 |
stStrLen = strlen(pcString); |
| 1750 |
for (i = 0; i < stStrLen; i++) |
| 1751 |
{ |
| 1752 |
if (isupper(pcString[i])) |
| 1753 |
{ |
| 1754 |
pcString[i] = (char)tolower(pcString[i]); |
| 1755 |
} |
| 1756 |
} |
| 1757 |
} |
| 1758 |
|
| 1759 |
MOS_STATUS VpSurfaceDumper::LocStringToEnum( |
| 1760 |
char* pcLocString, |
| 1761 |
uint32_t *pLocation) |
| 1762 |
{ |
| 1763 |
VP_FUNC_CALL(); |
| 1764 |
|
| 1765 |
MOS_STATUS eStatus; |
| 1766 |
|
| 1767 |
eStatus = MOS_STATUS_SUCCESS; |
| 1768 |
|
| 1769 |
VpDumperTool::StringToLower(pcLocString); |
| 1770 |
if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_PREALL) == 0) |
| 1771 |
{ |
| 1772 |
*pLocation = VPHAL_DUMP_TYPE_PRE_ALL; |
| 1773 |
} |
| 1774 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_PREDNDI) == 0) |
| 1775 |
{ |
| 1776 |
*pLocation = VPHAL_DUMP_TYPE_PRE_DNDI; |
| 1777 |
} |
| 1778 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_POSTDNDI) == 0) |
| 1779 |
{ |
| 1780 |
*pLocation = VPHAL_DUMP_TYPE_POST_DNDI; |
| 1781 |
} |
| 1782 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_PRECOMP) == 0) |
| 1783 |
{ |
| 1784 |
*pLocation = VPHAL_DUMP_TYPE_PRE_COMP; |
| 1785 |
} |
| 1786 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_POSTCOMP) == 0) |
| 1787 |
{ |
| 1788 |
*pLocation = VPHAL_DUMP_TYPE_POST_COMP; |
| 1789 |
} |
| 1790 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_PREMEMDECOMP) == 0) |
| 1791 |
{ |
| 1792 |
*pLocation = VPHAL_DUMP_TYPE_PRE_MEMDECOMP; |
| 1793 |
} |
| 1794 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_POSTMEMDECOMP) == 0) |
| 1795 |
{ |
| 1796 |
*pLocation = VPHAL_DUMP_TYPE_POST_MEMDECOMP; |
| 1797 |
} |
| 1798 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_POSTALL) == 0) |
| 1799 |
{ |
| 1800 |
*pLocation = VPHAL_DUMP_TYPE_POST_ALL; |
| 1801 |
} |
| 1802 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_VEBOX_DRIVERHEAP) == 0) |
| 1803 |
{ |
| 1804 |
*pLocation = VPHAL_DUMP_TYPE_VEBOX_DRIVERHEAP; |
| 1805 |
} |
| 1806 |
else if (strcmp(pcLocString, VPHAL_SURF_DUMP_LOC_VEBOX_KERNELHEAP) == 0) |
| 1807 |
{ |
| 1808 |
*pLocation = VPHAL_DUMP_TYPE_VEBOX_KERNELHEAP; |
| 1809 |
} |
| 1810 |
else |
| 1811 |
{ |
| 1812 |
VP_DEBUG_NORMALMESSAGE("Unknown dump location \"%s\".", pcLocString); |
| 1813 |
eStatus = MOS_STATUS_UNKNOWN; |
| 1814 |
goto finish; |
| 1815 |
} |
| 1816 |
|
| 1817 |
finish: |
| 1818 |
return eStatus; |
| 1819 |
} |
| 1820 |
|
| 1821 |
MOS_STATUS VpSurfaceDumper::EnumToLocString( |
| 1822 |
uint32_t Location, |
| 1823 |
char* pcLocString) |
| 1824 |
{ |
| 1825 |
VP_FUNC_CALL(); |
| 1826 |
|
| 1827 |
MOS_STATUS eStatus; |
| 1828 |
uint32_t i; |
| 1829 |
size_t stStrLen; |
| 1830 |
|
| 1831 |
eStatus = MOS_STATUS_SUCCESS; |
| 1832 |
|
| 1833 |
if (pcLocString == nullptr) |
| 1834 |
{ |
| 1835 |
eStatus = MOS_STATUS_INVALID_PARAMETER; |
| 1836 |
goto finish; |
| 1837 |
} |
| 1838 |
|
| 1839 |
switch (Location) |
| 1840 |
{ |
| 1841 |
case VPHAL_DUMP_TYPE_PRE_ALL: |
| 1842 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_PREALL); |
| 1843 |
break; |
| 1844 |
case VPHAL_DUMP_TYPE_PRE_DNDI: |
| 1845 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_PREDNDI); |
| 1846 |
break; |
| 1847 |
case VPHAL_DUMP_TYPE_POST_DNDI: |
| 1848 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_POSTDNDI); |
| 1849 |
break; |
| 1850 |
case VPHAL_DUMP_TYPE_PRE_COMP: |
| 1851 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_PRECOMP); |
| 1852 |
break; |
| 1853 |
case VPHAL_DUMP_TYPE_POST_COMP: |
| 1854 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_POSTCOMP); |
| 1855 |
break; |
| 1856 |
case VPHAL_DUMP_TYPE_PRE_MEMDECOMP: |
| 1857 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_PREMEMDECOMP); |
| 1858 |
break; |
| 1859 |
case VPHAL_DUMP_TYPE_POST_MEMDECOMP: |
| 1860 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_POSTMEMDECOMP); |
| 1861 |
break; |
| 1862 |
case VPHAL_DUMP_TYPE_POST_ALL: |
| 1863 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_POSTALL); |
| 1864 |
break; |
| 1865 |
case VPHAL_DUMP_TYPE_VEBOX_DRIVERHEAP: |
| 1866 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_VEBOX_DRIVERHEAP); |
| 1867 |
break; |
| 1868 |
case VPHAL_DUMP_TYPE_VEBOX_KERNELHEAP: |
| 1869 |
MOS_SecureStringPrint(pcLocString, MAX_PATH, MAX_PATH, VPHAL_SURF_DUMP_LOC_VEBOX_KERNELHEAP); |
| 1870 |
break; |
| 1871 |
default: |
| 1872 |
VP_DEBUG_ASSERTMESSAGE("Unknown dump location \"%d\".", Location); |
| 1873 |
eStatus = MOS_STATUS_UNKNOWN; |
| 1874 |
goto finish; |
| 1875 |
} // end switch |
| 1876 |
|
| 1877 |
stStrLen = strlen(pcLocString); |
| 1878 |
VP_DEBUG_ASSERT(stStrLen > 1); // assert b/c invalid access if <= 1 |
| 1879 |
i = pcLocString[1] == 'r' ? 3 : 4; // If pre, start i at 3, else 4 |
| 1880 |
// Maybe should add error case in case macros get changed later? |
| 1881 |
for (; i < stStrLen; i++) |
| 1882 |
{ |
| 1883 |
pcLocString[i] = (char)toupper(pcLocString[i]); |
| 1884 |
} |
| 1885 |
|
| 1886 |
finish: |
| 1887 |
return eStatus; |
| 1888 |
} |
| 1889 |
|
| 1890 |
MOS_STATUS VpSurfaceDumper::EnumToDdiString( |
| 1891 |
uint32_t uiDDI, |
| 1892 |
char* pcDdiString) |
| 1893 |
{ |
| 1894 |
VP_DEBUG_CHK_NULL_RETURN(pcDdiString) |
| 1895 |
|
| 1896 |
switch (uiDDI) |
| 1897 |
{ |
| 1898 |
case VPHAL_SURF_DUMP_DDI_UNKNOWN: |
| 1899 |
MOS_SecureStringPrint(pcDdiString, MAX_PATH, MAX_PATH, VPHAL_PARAMS_DUMP_DDI_UNKNOWN); |
| 1900 |
break; |
| 1901 |
case VPHAL_SURF_DUMP_DDI_VP_BLT: |
| 1902 |
MOS_SecureStringPrint(pcDdiString, MAX_PATH, MAX_PATH, VPHAL_PARAMS_DUMP_DDI_VP_BLT); |
| 1903 |
break; |
| 1904 |
case VPHAL_SURF_DUMP_DDI_CLEAR_VIEW: |
| 1905 |
MOS_SecureStringPrint(pcDdiString, MAX_PATH, MAX_PATH, VPHAL_PARAMS_DUMP_DDI_CLEAR_VIEW); |
| 1906 |
break; |
| 1907 |
default: |
| 1908 |
VP_DEBUG_ASSERTMESSAGE("Unknown dump DDI \"%d\".", uiDDI); |
| 1909 |
return MOS_STATUS_UNKNOWN; |
| 1910 |
} |
| 1911 |
|
| 1912 |
return MOS_STATUS_SUCCESS; |
| 1913 |
} |
| 1914 |
|
| 1915 |
MOS_STATUS VpSurfaceDumper::SurfTypeStringToEnum( |
| 1916 |
char* pcSurfType, |
| 1917 |
VPHAL_SURFACE_TYPE *pSurfType) |
| 1918 |
{ |
| 1919 |
VP_FUNC_CALL(); |
| 1920 |
|
| 1921 |
MOS_STATUS eStatus; |
| 1922 |
|
| 1923 |
eStatus = MOS_STATUS_SUCCESS; |
| 1924 |
VpDumperTool::StringToLower(pcSurfType); |
| 1925 |
if (strcmp(pcSurfType, VPHAL_SURF_DUMP_TYPE_BACKGROUND) == 0) |
| 1926 |
{ |
| 1927 |
*pSurfType = SURF_IN_BACKGROUND; |
| 1928 |
} |
| 1929 |
else if (strcmp(pcSurfType, VPHAL_SURF_DUMP_TYPE_PRIMARY) == 0) |
| 1930 |
{ |
| 1931 |
*pSurfType = SURF_IN_PRIMARY; |
| 1932 |
} |
| 1933 |
else if (strcmp(pcSurfType, VPHAL_SURF_DUMP_TYPE_SUBSTREAM) == 0) |
| 1934 |
{ |
| 1935 |
*pSurfType = SURF_IN_SUBSTREAM; |
| 1936 |
} |
| 1937 |
else if (strcmp(pcSurfType, VPHAL_SURF_DUMP_TYPE_REFERENCE) == 0) |
| 1938 |
{ |
| 1939 |
*pSurfType = SURF_IN_REFERENCE; |
| 1940 |
} |
| 1941 |
else if (strcmp(pcSurfType, VPHAL_SURF_DUMP_TYPE_RENDERTARGET) == 0) |
| 1942 |
{ |
| 1943 |
*pSurfType = SURF_OUT_RENDERTARGET; |
| 1944 |
} |
| 1945 |
else |
| 1946 |
{ |
| 1947 |
VP_DEBUG_ASSERTMESSAGE("Unknown surface type \"%s\".", pcSurfType); |
| 1948 |
eStatus = MOS_STATUS_UNKNOWN; |
| 1949 |
goto finish; |
| 1950 |
} |
| 1951 |
|
| 1952 |
finish: |
| 1953 |
return eStatus; |
| 1954 |
} |
| 1955 |
|
| 1956 |
|
| 1957 |
MOS_STATUS VpSurfaceDumper::ProcessDumpLocations( |
| 1958 |
char* pcDumpLocData) |
| 1959 |
{ |
| 1960 |
VP_FUNC_CALL(); |
| 1961 |
|
| 1962 |
MOS_STATUS eStatus; |
| 1963 |
char* pcCommaLoc; // pointer to next comma in dump location string |
| 1964 |
char* pcCurrToken; // pointer to current token in a string |
| 1965 |
char* pcColonLoc; // pointer to next colon in location string |
| 1966 |
int32_t iNumStrings; // number of dump locations |
| 1967 |
int32_t i; // loop iteration counter |
| 1968 |
VPHAL_SURF_DUMP_SPEC *pDumpSpec = &m_dumpSpec; |
| 1969 |
|
| 1970 |
eStatus = MOS_STATUS_SUCCESS; |
| 1971 |
iNumStrings = 0; |
| 1972 |
|
| 1973 |
if (strlen(pcDumpLocData) > 0) |
| 1974 |
{ |
| 1975 |
// Count number of strings in key data |
| 1976 |
// If non empty string, there is at least one value |
| 1977 |
iNumStrings++; |
| 1978 |
// Count the rest |
| 1979 |
pcCommaLoc = pcDumpLocData; |
| 1980 |
while ((pcCommaLoc = strchr(pcCommaLoc + 1, ',')) != nullptr) |
| 1981 |
{ |
| 1982 |
iNumStrings++; |
| 1983 |
} |
| 1984 |
|
| 1985 |
// Set number of strings and allocate space for them |
| 1986 |
pDumpSpec->iNumDumpLocs = iNumStrings; |
| 1987 |
pDumpSpec->pDumpLocations = (VPHAL_SURF_DUMP_LOC*)MOS_AllocAndZeroMemory( |
| 1988 |
sizeof(VPHAL_SURF_DUMP_LOC) * pDumpSpec->iNumDumpLocs); |
| 1989 |
pcCurrToken = pcDumpLocData; |
| 1990 |
|
| 1991 |
// Determine each part of the string |
| 1992 |
for (i = 0; i < pDumpSpec->iNumDumpLocs; i++) |
| 1993 |
{ |
| 1994 |
pcCommaLoc = strchr(pcCurrToken, ','); |
| 1995 |
if (pcCommaLoc != nullptr) |
| 1996 |
{ |
| 1997 |
*pcCommaLoc = '\0'; |
| 1998 |
} |
| 1999 |
|
| 2000 |
// Handle surface type |
| 2001 |
pcColonLoc = strchr(pcCurrToken, ':'); |
| 2002 |
if (pcColonLoc == nullptr) |
| 2003 |
{ |
| 2004 |
// Dump all |
| 2005 |
pDumpSpec->pDumpLocations[i].SurfType = SURF_NONE; |
| 2006 |
} |
| 2007 |
else |
| 2008 |
{ |
| 2009 |
// Remove surface type from dump location |
| 2010 |
*pcColonLoc = '\0'; |
| 2011 |
// Set surface type |
| 2012 |
pcColonLoc++; |
| 2013 |
|
| 2014 |
pcColonLoc = WhitespaceTrim(pcColonLoc); |
| 2015 |
VP_DEBUG_CHK_STATUS(SurfTypeStringToEnum(pcColonLoc, |
| 2016 |
&(pDumpSpec->pDumpLocations[i].SurfType))); |
| 2017 |
} |
| 2018 |
|
| 2019 |
//trim the whitespaces from dump location |
| 2020 |
pcCurrToken = WhitespaceTrim(pcCurrToken); |
| 2021 |
|
| 2022 |
VP_DEBUG_CHK_STATUS(LocStringToEnum(pcCurrToken, |
| 2023 |
&(pDumpSpec->pDumpLocations[i].DumpLocation))); |
| 2024 |
if (pcCommaLoc != nullptr) |
| 2025 |
{ |
| 2026 |
pcCurrToken = pcCommaLoc + 1; |
| 2027 |
} |
| 2028 |
} // end for each part of the string |
| 2029 |
} // if data length > 0 |
| 2030 |
finish: |
| 2031 |
return eStatus; |
| 2032 |
} |
| 2033 |
|
| 2034 |
void VpSurfaceDumper::GetSurfaceDumpSpecForVPSolo(VPHAL_SURF_DUMP_SPEC *pDumpSpec, MediaUserSetting::Value outValue) |
| 2035 |
{ |
| 2036 |
VP_FUNC_CALL(); |
| 2037 |
|
| 2038 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 2039 |
pDumpSpec->uiStartFrame = 0; |
| 2040 |
pDumpSpec->uiEndFrame = 0xFFFFFFFF; |
| 2041 |
outValue = "C:\\dumps"; |
| 2042 |
if (outValue.ConstString().size() > 0 && outValue.ConstString().size() < MOS_USER_CONTROL_MAX_DATA_SIZE) |
| 2043 |
{ |
| 2044 |
// Copy the Output path |
| 2045 |
MOS_SecureMemcpy( |
| 2046 |
pDumpSpec->pcOutputPath, |
| 2047 |
MAX_PATH, |
| 2048 |
outValue.ConstString().c_str(), |
| 2049 |
outValue.ConstString().size()); |
| 2050 |
} |
| 2051 |
outValue = "postall"; |
| 2052 |
if (outValue.ConstString().size() > 0 && outValue.ConstString().size() < MOS_USER_CONTROL_MAX_DATA_SIZE && pDumpSpec->pcOutputPath[0] != '\0') |
| 2053 |
{ |
| 2054 |
VP_DEBUG_CHK_STATUS(ProcessDumpLocations(const_cast<char *>(outValue.ConstString().c_str()))); |
| 2055 |
} |
| 2056 |
|
| 2057 |
finish: |
| 2058 |
if ((eStatus != MOS_STATUS_SUCCESS) || (pDumpSpec->pcOutputPath[0] == '\0')) |
| 2059 |
{ |
| 2060 |
pDumpSpec->uiStartFrame = 1; |
| 2061 |
pDumpSpec->uiEndFrame = 0; |
| 2062 |
} |
| 2063 |
} |
| 2064 |
|
| 2065 |
void VpSurfaceDumper::GetSurfaceDumpSpec() |
| 2066 |
{ |
| 2067 |
VP_FUNC_CALL(); |
| 2068 |
|
| 2069 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 2070 |
char pcDumpLocData[VPHAL_SURF_DUMP_MAX_DATA_LEN]; |
| 2071 |
VPHAL_SURF_DUMP_SPEC *pDumpSpec = &m_dumpSpec; |
| 2072 |
MediaUserSetting::Value outValue; |
| 2073 |
|
| 2074 |
pDumpSpec->uiStartFrame = 0xFFFFFFFF; |
| 2075 |
pDumpSpec->uiEndFrame = 0; |
| 2076 |
pDumpSpec->pcOutputPath[0] = '\0'; |
| 2077 |
pcDumpLocData[0] = '\0'; |
| 2078 |
|
| 2079 |
#if EMUL |
| 2080 |
GetSurfaceDumpSpecForVPSolo(pDumpSpec, outValue); |
| 2081 |
return; |
| 2082 |
#endif |
| 2083 |
|
| 2084 |
// Get start frame |
| 2085 |
// if start frame is not got assign a default value of 0 |
| 2086 |
ReadUserSettingForDebug( |
| 2087 |
m_userSettingPtr, |
| 2088 |
pDumpSpec->uiStartFrame, |
| 2089 |
__VPHAL_DBG_SURF_DUMP_START_FRAME_KEY_NAME, |
| 2090 |
MediaUserSetting::Group::Device); |
| 2091 |
|
| 2092 |
// Get end frame |
| 2093 |
// if end frame is not got assign a default value of max |
| 2094 |
ReadUserSettingForDebug( |
| 2095 |
m_userSettingPtr, |
| 2096 |
pDumpSpec->uiEndFrame, |
| 2097 |
__VPHAL_DBG_SURF_DUMP_END_FRAME_KEY_NAME, |
| 2098 |
MediaUserSetting::Group::Device); |
| 2099 |
|
| 2100 |
// Get out file path |
| 2101 |
ReadUserSettingForDebug( |
| 2102 |
m_userSettingPtr, |
| 2103 |
outValue, |
| 2104 |
__VPHAL_DBG_SURF_DUMP_OUTFILE_KEY_NAME, |
| 2105 |
MediaUserSetting::Group::Device); |
| 2106 |
|
| 2107 |
if (outValue.ConstString().size() > 0 && outValue.ConstString().size() < MOS_USER_CONTROL_MAX_DATA_SIZE) |
| 2108 |
{ |
| 2109 |
// Copy the Output path |
| 2110 |
MOS_SecureMemcpy( |
| 2111 |
pDumpSpec->pcOutputPath, |
| 2112 |
MAX_PATH, |
| 2113 |
outValue.ConstString().c_str(), |
| 2114 |
outValue.ConstString().size()); |
| 2115 |
} |
| 2116 |
#if !defined(LINUX) && !defined(ANDROID) |
| 2117 |
else |
| 2118 |
{ |
| 2119 |
std::string vphalDumpFilePath; |
| 2120 |
|
| 2121 |
// Use state separation APIs to obtain appropriate storage location |
| 2122 |
if (SUCCEEDED(GetDriverPersistentStorageLocation(vphalDumpFilePath))) |
| 2123 |
{ |
| 2124 |
std::string m_outputFilePath; |
| 2125 |
|
| 2126 |
m_outputFilePath = vphalDumpFilePath.c_str(); |
| 2127 |
m_outputFilePath.append(VPHAL_DUMP_OUTPUT_FOLDER); |
| 2128 |
|
| 2129 |
// Copy the Output path |
| 2130 |
MOS_SecureMemcpy( |
| 2131 |
pDumpSpec->pcOutputPath, |
| 2132 |
MAX_PATH, |
| 2133 |
m_outputFilePath.c_str(), |
| 2134 |
m_outputFilePath.size()); |
| 2135 |
|
| 2136 |
ReportUserSettingForDebug(m_userSettingPtr, __VPHAL_DBG_DUMP_OUTPUT_DIRECTORY, m_outputFilePath, MediaUserSetting::Group::Sequence); |
| 2137 |
} |
| 2138 |
} |
| 2139 |
#endif |
| 2140 |
|
| 2141 |
// Get dump locations |
| 2142 |
outValue = ""; |
| 2143 |
ReadUserSettingForDebug( |
| 2144 |
m_userSettingPtr, |
| 2145 |
outValue, |
| 2146 |
__VPHAL_DBG_SURF_DUMP_LOCATION_KEY_NAME, |
| 2147 |
MediaUserSetting::Group::Device); |
| 2148 |
if (outValue.ConstString().size() > 0 && outValue.ConstString().size() < MOS_USER_CONTROL_MAX_DATA_SIZE |
| 2149 |
&& pDumpSpec->pcOutputPath[0] != '\0') |
| 2150 |
{ |
| 2151 |
VP_DEBUG_CHK_STATUS(ProcessDumpLocations(const_cast<char *>(outValue.ConstString().c_str()))); |
| 2152 |
} |
| 2153 |
|
| 2154 |
// Get enableAuxDump |
| 2155 |
ReadUserSettingForDebug( |
| 2156 |
m_userSettingPtr, |
| 2157 |
pDumpSpec->enableAuxDump, |
| 2158 |
__VPHAL_DBG_SURF_DUMP_ENABLE_AUX_DUMP, |
| 2159 |
MediaUserSetting::Group::Device); |
| 2160 |
|
| 2161 |
// Get plane dump enabled flag |
| 2162 |
ReadUserSettingForDebug( |
| 2163 |
m_userSettingPtr, |
| 2164 |
pDumpSpec->enablePlaneDump, |
| 2165 |
__VPHAL_DBG_SURF_DUMPER_ENABLE_PLANE_DUMP, |
| 2166 |
MediaUserSetting::Group::Device); |
| 2167 |
|
| 2168 |
finish: |
| 2169 |
if ((eStatus != MOS_STATUS_SUCCESS) || (pDumpSpec->pcOutputPath[0] == '\0')) |
| 2170 |
{ |
| 2171 |
pDumpSpec->uiStartFrame = 1; |
| 2172 |
pDumpSpec->uiEndFrame = 0; |
| 2173 |
} |
| 2174 |
} |
| 2175 |
|
| 2176 |
VpSurfaceDumper::VpSurfaceDumper(PMOS_INTERFACE pOsInterface) : |
| 2177 |
m_dumpSpec(), |
| 2178 |
m_osInterface(pOsInterface) |
| 2179 |
{ |
| 2180 |
if (m_osInterface) |
| 2181 |
{ |
| 2182 |
m_userSettingPtr = m_osInterface->pfnGetUserSettingInstance(m_osInterface); |
| 2183 |
} |
| 2184 |
} |
| 2185 |
|
| 2186 |
VpSurfaceDumper::~VpSurfaceDumper() |
| 2187 |
{ |
| 2188 |
MOS_SafeFreeMemory(m_dumpSpec.pDumpLocations); |
| 2189 |
} |
| 2190 |
|
| 2191 |
|
| 2192 |
MOS_STATUS VpSurfaceDumper::DumpSurface( |
| 2193 |
PVPHAL_SURFACE pSurf, |
| 2194 |
uint32_t uiFrameNumber, |
| 2195 |
uint32_t uiCounter, |
| 2196 |
uint32_t Location, |
| 2197 |
uint32_t uiDDI) |
| 2198 |
{ |
| 2199 |
VP_FUNC_CALL(); |
| 2200 |
|
| 2201 |
int32_t VphalSurfDumpManualTrigger = VPHAL_SURF_DUMP_MANUAL_TRIGGER_DEFAULT_NOT_SET; |
| 2202 |
|
| 2203 |
MOS_STATUS eStatus; |
| 2204 |
int32_t i; |
| 2205 |
VPHAL_SURF_DUMP_SPEC* pDumpSpec = &m_dumpSpec; |
| 2206 |
bool isDumpFromDecomp; |
| 2207 |
bool orgDumpAuxEnable; |
| 2208 |
int32_t pid = MosUtilities::MosGetPid(); |
| 2209 |
uint64_t timeStamp = 0; |
| 2210 |
|
| 2211 |
MosUtilities::MosQueryPerformanceCounter(&timeStamp); |
| 2212 |
eStatus = MOS_STATUS_SUCCESS; |
| 2213 |
i = 0; |
| 2214 |
isDumpFromDecomp = (Location == VPHAL_DUMP_TYPE_PRE_MEMDECOMP || Location == VPHAL_DUMP_TYPE_POST_MEMDECOMP); |
| 2215 |
|
| 2216 |
orgDumpAuxEnable = m_dumpSpec.enableAuxDump; |
| 2217 |
if (Location == VPHAL_DUMP_TYPE_PRE_MEMDECOMP) |
| 2218 |
{ |
| 2219 |
// For PreMemDecomp, dump without aux is meaningless |
| 2220 |
// and, if we don't turn on aux dump, the surface will be deswizzled, |
| 2221 |
// while Mos_Specific_LockResource() will perform deswilling to temp buffer and then copy to locked buffer |
| 2222 |
// This will break the compressed surface. |
| 2223 |
// So, we cannot dump compressed surf with deswizzling under current implementation. |
| 2224 |
m_dumpSpec.enableAuxDump = true; |
| 2225 |
} |
| 2226 |
|
| 2227 |
OsContextNext *osCtx = nullptr; |
| 2228 |
|
| 2229 |
if (m_osInterface && m_osInterface->osStreamState && m_osInterface->osStreamState->osDeviceContext) |
| 2230 |
{ |
| 2231 |
osCtx = m_osInterface->osStreamState->osDeviceContext; |
| 2232 |
if (osCtx && osCtx->GetDumpFrameNum() != 0xffffffff && isDumpFromDecomp) |
| 2233 |
{ |
| 2234 |
// override the uiFrameNumer as it is during Vphal dumping its surface and already in lock and decomp phase |
| 2235 |
uiFrameNumber = osCtx->GetDumpFrameNum(); |
| 2236 |
} |
| 2237 |
|
| 2238 |
if (osCtx && !isDumpFromDecomp) |
| 2239 |
{ |
| 2240 |
osCtx->SetDumpFrameNum(uiFrameNumber); |
| 2241 |
} |
| 2242 |
|
| 2243 |
} |
| 2244 |
|
| 2245 |
|
| 2246 |
// Get if manual triggered build |
| 2247 |
ReadUserSettingForDebug( |
| 2248 |
m_userSettingPtr, |
| 2249 |
VphalSurfDumpManualTrigger, |
| 2250 |
__VPHAL_DBG_SURF_DUMP_MANUAL_TRIGGER_KEY_NAME, |
| 2251 |
MediaUserSetting::Group::Device); |
| 2252 |
|
| 2253 |
if (VphalSurfDumpManualTrigger != VPHAL_SURF_DUMP_MANUAL_TRIGGER_DEFAULT_NOT_SET) |
| 2254 |
{ |
| 2255 |
if (VphalSurfDumpManualTrigger == VPHAL_SURF_DUMP_MANUAL_TRIGGER_STARTED) |
| 2256 |
{ |
| 2257 |
VP_DEBUG_NORMALMESSAGE("Dump manaul trigger enabled, dump started: %d \n", VphalSurfDumpManualTrigger); |
| 2258 |
|
| 2259 |
for (i = 0; i < pDumpSpec->iNumDumpLocs; i++) |
| 2260 |
{ |
| 2261 |
if (pDumpSpec->pDumpLocations[i].DumpLocation == Location && // should dump at this pipeline location AND |
| 2262 |
(pDumpSpec->pDumpLocations[i].SurfType == pSurf->SurfType || // should dump for this surface type OR |
| 2263 |
pDumpSpec->pDumpLocations[i].SurfType == SURF_NONE)) // should dump for any surface type |
| 2264 |
{ |
| 2265 |
char *loc = nullptr; |
| 2266 |
if (osCtx) |
| 2267 |
{ |
| 2268 |
loc = osCtx->GetdumpLoc(); |
| 2269 |
} |
| 2270 |
VP_DEBUG_CHK_STATUS(EnumToLocString(Location, m_dumpLoc)); |
| 2271 |
VP_DEBUG_CHK_STATUS(EnumToDdiString(uiDDI, m_dumpDDI)); |
| 2272 |
if (!isDumpFromDecomp && pSurf->bIsCompressed && loc) |
| 2273 |
{ |
| 2274 |
EnumToLocString(Location, loc); |
| 2275 |
} |
| 2276 |
|
| 2277 |
if (!isDumpFromDecomp || (loc && loc[0] == 0)) |
| 2278 |
{ |
| 2279 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc[%s]_lyr[%d]_ddi[%s(%d)]", pDumpSpec->pcOutputPath, pid, timeStamp, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2280 |
} |
| 2281 |
else |
| 2282 |
{ |
| 2283 |
if (loc) |
| 2284 |
{ |
| 2285 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc[%s_%s]_lyr[%d]_ddi[%s(%d)]", pDumpSpec->pcOutputPath, pid, timeStamp, loc, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2286 |
} |
| 2287 |
} |
| 2288 |
DumpSurfaceToFile( |
| 2289 |
m_osInterface, |
| 2290 |
pSurf, |
| 2291 |
m_dumpPrefix, |
| 2292 |
uiFrameNumber, |
| 2293 |
true, |
| 2294 |
isDumpFromDecomp, |
| 2295 |
nullptr); |
| 2296 |
break; |
| 2297 |
} |
| 2298 |
} |
| 2299 |
} |
| 2300 |
else if (VphalSurfDumpManualTrigger == VPHAL_SURF_DUMP_MANUAL_TRIGGER_STOPPED) |
| 2301 |
{ |
| 2302 |
VP_DEBUG_NORMALMESSAGE("Dump manaul trigger enabled, dump stopped: %d \n", VphalSurfDumpManualTrigger); |
| 2303 |
} |
| 2304 |
else |
| 2305 |
{ |
| 2306 |
VP_DEBUG_NORMALMESSAGE("Dump manaul trigger flag: %d \n", VphalSurfDumpManualTrigger); |
| 2307 |
} |
| 2308 |
} |
| 2309 |
else if (pDumpSpec->uiStartFrame <= uiFrameNumber && |
| 2310 |
uiFrameNumber <= pDumpSpec->uiEndFrame) |
| 2311 |
{ |
| 2312 |
for (i = 0; i < pDumpSpec->iNumDumpLocs; i++) |
| 2313 |
{ |
| 2314 |
if (pDumpSpec->pDumpLocations[i].DumpLocation == Location && // should dump at this pipeline location AND |
| 2315 |
(pDumpSpec->pDumpLocations[i].SurfType == pSurf->SurfType || // should dump for this surface type OR |
| 2316 |
pDumpSpec->pDumpLocations[i].SurfType == SURF_NONE)) // should dump for any surface type |
| 2317 |
{ |
| 2318 |
char *loc = nullptr; |
| 2319 |
if (osCtx) |
| 2320 |
{ |
| 2321 |
loc = osCtx->GetdumpLoc(); |
| 2322 |
} |
| 2323 |
VP_DEBUG_CHK_STATUS(EnumToLocString(Location, m_dumpLoc)); |
| 2324 |
VP_DEBUG_CHK_STATUS(EnumToDdiString(uiDDI, m_dumpDDI)); |
| 2325 |
if (!isDumpFromDecomp && pSurf->bIsCompressed && loc) |
| 2326 |
{ |
| 2327 |
EnumToLocString(Location, loc); |
| 2328 |
} |
| 2329 |
|
| 2330 |
if (!isDumpFromDecomp || (loc && loc[0] == 0)) |
| 2331 |
{ |
| 2332 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc_loc[%s]_lyr[%d]_ddi[%s(%d)]", |
| 2333 |
pDumpSpec->pcOutputPath, pid, timeStamp, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2334 |
} |
| 2335 |
else |
| 2336 |
{ |
| 2337 |
if (loc) |
| 2338 |
{ |
| 2339 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc_loc[%s_%s]_lyr[%d]_ddi[%s(%d)]", |
| 2340 |
pDumpSpec->pcOutputPath, pid, timeStamp, loc, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2341 |
} |
| 2342 |
} |
| 2343 |
|
| 2344 |
DumpSurfaceToFile( |
| 2345 |
m_osInterface, |
| 2346 |
pSurf, |
| 2347 |
m_dumpPrefix, |
| 2348 |
uiFrameNumber, |
| 2349 |
true, |
| 2350 |
isDumpFromDecomp, |
| 2351 |
nullptr); |
| 2352 |
break; |
| 2353 |
} |
| 2354 |
} |
| 2355 |
} |
| 2356 |
else |
| 2357 |
{ |
| 2358 |
VP_DEBUG_VERBOSEMESSAGE("No surface dumpped, VphalSurfDumpManualTrigger: %d, uiStartFrame: %d, uiEndFrame: %d\n", VphalSurfDumpManualTrigger, pDumpSpec->uiStartFrame, pDumpSpec->uiEndFrame); |
| 2359 |
} |
| 2360 |
|
| 2361 |
finish: |
| 2362 |
if (!isDumpFromDecomp && osCtx) |
| 2363 |
{ |
| 2364 |
osCtx->ResetDumpFrameNum(); |
| 2365 |
osCtx->ResetdumpLoc(); |
| 2366 |
} |
| 2367 |
m_dumpSpec.enableAuxDump = orgDumpAuxEnable; |
| 2368 |
|
| 2369 |
return eStatus; |
| 2370 |
} |
| 2371 |
|
| 2372 |
MOS_STATUS VpSurfaceDumper::DumpSurface( |
| 2373 |
PVP_SURFACE pSurf, |
| 2374 |
uint32_t uiFrameNumber, |
| 2375 |
uint32_t uiCounter, |
| 2376 |
uint32_t Location, |
| 2377 |
uint32_t uiDDI) |
| 2378 |
{ |
| 2379 |
VP_FUNC_CALL(); |
| 2380 |
|
| 2381 |
MOS_USER_FEATURE_VALUE_DATA UserFeatureData; |
| 2382 |
int32_t VphalSurfDumpManualTrigger = VPHAL_SURF_DUMP_MANUAL_TRIGGER_DEFAULT_NOT_SET; |
| 2383 |
|
| 2384 |
MOS_STATUS eStatus; |
| 2385 |
int32_t i; |
| 2386 |
VPHAL_SURF_DUMP_SPEC* pDumpSpec = &m_dumpSpec; |
| 2387 |
bool isDumpFromDecomp; |
| 2388 |
bool orgDumpAuxEnable; |
| 2389 |
int32_t pid = MosUtilities::MosGetPid(); |
| 2390 |
uint64_t timeStamp = 0; |
| 2391 |
|
| 2392 |
MosUtilities::MosQueryPerformanceCounter(&timeStamp); |
| 2393 |
eStatus = MOS_STATUS_SUCCESS; |
| 2394 |
i = 0; |
| 2395 |
isDumpFromDecomp = (Location == VPHAL_DUMP_TYPE_PRE_MEMDECOMP || Location == VPHAL_DUMP_TYPE_POST_MEMDECOMP); |
| 2396 |
|
| 2397 |
orgDumpAuxEnable = m_dumpSpec.enableAuxDump; |
| 2398 |
if (Location == VPHAL_DUMP_TYPE_PRE_MEMDECOMP) |
| 2399 |
{ |
| 2400 |
// For PreMemDecomp, dump without aux is meaningless |
| 2401 |
// and, if we don't turn on aux dump, the surface will be deswizzled, |
| 2402 |
// while Mos_Specific_LockResource() will perform deswilling to temp buffer and then copy to locked buffer |
| 2403 |
// This will break the compressed surface. |
| 2404 |
// So, we cannot dump compressed surf with deswizzling under current implementation. |
| 2405 |
m_dumpSpec.enableAuxDump = true; |
| 2406 |
} |
| 2407 |
|
| 2408 |
OsContextNext *osCtx = nullptr; |
| 2409 |
|
| 2410 |
if (m_osInterface && m_osInterface->osStreamState && m_osInterface->osStreamState->osDeviceContext) |
| 2411 |
{ |
| 2412 |
osCtx = m_osInterface->osStreamState->osDeviceContext; |
| 2413 |
if (osCtx && osCtx->GetDumpFrameNum() != 0xffffffff && isDumpFromDecomp) |
| 2414 |
{ |
| 2415 |
// override the uiFrameNumer as it is during Vphal dumping its surface and already in lock and decomp phase |
| 2416 |
uiFrameNumber = osCtx->GetDumpFrameNum(); |
| 2417 |
} |
| 2418 |
|
| 2419 |
if (osCtx && !isDumpFromDecomp) |
| 2420 |
{ |
| 2421 |
osCtx->SetDumpFrameNum(uiFrameNumber); |
| 2422 |
} |
| 2423 |
|
| 2424 |
} |
| 2425 |
|
| 2426 |
// Get if manual triggered build |
| 2427 |
ReadUserSettingForDebug( |
| 2428 |
m_userSettingPtr, |
| 2429 |
VphalSurfDumpManualTrigger, |
| 2430 |
__VPHAL_DBG_SURF_DUMP_MANUAL_TRIGGER_KEY_NAME, |
| 2431 |
MediaUserSetting::Group::Device); |
| 2432 |
|
| 2433 |
if (VphalSurfDumpManualTrigger != VPHAL_SURF_DUMP_MANUAL_TRIGGER_DEFAULT_NOT_SET) |
| 2434 |
{ |
| 2435 |
if (VphalSurfDumpManualTrigger == VPHAL_SURF_DUMP_MANUAL_TRIGGER_STARTED) |
| 2436 |
{ |
| 2437 |
VP_DEBUG_NORMALMESSAGE("Dump manaul trigger enabled, dump started: %d \n", VphalSurfDumpManualTrigger); |
| 2438 |
|
| 2439 |
for (i = 0; i < pDumpSpec->iNumDumpLocs; i++) |
| 2440 |
{ |
| 2441 |
if (pDumpSpec->pDumpLocations[i].DumpLocation == Location && // should dump at this pipeline location AND |
| 2442 |
(pDumpSpec->pDumpLocations[i].SurfType == pSurf->SurfType || // should dump for this surface type OR |
| 2443 |
pDumpSpec->pDumpLocations[i].SurfType == SURF_NONE)) // should dump for any surface type |
| 2444 |
{ |
| 2445 |
char *loc = nullptr; |
| 2446 |
if (osCtx) |
| 2447 |
{ |
| 2448 |
loc = osCtx->GetdumpLoc(); |
| 2449 |
} |
| 2450 |
VP_DEBUG_CHK_STATUS(EnumToLocString(Location, m_dumpLoc)); |
| 2451 |
VP_DEBUG_CHK_STATUS(EnumToDdiString(uiDDI, m_dumpDDI)); |
| 2452 |
if (!isDumpFromDecomp && pSurf->osSurface->bIsCompressed && loc) |
| 2453 |
{ |
| 2454 |
EnumToLocString(Location, loc); |
| 2455 |
} |
| 2456 |
|
| 2457 |
if (!isDumpFromDecomp || (loc && loc[0] == 0)) |
| 2458 |
{ |
| 2459 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc[%s]_lyr[%d]_ddi[%s(%d)]", pDumpSpec->pcOutputPath, pid, timeStamp, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2460 |
} |
| 2461 |
else |
| 2462 |
{ |
| 2463 |
if (loc) |
| 2464 |
{ |
| 2465 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc[%s_%s]_lyr[%d]_ddi[%s(%d)]", pDumpSpec->pcOutputPath, pid, timeStamp, loc, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2466 |
} |
| 2467 |
} |
| 2468 |
DumpSurfaceToFile( |
| 2469 |
m_osInterface, |
| 2470 |
pSurf, |
| 2471 |
m_dumpPrefix, |
| 2472 |
uiFrameNumber, |
| 2473 |
true, |
| 2474 |
isDumpFromDecomp, |
| 2475 |
nullptr); |
| 2476 |
break; |
| 2477 |
} |
| 2478 |
} |
| 2479 |
} |
| 2480 |
else if (VphalSurfDumpManualTrigger == VPHAL_SURF_DUMP_MANUAL_TRIGGER_STOPPED) |
| 2481 |
{ |
| 2482 |
VP_DEBUG_NORMALMESSAGE("Dump manaul trigger enabled, dump stopped: %d \n", VphalSurfDumpManualTrigger); |
| 2483 |
} |
| 2484 |
else |
| 2485 |
{ |
| 2486 |
VP_DEBUG_NORMALMESSAGE("Dump manaul trigger flag: %d \n", VphalSurfDumpManualTrigger); |
| 2487 |
} |
| 2488 |
} |
| 2489 |
else if (pDumpSpec->uiStartFrame <= uiFrameNumber && |
| 2490 |
uiFrameNumber <= pDumpSpec->uiEndFrame) |
| 2491 |
{ |
| 2492 |
for (i = 0; i < pDumpSpec->iNumDumpLocs; i++) |
| 2493 |
{ |
| 2494 |
if (pDumpSpec->pDumpLocations[i].DumpLocation == Location && // should dump at this pipeline location AND |
| 2495 |
(pDumpSpec->pDumpLocations[i].SurfType == pSurf->SurfType || // should dump for this surface type OR |
| 2496 |
pDumpSpec->pDumpLocations[i].SurfType == SURF_NONE)) // should dump for any surface type |
| 2497 |
{ |
| 2498 |
char *loc = nullptr; |
| 2499 |
if (osCtx) |
| 2500 |
{ |
| 2501 |
loc = osCtx->GetdumpLoc(); |
| 2502 |
} |
| 2503 |
VP_DEBUG_CHK_STATUS(EnumToLocString(Location, m_dumpLoc)); |
| 2504 |
VP_DEBUG_CHK_STATUS(EnumToDdiString(uiDDI, m_dumpDDI)); |
| 2505 |
if (!isDumpFromDecomp && pSurf->osSurface->bIsCompressed && loc) |
| 2506 |
{ |
| 2507 |
EnumToLocString(Location, loc); |
| 2508 |
} |
| 2509 |
|
| 2510 |
if (!isDumpFromDecomp || (loc && loc[0] == 0)) |
| 2511 |
{ |
| 2512 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc[%s]_lyr[%d]_ddi[%s(%d)]", |
| 2513 |
pDumpSpec->pcOutputPath, pid, timeStamp, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2514 |
} |
| 2515 |
else |
| 2516 |
{ |
| 2517 |
if (loc) |
| 2518 |
{ |
| 2519 |
MOS_SecureStringPrint(m_dumpPrefix, MAX_PATH, MAX_PATH, "%s/surfdump_pid%x_ts%llx_loc[%s_%s]_lyr[%d]_ddi[%s(%d)]", |
| 2520 |
pDumpSpec->pcOutputPath, pid, timeStamp, loc, m_dumpLoc, uiCounter, m_dumpDDI, uiDDI); |
| 2521 |
} |
| 2522 |
} |
| 2523 |
|
| 2524 |
DumpSurfaceToFile( |
| 2525 |
m_osInterface, |
| 2526 |
pSurf, |
| 2527 |
m_dumpPrefix, |
| 2528 |
uiFrameNumber, |
| 2529 |
true, |
| 2530 |
isDumpFromDecomp, |
| 2531 |
nullptr); |
| 2532 |
break; |
| 2533 |
} |
| 2534 |
} |
| 2535 |
} |
| 2536 |
else |
| 2537 |
{ |
| 2538 |
VP_DEBUG_VERBOSEMESSAGE("No surface dumpped, VphalSurfDumpManualTrigger: %d, uiStartFrame: %d, uiEndFrame: %d\n", VphalSurfDumpManualTrigger, pDumpSpec->uiStartFrame, pDumpSpec->uiEndFrame); |
| 2539 |
} |
| 2540 |
|
| 2541 |
finish: |
| 2542 |
if (!isDumpFromDecomp && osCtx) |
| 2543 |
{ |
| 2544 |
osCtx->ResetDumpFrameNum(); |
| 2545 |
osCtx->ResetdumpLoc(); |
| 2546 |
} |
| 2547 |
m_dumpSpec.enableAuxDump = orgDumpAuxEnable; |
| 2548 |
|
| 2549 |
return eStatus; |
| 2550 |
} |
| 2551 |
|
| 2552 |
MOS_STATUS VpSurfaceDumper::DumpSurfaceArray( |
| 2553 |
PVPHAL_SURFACE *ppSurfaces, |
| 2554 |
uint32_t uiMaxSurfaces, |
| 2555 |
uint32_t uiNumSurfaces, |
| 2556 |
uint32_t uiFrameNumber, |
| 2557 |
uint32_t Location, |
| 2558 |
uint32_t uiDDI) |
| 2559 |
{ |
| 2560 |
VP_FUNC_CALL(); |
| 2561 |
|
| 2562 |
MOS_STATUS eStatus; |
| 2563 |
uint32_t uiIndex; |
| 2564 |
uint32_t uiLayer; |
| 2565 |
|
| 2566 |
//--------------------------------------------------- |
| 2567 |
VP_DEBUG_ASSERT(ppSurfaces); |
| 2568 |
//--------------------------------------------------- |
| 2569 |
|
| 2570 |
eStatus = MOS_STATUS_SUCCESS; |
| 2571 |
|
| 2572 |
for (uiIndex = 0, uiLayer = 0; |
| 2573 |
uiLayer < uiNumSurfaces && uiIndex < uiMaxSurfaces; uiIndex++) |
| 2574 |
{ |
| 2575 |
if (ppSurfaces[uiIndex]) |
| 2576 |
{ |
| 2577 |
VP_DEBUG_ASSERT(!Mos_ResourceIsNull(&ppSurfaces[uiIndex]->OsResource)); |
| 2578 |
|
| 2579 |
VP_DEBUG_CHK_STATUS(DumpSurface( |
| 2580 |
ppSurfaces[uiIndex], |
| 2581 |
uiFrameNumber, |
| 2582 |
uiLayer, |
| 2583 |
Location, |
| 2584 |
uiDDI)); |
| 2585 |
|
| 2586 |
uiLayer++; |
| 2587 |
} |
| 2588 |
} |
| 2589 |
|
| 2590 |
finish: |
| 2591 |
return eStatus; |
| 2592 |
} |
| 2593 |
|
| 2594 |
|
| 2595 |
void VpParameterDumper::GetParametersDumpSpec() |
| 2596 |
{ |
| 2597 |
VP_FUNC_CALL(); |
| 2598 |
|
| 2599 |
MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 2600 |
bool bDumpEnabled; |
| 2601 |
VPHAL_PARAMS_DUMP_SPEC *pDumpSpec = &m_dumpSpec; |
| 2602 |
MediaUserSetting::Value outValue; |
| 2603 |
|
| 2604 |
pDumpSpec->uiStartFrame = 0xFFFFFFFF; |
| 2605 |
pDumpSpec->uiEndFrame = 0; |
| 2606 |
pDumpSpec->outFileLocation[0] = '\0'; |
| 2607 |
bDumpEnabled = false; |
| 2608 |
|
| 2609 |
// Get start frame |
| 2610 |
// if start frame is not got assign a default value of 0 |
| 2611 |
ReadUserSettingForDebug( |
| 2612 |
m_userSettingPtr, |
| 2613 |
pDumpSpec->uiStartFrame, |
| 2614 |
__VPHAL_DBG_PARAM_DUMP_START_FRAME_KEY_NAME, |
| 2615 |
MediaUserSetting::Group::Sequence); |
| 2616 |
|
| 2617 |
// Get end frame |
| 2618 |
// if end frame is not got assign a default value of max |
| 2619 |
ReadUserSettingForDebug( |
| 2620 |
m_userSettingPtr, |
| 2621 |
pDumpSpec->uiEndFrame, |
| 2622 |
__VPHAL_DBG_PARAM_DUMP_END_FRAME_KEY_NAME, |
| 2623 |
MediaUserSetting::Group::Sequence); |
| 2624 |
|
| 2625 |
// Get out file path |
| 2626 |
ReadUserSettingForDebug( |
| 2627 |
m_userSettingPtr, |
| 2628 |
outValue, |
| 2629 |
__VPHAL_DBG_PARAM_DUMP_OUTFILE_KEY_NAME, |
| 2630 |
MediaUserSetting::Group::Sequence); |
| 2631 |
if (outValue.ConstString().size() > 0 && outValue.ConstString().size() < MOS_USER_CONTROL_MAX_DATA_SIZE) |
| 2632 |
{ |
| 2633 |
// Copy the Output path |
| 2634 |
MOS_SecureMemcpy( |
| 2635 |
pDumpSpec->outFileLocation, |
| 2636 |
MAX_PATH, |
| 2637 |
outValue.ConstString().c_str(), |
| 2638 |
outValue.ConstString().size()); |
| 2639 |
bDumpEnabled = true; |
| 2640 |
} |
| 2641 |
#if !defined(LINUX) && !defined(ANDROID) |
| 2642 |
else |
| 2643 |
{ |
| 2644 |
std::string vphalDumpFilePath; |
| 2645 |
|
| 2646 |
// Use state separation APIs to obtain appropriate storage location |
| 2647 |
if (SUCCEEDED(GetDriverPersistentStorageLocation(vphalDumpFilePath))) |
| 2648 |
{ |
| 2649 |
std::string m_outputFilePath; |
| 2650 |
|
| 2651 |
m_outputFilePath = vphalDumpFilePath.c_str(); |
| 2652 |
m_outputFilePath.append(VPHAL_DUMP_OUTPUT_FOLDER); |
| 2653 |
|
| 2654 |
// Copy the Output path |
| 2655 |
MOS_SecureMemcpy( |
| 2656 |
pDumpSpec->outFileLocation, |
| 2657 |
MAX_PATH, |
| 2658 |
m_outputFilePath.c_str(), |
| 2659 |
m_outputFilePath.size()); |
| 2660 |
|
| 2661 |
ReportUserSettingForDebug(m_userSettingPtr, __VPHAL_DBG_DUMP_OUTPUT_DIRECTORY, m_outputFilePath, MediaUserSetting::Group::Sequence); |
| 2662 |
|
| 2663 |
bDumpEnabled = true; |
| 2664 |
} |
| 2665 |
} |
| 2666 |
#endif |
| 2667 |
|
| 2668 |
// Get enableSkuWaDump |
| 2669 |
ReadUserSettingForDebug( |
| 2670 |
m_userSettingPtr, |
| 2671 |
pDumpSpec->enableSkuWaDump, |
| 2672 |
__VPHAL_DBG_PARA_DUMP_ENABLE_SKUWA_DUMP, |
| 2673 |
MediaUserSetting::Group::Sequence); |
| 2674 |
|
| 2675 |
if ((eStatus != MOS_STATUS_SUCCESS) || (!bDumpEnabled)) |
| 2676 |
{ |
| 2677 |
pDumpSpec->uiStartFrame = 1; |
| 2678 |
pDumpSpec->uiEndFrame = 0; |
| 2679 |
} |
| 2680 |
} |
| 2681 |
|
| 2682 |
MOS_STATUS VpParameterDumper::DumpSourceSurface( |
| 2683 |
uint32_t uiFrameCounter, |
| 2684 |
char *pcOutputPath, |
| 2685 |
PVPHAL_SURFACE pSrc, |
| 2686 |
uint32_t index, |
| 2687 |
char* &pcOutContents) |
| 2688 |
{ |
| 2689 |
VP_FUNC_CALL(); |
| 2690 |
|
| 2691 |
MOS_STATUS eStatus; |
| 2692 |
char sSurfaceFilePath[MAX_PATH] = { 0 }, sOsSurfaceFilePath[MAX_PATH] = { 0 }; |
| 2693 |
int32_t pid = MosUtilities::MosGetPid(); |
| 2694 |
uint64_t timeStamp = 0; |
| 2695 |
|
| 2696 |
MosUtilities::MosQueryPerformanceCounter(&timeStamp); |
| 2697 |
eStatus = MOS_STATUS_SUCCESS; |
| 2698 |
|
| 2699 |
//Color Information |
| 2700 |
{ |
| 2701 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<!-- Color Information -->\n")); |
| 2702 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_CSPACE>%s</VPHAL_CSPACE>\n", GetColorSpaceStr(pSrc->ColorSpace))); |
| 2703 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<EXTENDED_GAMUT></EXTENDED_GAMUT>\n")); |
| 2704 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<PALETTE_ALLOCATION>%d</PALETTE_ALLOCATION>\n", (pSrc->iPalette))); |
| 2705 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<PALETTE_DATA>\n")); |
| 2706 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<PALETTE_DATA_TYPE>%s</PALETTE_DATA_TYPE>\n", GetPaletteTypeStr(pSrc->Palette.PaletteType))); |
| 2707 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_CSPACE>%s</VPHAL_CSPACE>\n", GetColorSpaceStr(pSrc->Palette.ColorSpace))); |
| 2708 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<HAS_ALPHA>%d</HAS_ALPHA>\n", pSrc->Palette.bHasAlpha ? 1 : 0)); |
| 2709 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<TOTAL_ENTRIES>%d</TOTAL_ENTRIES>\n", pSrc->Palette.iTotalEntries)); |
| 2710 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<NUM_ENTRIES>%d</NUM_ENTRIES>\n", pSrc->Palette.iNumEntries)); |
| 2711 |
for (int nIndex = 0; nIndex < pSrc->Palette.iTotalEntries; nIndex++) |
| 2712 |
{ |
| 2713 |
if (pSrc->Palette.pPalette8) |
| 2714 |
{ |
| 2715 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<PVPHAL_COLOR_SAMPLE>%08x</PVPHAL_COLOR_SAMPLE>\n", pSrc->Palette.pPalette8[nIndex].dwValue)); |
| 2716 |
} |
| 2717 |
} |
| 2718 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</PALETTE_DATA>\n")); |
| 2719 |
|
| 2720 |
//Rendering parameters |
| 2721 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<!-- Rendering parameters -->\n")); |
| 2722 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_BLENDING_PARAMS>\n")); |
| 2723 |
if (pSrc->pBlendingParams) |
| 2724 |
{ |
| 2725 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_BLEND_TYPE>%s</VPHAL_BLEND_TYPE>\n", GetBlendTypeStr(pSrc->pBlendingParams->BlendType))); |
| 2726 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ALPHA type=\"real\">%.3f</ALPHA>\n", pSrc->pBlendingParams->fAlpha)); |
| 2727 |
} |
| 2728 |
else |
| 2729 |
{ |
| 2730 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ALPHA type=\"real\"></ALPHA>\n")); |
| 2731 |
} |
| 2732 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_BLENDING_PARAMS>\n")); |
| 2733 |
|
| 2734 |
//Luma key params |
| 2735 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_LUMAKEY_PARAMS>\n")); |
| 2736 |
if (pSrc->pLumaKeyParams) |
| 2737 |
{ |
| 2738 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<LUMA_LOW>%d</LUMA_LOW>\n", pSrc->pLumaKeyParams->LumaLow)); |
| 2739 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<LUMA_HIGH>%d</LUMA_HIGH>\n", pSrc->pLumaKeyParams->LumaHigh)); |
| 2740 |
} |
| 2741 |
else |
| 2742 |
{ |
| 2743 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<LUMA_LOW></LUMA_LOW>\n")); |
| 2744 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<LUMA_HIGH></LUMA_HIGH>\n")); |
| 2745 |
} |
| 2746 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_LUMAKEY_PARAMS>\n")); |
| 2747 |
|
| 2748 |
//ChromaSitting params |
| 2749 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_CHROMASITTING_PARAMS>\n")); |
| 2750 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CHROMA_SITING_HORZ_LEFT>%d</CHROMA_SITING_HORZ_LEFT>\n", (pSrc->ChromaSiting & CHROMA_SITING_HORZ_LEFT) == CHROMA_SITING_HORZ_LEFT ? 1 : 0)); |
| 2751 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CHROMA_SITING_HORZ_CENTER>%d</CHROMA_SITING_HORZ_CENTER>\n", (pSrc->ChromaSiting & CHROMA_SITING_HORZ_CENTER) == CHROMA_SITING_HORZ_CENTER ? 1 : 0)); |
| 2752 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CHROMA_SITING_HORZ_RIGHT>%d</CHROMA_SITING_HORZ_RIGHT>\n", (pSrc->ChromaSiting & CHROMA_SITING_HORZ_RIGHT) == CHROMA_SITING_HORZ_RIGHT ? 1 : 0)); |
| 2753 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CHROMA_SITING_VERT_TOP>%d</CHROMA_SITING_VERT_TOP>\n", (pSrc->ChromaSiting & CHROMA_SITING_VERT_TOP) == CHROMA_SITING_VERT_TOP ? 1 : 0)); |
| 2754 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CHROMA_SITING_VERT_CENTER>%d</CHROMA_SITING_VERT_CENTER>\n", (pSrc->ChromaSiting & CHROMA_SITING_VERT_CENTER) == CHROMA_SITING_VERT_CENTER ? 1 : 0)); |
| 2755 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CHROMA_SITING_VERT_BOTTOM>%d</CHROMA_SITING_VERT_BOTTOM>\n", (pSrc->ChromaSiting & CHROMA_SITING_VERT_BOTTOM) == CHROMA_SITING_VERT_BOTTOM ? 1 : 0)); |
| 2756 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_CHROMASITTING_PARAMS>\n")); |
| 2757 |
|
| 2758 |
//Propcamp params |
| 2759 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_PROCAMP_PARAMS>\n")); |
| 2760 |
if (pSrc->pProcampParams) |
| 2761 |
{ |
| 2762 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLED>%d</ENABLED>\n", (pSrc->pProcampParams->bEnabled ? 1 : 0))); |
| 2763 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<BRIGHTNESS type=\"real\">%.3f</BRIGHTNESS>\n", pSrc->pProcampParams->fBrightness)); |
| 2764 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CONTRAST type=\"real\">%.3f</CONTRAST>\n", pSrc->pProcampParams->fContrast)); |
| 2765 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<HUE type=\"real\">%.3f</HUE>\n", pSrc->pProcampParams->fHue)); |
| 2766 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<SATURATION type=\"real\">%.3f</SATURATION>\n", pSrc->pProcampParams->fSaturation)); |
| 2767 |
} |
| 2768 |
else |
| 2769 |
{ |
| 2770 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLED></ENABLED>\n")); |
| 2771 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<BRIGHTNESS type=\"real\"></BRIGHTNESS>\n")); |
| 2772 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CONTRAST type=\"real\"></CONTRAST>\n")); |
| 2773 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<HUE type=\"real\"></HUE>\n")); |
| 2774 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<SATURATION type=\"real\"></SATURATION>\n")); |
| 2775 |
} |
| 2776 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_PROCAMP_PARAMS>\n")); |
| 2777 |
|
| 2778 |
//IEF parameter |
| 2779 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_IEF_PARAMS>\n")); |
| 2780 |
if (pSrc->pIEFParams) |
| 2781 |
{ |
| 2782 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<IEFFACTOR type = \"real\">%.3f</IEFFACTOR>\n", pSrc->pIEFParams->fIEFFactor)); |
| 2783 |
} |
| 2784 |
else |
| 2785 |
{ |
| 2786 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<IEFFACTOR type = \"real\"></IEFFACTOR>\n")); |
| 2787 |
} |
| 2788 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_IEF_PARAMS>\n")); |
| 2789 |
|
| 2790 |
//Advanced processing |
| 2791 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<!-- Advanced processing -->\n")); |
| 2792 |
//DI |
| 2793 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_DI_PARAMS>\n")); |
| 2794 |
if (pSrc->pDeinterlaceParams) |
| 2795 |
{ |
| 2796 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<DIMODE>%s</DIMODE>\n", GetDIModeStr(pSrc->pDeinterlaceParams->DIMode))); |
| 2797 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<ENABLE_FMD>%d</ENABLE_FMD>\n", (pSrc->pDeinterlaceParams->bEnableFMD ? 1 : 0))); |
| 2798 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<SINGLE_FIELD>%d</SINGLE_FIELD>\n", (pSrc->pDeinterlaceParams->bSingleField ? 1 : 0))); |
| 2799 |
} |
| 2800 |
else |
| 2801 |
{ |
| 2802 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<DIMODE></DIMODE>\n")); |
| 2803 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<ENABLE_FMD></ENABLE_FMD>\n")); |
| 2804 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<SINGLE_FIELD></SINGLE_FIELD>\n")); |
| 2805 |
} |
| 2806 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_DI_PARAMS>\n")); |
| 2807 |
//Denoise |
| 2808 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_DENOISE_PARAMS>\n")); |
| 2809 |
if (pSrc->pDenoiseParams) |
| 2810 |
{ |
| 2811 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_LUMA>%d</ENABLE_LUMA>\n", (pSrc->pDenoiseParams->bEnableLuma ? 1 : 0))); |
| 2812 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_CHROMA>%d</ENABLE_CHROMA>\n", (pSrc->pDenoiseParams->bEnableChroma ? 1 : 0))); |
| 2813 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<AUTO_DETECT>%d</AUTO_DETECT>\n", (pSrc->pDenoiseParams->bAutoDetect ? 1 : 0))); |
| 2814 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<DENOISE_FACTOR>%.3f</DENOISE_FACTOR>\n", (pSrc->pDenoiseParams->fDenoiseFactor))); |
| 2815 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<NOISE_LEVEL>%s</NOISE_LEVEL>\n", GetDenoiseModeStr(pSrc->pDenoiseParams->NoiseLevel))); |
| 2816 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_HVS_DENOISE>%d</ENABLE_HVS_DENOISE>\n", (pSrc->pDenoiseParams->bEnableHVSDenoise ? 1 : 0))); |
| 2817 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<HVS_DENOISE_QP>%d</HVS_DENOISE_QP>\n", (pSrc->pDenoiseParams->HVSDenoise.QP))); |
| 2818 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<HVS_DENOISE_STRENGTH>%d</HVS_DENOISE_STRENGTH>\n", (pSrc->pDenoiseParams->HVSDenoise.Strength))); |
| 2819 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<HVS_DENOISE_MODE>%s</HVS_DENOISE_MODE>\n", GetHVSDenoiseModeStr(pSrc->pDenoiseParams->HVSDenoise.Mode))); |
| 2820 |
} |
| 2821 |
else |
| 2822 |
{ |
| 2823 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_LUMA></ENABLE_LUMA>\n")); |
| 2824 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_CHROMA></ENABLE_CHROMA>\n")); |
| 2825 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<AUTO_DETECT></AUTO_DETECT>\n")); |
| 2826 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<DENOISE_FACTOR></DENOISE_FACTOR>\n")); |
| 2827 |
} |
| 2828 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_DENOISE_PARAMS>\n")); |
| 2829 |
//ColorPipe |
| 2830 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_COLORPIPE_PARAMS>\n")); |
| 2831 |
if (pSrc->pColorPipeParams) |
| 2832 |
{ |
| 2833 |
VPHAL_TCC_PARAMS TccParams = pSrc->pColorPipeParams->TccParams; |
| 2834 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_ACE>%d</ENABLE_ACE>\n", (pSrc->pColorPipeParams->bEnableACE ? 1 : 0))); |
| 2835 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_STE>%d</ENABLE_STE>\n", (pSrc->pColorPipeParams->bEnableSTE ? 1 : 0))); |
| 2836 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_TCC>%d</ENABLE_TCC>\n", (pSrc->pColorPipeParams->bEnableTCC ? 1 : 0))); |
| 2837 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ACE_LEVEL>%d</ACE_LEVEL>\n", (pSrc->pColorPipeParams->dwAceLevel))); |
| 2838 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ACE_STRENGHTH>%d</ACE_STRENGHTH>\n", (pSrc->pColorPipeParams->dwAceStrength))); |
| 2839 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<STE_PARAMS>\n")); |
| 2840 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t\t<STE_FACTOR>%d</STE_FACTOR>\n", (pSrc->pColorPipeParams->SteParams.dwSTEFactor))); |
| 2841 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t</STE_PARAMS>\n")); |
| 2842 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<TCC_PARAMS>%d,%d,%d,%d,%d,%d</TCC_PARAMS>\n", TccParams.Blue, TccParams.Cyan, TccParams.Green, TccParams.Magenta, TccParams.Red, TccParams.Yellow)); |
| 2843 |
} |
| 2844 |
else |
| 2845 |
{ |
| 2846 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_ACE></ENABLE_ACE>\n")); |
| 2847 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_STE></ENABLE_STE>\n")); |
| 2848 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ENABLE_TCC></ENABLE_TCC>\n")); |
| 2849 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<ACE_LEVEL></ACE_LEVEL>\n")); |
| 2850 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<STE_PARAMS></STE_PARAMS>\n")); |
| 2851 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<TCC_PARAMS></TCC_PARAMS>\n")); |
| 2852 |
} |
| 2853 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_COLORPIPE_PARAMS>\n")); |
| 2854 |
//Gamut |
| 2855 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_GAMUT_PARAMS>\n")); |
| 2856 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<GCOMP_MODE></GCOMP_MODE>\n")); |
| 2857 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_GAMUT_PARAMS>\n")); |
| 2858 |
|
| 2859 |
//Sample information |
| 2860 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<!-- Sample information -->\n")); |
| 2861 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_FORMAT>%s</VPHAL_FORMAT>\n", GetWholeFormatStr(pSrc->Format))); |
| 2862 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_SURFACE_TYPE>%s</VPHAL_SURFACE_TYPE>\n", GetSurfaceTypeStr(pSrc->SurfType))); |
| 2863 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_SAMPLE_TYPE>%s</VPHAL_SAMPLE_TYPE>\n", GetSampleTypeStr(pSrc->SampleType))); |
| 2864 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_SCALING_MODE>%s</VPHAL_SCALING_MODE>\n", GetScalingModeStr(pSrc->ScalingMode))); |
| 2865 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_ROTATION_MODE>%s</VPHAL_ROTATION_MODE>\n", GetRotationModeStr(pSrc->Rotation))); |
| 2866 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<RCSRC>%d,%d,%d,%d</RCSRC>\n", pSrc->rcSrc.left, pSrc->rcSrc.top, pSrc->rcSrc.right, pSrc->rcSrc.bottom)); |
| 2867 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<RCDST>%d,%d,%d,%d</RCDST>\n", pSrc->rcDst.left, pSrc->rcDst.top, pSrc->rcDst.right, pSrc->rcDst.bottom)); |
| 2868 |
|
| 2869 |
//Basic information |
| 2870 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<!-- Basic information -->\n")); |
| 2871 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_TILE_TYPE>%s</VPHAL_TILE_TYPE>\n", GetTileTypeStr(pSrc->TileType))); |
| 2872 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_TILE_MODE>%s</VPHAL_TILE_MODE>\n", GetTileModeGMMStr(pSrc->TileModeGMM))); |
| 2873 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<WIDTH>%d</WIDTH>\n", pSrc->dwWidth)); |
| 2874 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<HEIGHT>%d</HEIGHT>\n", pSrc->dwHeight)); |
| 2875 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<PITCH>%d</PITCH>\n", pSrc->dwPitch)); |
| 2876 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<SIZE>%d</SIZE>\n", pSrc->dwPitch * pSrc->dwHeight)); |
| 2877 |
|
| 2878 |
//Surface content initialization |
| 2879 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<!-- Surface content initialization -->\n")); |
| 2880 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<DATA>\n")); |
| 2881 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<DEFAULT_COLOR type=\"integer\">0x000000FF</DEFAULT_COLOR>\n")); |
| 2882 |
if (pcOutputPath) |
| 2883 |
{ |
| 2884 |
memset(sSurfaceFilePath, 0, MAX_PATH); |
| 2885 |
memset(sOsSurfaceFilePath, 0, MAX_PATH); |
| 2886 |
|
| 2887 |
MOS_SecureStringPrint(sSurfaceFilePath, MAX_PATH, MAX_PATH, "%s%csurfdump_pid%x_ts%llx_loc[preALL]_lyr[%d]_f[%04d]_w[%d]_h[%d]_p[%d].%s", |
| 2888 |
pcOutputPath, MOS_DIR_SEPERATOR, pid, timeStamp, index, uiFrameCounter, pSrc->dwWidth, pSrc->dwHeight, pSrc->dwPitch, VpDumperTool::GetFormatStr(pSrc->Format)); |
| 2889 |
VpDumperTool::GetOsFilePath(sSurfaceFilePath, sOsSurfaceFilePath); |
| 2890 |
} |
| 2891 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<FILE>%s</FILE>\n", sOsSurfaceFilePath)); |
| 2892 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</DATA>\n")); |
| 2893 |
// get backward reference |
| 2894 |
if (pSrc->pBwdRef) |
| 2895 |
{ |
| 2896 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<BACKREFDATA>\n")); |
| 2897 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<DEFAULT_COLOR type=\"integer\">0x000000FF</DEFAULT_COLOR>\n")); |
| 2898 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<Num>%d</Num>\n", pSrc->uBwdRefCount)); |
| 2899 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<FILE></FILE>\n")); |
| 2900 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</BACKREFDATA>\n")); |
| 2901 |
} |
| 2902 |
// get forward reference |
| 2903 |
if (pSrc->pFwdRef) |
| 2904 |
{ |
| 2905 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<FWDREFDATA>\n")); |
| 2906 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<Num>%d</Num>\n", pSrc->uFwdRefCount)); |
| 2907 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</FWDREFDATA>\n")); |
| 2908 |
} |
| 2909 |
} |
| 2910 |
|
| 2911 |
finish: |
| 2912 |
return eStatus; |
| 2913 |
} |
| 2914 |
|
| 2915 |
MOS_STATUS VpParameterDumper::DumpTargetSurface( |
| 2916 |
uint32_t uiFrameCounter, |
| 2917 |
char *pcOutputPath, |
| 2918 |
PVPHAL_SURFACE pTarget, |
| 2919 |
uint32_t index, |
| 2920 |
char* &pcOutContents) |
| 2921 |
{ |
| 2922 |
VP_FUNC_CALL(); |
| 2923 |
|
| 2924 |
MOS_STATUS eStatus; |
| 2925 |
|
| 2926 |
eStatus = MOS_STATUS_SUCCESS; |
| 2927 |
|
| 2928 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_FORMAT>%s</VPHAL_FORMAT>\n", VpParameterDumper::GetWholeFormatStr(pTarget->Format))); |
| 2929 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_SURFACE_TYPE>%s</VPHAL_SURFACE_TYPE>\n", VpParameterDumper::GetSurfaceTypeStr(pTarget->SurfType))); |
| 2930 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_SAMPLE_TYPE>%s</VPHAL_SAMPLE_TYPE>\n", GetSampleTypeStr(pTarget->SampleType))); |
| 2931 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_CSPACE>%s</VPHAL_CSPACE>\n", GetColorSpaceStr(pTarget->ColorSpace))); |
| 2932 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_SCALING_MODE>%s</VPHAL_SCALING_MODE>\n", GetScalingModeStr(pTarget->ScalingMode))); |
| 2933 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_TILE_TYPE>%s</VPHAL_TILE_TYPE>\n", GetTileTypeStr(pTarget->TileType))); |
| 2934 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<VPHAL_TILE_MODE>%s</VPHAL_TILE_MODE>\n", GetTileModeGMMStr(pTarget->TileModeGMM))); |
| 2935 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<WIDTH>%d</WIDTH>\n", pTarget->dwWidth)); |
| 2936 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<HEIGHT>%d</HEIGHT>\n", pTarget->dwHeight)); |
| 2937 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<PITCH>%d</PITCH>\n", pTarget->dwPitch)); |
| 2938 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<SIZE>%d</SIZE>\n", pTarget->dwPitch*pTarget->dwHeight)); |
| 2939 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<RCSRC>%d,%d,%d,%d</RCSRC>\n", pTarget->rcSrc.left, pTarget->rcSrc.top, pTarget->rcSrc.right, pTarget->rcSrc.bottom)); |
| 2940 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<RCDST>%d,%d,%d,%d</RCDST>\n", pTarget->rcDst.left, pTarget->rcDst.top, pTarget->rcDst.right, pTarget->rcDst.bottom)); |
| 2941 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<DATA>\n")); |
| 2942 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t\t<DEFAULT_COLOR type=\"integer\">0x000000FF</DEFAULT_COLOR>\n")); |
| 2943 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t\t<FILE></FILE>\n")); |
| 2944 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t</DATA>\n")); |
| 2945 |
//Gamut |
| 2946 |
if (pTarget->pGamutParams) |
| 2947 |
{ |
| 2948 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_GAMUT_PARAMS>\n")); |
| 2949 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<GAMMA_VALUE>%s</GAMMA_VALUE>\n", VpParameterDumper::GetGammaValueTypeStr(pTarget->pGamutParams->GammaValue))); |
| 2950 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_GAMUT_PARAMS>\n")); |
| 2951 |
} |
| 2952 |
|
| 2953 |
finish: |
| 2954 |
return eStatus; |
| 2955 |
} |
| 2956 |
|
| 2957 |
MOS_STATUS VpParameterDumper::DumpRenderParameter( |
| 2958 |
uint32_t uiFrameCounter, |
| 2959 |
char *pcOutputPath, |
| 2960 |
PVPHAL_RENDER_PARAMS pRenderParams, |
| 2961 |
char* &pcOutContents) |
| 2962 |
{ |
| 2963 |
VP_FUNC_CALL(); |
| 2964 |
|
| 2965 |
MOS_STATUS eStatus; |
| 2966 |
|
| 2967 |
eStatus = MOS_STATUS_SUCCESS; |
| 2968 |
|
| 2969 |
if (pRenderParams->pTarget[0]) |
| 2970 |
{ |
| 2971 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_SURFACE_TARGET>\n")); |
| 2972 |
VP_DEBUG_CHK_STATUS(DumpTargetSurface( |
| 2973 |
uiFrameCounter, |
| 2974 |
pcOutputPath, |
| 2975 |
pRenderParams->pTarget[0], |
| 2976 |
0, |
| 2977 |
pcOutContents)); |
| 2978 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_SURFACE_TARGET>\n")); |
| 2979 |
} |
| 2980 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<SRC_COUNT>%d</SRC_COUNT>\n", pRenderParams->uSrcCount)); |
| 2981 |
|
| 2982 |
//Color fill |
| 2983 |
if (pRenderParams->pColorFillParams) |
| 2984 |
{ |
| 2985 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_COLORFILL_PARAMS>\n")); |
| 2986 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<bYCbCr>%d</bYCbCr>\n", pRenderParams->pColorFillParams->bYCbCr)); |
| 2987 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<COLOR Float Enable=\"integer\">%d</COLOR>\n", pRenderParams->pColorFillParams->isFloat)); |
| 2988 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<COLOR type=\"integer\">%08x</COLOR>\n", pRenderParams->pColorFillParams->Color)); |
| 2989 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<COLOR Float type=\"integer\">%f, %f, %f, %f</COLOR>\n", pRenderParams->pColorFillParams->ColorFloat[0], pRenderParams->pColorFillParams->ColorFloat[1], pRenderParams->pColorFillParams->ColorFloat[2], pRenderParams->pColorFillParams->ColorFloat[3])); |
| 2990 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t\t<CSPACE>%s</CSPACE>\n", GetColorSpaceStr(pRenderParams->pColorFillParams->CSpace))); |
| 2991 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t</VPHAL_COLORFILL_PARAMS>\n")); |
| 2992 |
} |
| 2993 |
|
| 2994 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t\t<VPHAL_COMPONENT>%s</VPHAL_COMPONENT>\n", GetComponentStr(pRenderParams->Component))); |
| 2995 |
|
| 2996 |
finish: |
| 2997 |
return eStatus; |
| 2998 |
} |
| 2999 |
|
| 3000 |
MOS_STATUS VpParameterDumper::DumpToXML( |
| 3001 |
uint32_t uiFrameCounter, |
| 3002 |
char *pcOutputPath, |
| 3003 |
PVPHAL_RENDER_PARAMS pRenderParams) |
| 3004 |
{ |
| 3005 |
VP_FUNC_CALL(); |
| 3006 |
|
| 3007 |
char sPath[MAX_PATH] = { 0 }, sOsPath[MAX_PATH] = { 0 }; |
| 3008 |
MOS_STATUS eStatus; |
| 3009 |
char* pcOutContents; |
| 3010 |
uint32_t dwStrLen = 0; |
| 3011 |
FILE *fpOutXML; |
| 3012 |
char* pCurFrameFileName; |
| 3013 |
char* pBwdFrameFileName; |
| 3014 |
VPHAL_PARAMS_DUMP_SPEC *pParamsDumpSpec = &m_dumpSpec; |
| 3015 |
int32_t pid = MosUtilities::MosGetPid(); |
| 3016 |
uint64_t timeStamp = 0; |
| 3017 |
|
| 3018 |
MosUtilities::MosQueryPerformanceCounter(&timeStamp); |
| 3019 |
eStatus = MOS_STATUS_SUCCESS; |
| 3020 |
dwStrLen = 0; |
| 3021 |
pcOutContents = nullptr; |
| 3022 |
fpOutXML = nullptr; |
| 3023 |
pCurFrameFileName = nullptr; |
| 3024 |
pBwdFrameFileName = nullptr; |
| 3025 |
|
| 3026 |
VP_DEBUG_CHK_NULL(pRenderParams); |
| 3027 |
VP_DEBUG_CHK_NULL(pParamsDumpSpec); |
| 3028 |
|
| 3029 |
if ((pParamsDumpSpec->uiEndFrame < pParamsDumpSpec->uiStartFrame) || pParamsDumpSpec->uiEndFrame ==0 || strlen(pParamsDumpSpec->outFileLocation) == 0) |
| 3030 |
goto finish; |
| 3031 |
|
| 3032 |
// Create a processing instruction element. |
| 3033 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(true, &pcOutContents, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")); |
| 3034 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\n")); |
| 3035 |
// Create the root element. |
| 3036 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "<VPHAL_SCENARIO>\n")); |
| 3037 |
// General infomation |
| 3038 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<ID>%d</ID>\n", MosUtilities::MosGetPid())); |
| 3039 |
|
| 3040 |
VP_DEBUG_CHK_NULL(pRenderParams->pSrc[0]); |
| 3041 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<DESCRIPTION>%d</DESCRIPTION>\n", pRenderParams->pSrc[0]->FrameID)); |
| 3042 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<!-- Number of frames to render -->\n")); |
| 3043 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<FRAME_COUNT type = \"integer\">1</FRAME_COUNT>\n")); |
| 3044 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<!-- 60i or 30p BLT -->\n")); |
| 3045 |
if ((pRenderParams->uSrcCount > 0) && |
| 3046 |
(pRenderParams->pSrc[0]->SampleType != SAMPLE_PROGRESSIVE)) |
| 3047 |
{ |
| 3048 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<BLT_TYPE>60i</BLT_TYPE>\n")); |
| 3049 |
} |
| 3050 |
else |
| 3051 |
{ |
| 3052 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<BLT_TYPE>30p</BLT_TYPE>\n")); |
| 3053 |
} |
| 3054 |
|
| 3055 |
// Surface |
| 3056 |
for (uint32_t i = 0; i < pRenderParams->uSrcCount; i++) |
| 3057 |
{ |
| 3058 |
if (pRenderParams->pSrc[i] == nullptr) |
| 3059 |
continue; |
| 3060 |
|
| 3061 |
//surface infomation |
| 3062 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<!-- Input surface definitions -->\n")); |
| 3063 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<VPHAL_SURFACE>\n")); |
| 3064 |
|
| 3065 |
VP_DEBUG_CHK_STATUS(DumpSourceSurface( |
| 3066 |
uiFrameCounter, |
| 3067 |
pcOutputPath, |
| 3068 |
pRenderParams->pSrc[i], |
| 3069 |
i, |
| 3070 |
pcOutContents)); |
| 3071 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t</VPHAL_SURFACE>\n")); |
| 3072 |
} |
| 3073 |
|
| 3074 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<!-- Rendering parameters -->\n")); |
| 3075 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t<VPHAL_RENDER_PARAMS>\n")); |
| 3076 |
|
| 3077 |
VP_DEBUG_CHK_STATUS(DumpRenderParameter( |
| 3078 |
uiFrameCounter, |
| 3079 |
pcOutputPath, |
| 3080 |
pRenderParams, |
| 3081 |
pcOutContents)); |
| 3082 |
|
| 3083 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "\t</VPHAL_RENDER_PARAMS>\n")); |
| 3084 |
VP_DEBUG_CHK_STATUS(VpDumperTool::AppendString(false, &pcOutContents, "</VPHAL_SCENARIO>\n")); |
| 3085 |
|
| 3086 |
MOS_SecureStringPrint(sPath, MAX_PATH, MAX_PATH, "%s%cparam_dump_pid%x_ts%llx[%04d].xml", pParamsDumpSpec->outFileLocation, MOS_DIR_SEPERATOR, pid, timeStamp, uiFrameCounter); |
| 3087 |
|
| 3088 |
VpDumperTool::GetOsFilePath(sPath, sOsPath); |
| 3089 |
|
| 3090 |
VP_DEBUG_CHK_STATUS(MosUtilities::MosWriteFileFromPtr(sOsPath, pcOutContents, strlen(pcOutContents))); |
| 3091 |
finish: |
| 3092 |
if (pcOutContents) |
| 3093 |
{ |
| 3094 |
MOS_FreeMemory(pcOutContents); |
| 3095 |
pcOutContents = nullptr; |
| 3096 |
} |
| 3097 |
return eStatus; |
| 3098 |
} |
| 3099 |
|
| 3100 |
VpParameterDumper::VpParameterDumper(PMOS_INTERFACE pOsInterface): |
| 3101 |
m_dumpSpec(), |
| 3102 |
m_osInterface(pOsInterface) |
| 3103 |
{ |
| 3104 |
if (m_osInterface) |
| 3105 |
{ |
| 3106 |
m_userSettingPtr = m_osInterface->pfnGetUserSettingInstance(m_osInterface); |
| 3107 |
} |
| 3108 |
} |
| 3109 |
|
| 3110 |
VpParameterDumper::~VpParameterDumper() |
| 3111 |
{ |
| 3112 |
} |
| 3113 |
|
| 3114 |
const char * VpDumperTool::GetFormatStr(MOS_FORMAT format) |
| 3115 |
{ |
| 3116 |
VP_FUNC_CALL(); |
| 3117 |
|
| 3118 |
switch (format) |
| 3119 |
{ |
| 3120 |
case Format_A8R8G8B8 : return _T("argb"); |
| 3121 |
case Format_X8R8G8B8 : return _T("xrgb"); |
| 3122 |
case Format_A8B8G8R8 : return _T("abgr"); |
| 3123 |
case Format_X8B8G8R8 : return _T("xbgr"); |
| 3124 |
case Format_A16R16G16B16: return _T("argb16"); |
| 3125 |
case Format_A16B16G16R16: return _T("abgr16"); |
| 3126 |
case Format_R5G6B5 : return _T("rgb16"); |
| 3127 |
case Format_R8G8B8 : return _T("rgb"); |
| 3128 |
case Format_R32U : return _T("r32u"); |
| 3129 |
case Format_RGBP : return _T("rgbp"); |
| 3130 |
case Format_BGRP : return _T("bgrp"); |
| 3131 |
case Format_R32F : return _T("r32f"); |
| 3132 |
case Format_YUY2 : return _T("yuy2"); |
| 3133 |
case Format_YUYV : return _T("yuyv"); |
| 3134 |
case Format_YVYU : return _T("yvyu"); |
| 3135 |
case Format_UYVY : return _T("uyvy"); |
| 3136 |
case Format_VYUY : return _T("vyuy"); |
| 3137 |
case Format_Y416 : return _T("y416"); |
| 3138 |
case Format_AYUV : return _T("ayuv"); |
| 3139 |
case Format_AUYV : return _T("auyv"); |
| 3140 |
case Format_NV12 : return _T("nv12"); |
| 3141 |
case Format_NV11 : return _T("nv11"); |
| 3142 |
case Format_P208 : return _T("p208"); |
| 3143 |
case Format_IMC1 : return _T("imc1"); |
| 3144 |
case Format_IMC2 : return _T("imc2"); |
| 3145 |
case Format_IMC3 : return _T("imc3"); |
| 3146 |
case Format_IMC4 : return _T("imc4"); |
| 3147 |
case Format_422H : return _T("422h"); |
| 3148 |
case Format_422V : return _T("422v"); |
| 3149 |
case Format_444P : return _T("444p"); |
| 3150 |
case Format_411P : return _T("411p"); |
| 3151 |
case Format_411R : return _T("411r"); |
| 3152 |
case Format_400P : return _T("400p"); |
| 3153 |
case Format_I420 : return _T("i420"); |
| 3154 |
case Format_IYUV : return _T("iyuv"); |
| 3155 |
case Format_YV12 : return _T("yv12"); |
| 3156 |
case Format_YVU9 : return _T("yvu9"); |
| 3157 |
case Format_AI44 : return _T("ai44"); |
| 3158 |
case Format_IA44 : return _T("ia44"); |
| 3159 |
case Format_P8 : return _T("P8"); |
| 3160 |
case Format_STMM : return _T("stmm"); |
| 3161 |
case Format_Buffer : return _T("buff"); |
| 3162 |
case Format_RAW : return _T("buff"); |
| 3163 |
case Format_PAL : return _T("pal"); |
| 3164 |
case Format_A8P8 : return _T("a8p8"); |
| 3165 |
case Format_A8 : return _T("a8"); |
| 3166 |
case Format_L8 : return _T("l8"); |
| 3167 |
case Format_A4L4 : return _T("a4l4"); |
| 3168 |
case Format_A8L8 : return _T("a8l8"); |
| 3169 |
case Format_V8U8 : return _T("v8u8"); |
| 3170 |
case Format_IRW0 : return _T("irw0"); |
| 3171 |
case Format_IRW1 : return _T("irw1"); |
| 3172 |
case Format_IRW2 : return _T("irw2"); |
| 3173 |
case Format_IRW3 : return _T("irw3"); |
| 3174 |
case Format_R10G10B10A2 : return _T("r10g10b10a2"); |
| 3175 |
case Format_B10G10R10A2 : return _T("b10g10r10a2"); |
| 3176 |
case Format_P010 : return _T("p010"); |
| 3177 |
case Format_P016 : return _T("p016"); |
| 3178 |
case Format_R16F : return _T("r16f"); |
| 3179 |
case Format_R16G16F : return _T("r16g16f"); |
| 3180 |
case Format_Y210 : return _T("y210"); |
| 3181 |
case Format_Y216 : return _T("y216"); |
| 3182 |
case Format_Y410 : return _T("y410"); |
| 3183 |
case Format_P210 : return _T("p210"); |
| 3184 |
case Format_P216 : return _T("p216"); |
| 3185 |
case Format_A16B16G16R16F : return _T("abgr16_float"); |
| 3186 |
case Format_A16R16G16B16F : return _T("argb16_float"); |
| 3187 |
default : return _T("Err"); |
| 3188 |
} |
| 3189 |
|
| 3190 |
return nullptr; |
| 3191 |
} |
| 3192 |
|
| 3193 |
MOS_STATUS VpDumperTool::GetSurfaceSize( |
| 3194 |
PVPHAL_SURFACE pSurface, |
| 3195 |
uint32_t iBpp, |
| 3196 |
uint32_t* piWidthInBytes, |
| 3197 |
uint32_t* piHeightInRows) |
| 3198 |
{ |
| 3199 |
VP_FUNC_CALL(); |
| 3200 |
|
| 3201 |
MOS_STATUS eStatus; |
| 3202 |
uint32_t iWidthInBytes; |
| 3203 |
uint32_t iHeightInRows; |
| 3204 |
|
| 3205 |
//------------------------------------------- |
| 3206 |
VP_DEBUG_ASSERT(pSurface->dwWidth >= 1); |
| 3207 |
VP_DEBUG_ASSERT(pSurface->dwHeight >= 1); |
| 3208 |
VP_DEBUG_ASSERT(pSurface->dwPitch >= 1); |
| 3209 |
//------------------------------------------- |
| 3210 |
|
| 3211 |
eStatus = MOS_STATUS_SUCCESS; |
| 3212 |
|
| 3213 |
switch (pSurface->Format) |
| 3214 |
{ |
| 3215 |
// Packed Formats |
| 3216 |
case Format_A8R8G8B8: |
| 3217 |
case Format_X8R8G8B8: |
| 3218 |
case Format_A8B8G8R8: |
| 3219 |
case Format_X8B8G8R8: |
| 3220 |
case Format_R5G6B5: |
| 3221 |
case Format_R8G8B8: |
| 3222 |
case Format_R32U: |
| 3223 |
case Format_R32F: |
| 3224 |
case Format_AYUV: |
| 3225 |
case Format_YUY2: |
| 3226 |
case Format_YUYV: |
| 3227 |
case Format_YVYU: |
| 3228 |
case Format_UYVY: |
| 3229 |
case Format_VYUY: |
| 3230 |
case Format_AI44: |
| 3231 |
case Format_IA44: |
| 3232 |
case Format_P8: |
| 3233 |
case Format_A8P8: |
| 3234 |
case Format_A8: |
| 3235 |
case Format_L8: |
| 3236 |
case Format_A4L4: |
| 3237 |
case Format_A8L8: |
| 3238 |
case Format_V8U8: |
| 3239 |
case Format_R10G10B10A2: |
| 3240 |
case Format_B10G10R10A2: |
| 3241 |
case Format_Y410: |
| 3242 |
case Format_Y416: |
| 3243 |
case Format_Y210: |
| 3244 |
case Format_Y216: |
| 3245 |
iWidthInBytes = pSurface->dwWidth * iBpp / 8; |
| 3246 |
iHeightInRows = pSurface->dwHeight; |
| 3247 |
break; |
| 3248 |
|
| 3249 |
// 4:2:0 (12-bits per pixel) |
| 3250 |
// IMC1 // IMC3 |
| 3251 |
// -----------------> // -----------------> |
| 3252 |
// ________________________ // ________________________ |
| 3253 |
//|Y0|Y1| | //|Y0|Y1| | |
| 3254 |
//|__|__| | //|__|__| | |
| 3255 |
//| | //| | |
| 3256 |
//| | //| | |
| 3257 |
//| | //| | |
| 3258 |
//| | //| | |
| 3259 |
//| | //| | |
| 3260 |
//|________________________| //|________________________| |
| 3261 |
//|V0|V1| | | //|U0|U1| | | |
| 3262 |
//|__|__| | | //|__|__| | | |
| 3263 |
//| | | //| | | |
| 3264 |
//|____________| PAD | //|____________| PAD | |
| 3265 |
//|U0|U1| | | //|V0|V1| | | |
| 3266 |
//|__|__| | | //|__|__| | | |
| 3267 |
//| | | //| | | |
| 3268 |
//|____________|___________| //|____________|___________| |
| 3269 |
case Format_IMC1: |
| 3270 |
case Format_IMC3: |
| 3271 |
iWidthInBytes = pSurface->dwWidth; |
| 3272 |
iHeightInRows = pSurface->dwHeight * 2; |
| 3273 |
break; |
| 3274 |
|
| 3275 |
// 4:0:0 (8-bits per pixel) |
| 3276 |
// 400P |
| 3277 |
// -----------------> |
| 3278 |
// ________________________ |
| 3279 |
//|Y0|Y1| | |
| 3280 |
//|__|__| | |
| 3281 |
//| | |
| 3282 |
//| | |
| 3283 |
//| | |
| 3284 |
//| | |
| 3285 |
//| | |
| 3286 |
//|________________________| |
| 3287 |
case Format_400P: |
| 3288 |
case Format_Buffer: |
| 3289 |
case Format_RAW: |
| 3290 |
iWidthInBytes = pSurface->dwWidth; |
| 3291 |
iHeightInRows = pSurface->dwHeight; |
| 3292 |
break; |
| 3293 |
|
| 3294 |
// 4:1:1 (12-bits per pixel) // 4:2:2 (16-bits per pixel) |
| 3295 |
// 411P // 422H |
| 3296 |
// -----------------> // -----------------> |
| 3297 |
// ________________________ // ________________________ |
| 3298 |
//|Y0|Y1| | //|Y0|Y1| | |
| 3299 |
//|__|__| | //|__|__| | |
| 3300 |
//| | //| | |
| 3301 |
//| | //| | |
| 3302 |
//| | //| | |
| 3303 |
//| | //| | |
| 3304 |
//| | //| | |
| 3305 |
//|________________________| //|________________________| |
| 3306 |
//|U0|U1|| | //|U0|U1| | | |
| 3307 |
//|__|__|| | //|__|__| | | |
| 3308 |
//| | | //| | | |
| 3309 |
//| | PAD | //| | PAD | |
| 3310 |
//| | | //| | | |
| 3311 |
//| | | //| | | |
| 3312 |
//| | | //| | | |
| 3313 |
//|______|_________________| //|____________|___________| |
| 3314 |
//|V0|V1|| | //|V0|V1| | | |
| 3315 |
//|__|__|| | //|__|__| | | |
| 3316 |
//| | | //| | | |
| 3317 |
//| | PAD | //| | PAD | |
| 3318 |
//| | | //| | | |
| 3319 |
//| | | //| | | |
| 3320 |
//| | | //| | | |
| 3321 |
//|______|_________________| //|____________|___________| |
| 3322 |
|
| 3323 |
// 4:4:4 (24-bits per pixel) |
| 3324 |
// 444P |
| 3325 |
// -----------------> |
| 3326 |
// ________________________ |
| 3327 |
//|Y0|Y1| | |
| 3328 |
//|__|__| | |
| 3329 |
//| | |
| 3330 |
//| | |
| 3331 |
//| | |
| 3332 |
//| | |
| 3333 |
//| | |
| 3334 |
//|________________________| |
| 3335 |
//|U0|U1| | |
| 3336 |
//|__|__| | |
| 3337 |
//| | |
| 3338 |
//| | |
| 3339 |
//| | |
| 3340 |
//| | |
| 3341 |
//| | |
| 3342 |
//|________________________| |
| 3343 |
//|V0|V1| | |
| 3344 |
//|__|__| | |
| 3345 |
//| | |
| 3346 |
//| | |
| 3347 |
//| | |
| 3348 |
//| | |
| 3349 |
//| | |
| 3350 |
//|________________________| |
| 3351 |
|
| 3352 |
// 4:4:4 (24-bits per pixel) |
| 3353 |
// RGBP |
| 3354 |
// -----------------> |
| 3355 |
// ________________________ |
| 3356 |
//|R0|R1| | |
| 3357 |
//|__|__| | |
| 3358 |
//| | |
| 3359 |
//| | |
| 3360 |
//| | |
| 3361 |
//| | |
| 3362 |
//| | |
| 3363 |
//|________________________| |
| 3364 |
//|G0|G1| | |
| 3365 |
//|__|__| | |
| 3366 |
//| | |
| 3367 |
//| | |
| 3368 |
//| | |
| 3369 |
//| | |
| 3370 |
//| | |
| 3371 |
//|________________________| |
| 3372 |
//|B0|B1| | |
| 3373 |
//|__|__| | |
| 3374 |
//| | |
| 3375 |
//| | |
| 3376 |
//| | |
| 3377 |
//| | |
| 3378 |
//| | |
| 3379 |
//|________________________| |
| 3380 |
case Format_RGBP: |
| 3381 |
|
| 3382 |
// 4:4:4 (24-bits per pixel) |
| 3383 |
// BGRP |
| 3384 |
// -----------------> |
| 3385 |
// ________________________ |
| 3386 |
//|B0|B1| | |
| 3387 |
//|__|__| | |
| 3388 |
//| | |
| 3389 |
//| | |
| 3390 |
//| | |
| 3391 |
//| | |
| 3392 |
//| | |
| 3393 |
//|________________________| |
| 3394 |
//|G0|G1| | |
| 3395 |
//|__|__| | |
| 3396 |
//| | |
| 3397 |
//| | |
| 3398 |
//| | |
| 3399 |
//| | |
| 3400 |
//| | |
| 3401 |
//|________________________| |
| 3402 |
//|R0|R1| | |
| 3403 |
//|__|__| | |
| 3404 |
//| | |
| 3405 |
//| | |
| 3406 |
//| | |
| 3407 |
//| | |
| 3408 |
//| | |
| 3409 |
//|________________________| |
| 3410 |
case Format_BGRP: |
| 3411 |
case Format_411P: |
| 3412 |
case Format_422H: |
| 3413 |
case Format_444P: |
| 3414 |
iWidthInBytes = pSurface->dwWidth; |
| 3415 |
iHeightInRows = pSurface->dwHeight * 3; |
| 3416 |
break; |
| 3417 |
|
| 3418 |
// 4:1:1 (12-bits per pixel) |
| 3419 |
// 411R |
| 3420 |
// -----------------> |
| 3421 |
// ________________________ |
| 3422 |
//|Y0|Y1| | |
| 3423 |
//|__|__| | |
| 3424 |
//| | |
| 3425 |
//| | |
| 3426 |
//| | |
| 3427 |
//| | |
| 3428 |
//| | |
| 3429 |
//|________________________| |
| 3430 |
//|U0|U1| | |
| 3431 |
//|__|__| | |
| 3432 |
//|________________________| |
| 3433 |
//|V0|V1| | |
| 3434 |
//|__|__| | |
| 3435 |
//|________________________| |
| 3436 |
case Format_411R: |
| 3437 |
iWidthInBytes = pSurface->dwWidth; |
| 3438 |
iHeightInRows = (pSurface->dwHeight * 3) / 2; |
| 3439 |
break; |
| 3440 |
|
| 3441 |
// 4:2:2V (16-bits per pixel) |
| 3442 |
// 422V |
| 3443 |
// -----------------> |
| 3444 |
// ________________________ |
| 3445 |
//|Y0|Y1| | |
| 3446 |
//|__|__| | |
| 3447 |
//| | |
| 3448 |
//| | |
| 3449 |
//| | |
| 3450 |
//| | |
| 3451 |
//| | |
| 3452 |
//|________________________| |
| 3453 |
//|U0|U1| | |
| 3454 |
//|__|__| | |
| 3455 |
//| | |
| 3456 |
//|________________________| |
| 3457 |
//|V0|V1| | |
| 3458 |
//|__|__| | |
| 3459 |
//| | |
| 3460 |
//|________________________| |
| 3461 |
case Format_422V: |
| 3462 |
iWidthInBytes = pSurface->dwWidth; |
| 3463 |
iHeightInRows = pSurface->dwHeight * 2; |
| 3464 |
break; |
| 3465 |
|
| 3466 |
// 4:2:0 (12-bits per pixel) |
| 3467 |
// IMC2 // IMC4 |
| 3468 |
// -----------------> // -----------------> |
| 3469 |
// ________________________ // ________________________ |
| 3470 |
//|Y0|Y1| | //|Y0|Y1| | |
| 3471 |
//|__|__| | //|__|__| | |
| 3472 |
//| | //| | |
| 3473 |
//| | //| | |
| 3474 |
//| | //| | |
| 3475 |
//| | //| | |
| 3476 |
//| | //| | |
| 3477 |
//|________________________| //|________________________| |
| 3478 |
//|V0|V1| |U0|U1| | //|U0|U1| |V0|V1| | |
| 3479 |
//|__|__| |__|__| | //|__|__| |__|__| | |
| 3480 |
//| | | //| | | |
| 3481 |
//|____________|___________| //|____________|___________| |
| 3482 |
|
| 3483 |
// NV12 // YV12 |
| 3484 |
// -----------------> // -----------------> |
| 3485 |
// ________________________ // ________________________ |
| 3486 |
//|Y0|Y1| | //|Y0|Y1| | |
| 3487 |
//|__|__| | //|__|__| | |
| 3488 |
//| | //| | |
| 3489 |
//| | //| | |
| 3490 |
//| | //| | |
| 3491 |
//| | //| | |
| 3492 |
//| | //| | |
| 3493 |
//|________________________| //|________________________| |
| 3494 |
//|U0|V0|U1|V1| | //|V0|V1| | |
| 3495 |
//|__|__|__|__| | //|__|__|__________________| |
| 3496 |
//| | //|U0|U1| | |
| 3497 |
//|________________________| //|__|__|__________________| |
| 3498 |
|
| 3499 |
case Format_IMC2: |
| 3500 |
case Format_IMC4: |
| 3501 |
case Format_NV12: |
| 3502 |
case Format_YV12: |
| 3503 |
case Format_I420: |
| 3504 |
case Format_IYUV: |
| 3505 |
case Format_YVU9: |
| 3506 |
iWidthInBytes = pSurface->dwWidth; |
| 3507 |
iHeightInRows = pSurface->dwHeight * iBpp / 8; |
| 3508 |
break; |
| 3509 |
|
| 3510 |
case Format_P010: |
| 3511 |
case Format_P016: |
| 3512 |
iWidthInBytes = pSurface->dwWidth * 2; |
| 3513 |
iHeightInRows = pSurface->dwHeight * 3 / 2; |
| 3514 |
break; |
| 3515 |
|
| 3516 |
case Format_A16R16G16B16: |
| 3517 |
case Format_A16B16G16R16: |
| 3518 |
iWidthInBytes = pSurface->dwWidth * 8; |
| 3519 |
iHeightInRows = pSurface->dwHeight; |
| 3520 |
break; |
| 3521 |
|
| 3522 |
case Format_P210: |
| 3523 |
case Format_P216: |
| 3524 |
iWidthInBytes = pSurface->dwWidth * 2; |
| 3525 |
iHeightInRows = pSurface->dwHeight * 2; |
| 3526 |
|
| 3527 |
default: |
| 3528 |
VP_DEBUG_ASSERTMESSAGE("Format %d not supported.", pSurface->Format); |
| 3529 |
eStatus = MOS_STATUS_UNKNOWN; |
| 3530 |
goto finish; |
| 3531 |
} |
| 3532 |
|
| 3533 |
*piWidthInBytes = iWidthInBytes; |
| 3534 |
*piHeightInRows = iHeightInRows; |
| 3535 |
|
| 3536 |
finish: |
| 3537 |
return eStatus; |
| 3538 |
} |
| 3539 |
|
| 3540 |
MOS_STATUS VpDumperTool::AppendString( |
| 3541 |
bool bFirst, |
| 3542 |
char* *ppcBigString, |
| 3543 |
PCCHAR pcToAppendFmt, |
| 3544 |
...) |
| 3545 |
{ |
| 3546 |
VP_FUNC_CALL(); |
| 3547 |
|
| 3548 |
static size_t stTotalStrLen = 0; |
| 3549 |
static size_t stTotalAlloc = 0; |
| 3550 |
|
| 3551 |
MOS_STATUS eStatus; |
| 3552 |
size_t stStrLenOld; |
| 3553 |
size_t stStrLenToAppend; |
| 3554 |
char* pcToAppend; |
| 3555 |
char* pcTmpPtr; |
| 3556 |
va_list argList; |
| 3557 |
|
| 3558 |
eStatus = MOS_STATUS_SUCCESS; |
| 3559 |
stStrLenToAppend = 0; |
| 3560 |
stStrLenOld = 0; |
| 3561 |
pcTmpPtr = nullptr; |
| 3562 |
pcToAppend = (char*)MOS_AllocAndZeroMemory(sizeof(char) * ALLOC_GRANULARITY); |
| 3563 |
|
| 3564 |
if (bFirst) |
| 3565 |
{ |
| 3566 |
stTotalStrLen = 0; |
| 3567 |
stTotalAlloc = 0; |
| 3568 |
} |
| 3569 |
|
| 3570 |
stStrLenOld = stTotalStrLen; |
| 3571 |
|
| 3572 |
if (ppcBigString == nullptr || pcToAppendFmt == nullptr || (int)strlen(pcToAppendFmt) < 0) |
| 3573 |
{ |
| 3574 |
eStatus = MOS_STATUS_INVALID_PARAMETER; |
| 3575 |
goto finish; |
| 3576 |
} |
| 3577 |
|
| 3578 |
va_start(argList, pcToAppendFmt); |
| 3579 |
MosUtilities::MosSecureVStringPrint(pcToAppend, ALLOC_GRANULARITY, ALLOC_GRANULARITY, pcToAppendFmt, argList); |
| 3580 |
va_end(argList); |
| 3581 |
|
| 3582 |
stStrLenToAppend = strlen(pcToAppend); |
| 3583 |
|
| 3584 |
if (*ppcBigString == nullptr) |
| 3585 |
{ |
| 3586 |
stTotalStrLen = stStrLenToAppend + 1; |
| 3587 |
stTotalAlloc = MOS_ALIGN_CEIL(stStrLenToAppend, ALLOC_GRANULARITY); |
| 3588 |
*ppcBigString = (char*)MOS_AllocAndZeroMemory(stTotalAlloc); |
| 3589 |
VP_DEBUG_CHK_NULL(*ppcBigString); |
| 3590 |
*ppcBigString[0] = '\0'; |
| 3591 |
stStrLenOld++; |
| 3592 |
} |
| 3593 |
else |
| 3594 |
{ |
| 3595 |
stTotalStrLen += stStrLenToAppend; |
| 3596 |
if (stTotalStrLen >= stTotalAlloc) |
| 3597 |
{ |
| 3598 |
stTotalAlloc = MOS_ALIGN_CEIL(stTotalStrLen, ALLOC_GRANULARITY); |
| 3599 |
// Below should be equivalent to *ppcBigString = (char*)realloc(*ppcBigString, stTotalAlloc); |
| 3600 |
pcTmpPtr = *ppcBigString; |
| 3601 |
*ppcBigString = (char*)MOS_AllocAndZeroMemory(stTotalAlloc); |
| 3602 |
VP_DEBUG_CHK_NULL(*ppcBigString); |
| 3603 |
MOS_SecureStringPrint(*ppcBigString, stTotalAlloc, stTotalAlloc, "%s", pcTmpPtr); |
| 3604 |
MOS_FreeMemory(pcTmpPtr); |
| 3605 |
} |
| 3606 |
} |
| 3607 |
MOS_SecureMemcpy( |
| 3608 |
(char*)(((uintptr_t)(*ppcBigString)) + stStrLenOld - 1), |
| 3609 |
stStrLenToAppend + 1, |
| 3610 |
pcToAppend, |
| 3611 |
stStrLenToAppend + 1); |
| 3612 |
|
| 3613 |
finish: |
| 3614 |
MOS_FreeMemory(pcToAppend); |
| 3615 |
return eStatus; |
| 3616 |
} |
| 3617 |
|
| 3618 |
void VpDumperTool::WriteFrame( |
| 3619 |
PMOS_INTERFACE pOsInterface, |
| 3620 |
PVPHAL_SURFACE pSurface, |
| 3621 |
PCCHAR fileName, |
| 3622 |
uint64_t iCounter) |
| 3623 |
{ |
| 3624 |
VP_FUNC_CALL(); |
| 3625 |
|
| 3626 |
uint8_t* pData; |
| 3627 |
char sPath[MAX_PATH]; |
| 3628 |
char sOsPath[MAX_PATH]; |
| 3629 |
uint8_t* pDst; |
| 3630 |
uint8_t* pTmpDst; |
| 3631 |
uint8_t* pTmpSrc; |
| 3632 |
uint32_t iWidthInBytes; |
| 3633 |
uint32_t iHeightInRows; |
| 3634 |
uint32_t iBpp; |
| 3635 |
uint32_t iSize; |
| 3636 |
uint32_t iY; |
| 3637 |
MOS_LOCK_PARAMS LockFlags; |
| 3638 |
|
| 3639 |
pDst = nullptr; |
| 3640 |
MOS_ZeroMemory(sPath, MAX_PATH); |
| 3641 |
MOS_ZeroMemory(sOsPath, MAX_PATH); |
| 3642 |
|
| 3643 |
// get bits per pixel for the format |
| 3644 |
pOsInterface->pfnGetBitsPerPixel(pOsInterface, pSurface->Format, &iBpp); |
| 3645 |
|
| 3646 |
VpDumperTool::GetSurfaceSize( |
| 3647 |
pSurface, |
| 3648 |
iBpp, |
| 3649 |
&iWidthInBytes, |
| 3650 |
&iHeightInRows); |
| 3651 |
|
| 3652 |
iSize = iWidthInBytes * iHeightInRows; |
| 3653 |
|
| 3654 |
// Write original image to file |
| 3655 |
MOS_ZeroMemory(&LockFlags, sizeof(MOS_LOCK_PARAMS)); |
| 3656 |
|
| 3657 |
LockFlags.ReadOnly = 1; |
| 3658 |
|
| 3659 |
pData = (uint8_t*)pOsInterface->pfnLockResource( |
| 3660 |
pOsInterface, |
| 3661 |
&pSurface->OsResource, |
| 3662 |
&LockFlags); |
| 3663 |
|
| 3664 |
if(pData == nullptr) |
| 3665 |
{ |
| 3666 |
VP_DEBUG_ASSERTMESSAGE("pData == nullptr."); |
| 3667 |
|
| 3668 |
return; |
| 3669 |
} |
| 3670 |
MOS_SecureStringPrint( |
| 3671 |
sPath, |
| 3672 |
MAX_PATH, |
| 3673 |
sizeof(sPath), |
| 3674 |
"c:\\dump\\f[%08I64x]_%s_w[%d]_h[%d]_p[%d].%s", |
| 3675 |
iCounter, |
| 3676 |
fileName, |
| 3677 |
pSurface->dwWidth, |
| 3678 |
pSurface->dwHeight, |
| 3679 |
pSurface->dwPitch, |
| 3680 |
VpDumperTool::GetFormatStr(pSurface->Format)); |
| 3681 |
|
| 3682 |
MOS_SecureMemcpy(sOsPath, MAX_PATH, sPath, strlen(sPath)); |
| 3683 |
|
| 3684 |
// Write the data to file |
| 3685 |
if (pSurface->dwPitch == iWidthInBytes) |
| 3686 |
{ |
| 3687 |
MosUtilities::MosWriteFileFromPtr((const char *)sOsPath, pData, iSize); |
| 3688 |
} |
| 3689 |
else |
| 3690 |
{ |
| 3691 |
pDst = (uint8_t*)MOS_AllocAndZeroMemory(iSize); |
| 3692 |
pTmpSrc = pData; |
| 3693 |
pTmpDst = pDst; |
| 3694 |
|
| 3695 |
for (iY = 0; iY < iHeightInRows; iY++) |
| 3696 |
{ |
| 3697 |
MOS_SecureMemcpy(pTmpDst, iSize, pTmpSrc, iWidthInBytes); |
| 3698 |
pTmpSrc += pSurface->dwPitch; |
| 3699 |
pTmpDst += iWidthInBytes; |
| 3700 |
} |
| 3701 |
|
| 3702 |
MosUtilities::MosWriteFileFromPtr((const char *)sOsPath, pDst, iSize); |
| 3703 |
} |
| 3704 |
|
| 3705 |
if (pDst) |
| 3706 |
{ |
| 3707 |
MOS_FreeMemory(pDst); |
| 3708 |
} |
| 3709 |
|
| 3710 |
pOsInterface->pfnUnlockResource( |
| 3711 |
pOsInterface, |
| 3712 |
&pSurface->OsResource); |
| 3713 |
} |
| 3714 |
|
| 3715 |
const char * VpParameterDumper::GetComponentStr(MOS_COMPONENT component) |
| 3716 |
{ |
| 3717 |
VP_FUNC_CALL(); |
| 3718 |
|
| 3719 |
switch (component) |
| 3720 |
{ |
| 3721 |
case COMPONENT_UNKNOWN: return _T("COMPONENT_UNKNOWN"); |
| 3722 |
case COMPONENT_LibVA: return _T("COMPONENT_LibVA"); |
| 3723 |
case COMPONENT_VPreP: return _T("COMPONENT_VPreP"); |
| 3724 |
case COMPONENT_EMULATION: return _T("COMPONENT_EMULATION"); |
| 3725 |
case COMPONENT_CM: return _T("COMPONENT_CM"); |
| 3726 |
case COMPONENT_Encode: return _T("COMPONENT_Encode"); |
| 3727 |
case COMPONENT_Decode: return _T("COMPONENT_Decode"); |
| 3728 |
default: return _T("Err"); |
| 3729 |
} |
| 3730 |
|
| 3731 |
return nullptr; |
| 3732 |
} |
| 3733 |
|
| 3734 |
const char * VpParameterDumper::GetWholeFormatStr(MOS_FORMAT format) |
| 3735 |
{ |
| 3736 |
VP_FUNC_CALL(); |
| 3737 |
|
| 3738 |
switch (format) |
| 3739 |
{ |
| 3740 |
case Format_Invalid: return _T("Format_Invalid"); |
| 3741 |
case Format_Source: return _T("Format_Source"); |
| 3742 |
case Format_420O: return _T("Format_420O"); |
| 3743 |
case Format_RGB_Swap: return _T("Format_RGB_Swap"); |
| 3744 |
case Format_RGB_No_Swap: return _T("Format_RGB_No_Swap"); |
| 3745 |
case Format_RGB: return _T("Format_RGB"); |
| 3746 |
case Format_RGB32: return _T("Format_RGB32"); |
| 3747 |
case Format_PA: return _T("Format_PA"); |
| 3748 |
case Format_PL2: return _T("Format_PL2"); |
| 3749 |
case Format_PL2_UnAligned: return _T("Format_PL2_UnAligned"); |
| 3750 |
case Format_PL3: return _T("Format_PL3"); |
| 3751 |
case Format_PL3_RGB: return _T("Format_PL3_RGB"); |
| 3752 |
case Format_PAL: return _T("Format_PA_T("); |
| 3753 |
|
| 3754 |
case Format_None: return _T("Format_None"); |
| 3755 |
case Format_Any: return _T("Format_Any"); |
| 3756 |
case Format_A8R8G8B8: return _T("Format_A8R8G8B8"); |
| 3757 |
case Format_X8R8G8B8: return _T("Format_X8R8G8B8"); |
| 3758 |
case Format_A8B8G8R8: return _T("Format_A8B8G8R8"); |
| 3759 |
case Format_X8B8G8R8: return _T("Format_X8B8G8R8"); |
| 3760 |
case Format_A16B16G16R16: return _T("Format_A16B16G16R16"); |
| 3761 |
case Format_A16R16G16B16: return _T("Format_A16R16G16B16"); |
| 3762 |
case Format_R5G6B5: return _T("Format_R5G6B5"); |
| 3763 |
case Format_R8G8B8: return _T("Format_R8G8B8"); |
| 3764 |
case Format_R32U: return _T("Format_R32U"); |
| 3765 |
case Format_R32F: return _T("Format_R32F"); |
| 3766 |
case Format_RGBP: return _T("Format_RGBP"); |
| 3767 |
case Format_BGRP: return _T("Format_BGRP"); |
| 3768 |
|
| 3769 |
case Format_YUY2: return _T("Format_YUY2"); |
| 3770 |
case Format_YUYV: return _T("Format_YUYV"); |
| 3771 |
case Format_YVYU: return _T("Format_YVYU"); |
| 3772 |
case Format_UYVY: return _T("Format_UYVY"); |
| 3773 |
case Format_VYUY: return _T("Format_VYUY"); |
| 3774 |
|
| 3775 |
case Format_Y416: return _T("Format_Y416"); |
| 3776 |
case Format_AYUV: return _T("Format_AYUV"); |
| 3777 |
case Format_AUYV: return _T("Format_AUYV"); |
| 3778 |
case Format_400P: return _T("Format_400P"); |
| 3779 |
case Format_NV12: return _T("Format_NV12"); |
| 3780 |
case Format_NV12_UnAligned: return _T("Format_NV12_UnAligned"); |
| 3781 |
case Format_NV21: return _T("Format_NV21"); |
| 3782 |
case Format_NV11: return _T("Format_NV11"); |
| 3783 |
case Format_NV11_UnAligned: return _T("Format_NV11_UnAligned"); |
| 3784 |
case Format_P208: return _T("Format_P208"); |
| 3785 |
case Format_P208_UnAligned: return _T("Format_P208_UnAligned"); |
| 3786 |
case Format_IMC1: return _T("Format_IMC1"); |
| 3787 |
case Format_IMC2: return _T("Format_IMC2"); |
| 3788 |
case Format_IMC3: return _T("Format_IMC3"); |
| 3789 |
case Format_IMC4: return _T("Format_IMC4"); |
| 3790 |
case Format_422H: return _T("Format_422H"); |
| 3791 |
case Format_422V: return _T("Format_422V"); |
| 3792 |
case Format_444P: return _T("Format_444P"); |
| 3793 |
case Format_411P: return _T("Format_411P"); |
| 3794 |
case Format_411R: return _T("Format_411R"); |
| 3795 |
case Format_I420: return _T("Format_I420"); |
| 3796 |
case Format_IYUV: return _T("Format_IYUV"); |
| 3797 |
case Format_YV12: return _T("Format_YV12"); |
| 3798 |
case Format_YVU9: return _T("Format_YVU9"); |
| 3799 |
case Format_AI44: return _T("Format_AI44"); |
| 3800 |
case Format_IA44: return _T("Format_IA44"); |
| 3801 |
case Format_P8: return _T("Format_P8"); |
| 3802 |
case Format_A8P8: return _T("Format_A8P8"); |
| 3803 |
case Format_A8: return _T("Format_A8"); |
| 3804 |
case Format_L8: return _T("Format_L8"); |
| 3805 |
case Format_A4L4: return _T("Format_A4L4"); |
| 3806 |
case Format_A8L8: return _T("Format_A8L8"); |
| 3807 |
case Format_IRW0: return _T("Format_IRW0"); |
| 3808 |
case Format_IRW1: return _T("Format_IRW1"); |
| 3809 |
case Format_IRW2: return _T("Format_IRW2"); |
| 3810 |
case Format_IRW3: return _T("Format_IRW3"); |
| 3811 |
case Format_IRW4: return _T("Format_IRW4"); |
| 3812 |
case Format_IRW5: return _T("Format_IRW5"); |
| 3813 |
case Format_IRW6: return _T("Format_IRW6"); |
| 3814 |
case Format_IRW7: return _T("Format_IRW7"); |
| 3815 |
case Format_STMM: return _T("Format_STMM"); |
| 3816 |
case Format_Buffer: return _T("Format_Buffer"); |
| 3817 |
case Format_Buffer_2D: return _T("Format_Buffer_2D"); |
| 3818 |
case Format_V8U8: return _T("Format_V8U8"); |
| 3819 |
case Format_R32S: return _T("Format_R32S"); |
| 3820 |
case Format_R8U: return _T("Format_R8U"); |
| 3821 |
case Format_R8G8UN: return _T("Format_R8G8UN"); |
| 3822 |
case Format_R8G8SN: return _T("Format_R8G8SN"); |
| 3823 |
case Format_G8R8_G8B8: return _T("Format_G8R8_G8B8"); |
| 3824 |
case Format_R16U: return _T("Format_R16U"); |
| 3825 |
case Format_R16S: return _T("Format_R16S"); |
| 3826 |
case Format_R16UN: return _T("Format_R16UN"); |
| 3827 |
case Format_RAW: return _T("Format_RAW"); |
| 3828 |
case Format_Y8: return _T("Format_Y8"); |
| 3829 |
case Format_Y1: return _T("Format_Y1"); |
| 3830 |
case Format_Y16U: return _T("Format_Y16U"); |
| 3831 |
case Format_Y16S: return _T("Format_Y16S"); |
| 3832 |
case Format_L16: return _T("Format_L16"); |
| 3833 |
case Format_D16: return _T("Format_D16"); |
| 3834 |
case Format_R10G10B10A2: return _T("Format_R10G10B10A2"); |
| 3835 |
case Format_B10G10R10A2: return _T("Format_B10G10R10A2"); |
| 3836 |
case Format_P016: return _T("Format_P016"); |
| 3837 |
case Format_P010: return _T("Format_P010"); |
| 3838 |
case Format_Y210: return _T("Format_Y210"); |
| 3839 |
case Format_Y216: return _T("Format_Y216"); |
| 3840 |
case Format_Y410: return _T("Format_Y410"); |
| 3841 |
case Format_P210: return _T("Format_P210"); |
| 3842 |
case Format_P216: return _T("Format_P216"); |
| 3843 |
case Format_YV12_Planar: return _T("Format_YV12_Planar"); |
| 3844 |
case Format_Count: return _T("Format_Count"); |
| 3845 |
case Format_A16B16G16R16F: return _T("Format_A16B16G16R16F"); |
| 3846 |
case Format_A16R16G16B16F: return _T("Format_A16R16G16B16F"); |
| 3847 |
default: return _T("Err"); |
| 3848 |
} |
| 3849 |
|
| 3850 |
return nullptr; |
| 3851 |
} |
| 3852 |
|
| 3853 |
const char * VpParameterDumper::GetTileTypeStr(MOS_TILE_TYPE tile_type) |
| 3854 |
{ |
| 3855 |
VP_FUNC_CALL(); |
| 3856 |
|
| 3857 |
switch (tile_type) |
| 3858 |
{ |
| 3859 |
case MOS_TILE_X: return _T("MOS_TILE_X"); |
| 3860 |
case MOS_TILE_Y: return _T("MOS_TILE_Y"); |
| 3861 |
case MOS_TILE_LINEAR: return _T("MOS_TILE_LINEAR"); |
| 3862 |
case MOS_TILE_INVALID: return _T("MOS_TILE_INVALID"); |
| 3863 |
default: return _T("Err"); |
| 3864 |
} |
| 3865 |
|
| 3866 |
return nullptr; |
| 3867 |
} |
| 3868 |
|
| 3869 |
const char *VpParameterDumper::GetTileModeGMMStr(MOS_TILE_MODE_GMM tile_mode) |
| 3870 |
{ |
| 3871 |
VP_FUNC_CALL(); |
| 3872 |
|
| 3873 |
switch (tile_mode) |
| 3874 |
{ |
| 3875 |
case MOS_TILE_64_GMM: |
| 3876 |
return _T("MOS_TILE_64_GMM"); |
| 3877 |
case MOS_TILE_4_GMM: |
| 3878 |
return _T("MOS_TILE_4_GMM"); |
| 3879 |
case MOS_TILE_LINEAR_GMM: |
| 3880 |
return _T("MOS_TILE_LINEAR_GMM"); |
| 3881 |
case MOS_TILE_UNSET_GMM: |
| 3882 |
return _T("MOS_TILE_UNSET_GMM"); |
| 3883 |
default: |
| 3884 |
return _T("Err"); |
| 3885 |
} |
| 3886 |
} |
| 3887 |
|
| 3888 |
const char * VpParameterDumper::GetSurfaceTypeStr(VPHAL_SURFACE_TYPE surface_type) |
| 3889 |
{ |
| 3890 |
VP_FUNC_CALL(); |
| 3891 |
|
| 3892 |
switch (surface_type) |
| 3893 |
{ |
| 3894 |
case SURF_NONE: return _T("SURF_NONE"); |
| 3895 |
case SURF_IN_BACKGROUND: return _T("SURF_IN_BACKGROUND"); |
| 3896 |
case SURF_IN_PRIMARY: return _T("SURF_IN_PRIMARY"); |
| 3897 |
case SURF_IN_SUBSTREAM: return _T("SURF_IN_SUBSTREAM"); |
| 3898 |
case SURF_IN_REFERENCE: return _T("SURF_IN_REFERENCE"); |
| 3899 |
case SURF_OUT_RENDERTARGET: return _T("SURF_OUT_RENDERTARGET"); |
| 3900 |
case SURF_TYPE_COUNT: return _T("SURF_TYPE_COUNT"); |
| 3901 |
default: return _T("Err"); |
| 3902 |
} |
| 3903 |
|
| 3904 |
return nullptr; |
| 3905 |
} |
| 3906 |
|
| 3907 |
const char *VpParameterDumper::GetGammaValueTypeStr(VPHAL_GAMMA_VALUE gamma_value) |
| 3908 |
{ |
| 3909 |
VP_FUNC_CALL(); |
| 3910 |
|
| 3911 |
switch (gamma_value) |
| 3912 |
{ |
| 3913 |
case GAMMA_1P0: |
| 3914 |
return _T("GAMMA_1P0"); |
| 3915 |
case GAMMA_2P2: |
| 3916 |
return _T("GAMMA_2P2"); |
| 3917 |
case GAMMA_2P6: |
| 3918 |
return _T("GAMMA_2P6"); |
| 3919 |
default: |
| 3920 |
return _T("Err"); |
| 3921 |
} |
| 3922 |
|
| 3923 |
return nullptr; |
| 3924 |
} |
| 3925 |
|
| 3926 |
const char * VpParameterDumper::GetSampleTypeStr(VPHAL_SAMPLE_TYPE sample_type) |
| 3927 |
{ |
| 3928 |
VP_FUNC_CALL(); |
| 3929 |
|
| 3930 |
switch (sample_type) |
| 3931 |
{ |
| 3932 |
case SAMPLE_PROGRESSIVE: return _T("SAMPLE_PROGRESSIVE"); |
| 3933 |
case SAMPLE_SINGLE_TOP_FIELD: return _T("SAMPLE_SINGLE_TOP_FIELD"); |
| 3934 |
case SAMPLE_SINGLE_BOTTOM_FIELD: return _T("SAMPLE_SINGLE_BOTTOM_FIELD"); |
| 3935 |
case SAMPLE_INTERLEAVED_EVEN_FIRST_TOP_FIELD: return _T("SAMPLE_INTERLEAVED_EVEN_FIRST_TOP_FIELD"); |
| 3936 |
case SAMPLE_INTERLEAVED_EVEN_FIRST_BOTTOM_FIELD: return _T("SAMPLE_INTERLEAVED_EVEN_FIRST_BOTTOM_FIELD"); |
| 3937 |
case SAMPLE_INTERLEAVED_ODD_FIRST_TOP_FIELD: return _T("SAMPLE_INTERLEAVED_ODD_FIRST_TOP_FIELD"); |
| 3938 |
case SAMPLE_INTERLEAVED_ODD_FIRST_BOTTOM_FIELD: return _T("SAMPLE_INTERLEAVED_ODD_FIRST_BOTTOM_FIELD"); |
| 3939 |
case SAMPLE_INVALID: return _T("SAMPLE_INVALID"); |
| 3940 |
default: return _T("Err"); |
| 3941 |
} |
| 3942 |
|
| 3943 |
return nullptr; |
| 3944 |
} |
| 3945 |
|
| 3946 |
const char * VpParameterDumper::GetColorSpaceStr(VPHAL_CSPACE color_space) |
| 3947 |
{ |
| 3948 |
VP_FUNC_CALL(); |
| 3949 |
|
| 3950 |
switch (color_space) |
| 3951 |
{ |
| 3952 |
case CSpace_None: return _T("CSpace_None"); |
| 3953 |
case CSpace_Source: return _T("CSpace_Source"); |
| 3954 |
case CSpace_RGB: return _T("CSpace_RGB"); |
| 3955 |
case CSpace_YUV: return _T("CSpace_YUV"); |
| 3956 |
case CSpace_Gray: return _T("CSpace_Gray"); |
| 3957 |
case CSpace_Any: return _T("CSpace_Any"); |
| 3958 |
case CSpace_sRGB: return _T("CSpace_sRGB"); |
| 3959 |
case CSpace_stRGB: return _T("CSpace_stRGB"); |
| 3960 |
case CSpace_BT601: return _T("CSpace_BT601"); |
| 3961 |
case CSpace_BT601_FullRange: return _T("CSpace_BT601_FullRange"); |
| 3962 |
case CSpace_BT709: return _T("CSpace_BT709"); |
| 3963 |
case CSpace_BT709_FullRange: return _T("CSpace_BT709_FullRange"); |
| 3964 |
case CSpace_xvYCC601: return _T("CSpace_xvYCC601"); |
| 3965 |
case CSpace_xvYCC709: return _T("CSpace_xvYCC709"); |
| 3966 |
case CSpace_BT601Gray: return _T("CSpace_BT601Gray"); |
| 3967 |
case CSpace_BT601Gray_FullRange: return _T("CSpace_BT601Gray_FullRange"); |
| 3968 |
case CSpace_BT2020: return _T("CSpace_BT2020"); |
| 3969 |
case CSpace_BT2020_FullRange: return _T("CSpace_BT2020_FullRange"); |
| 3970 |
case CSpace_BT2020_RGB: return _T("CSpace_BT2020_RGB"); |
| 3971 |
case CSpace_BT2020_stRGB: return _T("CSpace_BT2020_stRGB"); |
| 3972 |
case CSpace_Count: return _T("CSpace_Count"); |
| 3973 |
default: return _T("Err"); |
| 3974 |
} |
| 3975 |
|
| 3976 |
return nullptr; |
| 3977 |
} |
| 3978 |
|
| 3979 |
const char * VpParameterDumper::GetBlendTypeStr(VPHAL_BLEND_TYPE blend_type) |
| 3980 |
{ |
| 3981 |
VP_FUNC_CALL(); |
| 3982 |
|
| 3983 |
switch (blend_type) |
| 3984 |
{ |
| 3985 |
case BLEND_NONE: return _T("BLEND_NONE"); |
| 3986 |
case BLEND_SOURCE: return _T("BLEND_SOURCE"); |
| 3987 |
case BLEND_PARTIAL: return _T("BLEND_PARTIAL"); |
| 3988 |
case BLEND_CONSTANT: return _T("BLEND_CONSTANT"); |
| 3989 |
case BLEND_CONSTANT_SOURCE: return _T("BLEND_CONSTANT_SOURCE"); |
| 3990 |
case BLEND_CONSTANT_PARTIAL: return _T("BLEND_CONSTANT_PARTIAL"); |
| 3991 |
default: return _T("Err"); |
| 3992 |
} |
| 3993 |
|
| 3994 |
return nullptr; |
| 3995 |
} |
| 3996 |
|
| 3997 |
const char * VpParameterDumper::GetPaletteTypeStr(VPHAL_PALETTE_TYPE palette_type) |
| 3998 |
{ |
| 3999 |
VP_FUNC_CALL(); |
| 4000 |
|
| 4001 |
switch (palette_type) |
| 4002 |
{ |
| 4003 |
case VPHAL_PALETTE_NONE: return _T("VPHAL_PALETTE_NONE"); |
| 4004 |
case VPHAL_PALETTE_YCbCr_8: return _T("VPHAL_PALETTE_YCbCr_8"); |
| 4005 |
case VPHAL_PALETTE_ARGB_8: return _T("VPHAL_PALETTE_ARGB_8"); |
| 4006 |
case VPHAL_PALETTE_AVYU_8: return _T("VPHAL_PALETTE_AVYU_8"); |
| 4007 |
default: return _T("Err"); |
| 4008 |
} |
| 4009 |
|
| 4010 |
return nullptr; |
| 4011 |
} |
| 4012 |
|
| 4013 |
const char * VpParameterDumper::GetScalingModeStr(VPHAL_SCALING_MODE scaling_mode) |
| 4014 |
{ |
| 4015 |
VP_FUNC_CALL(); |
| 4016 |
|
| 4017 |
switch (scaling_mode) |
| 4018 |
{ |
| 4019 |
case VPHAL_SCALING_NEAREST: return _T("VPHAL_SCALING_NEAREST"); |
| 4020 |
case VPHAL_SCALING_BILINEAR: return _T("VPHAL_SCALING_BILINEAR"); |
| 4021 |
case VPHAL_SCALING_AVS: return _T("VPHAL_SCALING_AVS"); |
| 4022 |
default: return _T("Err"); |
| 4023 |
} |
| 4024 |
|
| 4025 |
return nullptr; |
| 4026 |
} |
| 4027 |
|
| 4028 |
const char * VpParameterDumper::GetRotationModeStr(VPHAL_ROTATION rotation_mode) |
| 4029 |
{ |
| 4030 |
VP_FUNC_CALL(); |
| 4031 |
|
| 4032 |
switch (rotation_mode) |
| 4033 |
{ |
| 4034 |
case VPHAL_ROTATION_IDENTITY: return _T("VPHAL_ROTATION_IDENTITY"); |
| 4035 |
case VPHAL_ROTATION_90: return _T("VPHAL_ROTATION_90"); |
| 4036 |
case VPHAL_ROTATION_180: return _T("VPHAL_ROTATION_180"); |
| 4037 |
case VPHAL_ROTATION_270: return _T("VPHAL_ROTATION_270"); |
| 4038 |
case VPHAL_MIRROR_HORIZONTAL: return _T("VPHAL_MIRROR_HORIZONTAL"); |
| 4039 |
case VPHAL_MIRROR_VERTICAL: return _T("VPHAL_MIRROR_VERTICAL"); |
| 4040 |
case VPHAL_ROTATE_90_MIRROR_VERTICAL: return _T("VPHAL_ROTATE_90_MIRROR_VERTICAL"); |
| 4041 |
case VPHAL_ROTATE_90_MIRROR_HORIZONTAL: return _T("VPHAL_ROTATE_90_MIRROR_HORIZONTAL"); |
| 4042 |
|
| 4043 |
default: return _T("Err"); |
| 4044 |
} |
| 4045 |
|
| 4046 |
return nullptr; |
| 4047 |
} |
| 4048 |
|
| 4049 |
const char * VpParameterDumper::GetDIModeStr(VPHAL_DI_MODE di_mode) |
| 4050 |
{ |
| 4051 |
VP_FUNC_CALL(); |
| 4052 |
|
| 4053 |
switch (di_mode) |
| 4054 |
{ |
| 4055 |
case DI_MODE_BOB: return _T("DI_MODE_BOB"); |
| 4056 |
case DI_MODE_ADI: return _T("DI_MODE_ADI"); |
| 4057 |
default: return _T("Err"); |
| 4058 |
} |
| 4059 |
|
| 4060 |
return nullptr; |
| 4061 |
} |
| 4062 |
|
| 4063 |
const char * VpParameterDumper::GetDenoiseModeStr(VPHAL_NOISELEVEL noise_level) |
| 4064 |
{ |
| 4065 |
VP_FUNC_CALL(); |
| 4066 |
|
| 4067 |
switch (noise_level) |
| 4068 |
{ |
| 4069 |
case NOISELEVEL_DEFAULT: return _T("NOISELEVEL_DEFAULT"); |
| 4070 |
case NOISELEVEL_VC1_HD: return _T("NOISELEVEL_VC1_HD"); |
| 4071 |
default: return _T("Err"); |
| 4072 |
} |
| 4073 |
|
| 4074 |
return nullptr; |
| 4075 |
} |
| 4076 |
|
| 4077 |
const char *VpParameterDumper::GetHVSDenoiseModeStr(VPHAL_HVSDN_MODE hvs_dn_mode) |
| 4078 |
{ |
| 4079 |
switch (hvs_dn_mode) |
| 4080 |
{ |
| 4081 |
case HVSDENOISE_AUTO_BDRATE: |
| 4082 |
return _T("HVSDENOISE_AUTO_BDRATE"); |
| 4083 |
case HVSDENOISE_AUTO_SUBJECTIVE: |
| 4084 |
return _T("HVSDENOISE_AUTO_SUBJECTIVE"); |
| 4085 |
case HVSDENOISE_MANUAL: |
| 4086 |
return _T("HVSDENOISE_MANUAL"); |
| 4087 |
default: |
| 4088 |
return _T("Err"); |
| 4089 |
} |
| 4090 |
|
| 4091 |
return nullptr; |
| 4092 |
} |
| 4093 |
#endif // (_DEBUG || _RELEASE_INTERNAL) |