From 2c51f70987d52c46fb93bb8831043d0197df7aeb Mon Sep 17 00:00:00 2001 From: Yang_Jiafeng Date: Mon, 4 Nov 2024 16:10:59 +0800 Subject: [PATCH] [VP] 422HV driver integrate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 422HV driver integrate。 --- .../agnostic/common/vp/hal/vp_common_defs.h | 1 + .../vp/kernel/igvpfc_422HV_input_xe2.cpp | 174 +++++++ .../vp/kernel/igvpfc_422HV_input_xe2.h | 53 ++ .../Xe_R/Xe2_HPG/vp/kernel/media_srcs.cmake | 2 + .../agnostic/common/renderhal/renderhal.cpp | 5 + .../vp/hal/bufferMgr/vp_resource_manager.cpp | 65 ++- .../vp/hal/bufferMgr/vp_resource_manager.h | 7 +- .../common/vp/hal/feature_manager/policy.cpp | 7 - .../vp/hal/feature_manager/surface_type.h | 23 +- .../vp/hal/feature_manager/vp_kernelset.cpp | 1 + .../kernel_args/igvpfc_422HV_input_args.h | 49 ++ .../hal/features/kernel_args/media_srcs.cmake | 1 + .../vp/hal/features/vp_ocl_fc_filter.cpp | 470 ++++++++++++++++-- .../common/vp/hal/features/vp_ocl_fc_filter.h | 34 +- .../vp/hal/packet/vp_render_ocl_fc_kernel.cpp | 3 + .../media_interfaces_lnl.cpp | 2 + 16 files changed, 821 insertions(+), 76 deletions(-) create mode 100644 media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.cpp create mode 100644 media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.h create mode 100644 media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_422HV_input_args.h diff --git a/media_common/agnostic/common/vp/hal/vp_common_defs.h b/media_common/agnostic/common/vp/hal/vp_common_defs.h index ac540d33d9a..39e20328208 100644 --- a/media_common/agnostic/common/vp/hal/vp_common_defs.h +++ b/media_common/agnostic/common/vp/hal/vp_common_defs.h @@ -190,6 +190,7 @@ enum VpKernelID kernelOclFc444PL3Output, kernelOclFc420PL3Input, kernelOclFc420PL3Output, + kernelOclFc422HVInput, baseKernelMaxNumID }; diff --git a/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.cpp b/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.cpp new file mode 100644 index 00000000000..668a25ce7a5 --- /dev/null +++ b/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2024, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +//////////////////////////////////////////////////////////////////////////////// +// !!! WARNING - AUTO GENERATED FILE. DO NOT EDIT DIRECTLY. !!! +// Generated by KernelBinToSource.exe tool +//////////////////////////////////////////////////////////////////////////////// + +#if !defined(MEDIA_BIN_DLL) +#include "vp_platform_interface.h" +#include "vp_render_common.h" +#endif +#include "igvpfc_422HV_input_xe2.h" + +#if defined(MEDIA_BIN_SUPPORT) && !defined(MEDIA_BIN_DLL) + +unsigned int IGVPFC_422HV_INPUT_GENERATION_XE2_SIZE = 0; +unsigned int *IGVPFC_422HV_INPUT_GENERATION_XE2 = nullptr; +static bool getIGVPFC_422HV_INPUT_XE2 = LoadMediaBin(IGVPFC_422HV_INPUT_GENERATION_XE2_NAME, &IGVPFC_422HV_INPUT_GENERATION_XE2_SIZE, &IGVPFC_422HV_INPUT_GENERATION_XE2); + +#endif // defined(MEDIA_BIN_SUPPORT) && !defined(MEDIA_BIN_DLL) + +#if !defined(MEDIA_BIN_DLL) +void AddVpNativeKernelEntryToListFc_422hv_inputXe2(vp::VpPlatformInterface &vpPlatformInterface) +{ + vp::KRN_ARG IMAGEREAD_CURBE[] = + { + {FC_422HV_INPUT_IMAGEREAD_WIDTHUV, 0, 0, 4, vp::ARG_KIND_GENERAL, false, vp::AddressingModeStateful}, + {FC_422HV_INPUT_IMAGEREAD_HEIGHTUV, 4, 0, 4, vp::ARG_KIND_GENERAL, false, vp::AddressingModeStateful}, + {FC_422HV_INPUT_IMAGEREAD_INPUTINDEX, 8, 0, 4, vp::ARG_KIND_GENERAL, false, vp::AddressingModeStateful}, + {FC_422HV_INPUT_IMAGEREAD_OUTPUTINDEX, 16, 0, 16, vp::ARG_KIND_GENERAL, false, vp::AddressingModeStateful}, + {FC_422HV_INPUT_IMAGEREAD_ENQUEUED_LOCAL_SIZE, 32, 0, 12, vp::ARG_KIND_GENERAL, false, vp::AddressingModeStateful}, + {FC_422HV_INPUT_IMAGEREAD_GLOBAL_ID_OFFSET, 0, 0, 12, vp::ARG_KIND_INLINE}, + {FC_422HV_INPUT_IMAGEREAD_LOCAL_SIZE, 12, 0, 12, vp::ARG_KIND_INLINE}, + }; + + vp::KRN_EXECUTE_ENV IMAGEREAD_PARAM = + { + 0, //barrier_count + true, //disable_mid_thread_preemption + 128, //grf_count + false, //has_global_atomics + true, //has_no_stateless_write + 32, //inline_data_payload_size + 192, //offset_to_skip_per_thread_data_load + 32, //simd_size + true, //subgroup_independent_forward_progress + 8, //eu_thread_count + false, //has_fence_for_image_access + false, //has_sample + true, //has_4gb_buffers + { 0, 0, 0 }, //work_group_walk_order_dimensions + 0, //private_size + 0 //slm_size + }; + + vp::KRN_BTI IMAGEREAD_BTI[] = + { + {FC_422HV_INPUT_IMAGEREAD_INPUTPLANE0, 0}, + {FC_422HV_INPUT_IMAGEREAD_INPUTPLANE1, 1}, + {FC_422HV_INPUT_IMAGEREAD_INPUTPLANE2, 2}, + {FC_422HV_INPUT_IMAGEREAD_OUTPUTPLANE0, 3}, + {FC_422HV_INPUT_IMAGEREAD_OUTPUTPLANE1, 4}, + }; + + vpPlatformInterface.InitVpDelayedNativeAdvKernel((uint32_t *)((uint8_t *)IGVPFC_422HV_INPUT_GENERATION_XE2 + 0), 2496, IMAGEREAD_CURBE, 7, 44, IMAGEREAD_PARAM, IMAGEREAD_BTI, 5, "ImageRead_fc_422HV_input"); + +} +#endif + +#if !defined(MEDIA_BIN_SUPPORT) || defined(MEDIA_BIN_DLL) +DEFINE_SHARED_ARRAY_SIZE_UINT32(IGVPFC_422HV_INPUT_GENERATION_XE2_SIZE, 2496); +extern const unsigned int IGVPFC_422HV_INPUT_GENERATION_XE2[] = +{ + 0x80100061, 0x7f054220, 0x00000000, 0x00000000, 0x80000065, 0x7f258220, 0x02000004, 0xffffffc0, + 0x80000065, 0x7f058110, 0x01000024, 0x00ff00ff, 0x80001a40, 0x7f258220, 0x02007f24, 0x00000040, + 0x80001940, 0x7f258220, 0x02007f24, 0x00000000, 0x8000195b, 0x7f048220, 0x01017f24, 0x00c07f04, + 0x800c0061, 0x04050220, 0x00100104, 0x00000000, 0x80012031, 0x01140000, 0xfa007f8f, 0xf6780003, + 0x8000c131, 0x030c0800, 0xfa007f8f, 0xf6740003, 0x00000060, 0x00000000, 0x00000000, 0x00000000, + 0x00000060, 0x00000000, 0x00000000, 0x00000000, 0x00000060, 0x00000000, 0x00000000, 0x00000000, + 0x3c8ca101, 0x00100000, 0x8000a065, 0x7f058220, 0x02000004, 0xffffffc0, 0x80001940, 0x7f058220, + 0x02007f04, 0x00000000, 0x80032231, 0x050c0000, 0xfa007f8f, 0xf6740003, 0x2c240061, 0x00100049, + 0x80000966, 0x80018220, 0x02008000, 0x400004c0, 0x80032241, 0x20010660, 0x01000584, 0x00004914, + 0xac848153, 0x49430503, 0x80000041, 0x20010660, 0x01000594, 0x00004964, 0xac840053, 0x49ff0506, + 0x00156052, 0x61040660, 0x010e0304, 0x04040104, 0x00141a52, 0x66040660, 0x010e0604, 0x04140204, + 0x00172331, 0x08440000, 0x20006114, 0x01686614, 0x28200061, 0x00106139, 0x28200061, 0x0010663b, + 0x00148365, 0x14058660, 0x06100c04, 0x807fffff, 0x00541970, 0x29050660, 0x16101404, 0x00100c04, + 0x00140065, 0x10058660, 0x06100804, 0x807fffff, 0x80540070, 0x00018660, 0x15000524, 0x00010001, + 0x00140065, 0x12058660, 0x06100a04, 0x807fffff, 0x00d41b70, 0x21050660, 0x16101004, 0x00100804, + 0x00140065, 0x16058660, 0x06100e04, 0x807fffff, 0x00941b70, 0x25050660, 0x16101204, 0x00100a04, + 0x00140065, 0x19058660, 0x06100804, 0x80000000, 0xec840061, 0x0010314a, 0x80940070, 0x00018660, + 0x15000524, 0x00000000, 0x00141d70, 0x2d050660, 0x16101604, 0x00100e04, 0x00140065, 0x1b058660, + 0x06100a04, 0x80000000, 0x00141d6b, 0x23040228, 0xd28a2104, 0x08051904, 0xfc841d61, 0x00104a30, + 0x00141b6b, 0x27040228, 0xd28a2504, 0x0a051b04, 0x04941b62, 0x20018aa0, 0x0a102304, 0x00000000, + 0x00140065, 0x1d058660, 0x06100c04, 0x80000000, 0x80541170, 0x00018660, 0x15000524, 0x00020002, + 0x04141b62, 0x20010aa0, 0x0a102704, 0x00102000, 0x00140065, 0x1f058660, 0x06100e04, 0x80000000, + 0x00141b6b, 0x2b040228, 0xd28a2904, 0x0c051d04, 0x80141170, 0x00018660, 0x15000524, 0x00030003, + 0x00d40070, 0x00010220, 0x52106604, 0x00000514, 0x00141c6b, 0x2f040228, 0xd28a2d04, 0x0e051f04, + 0x04541c62, 0x20010aa0, 0x0a102b04, 0x00102000, 0x04141962, 0x20010aa0, 0x0a102f04, 0x00102000, + 0x04d41170, 0x00010220, 0x52106104, 0x00000504, 0x00140061, 0x31050aa0, 0x00102000, 0x00000000, + 0x00140061, 0x33050aa0, 0x00102000, 0x00000000, 0x00140061, 0x35050aa0, 0x00102000, 0x00000000, + 0x00140061, 0x37050aa0, 0x00102000, 0x00000000, 0x00162431, 0x00000000, 0xda0c39a7, 0x043c3144, + 0x14d4002e, 0x0000c000, 0x00000570, 0x00000570, 0x0014c531, 0x06440000, 0x20026114, 0x01686614, + 0x68840065, 0x00340516, 0x0014c631, 0x0e440000, 0x20046114, 0x01686614, 0x80d41970, 0x00018660, + 0x15001604, 0x00010001, 0x80000065, 0x17058660, 0x05000554, 0x00030003, 0xec840061, 0x0010331e, + 0x80d41a70, 0x00018660, 0x15001704, 0x00010001, 0x68840065, 0x003c0518, 0xec840061, 0x0010331f, + 0x80d41a70, 0x00018660, 0x15001804, 0x00010001, 0x80000065, 0x19058660, 0x05000574, 0x00030003, + 0xec840061, 0x00103320, 0x80d41a70, 0x00018660, 0x15001904, 0x00010001, 0xec840061, 0x00103321, + 0x80d40070, 0x00018660, 0x15001604, 0x00020002, 0xec840061, 0x00103322, 0x80d40070, 0x00018660, + 0x15001704, 0x00020002, 0xec840061, 0x00103323, 0x80d40070, 0x00018660, 0x15001804, 0x00020002, + 0xec840061, 0x00103324, 0x80d40070, 0x00018660, 0x15001904, 0x00020002, 0xec840061, 0x00103325, + 0x80d40070, 0x00018660, 0x15001604, 0x00030003, 0xec840061, 0x00103326, 0x80d40070, 0x00018660, + 0x15001704, 0x00030003, 0xec840061, 0x00103327, 0x80d40070, 0x00018660, 0x15001804, 0x00030003, + 0xec840061, 0x00103328, 0x80d40070, 0x00018660, 0x15001904, 0x00030003, 0x00148565, 0x2a058660, + 0x06100604, 0x807fffff, 0xec840061, 0x00103329, 0x00d41a70, 0x4d050660, 0x16102a04, 0x00100604, + 0x00140065, 0x2c058660, 0x06100804, 0x807fffff, 0xec840061, 0x0010334f, 0x00d41a70, 0x50050660, + 0x16102c04, 0x00100804, 0x00148665, 0x2e058660, 0x06100e04, 0x807fffff, 0xec840061, 0x00103352, + 0x00d41a70, 0x53050660, 0x16102e04, 0x00100e04, 0x0014a465, 0x33058660, 0x06100a04, 0x807fffff, + 0xec840061, 0x00103355, 0x00d41a70, 0x56050660, 0x16103304, 0x00100a04, 0x00140065, 0x31058660, + 0x06100604, 0x80000000, 0x00140065, 0x39058660, 0x06100e04, 0x80000000, 0x00141a6b, 0x59040228, + 0xd28a4d04, 0x06053104, 0x00140065, 0x37058660, 0x06100804, 0x80000000, 0xec840061, 0x00103358, + 0x00141c6b, 0x5d040228, 0xd28a5304, 0x0e053904, 0xfc840061, 0x00104a33, 0x00140065, 0x35058660, + 0x06101004, 0x807fffff, 0x04941e62, 0x20018aa0, 0x0a105904, 0x00000000, 0x00140065, 0x43058660, + 0x06101404, 0x807fffff, 0x00141e6b, 0x5b040228, 0xd28a5004, 0x08053704, 0x04941d62, 0x22018aa0, + 0x0a105d04, 0x00000000, 0x00140065, 0x3b058660, 0x06100c04, 0x807fffff, 0x00140065, 0x3f058660, + 0x06100a04, 0x80000000, 0x00940970, 0x64050660, 0x16103504, 0x00101004, 0x04d41c62, 0x20010aa0, + 0x0a105b04, 0x00102000, 0x00941170, 0x70050660, 0x16104304, 0x00101404, 0x00140065, 0x3d058660, + 0x06101204, 0x807fffff, 0x00140065, 0x41058660, 0x06101004, 0x80000000, 0x00141d6b, 0x5f040228, + 0xd28a5604, 0x0a053f04, 0x00d40070, 0x68050660, 0x16103b04, 0x00100c04, 0xfc840061, 0x00104a32, + 0x00140065, 0x45058660, 0x06100c04, 0x80000000, 0x00141d6b, 0x6c040228, 0xd28a6404, 0x10054104, + 0x04541d62, 0x20010aa0, 0x0a105f04, 0x00102000, 0x00d41170, 0x6a050660, 0x16103d04, 0x00101204, + 0x00140065, 0x47058660, 0x06101204, 0x80000000, 0x00141c6b, 0x6e040228, 0xd28a6804, 0x0c054504, + 0x04941c62, 0x22010aa0, 0x0a106c04, 0x00102200, 0xfc841161, 0x00101e33, 0x00141b6b, 0x72040228, + 0xd28a6a04, 0x12054704, 0x04141b62, 0x20010aa0, 0x0a106e04, 0x00102000, 0x04541962, 0x22010aa0, + 0x0a107204, 0x00102200, 0xfc841161, 0x00101f32, 0x04d40062, 0x76058aa0, 0x0a102000, 0x00000000, + 0xfc841161, 0x00102031, 0xfc840061, 0x00102133, 0x00140065, 0x4b058660, 0x06101404, 0x80000000, + 0x04940062, 0x01058aa0, 0x0a102000, 0x00000000, 0x0014196b, 0x74040228, 0xd28a7004, 0x14054b04, + 0x04540062, 0x03058aa0, 0x0a102000, 0x00000000, 0x04d40062, 0x05058aa0, 0x0a102000, 0x00000000, + 0xfc841161, 0x00102232, 0x04141a62, 0x22010aa0, 0x0a107404, 0x00102200, 0xfc841161, 0x00102331, + 0xfc840061, 0x00102430, 0xfc840061, 0x00102533, 0x04940062, 0x20010aa0, 0x0a102200, 0x00107604, + 0x04540062, 0x07050aa0, 0x0a102200, 0x00100104, 0x04140062, 0x09050aa0, 0x0a102200, 0x00100304, + 0x04d40062, 0x22010aa0, 0x0a102200, 0x00100504, 0xfc841161, 0x00102632, 0xfc840061, 0x00102731, + 0xfc840061, 0x00102830, 0xfc840061, 0x00102933, 0x28200061, 0x0010611a, 0x28200061, 0x0010661c, + 0x14940062, 0x0b058aa0, 0x0a102000, 0x00000000, 0x14540062, 0x0d058aa0, 0x0a100704, 0x00000000, + 0x14140062, 0x0f058aa0, 0x0a100904, 0x00000000, 0x14d40062, 0x11058aa0, 0x0a102200, 0x00000000, + 0x00162731, 0x00000000, 0xda0c1aa4, 0x043c0b45, 0x0014002f, 0x00004000, 0x00000000, 0x00000010, + 0x28100061, 0x0010497f, 0x80022031, 0x00000004, 0x30207f0c, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 +}; +#endif // !defined(MEDIA_BIN_SUPPORT) || defined(MEDIA_BIN_DLL) \ No newline at end of file diff --git a/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.h b/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.h new file mode 100644 index 00000000000..4f1ec97e2de --- /dev/null +++ b/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/igvpfc_422HV_input_xe2.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +//////////////////////////////////////////////////////////////////////////////// +// !!! WARNING - AUTO GENERATED FILE. DO NOT EDIT DIRECTLY. !!! +// Generated by KernelBinToSource.exe tool +//////////////////////////////////////////////////////////////////////////////// + +#ifndef __IGVPFC_422HV_INPUT_XE2_H__ +#define __IGVPFC_422HV_INPUT_XE2_H__ + +#include "media_bin_mgr.h" +DECLARE_SHARED_ARRAY_SIZE_UINT32(IGVPFC_422HV_INPUT_GENERATION_XE2_SIZE); +DECLARE_SHARED_ARRAY_UINT32(IGVPFC_422HV_INPUT_GENERATION_XE2); + +#if defined(MEDIA_BIN_SUPPORT) + +#define IGVPFC_422HV_INPUT_GENERATION_XE2_NAME "IGVPFC_422HV_INPUT_XE2" + +#if defined(MEDIA_BIN_DLL) +static bool registerIGVPFC_422HV_INPUT_XE2 = RegisterMediaBin(IGVPFC_422HV_INPUT_GENERATION_XE2_NAME, IGVPFC_422HV_INPUT_GENERATION_XE2_SIZE, IGVPFC_422HV_INPUT_GENERATION_XE2); + +#endif // defined(MEDIA_BIN_DLL) + +#endif // defined(MEDIA_BIN_SUPPORT) + +#if !defined(MEDIA_BIN_DLL) +#include "igvpfc_422HV_input_args.h" +// Following functions are always needed in media driver dll no matter media_bin_supported or not +extern void AddVpNativeKernelEntryToListFc_422hv_inputXe2(vp::VpPlatformInterface &vpPlatformInterface); +#endif // !defined(MEDIA_BIN_DLL) + +#endif // __IGVPFC_422HV_INPUT_XE2_H__ diff --git a/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/media_srcs.cmake b/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/media_srcs.cmake index 7f6625e4325..88f4a8fcd23 100644 --- a/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/media_srcs.cmake +++ b/media_softlet/agnostic/Xe_R/Xe2_HPG/vp/kernel/media_srcs.cmake @@ -30,6 +30,7 @@ set(TMP_SOURCES_ ${CMAKE_CURRENT_LIST_DIR}/igvpfc_420PL3_output_xe2.cpp ${CMAKE_CURRENT_LIST_DIR}/igvpfc_444PL3_input_xe2.cpp ${CMAKE_CURRENT_LIST_DIR}/igvpfc_444PL3_output_xe2.cpp + ${CMAKE_CURRENT_LIST_DIR}/igvpfc_422HV_input_xe2.cpp ${CMAKE_CURRENT_LIST_DIR}/igvp3dlut_xe2.cpp ) @@ -43,6 +44,7 @@ set(TMP_HEADERS_ ${CMAKE_CURRENT_LIST_DIR}/igvpfc_420PL3_output_xe2.h ${CMAKE_CURRENT_LIST_DIR}/igvpfc_444PL3_input_xe2.h ${CMAKE_CURRENT_LIST_DIR}/igvpfc_444PL3_output_xe2.h + ${CMAKE_CURRENT_LIST_DIR}/igvpfc_422HV_input_xe2.h ${CMAKE_CURRENT_LIST_DIR}/igvp3dlut_xe2.h ) diff --git a/media_softlet/agnostic/common/renderhal/renderhal.cpp b/media_softlet/agnostic/common/renderhal/renderhal.cpp index 67535039a9d..c54d27db5bc 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal.cpp +++ b/media_softlet/agnostic/common/renderhal/renderhal.cpp @@ -4292,6 +4292,11 @@ MOS_STATUS RenderHal_GetPlaneDefinitionForCommonMessage( case Format_RGBP: case Format_BGRP: case Format_444P: + case Format_422H: + case Format_422V: + case Format_411P: + case Format_R8UN: + case Format_R8G8UN: //already handled rightly in normal non-adv GetPlaneDefinition break; case Format_YV12: diff --git a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp index 3b62e1292b9..dd835e0577d 100644 --- a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp +++ b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.cpp @@ -257,6 +257,10 @@ VpResourceManager::~VpResourceManager() { m_allocator.DestroyVpSurface(m_fcIntermediaSurfaceInput[i]); } + if (m_fcSeparateIntermediaSurfaceSecPlaneInput[i]) + { + m_allocator.DestroyVpSurface(m_fcSeparateIntermediaSurfaceSecPlaneInput[i]); + } } if (m_fcIntermediaSurfaceOutput) { @@ -1098,30 +1102,48 @@ MOS_STATUS VpResourceManager::AssignFcResources(VP_EXECUTE_CAPS &caps, std::vect { VP_PUBLIC_CHK_NULL_RETURN(inputSurfaces[i]); VP_PUBLIC_CHK_NULL_RETURN(inputSurfaces[i]->osSurface); - MOS_FORMAT fcIntermediaSurfaceInputFormat = Format_Any; + MOS_FORMAT fcIntermediaInputFormat = Format_Any; + MOS_FORMAT fcSeparateIntermediaSecPlaneInputFormat = Format_Any; + uint32_t widthPL1Factor = 1; + uint32_t heightPL1Factor = 1; switch (inputSurfaces[i]->osSurface->Format) { case Format_RGBP: case Format_BGRP: - fcIntermediaSurfaceInputFormat = Format_A8R8G8B8; + fcIntermediaInputFormat = Format_A8R8G8B8; break; case Format_444P: - fcIntermediaSurfaceInputFormat = Format_AYUV; + fcIntermediaInputFormat = Format_AYUV; break; case Format_I420: case Format_YV12: case Format_IYUV: - fcIntermediaSurfaceInputFormat = Format_NV12; + fcIntermediaInputFormat = Format_NV12; + break; + case Format_422H: + fcIntermediaInputFormat = Format_R8UN; + fcSeparateIntermediaSecPlaneInputFormat = Format_R8G8UN; + widthPL1Factor = 2; + break; + case Format_422V: + fcIntermediaInputFormat = Format_R8UN; + fcSeparateIntermediaSecPlaneInputFormat = Format_R8G8UN; + heightPL1Factor = 2; + break; + case Format_411P: + fcIntermediaInputFormat = Format_R8UN; + fcSeparateIntermediaSecPlaneInputFormat = Format_R8G8UN; + widthPL1Factor = 4; break; default: break; } - if (fcIntermediaSurfaceInputFormat != Format_Any) + if (fcIntermediaInputFormat != Format_Any) { VP_PUBLIC_CHK_STATUS_RETURN(m_allocator.ReAllocateSurface( m_fcIntermediaSurfaceInput[i], "fcIntermediaSurfaceInput", - fcIntermediaSurfaceInputFormat, + fcIntermediaInputFormat, MOS_GFXRES_2D, MOS_TILE_Y, inputSurfaces[i]->osSurface->dwWidth, @@ -1133,11 +1155,36 @@ MOS_STATUS VpResourceManager::AssignFcResources(VP_EXECUTE_CAPS &caps, std::vect IsDeferredResourceDestroyNeeded(), MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER)); - m_fcIntermediaSurfaceInput[i]->rcSrc = inputSurfaces[i]->rcSrc; - m_fcIntermediaSurfaceInput[i]->rcDst = inputSurfaces[i]->rcDst; - m_fcIntermediaSurfaceInput[i]->SampleType = inputSurfaces[i]->SampleType; + m_fcIntermediaSurfaceInput[i]->rcSrc = inputSurfaces[i]->rcSrc; + m_fcIntermediaSurfaceInput[i]->rcDst = inputSurfaces[i]->rcDst; + m_fcIntermediaSurfaceInput[i]->SampleType = inputSurfaces[i]->SampleType; surfSetting.surfGroup.insert(std::make_pair((SurfaceType)(SurfaceTypeFcIntermediaInput + i), m_fcIntermediaSurfaceInput[i])); } + if (fcSeparateIntermediaSecPlaneInputFormat != Format_Any) + { + VP_PUBLIC_CHK_STATUS_RETURN(m_allocator.ReAllocateSurface( + m_fcSeparateIntermediaSurfaceSecPlaneInput[i], + "fcSeparateIntermediaSurfaceSecPlaneInput", + fcSeparateIntermediaSecPlaneInputFormat, + MOS_GFXRES_2D, + MOS_TILE_Y, + inputSurfaces[i]->osSurface->dwWidth / widthPL1Factor, + inputSurfaces[i]->osSurface->dwHeight / heightPL1Factor, + false, + MOS_MMC_DISABLED, + allocated, + false, + IsDeferredResourceDestroyNeeded(), + MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER)); + + m_fcSeparateIntermediaSurfaceSecPlaneInput[i]->rcSrc.top = inputSurfaces[i]->rcSrc.top / heightPL1Factor; + m_fcSeparateIntermediaSurfaceSecPlaneInput[i]->rcSrc.bottom = inputSurfaces[i]->rcSrc.bottom / heightPL1Factor; + m_fcSeparateIntermediaSurfaceSecPlaneInput[i]->rcSrc.left = inputSurfaces[i]->rcSrc.left / widthPL1Factor; + m_fcSeparateIntermediaSurfaceSecPlaneInput[i]->rcSrc.right = inputSurfaces[i]->rcSrc.right / widthPL1Factor; + m_fcSeparateIntermediaSurfaceSecPlaneInput[i]->rcDst = inputSurfaces[i]->rcDst; + m_fcSeparateIntermediaSurfaceSecPlaneInput[i]->SampleType = inputSurfaces[i]->SampleType; + surfSetting.surfGroup.insert(std::make_pair((SurfaceType)(SurfaceTypeFcSeparateIntermediaInputSecPlane + i), m_fcSeparateIntermediaSurfaceSecPlaneInput[i])); + } } // Allocate OCL FC intermedia outputSurface { diff --git a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.h b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.h index 47fdf880d72..e58b6e0e2d9 100644 --- a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.h +++ b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_resource_manager.h @@ -551,9 +551,10 @@ class VpResourceManager VP_SURFACE *m_temperalInput = nullptr; // Fc Resource - VP_SURFACE *m_cmfcCoeff = nullptr; - VP_SURFACE *m_fcIntermediaSurfaceOutput = nullptr; - VP_SURFACE *m_fcIntermediaSurfaceInput[VP_COMP_MAX_LAYERS] = {}; + VP_SURFACE *m_cmfcCoeff = nullptr; + VP_SURFACE *m_fcIntermediaSurfaceOutput = nullptr; + VP_SURFACE *m_fcIntermediaSurfaceInput[VP_COMP_MAX_LAYERS] = {}; + VP_SURFACE *m_fcSeparateIntermediaSurfaceSecPlaneInput[VP_COMP_MAX_LAYERS] = {}; //for decompreesion sync on interlace input of FC VP_SURFACE *m_decompressionSyncSurface = nullptr; // Hdr Resource diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp b/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp index c5025dc0e27..ec700419984 100644 --- a/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp +++ b/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp @@ -1023,13 +1023,6 @@ MOS_STATUS Policy::GetCSCExecutionCaps(SwFilter* feature, bool isCamPipeWithBaye return MOS_STATUS_SUCCESS; } - if (cscParams->formatInput == Format_422H || - cscParams->formatInput == Format_422V) - { - //422H and 422V input not supported by OCL FC yet. Will remove the restriction after they are enabled - cscEngine->forceLegacyFC = true; - } - bool isAlphaSettingSupportedBySfc = IsAlphaSettingSupportedBySfc(cscParams->formatInput, cscParams->formatOutput, cscParams->pAlphaParams); bool isAlphaSettingSupportedByVebox = diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/surface_type.h b/media_softlet/agnostic/common/vp/hal/feature_manager/surface_type.h index 1d68a41f841..db3673f26da 100644 --- a/media_softlet/agnostic/common/vp/hal/feature_manager/surface_type.h +++ b/media_softlet/agnostic/common/vp/hal/feature_manager/surface_type.h @@ -88,17 +88,18 @@ enum SurfaceType SurfaceTypeFixFuncEnd = SurfaceTypeGeneralEnd + 0x2000, //for fix function usage // FC - SurfaceTypeFcInputLayer0 = SurfaceTypeFixFuncEnd + 0x100, - SurfaceTypeFcInputLayerMax = SurfaceTypeFcInputLayer0 + SURFACETYPE_SIZE8, - SurfaceTypeFcInputLayer0Field1Dual = SurfaceTypeFixFuncEnd + 0x200, - SurfaceTypeFcInputLayerMaxField1Dual = SurfaceTypeFcInputLayer0Field1Dual + SURFACETYPE_SIZE8, - SurfaceTypeFcTarget0 = SurfaceTypeFixFuncEnd + 0x300, - SurfaceTypeFcTarget1 = SurfaceTypeFixFuncEnd + 0x400, - SurfaceTypeFcCscCoeff = SurfaceTypeFixFuncEnd + 0x500, - SurfaceTypeDecompressionSync = SurfaceTypeFixFuncEnd + 0x600, - SurfaceTypeFcIntermediaInput = SurfaceTypeFixFuncEnd + 0x700, - SurfaceTypeFcIntermediaOutput = SurfaceTypeFixFuncEnd + 0x800, - SurfaceTypeFcEnd = SurfaceTypeFixFuncEnd + 0x900, + SurfaceTypeFcInputLayer0 = SurfaceTypeFixFuncEnd + 0x100, + SurfaceTypeFcInputLayerMax = SurfaceTypeFcInputLayer0 + SURFACETYPE_SIZE8, + SurfaceTypeFcInputLayer0Field1Dual = SurfaceTypeFixFuncEnd + 0x200, + SurfaceTypeFcInputLayerMaxField1Dual = SurfaceTypeFcInputLayer0Field1Dual + SURFACETYPE_SIZE8, + SurfaceTypeFcTarget0 = SurfaceTypeFixFuncEnd + 0x300, + SurfaceTypeFcTarget1 = SurfaceTypeFixFuncEnd + 0x400, + SurfaceTypeFcCscCoeff = SurfaceTypeFixFuncEnd + 0x500, + SurfaceTypeDecompressionSync = SurfaceTypeFixFuncEnd + 0x600, + SurfaceTypeFcIntermediaInput = SurfaceTypeFixFuncEnd + 0x700, + SurfaceTypeFcSeparateIntermediaInputSecPlane = SurfaceTypeFixFuncEnd + 0x800, + SurfaceTypeFcIntermediaOutput = SurfaceTypeFixFuncEnd + 0x900, + SurfaceTypeFcEnd = SurfaceTypeFixFuncEnd + 0xa00, // 3DLut Kernel SurfaceType3DLut2D = SurfaceTypeFcEnd + 0x100, diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp b/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp index 09d9393f941..20906b85187 100644 --- a/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp +++ b/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp @@ -133,6 +133,7 @@ MOS_STATUS VpKernelSet::CreateSingleKernelObject( case kernelOclFc420PL3Output: case kernelOclFc444PL3Input: case kernelOclFc444PL3Output: + case kernelOclFc422HVInput: kernel = (VpRenderKernelObj *)MOS_New(VpRenderOclFcKernel, m_hwInterface, kernelId, kernelIndex, m_allocator); VP_RENDER_CHK_NULL_RETURN(kernel); break; diff --git a/media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_422HV_input_args.h b/media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_422HV_input_args.h new file mode 100644 index 00000000000..fa61342d309 --- /dev/null +++ b/media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_422HV_input_args.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024, Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +//////////////////////////////////////////////////////////////////////////////// +// !!! WARNING - AUTO GENERATED FILE. DO NOT EDIT DIRECTLY. !!! +// Generated by KernelBinToSource.exe tool +//////////////////////////////////////////////////////////////////////////////// + +#ifndef __IGVPFC_422HV_INPUT_ENUM_H__ +#define __IGVPFC_422HV_INPUT_ENUM_H__ + +enum ARGS_FC_422HV_INPUT_IMAGEREAD +{ + FC_422HV_INPUT_IMAGEREAD_INPUTPLANE0, + FC_422HV_INPUT_IMAGEREAD_INPUTPLANE1, + FC_422HV_INPUT_IMAGEREAD_INPUTPLANE2, + FC_422HV_INPUT_IMAGEREAD_OUTPUTPLANE0, + FC_422HV_INPUT_IMAGEREAD_OUTPUTPLANE1, + FC_422HV_INPUT_IMAGEREAD_WIDTHUV, + FC_422HV_INPUT_IMAGEREAD_HEIGHTUV, + FC_422HV_INPUT_IMAGEREAD_INPUTINDEX, + FC_422HV_INPUT_IMAGEREAD_OUTPUTINDEX, + FC_422HV_INPUT_IMAGEREAD_ENQUEUED_LOCAL_SIZE, + FC_422HV_INPUT_IMAGEREAD_GLOBAL_ID_OFFSET, + FC_422HV_INPUT_IMAGEREAD_LOCAL_SIZE, + FC_422HV_INPUT_IMAGEREAD_MAX +}; + +#endif // __IGVPFC_422HV_INPUT_ENUM_H__ diff --git a/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake b/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake index 5b27726e6ea..793112af822 100644 --- a/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake +++ b/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake @@ -30,6 +30,7 @@ set(TMP_HEADERS_ ${CMAKE_CURRENT_LIST_DIR}/igvpfc_420PL3_output_args.h ${CMAKE_CURRENT_LIST_DIR}/igvpfc_444PL3_input_args.h ${CMAKE_CURRENT_LIST_DIR}/igvpfc_444PL3_output_args.h + ${CMAKE_CURRENT_LIST_DIR}/igvpfc_422HV_input_args.h ) set(SOFTLET_VP_SOURCES_ diff --git a/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.cpp b/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.cpp index a6836bf9ee4..d4d8b71bd77 100644 --- a/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.cpp +++ b/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.cpp @@ -32,6 +32,7 @@ #include "igvpfc_420PL3_output_args.h" #include "igvpfc_444PL3_input_args.h" #include "igvpfc_444PL3_output_args.h" +#include "igvpfc_422HV_input_args.h" #include namespace vp @@ -143,6 +144,15 @@ MOS_STATUS VpOclFcFilter::Destroy() MOS_FreeMemAndSetNull(krnArg.pData); } } + for (std::pair &singleLayerHandle : m_fc422HVInputMultiLayersKrnArgs) + { + KERNEL_INDEX_ARG_MAP &krnArgs = singleLayerHandle.second; + for (auto &handle : krnArgs) + { + KRN_ARG &krnArg = handle.second; + MOS_FreeMemAndSetNull(krnArg.pData); + } + } return MOS_STATUS_SUCCESS; } @@ -211,6 +221,12 @@ MOS_STATUS VpOclFcFilter::InitKrnParams(OCL_FC_KERNEL_PARAMS &krnParams, SwFilte VP_RENDER_CHK_STATUS_RETURN(GenerateFc444PL3InputParam(compParam.inputLayersParam[i], compParam.layerNumber, param, i)); krnParams.push_back(param); break; + case Format_422H: + case Format_422V: + case Format_411P: + VP_RENDER_CHK_STATUS_RETURN(GenerateFc422HVInputParam(compParam.inputLayersParam[i], i, param)); + krnParams.push_back(param); + break; default: break; } @@ -268,7 +284,7 @@ MOS_STATUS VpOclFcFilter::GenerateFc420PL3InputParam(OCL_FC_LAYER_PARAM &inputLa VP_PUBLIC_CHK_NULL_RETURN(inputSurf); VP_PUBLIC_CHK_NULL_RETURN(inputSurf->osSurface); VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputOutputSingleChannelIndexToKrnParam(inputSurf->osSurface->Format, lumaChannelIndices)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(inputSurf->osSurface->Format, chromaChannelIndices)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(inputSurf->osSurface->Format, Format_Any, chromaChannelIndices)); uint32_t srcSurfaceWidth = inputSurf->osSurface->dwWidth; uint32_t srcSurfaceHeight = inputSurf->osSurface->dwHeight; @@ -432,6 +448,175 @@ MOS_STATUS VpOclFcFilter::GenerateFc420PL3OutputParam(OCL_FC_LAYER_PARAM &output return MOS_STATUS_SUCCESS; } +MOS_STATUS VpOclFcFilter::GenerateFc422HVInputParam(OCL_FC_LAYER_PARAM &inputLayersParam, uint32_t index, OCL_FC_KERNEL_PARAM ¶m) +{ + VP_FUNC_CALL(); + VP_PUBLIC_CHK_NULL_RETURN(m_pvpMhwInterface); + VP_PUBLIC_CHK_NULL_RETURN(m_pvpMhwInterface->m_vpPlatformInterface); + param.Init(); + VP_SURFACE *inputSurf = inputLayersParam.surf; + uint32_t chromaChannelIndices[4] = {}; + uint32_t channelIndex = 0; + VP_PUBLIC_CHK_NULL_RETURN(inputSurf); + VP_PUBLIC_CHK_NULL_RETURN(inputSurf->osSurface); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputOutputSingleChannelIndexToKrnParam(inputSurf->osSurface->Format, channelIndex)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(inputSurf->osSurface->Format, Format_Any, chromaChannelIndices)); + + uint32_t surfaceWidthPL1 = inputSurf->osSurface->dwWidth; + uint32_t surfaceHeightPL1 = inputSurf->osSurface->dwHeight; + switch (inputSurf->osSurface->Format) + { + case Format_422H: + surfaceWidthPL1 /= 2; + break; + case Format_422V: + surfaceHeightPL1 /= 2; + break; + case Format_411P: + surfaceWidthPL1 /= 4; + break; + default: + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); + } + uint32_t tarSurfaceWidth = inputSurf->osSurface->dwWidth; + uint32_t tarSurfaceHeight = inputSurf->osSurface->dwHeight; + uint32_t localSize[3] = {128, 2, 1}; // localWidth, localHeight, localDepth + uint32_t threadWidth = tarSurfaceWidth / localSize[0] + (tarSurfaceWidth % localSize[0] != 0); + uint32_t threadHeight = tarSurfaceHeight / localSize[1] + (tarSurfaceHeight % localSize[1] != 0); + KERNEL_ARGS krnArgs = {}; + KERNEL_ARG_INDEX_SURFACE_MAP krnStatefulSurfaces = {}; + std::string krnName = "ImageRead_fc_422HV_input"; + auto handle = m_pvpMhwInterface->m_vpPlatformInterface->GetKernelPool().find(krnName); + VP_PUBLIC_CHK_NOT_FOUND_RETURN(handle, &m_pvpMhwInterface->m_vpPlatformInterface->GetKernelPool()); + KERNEL_BTIS kernelBtis = handle->second.GetKernelBtis(); + KERNEL_ARGS kernelArgs = handle->second.GetKernelArgs(); + auto argLayerHandle = m_fc422HVInputMultiLayersKrnArgs.find(index); + if (argLayerHandle == m_fc422HVInputMultiLayersKrnArgs.end()) + { + KERNEL_INDEX_ARG_MAP fc422HVInputSingleLayerKrnArgs = {}; + argLayerHandle = m_fc422HVInputMultiLayersKrnArgs.insert(std::make_pair(index, fc422HVInputSingleLayerKrnArgs)).first; + VP_PUBLIC_CHK_NOT_FOUND_RETURN(argLayerHandle, &m_fc422HVInputMultiLayersKrnArgs); + } + KERNEL_INDEX_ARG_MAP &fc422HVInputKrnArgs = argLayerHandle->second; + + for (auto const &kernelArg : kernelArgs) + { + uint32_t uIndex = kernelArg.uIndex; + auto argHandle = fc422HVInputKrnArgs.find(uIndex); + if (argHandle == fc422HVInputKrnArgs.end()) + { + KRN_ARG krnArg = {}; + argHandle = fc422HVInputKrnArgs.insert(std::make_pair(uIndex, krnArg)).first; + VP_PUBLIC_CHK_NOT_FOUND_RETURN(argHandle, &fc422HVInputKrnArgs); + } + KRN_ARG &krnArg = argHandle->second; + bool bInit = true; + krnArg.uIndex = uIndex; + krnArg.eArgKind = kernelArg.eArgKind; + if (krnArg.pData == nullptr) + { + if (kernelArg.uSize > 0) + { + krnArg.uSize = kernelArg.uSize; + krnArg.pData = MOS_AllocAndZeroMemory(kernelArg.uSize); + } + } + else + { + VP_PUBLIC_CHK_VALUE_RETURN(krnArg.uSize, kernelArg.uSize); + MOS_ZeroMemory(krnArg.pData, krnArg.uSize); + } + VP_PUBLIC_CHK_STATUS_RETURN(SetupSingleFc422HVInputKrnArg(surfaceWidthPL1, surfaceHeightPL1, channelIndex, chromaChannelIndices, localSize, krnArg, bInit)); + if (bInit) + { + krnArgs.push_back(krnArg); + } + } + + for (auto const &kernelBti : kernelBtis) + { + uint32_t uIndex = kernelBti.first; + SURFACE_PARAMS surfaceParam = {}; + bool bInit = true; + VP_PUBLIC_CHK_STATUS_RETURN(SetupSingleFc422HVInputBti(uIndex, index, surfaceParam, bInit)); + if (bInit) + { + krnStatefulSurfaces.insert(std::make_pair(uIndex, surfaceParam)); + } + } + param.kernelArgs = krnArgs; + param.kernelId = kernelOclFc422HVInput; + param.threadWidth = threadWidth; + param.threadHeight = threadHeight; + param.localWidth = localSize[0]; + param.localHeight = localSize[1]; + param.kernelStatefulSurfaces = krnStatefulSurfaces; + return MOS_STATUS_SUCCESS; +} + +MOS_STATUS VpOclFcFilter::SetupSingleFc422HVInputBti(uint32_t uIndex, uint32_t layIndex, SURFACE_PARAMS &surfaceParam, bool &bInit) +{ + switch (uIndex) + { + case FC_422HV_INPUT_IMAGEREAD_INPUTPLANE0: + surfaceParam.surfType = SurfaceType(SurfaceTypeFcInputLayer0 + layIndex); + break; + case FC_422HV_INPUT_IMAGEREAD_INPUTPLANE1: + case FC_422HV_INPUT_IMAGEREAD_INPUTPLANE2: + surfaceParam.surfType = SurfaceTypeSubPlane; + break; + case FC_422HV_INPUT_IMAGEREAD_OUTPUTPLANE0: + surfaceParam.surfType = SurfaceType(SurfaceTypeFcIntermediaInput + layIndex); + surfaceParam.isOutput = true; + break; + case FC_422HV_INPUT_IMAGEREAD_OUTPUTPLANE1: + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + layIndex); + surfaceParam.isOutput = true; + break; + default: + bInit = false; + break; + } + return MOS_STATUS_SUCCESS; +} + +MOS_STATUS VpOclFcFilter::SetupSingleFc422HVInputKrnArg(uint32_t srcSurfaceWidthPL1, uint32_t srcSurfaceHeightPL1, uint32_t channelIndex, uint32_t chromaChannelIndices[4], uint32_t localSize[3], KRN_ARG &krnArg, bool &bInit) +{ + switch (krnArg.uIndex) + { + case FC_422HV_INPUT_IMAGEREAD_WIDTHUV: + VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); + *(uint32_t *)krnArg.pData = srcSurfaceWidthPL1; + break; + case FC_422HV_INPUT_IMAGEREAD_HEIGHTUV: + VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); + *(uint32_t *)krnArg.pData = srcSurfaceHeightPL1; + break; + case FC_422HV_INPUT_IMAGEREAD_INPUTINDEX: + VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); + *(uint32_t *)krnArg.pData = channelIndex; + break; + case FC_422HV_INPUT_IMAGEREAD_OUTPUTINDEX: + VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); + static_cast(krnArg.pData)[0] = chromaChannelIndices[0]; + static_cast(krnArg.pData)[1] = chromaChannelIndices[1]; + static_cast(krnArg.pData)[2] = chromaChannelIndices[2]; + static_cast(krnArg.pData)[3] = chromaChannelIndices[3]; + break; + case FC_422HV_INPUT_IMAGEREAD_LOCAL_SIZE: + case FC_422HV_INPUT_IMAGEREAD_ENQUEUED_LOCAL_SIZE: + VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); + static_cast(krnArg.pData)[0] = localSize[0]; + static_cast(krnArg.pData)[1] = localSize[1]; + static_cast(krnArg.pData)[2] = localSize[2]; + break; + default: + bInit = false; + break; + } + return MOS_STATUS_SUCCESS; +} + MOS_STATUS VpOclFcFilter::GenerateFc444PL3OutputParam(OCL_FC_LAYER_PARAM &outputLayersParam, OCL_FC_KERNEL_PARAM ¶m) { VP_FUNC_CALL(); @@ -443,7 +628,7 @@ MOS_STATUS VpOclFcFilter::GenerateFc444PL3OutputParam(OCL_FC_LAYER_PARAM &output uint32_t outputChannelIndices[4] = {}; VP_PUBLIC_CHK_NULL_RETURN(outputSurf); VP_PUBLIC_CHK_NULL_RETURN(outputSurf->osSurface); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(outputLayersParam.interMediaOverwriteSurface, inputChannelIndices)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(outputLayersParam.intermediaFormat, outputLayersParam.separateIntermediaSecPlaneFormat, inputChannelIndices)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertOutputChannelIndicesToKrnParam(outputSurf->osSurface->Format, outputChannelIndices)); uint32_t srcSurfaceWidth = outputSurf->osSurface->dwWidth; @@ -592,8 +777,8 @@ MOS_STATUS VpOclFcFilter::GenerateFc444PL3InputParam(OCL_FC_LAYER_PARAM &layer, KERNEL_BTIS kernelBtis = handle->second.GetKernelBtis(); KERNEL_ARGS kernelArgs = handle->second.GetKernelArgs(); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(layer.surf->osSurface->Format, inputChannelIndices)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertOutputChannelIndicesToKrnParam(layer.interMediaOverwriteSurface, outputChannelIndices)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(layer.surf->osSurface->Format, Format_Any, inputChannelIndices)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertOutputChannelIndicesToKrnParam(layer.intermediaFormat, outputChannelIndices)); auto argLayerHandle = m_fc444PL3InputMultiLayersKrnArgs.find(layerIndex); if (argLayerHandle == m_fc444PL3InputMultiLayersKrnArgs.end()) { @@ -1172,13 +1357,125 @@ MOS_STATUS VpOclFcFilter::SetupSingleFcCommonBti(uint32_t uIndex, const OCL_FC_C surfaceParam.isOutput = true; break; case FC_COMMON_FASTCOMP_INPUT0PL1: + if (compParam.layerNumber > 0 && compParam.inputLayersParam[0].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane); + if (compParam.inputLayersParam[0].diParams.enabled && + compParam.inputLayersParam[0].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_INPUT1PL1: + if (compParam.layerNumber > 1 && compParam.inputLayersParam[1].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + 1); + if (compParam.inputLayersParam[1].diParams.enabled && + compParam.inputLayersParam[1].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_INPUT2PL1: + if (compParam.layerNumber > 2 && compParam.inputLayersParam[2].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + 2); + if (compParam.inputLayersParam[2].diParams.enabled && + compParam.inputLayersParam[2].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_INPUT3PL1: + if (compParam.layerNumber > 3 && compParam.inputLayersParam[3].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + 3); + if (compParam.inputLayersParam[3].diParams.enabled && + compParam.inputLayersParam[3].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_INPUT4PL1: + if (compParam.layerNumber > 4 && compParam.inputLayersParam[4].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + 4); + if (compParam.inputLayersParam[4].diParams.enabled && + compParam.inputLayersParam[4].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_INPUT5PL1: + if (compParam.layerNumber > 5 && compParam.inputLayersParam[5].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + 5); + if (compParam.inputLayersParam[5].diParams.enabled && + compParam.inputLayersParam[5].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_INPUT6PL1: + if (compParam.layerNumber > 6 && compParam.inputLayersParam[6].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + 6); + if (compParam.inputLayersParam[6].diParams.enabled && + compParam.inputLayersParam[6].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_INPUT7PL1: + if (compParam.layerNumber > 7 && compParam.inputLayersParam[7].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceType(SurfaceTypeFcSeparateIntermediaInputSecPlane + 7); + if (compParam.inputLayersParam[7].diParams.enabled && + compParam.inputLayersParam[7].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_COMMON_FASTCOMP_OUTPUTPL1: surfaceParam.surfType = SurfaceTypeSubPlane; break; @@ -1260,18 +1557,29 @@ MOS_STATUS VpOclFcFilter::InitLayer(SwFilterPipe &executingPipe, bool isInputPip { case Format_RGBP: case Format_BGRP: - layer.needIntermediaSurface = true; - layer.interMediaOverwriteSurface = Format_A8R8G8B8; + layer.needIntermediaSurface = true; + layer.intermediaFormat = Format_A8R8G8B8; break; case Format_444P: - layer.needIntermediaSurface = true; - layer.interMediaOverwriteSurface = Format_AYUV; + layer.needIntermediaSurface = true; + layer.intermediaFormat = Format_AYUV; break; case Format_I420: case Format_IYUV: case Format_YV12: - layer.needIntermediaSurface = true; - layer.interMediaOverwriteSurface = Format_NV12; + layer.needIntermediaSurface = true; + layer.intermediaFormat = Format_NV12; + break; + case Format_422H: + case Format_422V: + case Format_411P: + if (isInputPipe) + { + layer.needIntermediaSurface = true; + layer.intermediaFormat = Format_R8UN; + layer.needSepareateIntermediaSecPlane = true; + layer.separateIntermediaSecPlaneFormat = Format_R8G8UN; + } break; default: break; @@ -1406,8 +1714,32 @@ MOS_STATUS VpOclFcFilter::GetChromaSitingFactor(MOS_FORMAT format, uint8_t &hitS hitSecPlaneFactorX = 2; hitSecPlaneFactorY = 1; break; + case Format_RGBP: + case Format_BGRP: + case Format_444P: + hitSecPlaneFactorX = 1; + hitSecPlaneFactorY = 1; + break; + case Format_I420: + case Format_IYUV: + case Format_YV12: + hitSecPlaneFactorX = 2; + hitSecPlaneFactorY = 2; + break; + case Format_422H: + hitSecPlaneFactorX = 2; + hitSecPlaneFactorY = 1; + break; + case Format_422V: + hitSecPlaneFactorX = 1; + hitSecPlaneFactorY = 2; + break; + case Format_411P: + hitSecPlaneFactorX = 4; + hitSecPlaneFactorY = 1; + break; default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); } return MOS_STATUS_SUCCESS; @@ -1477,7 +1809,7 @@ MOS_STATUS VpOclFcFilter::GetBitNumber(MOS_FORMAT format, uint8_t *pOriginBitNum alphaBitNumber = 0; break; default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); } if (pOriginBitNumber) @@ -1501,14 +1833,14 @@ MOS_STATUS VpOclFcFilter::GenerateInputImageParam(OCL_FC_LAYER_PARAM &layer, VPH VP_FUNC_CALL(); VP_PUBLIC_CHK_NULL_RETURN(layer.surf); VP_PUBLIC_CHK_NULL_RETURN(layer.surf->osSurface); - MOS_FORMAT surfOverwriteFormat = layer.needIntermediaSurface ? layer.interMediaOverwriteSurface : layer.surf->osSurface->Format; + MOS_FORMAT surfOverwriteFormat = layer.needIntermediaSurface ? layer.intermediaFormat : layer.surf->osSurface->Format; uint32_t inputWidth = MOS_MIN(static_cast(layer.surf->osSurface->dwWidth), static_cast(layer.surf->rcSrc.right)); uint32_t inputHeight = MOS_MIN(static_cast(layer.surf->osSurface->dwHeight), static_cast(layer.surf->rcSrc.bottom)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertProcampAndCscToKrnParam(layer.surf->ColorSpace, mainCSpace, imageParam.csc, layer.procampParams)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(surfOverwriteFormat, imageParam.inputChannelIndices)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(surfOverwriteFormat, layer.separateIntermediaSecPlaneFormat, imageParam.inputChannelIndices)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertScalingRotToKrnParam(layer.surf->rcSrc, layer.surf->rcDst, layer.scalingMode, inputWidth, inputHeight, layer.rotation, imageParam.scale, imageParam.controlSetting.samplerType, imageParam.coordShift)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaUpsampleToKrnParam(surfOverwriteFormat, layer.surf->ChromaSiting, layer.scalingMode, inputWidth, inputHeight, imageParam.coordShift.chromaShiftX, imageParam.coordShift.chromaShiftY, imageParam.controlSetting.isChromaShift)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(surfOverwriteFormat, true, imageParam.inputPlaneNum)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaUpsampleToKrnParam(layer.surf->osSurface->Format, layer.surf->ChromaSiting, layer.scalingMode, inputWidth, inputHeight, imageParam.coordShift.chromaShiftX, imageParam.coordShift.chromaShiftY, imageParam.controlSetting.isChromaShift)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(surfOverwriteFormat, layer.needSepareateIntermediaSecPlane, true, imageParam.inputPlaneNum)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertBlendingToKrnParam(layer.blendingParams, imageParam.controlSetting.ignoreSrcPixelAlpha, imageParam.controlSetting.ignoreDstPixelAlpha, imageParam.constAlphs)); if (layer.lumaKey.enabled) @@ -1851,6 +2183,33 @@ MOS_STATUS VpOclFcFilter::ConvertChromaUpsampleToKrnParam(MOS_FORMAT format, uin chromaShiftX -= 0.5f; } } + else if (hitSecPlaneFactorX == 1 && hitSecPlaneFactorY == 2) + { + // For PA surface, only (H Left, V Top) and (H Center, V top) are needed. + if (chromaSitingLoc & (CHROMA_SITING_VERT_CENTER)) + { + //Top Center + isChromaShift = 1; + chromaShiftY -= 0.5f; + } + } + else if (hitSecPlaneFactorX == 4 && hitSecPlaneFactorY == 1) + { + chromaShiftY += 1; + isChromaShift = 1; + // For PA surface, only (H Left, V Top) and (H Center, V top) are needed. + if (chromaSitingLoc & (CHROMA_SITING_VERT_CENTER)) + { + //Top Center + //common shift 0.5, inital chromaShiftX 0.5, (0.5 + 0.5 + 1 - 0.5) / 4 = 0.5(3d sampler shift) - 0.125(chroma siting shift, 0.25 is one step for 411, half of 0.125) + chromaShiftX += 0.5f; + } + else + { + //Top Left + chromaShiftX += 1; + } + } } if (scalingMode == VPHAL_SCALING_NEAREST) @@ -1871,15 +2230,18 @@ MOS_STATUS VpOclFcFilter::ConvertInputOutputSingleChannelIndexToKrnParam(MOS_FOR case Format_YV12: case Format_I420: case Format_IYUV: + case Format_422H: + case Format_422V: + case Format_411P: inputChannelIndex = 0; break; default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); } return MOS_STATUS_SUCCESS; } -MOS_STATUS VpOclFcFilter::ConvertInputChannelIndicesToKrnParam(MOS_FORMAT format, uint32_t *inputChannelIndices) +MOS_STATUS VpOclFcFilter::ConvertInputChannelIndicesToKrnParam(MOS_FORMAT format, MOS_FORMAT separateIntermediaSecPlaneFormat, uint32_t *inputChannelIndices) { switch (format) { @@ -1982,14 +2344,35 @@ MOS_STATUS VpOclFcFilter::ConvertInputChannelIndicesToKrnParam(MOS_FORMAT format inputChannelIndices[2] = 5; inputChannelIndices[3] = 5; break; + case Format_422H: + case Format_422V: + case Format_411P: + inputChannelIndices[0] = 1; + inputChannelIndices[1] = 2; + inputChannelIndices[2] = 3; + inputChannelIndices[3] = 3; + break; + case Format_R8UN: + if (separateIntermediaSecPlaneFormat == Format_R8G8UN) + { + inputChannelIndices[0] = 0; + inputChannelIndices[1] = 4; + inputChannelIndices[2] = 5; + inputChannelIndices[3] = 3; + } + else + { + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); + } + break; default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); } return MOS_STATUS_SUCCESS; } -MOS_STATUS VpOclFcFilter::ConvertPlaneNumToKrnParam(MOS_FORMAT format, bool isInput, uint32_t &planeNum) +MOS_STATUS VpOclFcFilter::ConvertPlaneNumToKrnParam(MOS_FORMAT format, bool needSeparateIntermediaSecPlane, bool isInput, uint32_t &planeNum) { switch (format) { @@ -2035,7 +2418,14 @@ MOS_STATUS VpOclFcFilter::ConvertPlaneNumToKrnParam(MOS_FORMAT format, bool isIn } break; default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); + if (needSeparateIntermediaSecPlane) + { + planeNum = 2; + } + else + { + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); + } } return MOS_STATUS_SUCCESS; @@ -2076,7 +2466,7 @@ MOS_STATUS VpOclFcFilter::ConvertBlendingToKrnParam(VPHAL_BLENDING_PARAMS &blend ignoreDstPixelAlpha = 0; break; default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); } return MOS_STATUS_SUCCESS; @@ -2088,11 +2478,11 @@ MOS_STATUS VpOclFcFilter::GenerateTargetParam(OCL_FC_COMP_PARAM &compParam, OCL_ VP_SURFACE *targetSurf = compParam.outputLayerParam.surf; VP_PUBLIC_CHK_NULL_RETURN(targetSurf); VP_PUBLIC_CHK_NULL_RETURN(targetSurf->osSurface); - MOS_FORMAT outputSurfOverwriteFormat = compParam.outputLayerParam.needIntermediaSurface ? compParam.outputLayerParam.interMediaOverwriteSurface : targetSurf->osSurface->Format; - VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(outputSurfOverwriteFormat, false, targetParam.planeNumber)); + MOS_FORMAT outputSurfOverwriteFormat = compParam.outputLayerParam.needIntermediaSurface ? compParam.outputLayerParam.intermediaFormat : targetSurf->osSurface->Format; + VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(outputSurfOverwriteFormat, compParam.outputLayerParam.needSepareateIntermediaSecPlane, false, targetParam.planeNumber)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertOutputChannelIndicesToKrnParam(outputSurfOverwriteFormat, targetParam.dynamicChannelIndices)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertTargetRoiToKrnParam(targetSurf->rcDst, targetSurf->osSurface->dwWidth, targetSurf->osSurface->dwHeight, targetParam.targetROI)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaDownsampleToKrnParam(outputSurfOverwriteFormat, targetSurf->ChromaSiting, targetParam.chromaSitingFactor, targetParam.controlSetting.hitSecPlaneFactorX, targetParam.controlSetting.hitSecPlaneFactorY)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaDownsampleToKrnParam(targetSurf->osSurface->Format, targetSurf->ChromaSiting, targetParam.chromaSitingFactor, targetParam.controlSetting.hitSecPlaneFactorX, targetParam.controlSetting.hitSecPlaneFactorY)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertColorFillToKrnParam(compParam.enableColorFill, compParam.colorFillParams, compParam.mainCSpace, targetParam.controlSetting.isColorFill, targetParam.background)); //ConvertAlphaToKrnParam must be called after ConvertColorFillToKrnParam VP_PUBLIC_CHK_STATUS_RETURN(ConvertAlphaToKrnParam(compParam.bAlphaCalculateEnable, compParam.compAlpha, targetParam.background[3], targetParam.controlSetting.alphaLayerIndex, targetParam.alpha)); @@ -2202,7 +2592,7 @@ MOS_STATUS VpOclFcFilter::ConvertOutputChannelIndicesToKrnParam(MOS_FORMAT forma dynamicChannelIndices[1] = 1; break; default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); + VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); } return MOS_STATUS_SUCCESS; @@ -2553,6 +2943,20 @@ MOS_STATUS VpOclFcFilter::SetupSingleFcFastExpressBti(uint32_t uIndex, const OCL surfaceParam.combineChannelY = true; break; case FC_FP_FASTEXPRESS_INPUTPL1: + if (compParam.layerNumber > 0 && compParam.inputLayersParam[0].needSepareateIntermediaSecPlane) + { + surfaceParam.surfType = SurfaceTypeFcSeparateIntermediaInputSecPlane; + if (compParam.inputLayersParam[0].diParams.enabled && + compParam.inputLayersParam[0].diParams.params.DIMode == DI_MODE_BOB) + { + surfaceParam.needVerticalStirde = true; + } + } + else + { + surfaceParam.surfType = SurfaceTypeSubPlane; + } + break; case FC_FP_FASTEXPRESS_OUTPUTPL1: surfaceParam.surfType = SurfaceTypeSubPlane; break; @@ -2619,30 +3023,30 @@ MOS_STATUS VpOclFcFilter::GenerateFastExpressInputOutputParam(OCL_FC_COMP_PARAM OCL_FC_LAYER_PARAM &outputLayer = compParam.outputLayerParam; VP_PUBLIC_CHK_NULL_RETURN(outputLayer.surf); VP_PUBLIC_CHK_NULL_RETURN(outputLayer.surf->osSurface); - MOS_FORMAT outputSurfOverwriteFormat = outputLayer.needIntermediaSurface ? outputLayer.interMediaOverwriteSurface : outputLayer.surf->osSurface->Format; + MOS_FORMAT outputSurfOverwriteFormat = outputLayer.needIntermediaSurface ? outputLayer.intermediaFormat : outputLayer.surf->osSurface->Format; if (compParam.layerNumber == 1) { VP_PUBLIC_CHK_NULL_RETURN(inputLayer.surf); VP_PUBLIC_CHK_NULL_RETURN(inputLayer.surf->osSurface); - MOS_FORMAT inputSurfOverwriteFormat = inputLayer.needIntermediaSurface ? inputLayer.interMediaOverwriteSurface : inputLayer.surf->osSurface->Format; + MOS_FORMAT inputSurfOverwriteFormat = inputLayer.needIntermediaSurface ? inputLayer.intermediaFormat : inputLayer.surf->osSurface->Format; uint32_t inputWidth = MOS_MIN(static_cast(inputLayer.surf->osSurface->dwWidth), static_cast(inputLayer.surf->rcSrc.right)); uint32_t inputHeight = MOS_MIN(static_cast(inputLayer.surf->osSurface->dwHeight), static_cast(inputLayer.surf->rcSrc.bottom)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertProcampAndCscToKrnParam(inputLayer.surf->ColorSpace, compParam.mainCSpace, imageParam.csc, inputLayer.procampParams)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(inputSurfOverwriteFormat, imageParam.inputChannelIndices)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertInputChannelIndicesToKrnParam(inputSurfOverwriteFormat, inputLayer.separateIntermediaSecPlaneFormat, imageParam.inputChannelIndices)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertScalingRotToKrnParam(inputLayer.surf->rcSrc, inputLayer.surf->rcDst, inputLayer.scalingMode, inputWidth, inputHeight, inputLayer.rotation, imageParam.scaleParam, imageParam.controlSetting.samplerType, imageParam.coordShift)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaUpsampleToKrnParam(inputSurfOverwriteFormat, inputLayer.surf->ChromaSiting, inputLayer.scalingMode, inputWidth, inputHeight, imageParam.coordShift.chromaShiftX, imageParam.coordShift.chromaShiftY, imageParam.controlSetting.isChromaShift)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(inputSurfOverwriteFormat, true, imageParam.inputPlaneNum)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaUpsampleToKrnParam(inputLayer.surf->osSurface->Format, inputLayer.surf->ChromaSiting, inputLayer.scalingMode, inputWidth, inputHeight, imageParam.coordShift.chromaShiftX, imageParam.coordShift.chromaShiftY, imageParam.controlSetting.isChromaShift)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(inputSurfOverwriteFormat, inputLayer.needSepareateIntermediaSecPlane, true, imageParam.inputPlaneNum)); } VP_PUBLIC_CHK_STATUS_RETURN(ConvertAlignedTrgRectToKrnParam(inputLayer.surf, outputLayer.surf, compParam.enableColorFill, targetParam)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(outputSurfOverwriteFormat, false, targetParam.planeNumber)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertPlaneNumToKrnParam(outputSurfOverwriteFormat, outputLayer.needSepareateIntermediaSecPlane, false, targetParam.planeNumber)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertOutputChannelIndicesToKrnParam(outputSurfOverwriteFormat, targetParam.dynamicChannelIndices)); targetParam.combineChannelIndices[0] = 0; targetParam.combineChannelIndices[1] = 1; VP_PUBLIC_CHK_STATUS_RETURN(ConvertTargetRoiToKrnParam(outputLayer.surf->rcDst, outputLayer.surf->osSurface->dwWidth, outputLayer.surf->osSurface->dwHeight, targetParam.targetROI)); - VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaDownsampleToKrnParam(outputSurfOverwriteFormat, outputLayer.surf->ChromaSiting, targetParam.chromaSitingFactor, targetParam.controlSetting.hitSecPlaneFactorX, targetParam.controlSetting.hitSecPlaneFactorY)); + VP_PUBLIC_CHK_STATUS_RETURN(ConvertChromaDownsampleToKrnParam(outputLayer.surf->osSurface->Format, outputLayer.surf->ChromaSiting, targetParam.chromaSitingFactor, targetParam.controlSetting.hitSecPlaneFactorX, targetParam.controlSetting.hitSecPlaneFactorY)); VP_PUBLIC_CHK_STATUS_RETURN(ConvertColorFillToKrnParam(compParam.enableColorFill, compParam.colorFillParams, compParam.mainCSpace, targetParam.controlSetting.isColorFill, targetParam.background)); //ConvertAlphaToKrnParam must be called after ConvertColorFillToKrnParam uint8_t alphaLayerIndex = 0; diff --git a/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.h b/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.h index 03875420f01..98367851f8f 100644 --- a/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.h +++ b/media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.h @@ -47,17 +47,19 @@ struct OCL_FC_DI_PARAMS struct OCL_FC_LAYER_PARAM { - VP_SURFACE *surf = nullptr; - uint32_t layerID = 0; - uint32_t layerIDOrigin = 0; //!< Origin layerID before layerSkipped, which can be used to reference surfaces in SurfaceGroup. - VPHAL_SCALING_MODE scalingMode = VPHAL_SCALING_NEAREST; - VPHAL_ROTATION rotation = VPHAL_ROTATION_IDENTITY; - OCL_FC_LUMA_KEY_PARAMS lumaKey = {}; - VPHAL_BLENDING_PARAMS blendingParams = {}; - VPHAL_PROCAMP_PARAMS procampParams = {}; - OCL_FC_DI_PARAMS diParams = {}; - bool needIntermediaSurface = false; - MOS_FORMAT interMediaOverwriteSurface = Format_Any; + VP_SURFACE *surf = nullptr; + uint32_t layerID = 0; + uint32_t layerIDOrigin = 0; //!< Origin layerID before layerSkipped, which can be used to reference surfaces in SurfaceGroup. + VPHAL_SCALING_MODE scalingMode = VPHAL_SCALING_NEAREST; + VPHAL_ROTATION rotation = VPHAL_ROTATION_IDENTITY; + OCL_FC_LUMA_KEY_PARAMS lumaKey = {}; + VPHAL_BLENDING_PARAMS blendingParams = {}; + VPHAL_PROCAMP_PARAMS procampParams = {}; + OCL_FC_DI_PARAMS diParams = {}; + bool needIntermediaSurface = false; + bool needSepareateIntermediaSecPlane = false; + MOS_FORMAT intermediaFormat = Format_Any; + MOS_FORMAT separateIntermediaSecPlaneFormat = Format_Any; }; struct OCL_FC_COMP_PARAM @@ -239,6 +241,11 @@ class VpOclFcFilter : public VpFilter MOS_STATUS SetupSingleFc420PL3OutputBti(uint32_t uIndex, SURFACE_PARAMS &surfaceParam, bool &bInit); MOS_STATUS SetupSingleFc420PL3OutputKrnArg(uint32_t srcSurfaceWidth, uint32_t srcSurfaceHeight, uint32_t lumaChannelIndices, uint32_t chromaChannelIndices[2], uint32_t localSize[3], KRN_ARG &krnArg, bool &bInit); + //OCL FC 422HV/411P input kernel + MOS_STATUS GenerateFc422HVInputParam(OCL_FC_LAYER_PARAM &inputLayersParam, uint32_t index, OCL_FC_KERNEL_PARAM ¶m); + MOS_STATUS SetupSingleFc422HVInputBti(uint32_t uIndex, uint32_t layIndex, SURFACE_PARAMS &surfaceParam, bool &bInit); + MOS_STATUS SetupSingleFc422HVInputKrnArg(uint32_t srcSurfaceWidthPL1, uint32_t srcSurfaceHeightPL1, uint32_t channelIndex, uint32_t chromaChannelIndices[4], uint32_t localSize[3], KRN_ARG &krnArg, bool &bInit); + //OCL FC 444 PL3 input kernel MOS_STATUS GenerateFc444PL3InputParam(OCL_FC_LAYER_PARAM &layer, uint32_t layerNumber, OCL_FC_KERNEL_PARAM ¶m, uint32_t layerIndex); MOS_STATUS SetupSingleFc444PL3InputKrnArg(uint32_t localSize[3], KRN_ARG &krnArg, bool &bInit, uint32_t inputChannelIndices[4], uint32_t outputChannelIndices[4], uint32_t planeChannelIndices); @@ -260,8 +267,8 @@ class VpOclFcFilter : public VpFilter MOS_STATUS ConvertScalingRotToKrnParam(RECT &rcSrc, RECT &rcDst, VPHAL_SCALING_MODE scalingMode, uint32_t inputWidth, uint32_t inputHeight, VPHAL_ROTATION rotation, OCL_FC_KRN_SCALE_PARAM &scaling, uint8_t &samplerType, OCL_FC_KRN_COORD_SHIFT_PARAM &coordShift); MOS_STATUS ConvertRotationToKrnParam(VPHAL_ROTATION rotation, float strideX, float strideY, float startLeft, float startRight, float startTop, float startBottom, OCL_FC_KRN_SCALE_PARAM &scaling); MOS_STATUS ConvertChromaUpsampleToKrnParam(MOS_FORMAT format, uint32_t chromaSitingLoc, VPHAL_SCALING_MODE scalingMode, uint32_t inputWidth, uint32_t inputHeight, float &chromaShiftX, float &chromaShiftY, uint8_t &isChromaShift); - MOS_STATUS ConvertInputChannelIndicesToKrnParam(MOS_FORMAT format, uint32_t *inputChannelIndices); - MOS_STATUS ConvertPlaneNumToKrnParam(MOS_FORMAT format, bool isInput, uint32_t &planeNum); + MOS_STATUS ConvertInputChannelIndicesToKrnParam(MOS_FORMAT format, MOS_FORMAT separateIntermediaSecPlaneFormat, uint32_t *inputChannelIndices); + MOS_STATUS ConvertPlaneNumToKrnParam(MOS_FORMAT format, bool needSeparateIntermediaSecPlane, bool isInput, uint32_t &planeNum); MOS_STATUS ConvertBlendingToKrnParam(VPHAL_BLENDING_PARAMS &blend, uint8_t &ignoreSrcPixelAlpha, uint8_t &ignoreDstPixelAlpha, float &constAlpha); //OCL FC common kernel output parameter @@ -298,6 +305,7 @@ class VpOclFcFilter : public VpFilter KERNEL_INDEX_ARG_MAP m_fcFastExpressKrnArgs; MULTI_LAYERS_KERNEL_INDEX_ARG_MAP m_fc420PL3InputMultiLayersKrnArgs; MULTI_LAYERS_KERNEL_INDEX_ARG_MAP m_fc444PL3InputMultiLayersKrnArgs; + MULTI_LAYERS_KERNEL_INDEX_ARG_MAP m_fc422HVInputMultiLayersKrnArgs; KERNEL_INDEX_ARG_MAP m_fc420PL3OutputKrnArgs; KERNEL_INDEX_ARG_MAP m_fc444PL3OutputKrnArgs; diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_ocl_fc_kernel.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_ocl_fc_kernel.cpp index 107c3e41e69..dcf25c7c2c3 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_ocl_fc_kernel.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_ocl_fc_kernel.cpp @@ -54,6 +54,9 @@ VpRenderOclFcKernel::VpRenderOclFcKernel(PVP_MHWINTERFACE hwInterface, VpKernelI case kernelOclFc420PL3Output: m_kernelName = "ImageWrite_fc_420PL3_output"; break; + case kernelOclFc422HVInput: + m_kernelName = "ImageRead_fc_422HV_input"; + break; default: m_kernelName.assign(""); VP_RENDER_ASSERTMESSAGE("Kernel ID cannot map to Kernel Name"); diff --git a/media_softlet/media_interface/media_interfaces_lnl/media_interfaces_lnl.cpp b/media_softlet/media_interface/media_interfaces_lnl/media_interfaces_lnl.cpp index c02d87f3f3d..e6ad04d8a0d 100644 --- a/media_softlet/media_interface/media_interfaces_lnl/media_interfaces_lnl.cpp +++ b/media_softlet/media_interface/media_interfaces_lnl/media_interfaces_lnl.cpp @@ -57,6 +57,7 @@ #include "igvpfc_420PL3_output_xe2.h" #include "igvpfc_444PL3_input_xe2.h" #include "igvpfc_444PL3_output_xe2.h" +#include "igvpfc_422HV_input_xe2.h" #include "igvp3dlut_xe2.h" #endif @@ -160,6 +161,7 @@ void VphalInterfacesXe2_Lpm::InitPlatformKernelBinary( AddVpNativeKernelEntryToListFc_420pl3_outputXe2(*vpPlatformInterface); AddVpNativeKernelEntryToListFc_444pl3_inputXe2(*vpPlatformInterface); AddVpNativeKernelEntryToListFc_444pl3_outputXe2(*vpPlatformInterface); + AddVpNativeKernelEntryToListFc_422hv_inputXe2(*vpPlatformInterface); AddVpNativeKernelEntryToList3dlutXe2(*vpPlatformInterface); #endif }