replace common qcom sources with samsung ones

This commit is contained in:
SaschaNes
2025-08-12 22:13:00 +02:00
parent ba24dcded9
commit 6f7753de11
5682 changed files with 2450203 additions and 103634 deletions

View File

@@ -0,0 +1,15 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "vendor.qti.hardware.display.mapperextensions@1.0",
root: "vendor.qti.hardware.display",
system_ext_specific: true,
srcs: [
"types.hal",
"IQtiMapperExtensions.hal",
],
interfaces: [
"android.hidl.base@1.0",
],
gen_java: false,
}

View File

@@ -0,0 +1,189 @@
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package vendor.qti.hardware.display.mapperextensions@1.0;
interface IQtiMapperExtensions {
/*
* Check if the secure buffer can be mapped
*/
@callflow(next="*")
getMapSecureBufferFlag(pointer buffer) generates (Error error, bool mapSecureBuffer);
/*
* Check if the buffer is interlaced
*/
@callflow(next="*")
getInterlacedFlag(pointer buffer) generates (Error error, bool interlaced);
/*
* Get custom dimensions from handle
* Uses information in the metadata to return
* custom stride and height
*/
@callflow(next="*")
getCustomDimensions(pointer buffer) generates (Error error, int32_t stride, int32_t height);
/*
* Get RGB Data address
*/
@callflow(next="*")
getRgbDataAddress(pointer buffer) generates (Error error, pointer rgb_data);
/*
* Calculate aligned width, aligned height and if UBWC is enabled from
* the given width, height, format and gralloc usage
*/
@callflow(next="*")
calculateBufferAttributes(int32_t width, int32_t height, int32_t format, uint64_t usage)
generates (Error error, int32_t aligned_width, int32_t aligned_height, bool ubwc_enabled);
/*
* Gets the color space from the gralloc metadata
*/
@callflow(next="*")
getColorSpace(pointer buffer) generates (Error error, int32_t color_space);
/*
* Get YUV plane info
* Returns a vector of YCbCrLayouts of size 2
* The second member in the vector is populated if the buffer is interlaced
*/
@callflow(next="*")
getYuvPlaneInfo(pointer buffer) generates (Error error, vec<YCbCrLayout> layout);
/*
* Set Single buffer mode
*/
@callflow(next="*")
setSingleBufferMode(pointer buffer, bool enable) generates (Error error);
/*
* Get custom format and private handle flags for a given combination of
* format and usage flags.
*/
@callflow(next="*")
getCustomFormatFlags(int32_t format, uint64_t usage)
generates (Error error, int32_t format, uint64_t priv_flags);
/*
* Get fd of allocated buffer.
*/
@callflow(next="*")
getFd(pointer buffer) generates (Error error, int32_t fd);
/*
* Get width of the actual allocated buffer.
*/
@callflow(next="*")
getWidth(pointer buffer) generates (Error error, int32_t width);
/*
* Get height of the actual allocated buffer.
*/
@callflow(next="*")
getHeight(pointer buffer) generates (Error error, int32_t height);
/*
* Get offset of allocated buffer.
*/
@callflow(next="*")
getOffset(pointer buffer) generates (Error error, uint64_t offset);
/*
* Get size of allocated buffer.
*/
@callflow(next="*")
getSize(pointer buffer) generates (Error error, uint64_t size);
/*
* Get width ask to allocate.
*/
@callflow(next="*")
getUnalignedWidth(pointer buffer) generates (Error error, int32_t unaligned_width);
/*
* Get height ask to allocate.
*/
@callflow(next="*")
getUnalignedHeight(pointer buffer) generates (Error error, int32_t unaligned_height);
/*
* Get number of layer.
*/
@callflow(next="*")
getLayerCount(pointer buffer) generates (Error error, uint64_t layer_count);
/*
* Get Id of allocated buffer.
*/
@callflow(next="*")
getId(pointer buffer) generates (Error error, uint64_t id);
/*
* Get usage flags of allocated buffer.
*/
@callflow(next="*")
getUsageFlags(pointer buffer) generates (Error error, uint64_t usage);
/*
* Get format of allocated buffer.
*/
@callflow(next="*")
getFormat(pointer buffer) generates (Error error, int32_t format);
/*
* Get private flags of allocated buffer.
*/
@callflow(next="*")
getPrivateFlags(pointer buffer) generates (Error error, int32_t flags);
/* Get graphics surface metadata address
*/
@callflow(next="*")
getSurfaceMetadata(pointer buffer) generates (Error error, pointer metadata);
/* Get per plane layout information for given format, gralloc usage, width and height
* Returns a vector of PlaneLayout whose size depends on the format
* For RGB & RAW formats size is 1
* For YUV semiplanar size :
* - progressive & compressed size is 4 including meta plane
* - progressive & linear size is 2
* For YUV semiplanar interlaced compressed size is 8 including meta plane
* For YUV planar size is 3
* Output parameter "size" is representing the total size of the buffer.
*/
@callflow(next="*")
getFormatLayout(int32_t format, uint64_t usage, int32_t flags, int32_t width, int32_t height)
generates (Error error, uint64_t size, vec<PlaneLayout> plane_info);
};

View File

@@ -0,0 +1,173 @@
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* Neither the name of The Linux Foundation. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Not a Contribution.
* Copyright (C) 2011 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package vendor.qti.hardware.display.mapperextensions@1.0;
enum Error : int32_t {
NONE = 0,
BAD_BUFFER = 2,
NO_RESOURCES = 5,
UNSUPPORTED = 7,
};
struct YCbCrLayout {
pointer y;
pointer cb;
pointer cr;
uint32_t yStride;
uint32_t cStride;
uint32_t chromaStep;
};
/**
* Plane Component type definitions.
*/
enum PlaneComponent : uint32_t {
/* luma */
PLANE_COMPONENT_Y = 1 << 0,
/* chroma blue */
PLANE_COMPONENT_Cb = 1 << 1,
/* chroma red */
PLANE_COMPONENT_Cr = 1 << 2,
/* red */
PLANE_COMPONENT_R = 1 << 10,
/* green */
PLANE_COMPONENT_G = 1 << 11,
/* blue */
PLANE_COMPONENT_B = 1 << 12,
/* alpha */
PLANE_COMPONENT_A = 1 << 20,
/* raw data plane */
PLANE_COMPONENT_RAW = 1 << 30,
/* meta information plane */
PLANE_COMPONENT_META = 1 << 31,
};
/**
* Flags to send with getFormatLayout for extra information for e.g. interlaced,
* otherwise send 0.
*/
enum Flags : int32_t {
/* flag to send for interlace */
LAYOUT_INTERLACED_FLAG = 1 << 0,
};
/**
* Structure for describing plane layout information for YUVA/RGBA/RAW formats
* YUV formats can be planar or semi-planar.
*
* This layout structure is used with any pixel format that can be
* represented by it, such as:
* - HAL_PIXEL_FORMAT_YCbCr_*
* - HAL_PIXEL_FORMAT_RGB*_*
* - even implementation defined formats that can be represented by
* the structures
*
* Each plane can be made up of one or more PlaneComponents depending on
* the format.
*
* Each plane can be subsampled either vertically or horizontally by
* a power-of-two factor.
*
* Pixel increment describes the distance in bytes from one pixel to the
* next pixel (to the right) on the same row for the component plane.
* This can be negative.
*
* Stride is provided in both pixels and bytes.
* Stride_bytes describes the distance in bytes from the first pixel of
* one row to the first pixel of the next row (below) for the component plane.
* This can be negative.
*
* Scanlines describes the height of the plane in terms of number of rows.
*
* Size of plane is stride_bytes * scanlines + any padding required for
* alignment as per format specification.
*
*/
struct PlaneLayout {
/** Fields below provide the plane layout requirements.
* Values of these fields are specific to the format being
* described and are fixed. They do not depend on actual image
* width and height.
*/
/** Components represented by the plane. */
bitfield<PlaneComponent> component;
/** horizontal subsampling. Must be a positive power of 2. */
uint32_t h_subsampling;
/** vertical subsampling. Must be a positive power of 2. */
uint32_t v_subsampling;
/** offset to the first byte of the top-left pixel of the plane
* and it is calculated from the start of the buffer.
* Add base of the handle with offset to get the first byte of the plane.
*/
uint32_t offset;
/** pixel increment */
int32_t pixel_increment;
/** Fields below will have values that are calcuated based
* on provided image width and height.
*/
/** row width or horizontal stride in pixels */
int32_t stride;
/** row width or horzontal stride in bytes */
int32_t stride_bytes;
/** plane height or vertical stride */
int32_t scanlines;
/** Size of the plane in bytes */
uint32_t size;
};

View File

@@ -0,0 +1,15 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "vendor.qti.hardware.display.mapperextensions@1.1",
root: "vendor.qti.hardware.display",
system_ext_specific: true,
srcs: [
"IQtiMapperExtensions.hal",
],
interfaces: [
"android.hidl.base@1.0",
"vendor.qti.hardware.display.mapperextensions@1.0",
],
gen_java: false,
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package vendor.qti.hardware.display.mapperextensions@1.1;
import @1.0::IQtiMapperExtensions;
import @1.0::Error;
interface IQtiMapperExtensions extends @1.0::IQtiMapperExtensions {
/*
* Get graphics surface metadata.
* Pass a valid pointer to surface metadata.
*/
@callflow(next="*")
getSurfaceMetadata_V1(pointer buffer, pointer metadata) generates (Error error);
};

View File

@@ -0,0 +1,17 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "vendor.qti.hardware.display.mapperextensions@1.2",
owner: "qti",
root: "vendor.qti.hardware.display",
system_ext_specific: true,
srcs: [
"IQtiMapperExtensions.hal",
],
interfaces: [
"android.hidl.base@1.0",
"vendor.qti.hardware.display.mapperextensions@1.0",
"vendor.qti.hardware.display.mapperextensions@1.1",
],
gen_java: false,
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package vendor.qti.hardware.display.mapperextensions@1.2;
import @1.1::IQtiMapperExtensions;
import @1.0::Error;
interface IQtiMapperExtensions extends @1.1::IQtiMapperExtensions {
/*
* Copy graphics metadata.
* Set dst buffer to src buffer.
*/
@callflow(next="*")
copyMetaData(pointer src, pointer dst) generates (Error error);
/*
* Copy graphics metadata from src buffer.
* Set virtual address to src buffer.
*/
@callflow(next="*")
setMetadataBlob(vec<uint8_t> src, pointer dst) generates (Error error);
/*
* Get graphics metadata blob from src buffer.
*/
@callflow(next="*")
getMetadataBlob(pointer src) generates (Error error, vec<uint8_t> data);
};

View File

@@ -0,0 +1,19 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "vendor.qti.hardware.display.mapperextensions@1.3",
owner: "qti",
root: "vendor.qti.hardware.display",
system_ext_specific: true,
srcs: [
"IQtiMapperExtensions.hal",
],
interfaces: [
"android.hidl.base@1.0",
"android.hardware.graphics.mapper@4.0",
"vendor.qti.hardware.display.mapperextensions@1.0",
"vendor.qti.hardware.display.mapperextensions@1.1",
"vendor.qti.hardware.display.mapperextensions@1.2",
],
gen_java: false,
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* disclaimer below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package vendor.qti.hardware.display.mapperextensions@1.3;
import android.hardware.graphics.mapper@4.0::types;
import android.hardware.graphics.mapper@4.0;
import vendor.qti.hardware.display.mapperextensions@1.2::IQtiMapperExtensions;
import vendor.qti.hardware.display.mapperextensions@1.0::Error;
interface IQtiMapperExtensions extends @1.2::IQtiMapperExtensions {
/*
* Fast path for get metadata.
*/
@callflow(next="*")
getMetaDataValue(pointer src, MetadataType metadataType, pointer in) generates (@1.0::Error error);
};

View File

@@ -0,0 +1,32 @@
cc_library_headers {
name: "libiqtimapperext_stablec",
export_include_dirs: ["include"],
vendor_available: true,
// TODO(b/214400477) Remove apex_available
apex_available: [
"//apex_available:platform",
"com.android.media.swcodec",
"test_com.android.media.swcodec",
],
min_sdk_version: "29",
}
cc_library_headers {
name: "libiqtimapperext_providerutils",
vendor_available: true,
export_include_dirs: ["implutils/include"],
header_libs: [
"libiqtimapperext_stablec",
],
export_header_lib_headers: [
"libiqtimapperext_stablec",
],
// TODO(b/214400477) Remove apex_available
apex_available: [
"//apex_available:platform",
"com.android.media.swcodec",
"test_com.android.media.swcodec",
],
min_sdk_version: "29",
}

View File

@@ -0,0 +1,99 @@
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#pragma once
#include <vendor/qti/hardware/display/mapperextensions/IQtiMapperExt.h>
#include <log/log.h>
#include <mutex>
#include <type_traits>
namespace vendor::qtimapperext {
/**
* Extend from this interface to provide Version 2 of the IQtiMapperExt interface
*/
struct IQtiMapperExtV2Impl {
static const auto version = IQTIMAPPEREXT_VERSION_2;
virtual ~IQtiMapperExtV2Impl() = default;
virtual IQtiMapperExt_Error getMultiViewInfo(buffer_handle_t _Nonnull buffer,
uint32_t* _Nonnull views) = 0;
virtual IQtiMapperExt_Error getBaseView(buffer_handle_t _Nonnull buffer,
uint32_t* _Nonnull view) = 0;
virtual IQtiMapperExt_Error importViewBuffer(
buffer_handle_t _Nonnull metaHandle, uint32_t view,
buffer_handle_t _Nullable* _Nonnull outBufferHandle) = 0;
};
namespace provider {
#ifndef __cpp_inline_variables
#error "Only C++17 & newer is supported; inline variables is missing"
#endif
inline void* _Nullable sIQtiMapperExtInstance = nullptr;
} // namespace provider
template <typename IMPL>
class IQtiMapperExtProvider {
private:
static_assert(IMPL::version >= IQTIMAPPEREXT_VERSION_2,
"Must be at least IQTIMAPPEREXT_VERSION_2");
static_assert(std::is_final_v<IMPL>, "Implementation must be final");
static_assert(std::is_constructible_v<IMPL>, "Implementation must have a no-args constructor");
std::once_flag mLoadOnceFlag;
IMPL* _Nullable mImpl;
IQtiMapperExt* _Nullable mQtiMapperExt;
static IMPL& impl() {
return *reinterpret_cast<IQtiMapperExtProvider<IMPL>*>(
provider::sIQtiMapperExtInstance)->mImpl;
}
void bindV2() {
mQtiMapperExt->v2 = {
.getMultiViewInfo = [](buffer_handle_t _Nonnull buffer,
uint32_t* _Nonnull views) -> IQtiMapperExt_Error {
return impl().getMultiViewInfo(buffer, views);
},
.getBaseView = [](buffer_handle_t _Nonnull buffer,
uint32_t* _Nonnull view) -> IQtiMapperExt_Error {
return impl().getBaseView(buffer, view);
},
.importViewBuffer = [](buffer_handle_t _Nonnull metaHandle, uint32_t view,
buffer_handle_t _Nullable* _Nonnull outBufferHandle)
-> IQtiMapperExt_Error {
return impl().importViewBuffer(metaHandle, view, outBufferHandle);
},
};
}
public:
explicit IQtiMapperExtProvider() = default;
IQtiMapperExt_Error load(IQtiMapperExt* _Nullable* _Nonnull outImplementation) {
std::call_once(mLoadOnceFlag, [this] {
LOG_ALWAYS_FATAL_IF(provider::sIQtiMapperExtInstance != nullptr,
"IQtiMapperExt implementation already loaded!");
provider::sIQtiMapperExtInstance = this;
mImpl = new IMPL();
mQtiMapperExt = new IQtiMapperExt();
mQtiMapperExt->version = IMPL::version;
if (IMPL::version >= IQTIMAPPEREXT_VERSION_2) {
bindV2();
}
});
*outImplementation = mQtiMapperExt;
return IQTIMAPPEREXT_ERROR_NONE;
}
};
} // namespace vendor::qtimapperext

View File

@@ -0,0 +1,104 @@
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#pragma once
#include <stdint.h>
#include <sys/cdefs.h>
#include <cutils/native_handle.h>
__BEGIN_DECLS
/**
* IQtiMapperExt versioning
*
* IQtiMapperExt version 1 is HIDL
* C-style IQtiMapperExt API starts at 2
*/
enum IQtiMapperExt_Version : uint32_t {
IQTIMAPPEREXT_VERSION_2 = 2,
};
enum IQtiMapperExt_Error : int32_t {
/**
* No error.
*/
IQTIMAPPEREXT_ERROR_NONE = 0,
/**
* Invalid BufferDescriptor.
*/
IQTIMAPPEREXT_ERROR_BAD_DESCRIPTOR = 1,
/**
* Invalid buffer handle.
*/
IQTIMAPPEREXT_ERROR_BAD_BUFFER = 2,
/**
* Invalid HardwareBufferDescription.
*/
IQTIMAPPEREXT_ERROR_BAD_VALUE = 3,
/**
* Resource unavailable.
*/
IQTIMAPPEREXT_ERROR_NO_RESOURCES = 5,
/**
* Permanent failure.
*/
IQTIMAPPEREXT_ERROR_UNSUPPORTED = 7,
};
typedef struct IQtiMapperExtV2 {
/**
* Get view bit masks of all views included in this handle.
*/
IQtiMapperExt_Error (*_Nonnull getMultiViewInfo)(buffer_handle_t _Nonnull buffer,
uint32_t* _Nonnull views);
/**
* Get view bit mask for the base view of current buffer
*/
IQtiMapperExt_Error (*_Nonnull getBaseView)(buffer_handle_t _Nonnull buffer,
uint32_t* _Nonnull view);
/**
* Imports a specific view buffer from a imported meta handle to create an imported buffer
* specific for the view only.
*
* @param metaHandle Meta handle which has already been imported by importBuffer
* @param view View of the meta buffer to import.
* @param outBufferHandle The resulting imported buffer handle for the specific view
* @return error Error status of the call, which may be
* - `NONE` upon success.
* - `BAD_BUFFER` if the raw handle is invalid.
* - `BAD_VALUE` if the view id is not valid in the meta handle.
* - `NO_RESOURCES` if the raw handle cannot be imported due to
* unavailability of resources.
*/
IQtiMapperExt_Error (*_Nonnull importViewBuffer)(
buffer_handle_t _Nonnull metaHandle, uint32_t view,
buffer_handle_t _Nullable* _Nonnull outBufferHandle);
} IQtiMapperExtV2;
/**
* Return value for IQtiMapperExt_loadIMapperExt
*
* Note: This struct's size is not fixed and callers must never store it by-value as a result.
* Only fields up to those covered by `version` are allowed to be accessed.
*/
typedef struct IQtiMapperExt {
alignas(alignof(max_align_t)) IQtiMapperExt_Version version;
IQtiMapperExtV2 v2;
} IQtiMapperExt;
/**
* Loads the vendor-provided implementation of IQtiMapperExt
* @return Error status of the call.
* - `NONE` upon success
* - `UNSUPPORTED` if no implementation is available
*/
IQtiMapperExt_Error IQtiMapperExt_loadIMapperExt(
IQtiMapperExt* _Nullable* _Nonnull outImplementation);
__END_DECLS