| From ffd0b738cd3c1b42fef3399e6eedc9fd70c0b5fe Mon Sep 17 00:00:00 2001 |
| From: Juston Li <juston.li@intel.com> |
| Date: Tue, 24 May 2022 10:18:24 -0700 |
| Subject: [PATCH 2/2] Revert "[Media Common] Optimization getimage" |
| |
| This reverts commit 497d9864aaba83214cbc2e6ae8cee4151934fe43. |
| --- |
| media_driver/linux/common/ddi/media_libva.cpp | 21 ++++++++++++++++--- |
| 1 file changed, 18 insertions(+), 3 deletions(-) |
| |
| diff --git a/media_driver/linux/common/ddi/media_libva.cpp b/media_driver/linux/common/ddi/media_libva.cpp |
| index 865f9a97c47f..d03d4d096fac 100755 |
| --- a/media_driver/linux/common/ddi/media_libva.cpp |
| +++ b/media_driver/linux/common/ddi/media_libva.cpp |
| @@ -5186,7 +5186,7 @@ static VAStatus DdiMedia_CopySurfaceToImage( |
| DDI_NORMALMESSAGE("surface Decompression fail, continue next steps."); |
| } |
| } |
| - void *surfData = DdiMediaUtil_LockSurface(surface, MOS_LOCKFLAG_READONLY); |
| + void *surfData = DdiMediaUtil_LockSurface(surface, (MOS_LOCKFLAG_READONLY | MOS_LOCKFLAG_NO_SWIZZLE)); |
| if (surfData == nullptr) |
| { |
| DDI_ASSERTMESSAGE("nullptr surfData."); |
| @@ -5204,8 +5204,17 @@ static VAStatus DdiMedia_CopySurfaceToImage( |
| |
| uint8_t *ySrc = nullptr; |
| uint8_t *yDst = (uint8_t*)imageData; |
| + uint8_t *swizzleData = (uint8_t*)MOS_AllocMemory(surface->data_size); |
| |
| - ySrc = (uint8_t*)surfData; |
| + if (!surface->pMediaCtx->bIsAtomSOC && surface->TileType != I915_TILING_NONE) |
| + { |
| + SwizzleSurface(surface->pMediaCtx, surface->pGmmResourceInfo, surfData, (MOS_TILE_TYPE)surface->TileType, (uint8_t *)swizzleData, false); |
| + ySrc = swizzleData; |
| + } |
| + else |
| + { |
| + ySrc = (uint8_t*)surfData; |
| + } |
| |
| DdiMedia_CopyPlane(yDst, image->pitches[0], ySrc, surface->iPitch, image->height); |
| if (image->num_planes > 1) |
| @@ -5228,6 +5237,8 @@ static VAStatus DdiMedia_CopySurfaceToImage( |
| } |
| } |
| |
| + MOS_FreeMemory(swizzleData); |
| + |
| vaStatus = DdiMedia_UnmapBuffer(ctx, image->buf); |
| if (vaStatus != VA_STATUS_SUCCESS) |
| { |
| @@ -5303,7 +5314,11 @@ VAStatus DdiMedia_GetImage( |
| VASurfaceID output_surface = surface; |
| |
| if (inputSurface->format != DdiMedia_OsFormatToMediaFormat(vaimg->format.fourcc, vaimg->format.alpha_mask) || |
| - width != vaimg->width || height != vaimg->height) |
| + width != vaimg->width || height != vaimg->height || |
| + (MEDIA_IS_WA(&mediaCtx->WaTable, WaEnableVPPCopy) && |
| + vaimg->format.fourcc != VA_FOURCC_444P && |
| + vaimg->format.fourcc != VA_FOURCC_422V && |
| + vaimg->format.fourcc != VA_FOURCC_422H)) |
| { |
| VAContextID context = VA_INVALID_ID; |
| //Create VP Context. |
| -- |
| 2.35.3 |
| |