mirror of
https://github.com/bylaws/libadrenotools
synced 2024-11-21 14:29:15 -07:00
Shim some additional functions, fixing graphics bugs
This commit is contained in:
parent
9032460f55
commit
812ae09b9e
23 changed files with 10124 additions and 4490 deletions
9
tools/qtimapper-shim/.clang-format
Normal file
9
tools/qtimapper-shim/.clang-format
Normal file
|
@ -0,0 +1,9 @@
|
|||
BasedOnStyle: Google
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: NOLINT:.*
|
||||
DerivePointerAlignment: false
|
||||
IndentWidth: 2
|
||||
PointerAlignment: Left
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
|
@ -3,6 +3,8 @@ cc_defaults {
|
|||
|
||||
srcs: [
|
||||
"shim.cpp",
|
||||
"ext/gr_utils.cpp",
|
||||
"ext/gr_adreno_info.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
|
@ -12,6 +14,7 @@ cc_defaults {
|
|||
"libhardware",
|
||||
"libutils",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-Wno-error",
|
||||
"-Wno-unused-parameter",
|
||||
|
@ -19,16 +22,16 @@ cc_defaults {
|
|||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "vendor.qti.hardware.display.mapperstub",
|
||||
name: "vendor.qti.hardware.display.mappershim",
|
||||
defaults: ["shim_defaults"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "vendor.qti.hardware.display.mapperextensionsstub",
|
||||
name: "vendor.qti.hardware.display.mapperextensionsshim",
|
||||
defaults: ["shim_defaults"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.graphics.mapperstub",
|
||||
name: "android.hardware.graphics.mappershim",
|
||||
defaults: ["shim_defaults"],
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ The code is fairly ugly but functional enough for the purpose, some functions ar
|
|||
|
||||
Chuck into a lineage tree, then:
|
||||
```
|
||||
make vendor.qti.hardware.display.mapperstub
|
||||
make vendor.qti.hardware.display.mapperextensionsstub
|
||||
make android.hardware.graphics.mapperstub
|
||||
make vendor.qti.hardware.display.mappershim
|
||||
make vendor.qti.hardware.display.mapperextensionsshim
|
||||
make android.hardware.graphics.mappershim
|
||||
```
|
||||
and grab SOs out of outputs dir
|
||||
|
|
173
tools/qtimapper-shim/ext/QtiGrallocDefs.h
Normal file
173
tools/qtimapper-shim/ext/QtiGrallocDefs.h
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021 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.
|
||||
*/
|
||||
|
||||
#ifndef __QTIGRALLOCDEFS_H__
|
||||
#define __QTIGRALLOCDEFS_H__
|
||||
|
||||
// From gralloc_priv.h
|
||||
|
||||
/* Gralloc usage bits indicating the type of allocation that should be used */
|
||||
/* Refer to BufferUsage in hardware/interfaces/graphics/common/<ver>/types.hal */
|
||||
|
||||
/* The bits below are in officially defined vendor space
|
||||
* i.e bits 28-31 and 48-63*/
|
||||
/* Non linear, Universal Bandwidth Compression */
|
||||
#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC (UINT32_C(1) << 28)
|
||||
|
||||
/* Set this for allocating uncached memory (using O_DSYNC),
|
||||
* cannot be used with noncontiguous heaps */
|
||||
#define GRALLOC_USAGE_PRIVATE_UNCACHED (UINT32_C(1) << 29)
|
||||
|
||||
/* This flag is used to indicate 10 bit format.
|
||||
* When both GRALLOC_USAGE_PRIVATE_ALLOC_UBWC & GRALLOC_USAGE_PRIVATE_10BIT
|
||||
* are set then it will indicate UBWC_TP10 format.
|
||||
* When only GRALLOC_USAGE_PRIVATE_10BIT is set it will indicate linear P010 format.
|
||||
*/
|
||||
#define GRALLOC_USAGE_PRIVATE_10BIT (UINT32_C(1) << 30)
|
||||
|
||||
/* This flag is used for SECURE display usecase */
|
||||
#define GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY (UINT32_C(1) << 31)
|
||||
|
||||
/* This flag is used to indicate video NV21 format */
|
||||
#define GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER 1ULL << 48
|
||||
|
||||
/* unused legacy flags */
|
||||
#define GRALLOC_USAGE_PRIVATE_MM_HEAP 0
|
||||
#define GRALLOC_USAGE_PRIVATE_IOMMU_HEAP 0
|
||||
|
||||
/* This flag is set for WFD usecase */
|
||||
#define GRALLOC_USAGE_PRIVATE_WFD 1ULL << 51
|
||||
|
||||
/* This flag is set for HEIF usecase */
|
||||
#define GRALLOC_USAGE_PRIVATE_HEIF (UINT32_C(1) << 27)
|
||||
|
||||
/* TODO(user): Remove when clients stop referencing this flag */
|
||||
#define GRALLOC_USAGE_PRIVATE_10BIT_TP 0
|
||||
|
||||
/* This flag indicates PI format is being used */
|
||||
#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI 1ULL << 49
|
||||
|
||||
/* This flag is set while CDSP accesses the buffer */
|
||||
#define GRALLOC_USAGE_PRIVATE_CDSP 1ULL << 50
|
||||
|
||||
// OEM specific HAL formats
|
||||
#define HAL_PIXEL_FORMAT_RGBA_5551 6
|
||||
#define HAL_PIXEL_FORMAT_RGBA_4444 7
|
||||
#define HAL_PIXEL_FORMAT_NV12_ENCODEABLE 0x102
|
||||
#define HAL_PIXEL_FORMAT_NV21_ENCODEABLE 0x7FA30C00
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS 0x7FA30C04
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED 0x7FA30C03
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP 0x109
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO 0x7FA30C01
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_422_SP 0x10B
|
||||
#define HAL_PIXEL_FORMAT_R_8 0x10D
|
||||
#define HAL_PIXEL_FORMAT_RG_88 0x10E
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_444_SP 0x10F
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_444_SP 0x110
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_422_I 0x111
|
||||
#define HAL_PIXEL_FORMAT_BGRX_8888 0x112
|
||||
#define HAL_PIXEL_FORMAT_NV21_ZSL 0x113
|
||||
#define HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS 0x114
|
||||
#define HAL_PIXEL_FORMAT_BGR_565 0x115
|
||||
#define HAL_PIXEL_FORMAT_RAW8 0x123
|
||||
#define HAL_PIXEL_FORMAT_NV12_HEIF 0x116
|
||||
|
||||
// 10 bit
|
||||
#define HAL_PIXEL_FORMAT_ARGB_2101010 0x117
|
||||
#define HAL_PIXEL_FORMAT_RGBX_1010102 0x118
|
||||
#define HAL_PIXEL_FORMAT_XRGB_2101010 0x119
|
||||
#define HAL_PIXEL_FORMAT_BGRA_1010102 0x11A
|
||||
#define HAL_PIXEL_FORMAT_ABGR_2101010 0x11B
|
||||
#define HAL_PIXEL_FORMAT_BGRX_1010102 0x11C
|
||||
#define HAL_PIXEL_FORMAT_XBGR_2101010 0x11D
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x36 // HAL_PIXEL_FORMAT_YCBCR_P010
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC 0x124
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS 0x7FA30C0A
|
||||
|
||||
#define HAL_PIXEL_FORMAT_CbYCrY_422_I 0x120
|
||||
#define HAL_PIXEL_FORMAT_BGR_888 0x121
|
||||
|
||||
#define HAL_PIXEL_FORMAT_INTERLACE 0x180
|
||||
|
||||
// Camera utils format
|
||||
#define HAL_PIXEL_FORMAT_NV12_LINEAR_FLEX 0x125
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX 0x126
|
||||
#define HAL_PIXEL_FORMAT_MULTIPLANAR_FLEX 0x127
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_2_BATCH 0x128
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_4_BATCH 0x129
|
||||
#define HAL_PIXEL_FORMAT_NV12_UBWC_FLEX_8_BATCH 0x130
|
||||
|
||||
// FSC Formats
|
||||
#define HAL_PIXEL_FORMAT_RGB888_UBWC_FSC 0x131
|
||||
#define HAL_PIXEL_FORMAT_RGB101010_UBWC_FSC 0x132
|
||||
|
||||
// v4l2_fourcc('Y', 'U', 'Y', 'L'). 24 bpp YUYV 4:2:2 10 bit per component
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT 0x4C595559
|
||||
|
||||
// v4l2_fourcc('Y', 'B', 'W', 'C'). 10 bit per component. This compressed
|
||||
// format reduces the memory access bandwidth
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_422_I_10BIT_COMPRESSED 0x43574259
|
||||
|
||||
// UBWC aligned Venus format
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC 0x7FA30C06
|
||||
#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x7FA30C09
|
||||
|
||||
// Khronos ASTC formats
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
|
||||
#define HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
|
||||
|
||||
enum { BUFFER_TYPE_UI = 0, BUFFER_TYPE_VIDEO };
|
||||
|
||||
#endif //__QTIGRALLOCDEFS_H__
|
86
tools/qtimapper-shim/ext/common.h
Normal file
86
tools/qtimapper-shim/ext/common.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
|
||||
#include "types/common.h"
|
||||
|
||||
using namespace android::hardware;
|
||||
using namespace android;
|
||||
|
||||
/* Simplified version of hidl::base::V1_0::IBase */
|
||||
struct IBase : virtual public RefBase {
|
||||
virtual bool isRemote() const;
|
||||
|
||||
using interfaceChain_cb = std::function<void(const hidl_vec<hidl_string>& descriptors)>;
|
||||
virtual Return<void> interfaceChain(interfaceChain_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using interfaceDescriptor_cb = std::function<void(const hidl_string& descriptor)>;
|
||||
virtual Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getHashChain_cb = std::function<void(const hidl_vec<hidl_array<uint8_t, 32>>& hashchain)>;
|
||||
virtual Return<void> getHashChain(getHashChain_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> setHALInstrumentation() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<bool> linkToDeath(const sp<hidl_death_recipient>& recipient, uint64_t cookie) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> ping() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getDebugInfo_cb = std::function<void(const hidl::base::V1_0::DebugInfo& info)>;
|
||||
virtual Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> notifySyspropsChanged() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<bool> unlinkToDeath(const sp<hidl_death_recipient>& recipient) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
};
|
344
tools/qtimapper-shim/ext/gr_adreno_info.cpp
Normal file
344
tools/qtimapper-shim/ext/gr_adreno_info.cpp
Normal file
|
@ -0,0 +1,344 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2018, 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.
|
||||
*/
|
||||
|
||||
#include "gr_adreno_info.h"
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <dlfcn.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "gr_utils.h"
|
||||
#include "gralloc_priv.h"
|
||||
|
||||
using std::lock_guard;
|
||||
using std::mutex;
|
||||
|
||||
namespace gralloc {
|
||||
|
||||
AdrenoMemInfo* AdrenoMemInfo::s_instance = nullptr;
|
||||
|
||||
AdrenoMemInfo* AdrenoMemInfo::GetInstance() {
|
||||
static mutex s_lock;
|
||||
lock_guard<mutex> obj(s_lock);
|
||||
if (!s_instance) {
|
||||
s_instance = new AdrenoMemInfo();
|
||||
}
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
AdrenoMemInfo::AdrenoMemInfo() {
|
||||
libadreno_utils_ = ::dlopen("libadreno_utils.so", RTLD_NOW);
|
||||
if (libadreno_utils_) {
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_aligned_width_and_height) =
|
||||
::dlsym(libadreno_utils_, "compute_aligned_width_and_height");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_fmt_aligned_width_and_height) =
|
||||
::dlsym(libadreno_utils_, "compute_fmt_aligned_width_and_height");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_padding) =
|
||||
::dlsym(libadreno_utils_, "compute_surface_padding");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_compute_compressedfmt_aligned_width_and_height) =
|
||||
::dlsym(libadreno_utils_, "compute_compressedfmt_aligned_width_and_height");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_isUBWCSupportedByGpu) =
|
||||
::dlsym(libadreno_utils_, "isUBWCSupportedByGpu");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_get_gpu_pixel_alignment) =
|
||||
::dlsym(libadreno_utils_, "get_gpu_pixel_alignment");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_get_metadata_blob_size) =
|
||||
::dlsym(libadreno_utils_, "adreno_get_metadata_blob_size");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_init_memory_layout) =
|
||||
::dlsym(libadreno_utils_, "adreno_init_memory_layout");
|
||||
*reinterpret_cast<void**>(&LINK_adreno_get_aligned_gpu_buffer_size) =
|
||||
::dlsym(libadreno_utils_, "adreno_get_aligned_gpu_buffer_size");
|
||||
} else {
|
||||
ALOGE(" Failed to load libadreno_utils.so");
|
||||
}
|
||||
|
||||
// Check if the overriding property debug.gralloc.gfx_ubwc_disable
|
||||
// that disables UBWC allocations for the graphics stack is set
|
||||
char property[PROPERTY_VALUE_MAX];
|
||||
property_get(DISABLE_UBWC_PROP, property, "0");
|
||||
if (!(strncmp(property, "1", PROPERTY_VALUE_MAX)) ||
|
||||
!(strncmp(property, "true", PROPERTY_VALUE_MAX))) {
|
||||
gfx_ubwc_disable_ = true;
|
||||
}
|
||||
|
||||
property_get(DISABLE_AHARDWAREBUFFER_PROP, property, "0");
|
||||
if (!(strncmp(property, "1", PROPERTY_VALUE_MAX)) ||
|
||||
!(strncmp(property, "true", PROPERTY_VALUE_MAX))) {
|
||||
gfx_ahardware_buffer_disable_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
AdrenoMemInfo::~AdrenoMemInfo() {
|
||||
if (libadreno_utils_) {
|
||||
::dlclose(libadreno_utils_);
|
||||
}
|
||||
}
|
||||
|
||||
void AdrenoMemInfo::AlignUnCompressedRGB(int width, int height, int format, int tile_enabled,
|
||||
unsigned int* aligned_w, unsigned int* aligned_h) {
|
||||
*aligned_w = (unsigned int)ALIGN(width, 32);
|
||||
*aligned_h = (unsigned int)ALIGN(height, 32);
|
||||
|
||||
int bpp = 4;
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_BGR_888:
|
||||
bpp = 3;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
bpp = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int raster_mode = 0; // Adreno unknown raster mode.
|
||||
int padding_threshold = 512; // Threshold for padding surfaces.
|
||||
// the function below computes aligned width and aligned height
|
||||
// based on linear or macro tile mode selected.
|
||||
if (LINK_adreno_compute_fmt_aligned_width_and_height) {
|
||||
// We call into adreno_utils only for RGB formats. So plane_id is 0 and
|
||||
// num_samples is 1 always. We may have to add uitility function to
|
||||
// find out these if there is a need to call this API for YUV formats.
|
||||
LINK_adreno_compute_fmt_aligned_width_and_height(
|
||||
width, height, 0 /*plane_id*/, GetGpuPixelFormat(format), 1 /*num_samples*/, tile_enabled,
|
||||
raster_mode, padding_threshold, reinterpret_cast<int*>(aligned_w),
|
||||
reinterpret_cast<int*>(aligned_h));
|
||||
} else if (LINK_adreno_compute_aligned_width_and_height) {
|
||||
LINK_adreno_compute_aligned_width_and_height(
|
||||
width, height, bpp, tile_enabled, raster_mode, padding_threshold,
|
||||
reinterpret_cast<int*>(aligned_w), reinterpret_cast<int*>(aligned_h));
|
||||
} else if (LINK_adreno_compute_padding) {
|
||||
int surface_tile_height = 1; // Linear surface
|
||||
*aligned_w = UINT(LINK_adreno_compute_padding(width, bpp, surface_tile_height, raster_mode,
|
||||
padding_threshold));
|
||||
ALOGW("%s: Warning!! Old GFX API is used to calculate stride", __FUNCTION__);
|
||||
} else {
|
||||
ALOGW(
|
||||
"%s: Warning!! Symbols compute_surface_padding and "
|
||||
"compute_fmt_aligned_width_and_height and "
|
||||
"compute_aligned_width_and_height not found",
|
||||
__FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
void AdrenoMemInfo::AlignCompressedRGB(int width, int height, int format, unsigned int* aligned_w,
|
||||
unsigned int* aligned_h) {
|
||||
if (LINK_adreno_compute_compressedfmt_aligned_width_and_height) {
|
||||
int bytesPerPixel = 0;
|
||||
int raster_mode = 0; // Adreno unknown raster mode.
|
||||
int padding_threshold = 512; // Threshold for padding
|
||||
// surfaces.
|
||||
|
||||
LINK_adreno_compute_compressedfmt_aligned_width_and_height(
|
||||
width, height, format, 0, raster_mode, padding_threshold, reinterpret_cast<int*>(aligned_w),
|
||||
reinterpret_cast<int*>(aligned_h), &bytesPerPixel);
|
||||
} else {
|
||||
*aligned_w = (unsigned int)ALIGN(width, 32);
|
||||
*aligned_h = (unsigned int)ALIGN(height, 32);
|
||||
ALOGW("%s: Warning!! compute_compressedfmt_aligned_width_and_height not found", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
bool AdrenoMemInfo::IsUBWCSupportedByGPU(int format) {
|
||||
if (!gfx_ubwc_disable_ && LINK_adreno_isUBWCSupportedByGpu) {
|
||||
ADRENOPIXELFORMAT gpu_format = GetGpuPixelFormat(format);
|
||||
return LINK_adreno_isUBWCSupportedByGpu(gpu_format);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t AdrenoMemInfo::GetGpuPixelAlignment() {
|
||||
if (LINK_adreno_get_gpu_pixel_alignment) {
|
||||
return LINK_adreno_get_gpu_pixel_alignment();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
ADRENOPIXELFORMAT AdrenoMemInfo::GetGpuPixelFormat(int hal_format) {
|
||||
switch (hal_format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
return ADRENO_PIXELFORMAT_R8G8B8A8;
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
return ADRENO_PIXELFORMAT_R8G8B8X8;
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
return ADRENO_PIXELFORMAT_B8G8R8A8_UNORM;
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
return ADRENO_PIXELFORMAT_R8G8B8;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
return ADRENO_PIXELFORMAT_B5G6R5;
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
return ADRENO_PIXELFORMAT_R5G6B5;
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
return ADRENO_PIXELFORMAT_R5G5B5A1;
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
return ADRENO_PIXELFORMAT_R4G4B4A4;
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
return ADRENO_PIXELFORMAT_R10G10B10A2_UNORM;
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
return ADRENO_PIXELFORMAT_R10G10B10X2_UNORM;
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
return ADRENO_PIXELFORMAT_A2B10G10R10_UNORM;
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
return ADRENO_PIXELFORMAT_R16G16B16A16_FLOAT;
|
||||
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
|
||||
return ADRENO_PIXELFORMAT_NV12;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
|
||||
return ADRENO_PIXELFORMAT_NV12_EXT;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
|
||||
return ADRENO_PIXELFORMAT_TP10;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS:
|
||||
return ADRENO_PIXELFORMAT_P010;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_16:
|
||||
return ADRENO_PIXELFORMAT_D16_UNORM;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24:
|
||||
return ADRENO_PIXELFORMAT_D24_UNORM_X8_UINT;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
|
||||
return ADRENO_PIXELFORMAT_D24_UNORM_S8_UINT;
|
||||
case HAL_PIXEL_FORMAT_DEPTH_32F:
|
||||
return ADRENO_PIXELFORMAT_D32_FLOAT;
|
||||
case HAL_PIXEL_FORMAT_STENCIL_8:
|
||||
return ADRENO_PIXELFORMAT_S8_UINT;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_4X4;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_4X4_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X4;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X4_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_5X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X6;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_6X6_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X6;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X6_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X8;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_8X8_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X5;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X5_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X6;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X6_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X8;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X8_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X10;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_10X10_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X10;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X10_SRGB;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X12;
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||
return ADRENO_PIXELFORMAT_ASTC_12X12_SRGB;
|
||||
default:
|
||||
ALOGE("%s: No map for format: 0x%x", __FUNCTION__, hal_format);
|
||||
break;
|
||||
}
|
||||
|
||||
return ADRENO_PIXELFORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
uint32_t AdrenoMemInfo::AdrenoGetMetadataBlobSize() {
|
||||
if (LINK_adreno_get_metadata_blob_size) {
|
||||
return LINK_adreno_get_metadata_blob_size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AdrenoMemInfo::AdrenoInitMemoryLayout(void* metadata_blob, int width, int height, int depth,
|
||||
int format, int num_samples, int isUBWC, uint64_t usage,
|
||||
uint32_t num_planes) {
|
||||
if (LINK_adreno_init_memory_layout) {
|
||||
surface_tile_mode_t tile_mode = static_cast<surface_tile_mode_t>(isUBWC);
|
||||
return LINK_adreno_init_memory_layout(metadata_blob, width, height, depth,
|
||||
GetGpuPixelFormat(format), num_samples, tile_mode, usage,
|
||||
num_planes);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t AdrenoMemInfo::AdrenoGetAlignedGpuBufferSize(void* metadata_blob) {
|
||||
if (LINK_adreno_get_aligned_gpu_buffer_size) {
|
||||
return LINK_adreno_get_aligned_gpu_buffer_size(metadata_blob);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AdrenoMemInfo::AdrenoSizeAPIAvaliable() {
|
||||
if (gfx_ahardware_buffer_disable_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (LINK_adreno_get_metadata_blob_size && LINK_adreno_init_memory_layout &&
|
||||
LINK_adreno_get_aligned_gpu_buffer_size);
|
||||
}
|
||||
|
||||
bool AdrenoMemInfo::IsPISupportedByGPU(int format, uint64_t usage) {
|
||||
if (LINK_adreno_isPISupportedByGpu) {
|
||||
return LINK_adreno_isPISupportedByGpu(format, usage);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace gralloc
|
234
tools/qtimapper-shim/ext/gr_adreno_info.h
Normal file
234
tools/qtimapper-shim/ext/gr_adreno_info.h
Normal file
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2018, 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.
|
||||
*/
|
||||
|
||||
#ifndef __GR_ADRENO_INFO_H__
|
||||
#define __GR_ADRENO_INFO_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace gralloc {
|
||||
|
||||
// Adreno Pixel Formats
|
||||
typedef enum {
|
||||
ADRENO_PIXELFORMAT_UNKNOWN = 0,
|
||||
ADRENO_PIXELFORMAT_R16G16B16A16_FLOAT = 10,
|
||||
ADRENO_PIXELFORMAT_R10G10B10A2_UNORM = 24, // Vertex, Normalized GL_UNSIGNED_INT_10_10_10_2_OES
|
||||
ADRENO_PIXELFORMAT_R8G8B8A8 = 28,
|
||||
ADRENO_PIXELFORMAT_R8G8B8A8_SRGB = 29,
|
||||
ADRENO_PIXELFORMAT_D32_FLOAT = 40,
|
||||
ADRENO_PIXELFORMAT_D24_UNORM_S8_UINT = 45,
|
||||
ADRENO_PIXELFORMAT_D16_UNORM = 55,
|
||||
ADRENO_PIXELFORMAT_B5G6R5 = 85,
|
||||
ADRENO_PIXELFORMAT_B5G5R5A1 = 86,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8_UNORM = 87,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8 = 90,
|
||||
ADRENO_PIXELFORMAT_B8G8R8A8_SRGB = 91,
|
||||
ADRENO_PIXELFORMAT_B8G8R8X8_SRGB = 93,
|
||||
ADRENO_PIXELFORMAT_NV12 = 103,
|
||||
ADRENO_PIXELFORMAT_P010 = 104,
|
||||
ADRENO_PIXELFORMAT_YUY2 = 107,
|
||||
ADRENO_PIXELFORMAT_B4G4R4A4 = 115,
|
||||
ADRENO_PIXELFORMAT_NV12_EXT = 506, // NV12 with non-std alignment and offsets
|
||||
ADRENO_PIXELFORMAT_R8G8B8X8 = 507, // GL_RGB8 (Internal)
|
||||
ADRENO_PIXELFORMAT_R8G8B8 = 508, // GL_RGB8
|
||||
ADRENO_PIXELFORMAT_A1B5G5R5 = 519, // GL_RGB5_A1
|
||||
ADRENO_PIXELFORMAT_R8G8B8X8_SRGB = 520, // GL_SRGB8
|
||||
ADRENO_PIXELFORMAT_R8G8B8_SRGB = 521, // GL_SRGB8
|
||||
ADRENO_PIXELFORMAT_A2B10G10R10_UNORM = 532,
|
||||
// Vertex, Normalized GL_UNSIGNED_INT_10_10_10_2_OES
|
||||
ADRENO_PIXELFORMAT_R10G10B10X2_UNORM = 537,
|
||||
ADRENO_PIXELFORMAT_D24_UNORM_X8_UINT = 548,
|
||||
ADRENO_PIXELFORMAT_D24_UNORM = 549,
|
||||
ADRENO_PIXELFORMAT_D32_FLOAT_X24S8_UINT = 551,
|
||||
ADRENO_PIXELFORMAT_S8_UINT = 552,
|
||||
ADRENO_PIXELFORMAT_ASTC_4X4 = 568, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_5X4 = 569, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_5X5 = 570, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_6X5 = 571, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_6X6 = 572, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_8X5 = 573, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_8X6 = 574, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_8X8 = 575, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X5 = 576, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X6 = 577, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X8 = 578, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X10 = 579, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_12X10 = 580, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_12X12 = 581, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_4X4_SRGB = 582, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_5X4_SRGB = 583, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_5X5_SRGB = 584, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_6X5_SRGB = 585, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_6X6_SRGB = 586, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_8X5_SRGB = 587, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_8X6_SRGB = 588, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_8X8_SRGB = 589, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X5_SRGB = 590, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X6_SRGB = 591, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X8_SRGB = 592, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_10X10_SRGB = 593, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_12X10_SRGB = 594, // ASTC Compressed
|
||||
ADRENO_PIXELFORMAT_ASTC_12X12_SRGB = 595, // ASTC Compressed
|
||||
// Vertex, Normalized GL_UNSIGNED_INT_10_10_10_2_OES
|
||||
ADRENO_PIXELFORMAT_R5G6B5 = 610, // RGBA version of B5G6R5
|
||||
ADRENO_PIXELFORMAT_R5G5B5A1 = 611, // RGBA version of B5G5R5A1
|
||||
ADRENO_PIXELFORMAT_R4G4B4A4 = 612, // RGBA version of B4G4R4A4
|
||||
ADRENO_PIXELFORMAT_UYVY = 614, // YUV 4:2:2 packed progressive (1 plane)
|
||||
ADRENO_PIXELFORMAT_NV21 = 619,
|
||||
ADRENO_PIXELFORMAT_Y8U8V8A8 = 620, // YUV 4:4:4 packed (1 plane)
|
||||
ADRENO_PIXELFORMAT_Y8 = 625, // Single 8-bit luma only channel YUV format
|
||||
ADRENO_PIXELFORMAT_TP10 = 654, // YUV 4:2:0 planar 10 bits/comp (2 planes)
|
||||
} ADRENOPIXELFORMAT;
|
||||
|
||||
typedef enum {
|
||||
SURFACE_TILE_MODE_DISABLE = 0x0, // used for linear surface
|
||||
SURFACE_TILE_MODE_ENABLE = 0x1 // used for tiled surface
|
||||
} surface_tile_mode_t;
|
||||
|
||||
class AdrenoMemInfo {
|
||||
public:
|
||||
/*
|
||||
* Function to compute aligned width and aligned height based on
|
||||
* width, height, format and usage flags.
|
||||
*
|
||||
* @return aligned width, aligned height
|
||||
*/
|
||||
void GetAlignedWidthAndHeight(int width, int height, int format, int usage,
|
||||
unsigned int* aligned_w, unsigned int* aligned_h, bool ubwc_enabled,
|
||||
bool tile_enabled);
|
||||
|
||||
/*
|
||||
* Function to compute the adreno aligned width and aligned height
|
||||
* based on the width and format.
|
||||
*
|
||||
* @return aligned width, aligned height
|
||||
*/
|
||||
void AlignUnCompressedRGB(int width, int height, int format, int tileEnabled,
|
||||
unsigned int* aligned_w, unsigned int* aligned_h);
|
||||
|
||||
/*
|
||||
* Function to compute the adreno aligned width and aligned height
|
||||
* based on the width and format.
|
||||
*
|
||||
* @return aligned width, aligned height
|
||||
*/
|
||||
void AlignCompressedRGB(int width, int height, int format, unsigned int* aligned_w,
|
||||
unsigned int* aligned_h);
|
||||
|
||||
/*
|
||||
* Function to compute the pixel alignment requirement.
|
||||
*
|
||||
* @return alignment
|
||||
*/
|
||||
uint32_t GetGpuPixelAlignment();
|
||||
|
||||
/*
|
||||
* Function to query whether GPU supports UBWC for given HAL format
|
||||
* @return > 0 : supported
|
||||
* 0 : not supported
|
||||
*/
|
||||
bool IsUBWCSupportedByGPU(int format);
|
||||
|
||||
/*
|
||||
* Function to check if GPU supports PI or not
|
||||
*/
|
||||
bool IsPISupportedByGPU(int format, uint64_t usage);
|
||||
/*
|
||||
* Function to get the corresponding Adreno format for given HAL format
|
||||
*/
|
||||
ADRENOPIXELFORMAT GetGpuPixelFormat(int hal_format);
|
||||
|
||||
/*
|
||||
* Function to get graphics metadata blob size
|
||||
* @return graphics metadata size
|
||||
*/
|
||||
uint32_t AdrenoGetMetadataBlobSize();
|
||||
|
||||
/*
|
||||
* Function to populate the graphics metadata blob
|
||||
* @return 1 : Successful
|
||||
* 2 : Unsuccessful
|
||||
*/
|
||||
int AdrenoInitMemoryLayout(void* metadata_blob, int width, int height, int depth, int format,
|
||||
int num_samples, int isUBWC, uint64_t usage, uint32_t num_planes);
|
||||
/*
|
||||
* Function to get buffer size for based on graphcis metadata
|
||||
* @return buffer size
|
||||
*/
|
||||
uint32_t AdrenoGetAlignedGpuBufferSize(void* metadata_blob);
|
||||
|
||||
/*
|
||||
* Function to check if adreno size calculation APIs are avaliable
|
||||
* @return true : Avaliable
|
||||
* false : Unavaliable
|
||||
*/
|
||||
bool AdrenoSizeAPIAvaliable();
|
||||
|
||||
static AdrenoMemInfo* GetInstance();
|
||||
|
||||
private:
|
||||
AdrenoMemInfo();
|
||||
~AdrenoMemInfo();
|
||||
// link(s)to adreno surface padding library.
|
||||
int (*LINK_adreno_compute_padding)(int width, int bpp, int surface_tile_height,
|
||||
int screen_tile_height, int padding_threshold) = NULL;
|
||||
void (*LINK_adreno_compute_aligned_width_and_height)(int width, int height, int bpp,
|
||||
int tile_mode, int raster_mode,
|
||||
int padding_threshold, int* aligned_w,
|
||||
int* aligned_h) = NULL;
|
||||
void (*LINK_adreno_compute_fmt_aligned_width_and_height)(int width, int height, int plane_id,
|
||||
int format, int num_samples,
|
||||
int tile_mode, int raster_mode,
|
||||
int padding_threshold, int* aligned_w,
|
||||
int* aligned_h) = NULL;
|
||||
void (*LINK_adreno_compute_compressedfmt_aligned_width_and_height)(
|
||||
int width, int height, int format, int tile_mode, int raster_mode, int padding_threshold,
|
||||
int* aligned_w, int* aligned_h, int* bpp) = NULL;
|
||||
int (*LINK_adreno_isUBWCSupportedByGpu)(ADRENOPIXELFORMAT format) = NULL;
|
||||
unsigned int (*LINK_adreno_get_gpu_pixel_alignment)() = NULL;
|
||||
|
||||
uint32_t (*LINK_adreno_get_metadata_blob_size)() = NULL;
|
||||
int (*LINK_adreno_init_memory_layout)(void* metadata_blob, int width, int height, int depth,
|
||||
ADRENOPIXELFORMAT format, int num_samples,
|
||||
surface_tile_mode_t tile_mode, uint64_t usage,
|
||||
uint32_t num_planes) = NULL;
|
||||
uint32_t (*LINK_adreno_get_aligned_gpu_buffer_size)(void* metadata_blob) = NULL;
|
||||
int (*LINK_adreno_isPISupportedByGpu)(int format, uint64_t usage) = NULL;
|
||||
|
||||
bool gfx_ubwc_disable_ = false;
|
||||
bool gfx_ahardware_buffer_disable_ = false;
|
||||
void* libadreno_utils_ = NULL;
|
||||
|
||||
static AdrenoMemInfo* s_instance;
|
||||
};
|
||||
|
||||
} // namespace gralloc
|
||||
|
||||
#endif // __GR_ADRENO_INFO_H__
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
|
||||
* Not a Contribution
|
||||
*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
|
@ -20,28 +20,12 @@
|
|||
#ifndef __GR_PRIV_HANDLE_H__
|
||||
#define __GR_PRIV_HANDLE_H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <log/log.h>
|
||||
#include <hardware/gralloc.h>
|
||||
#include <hardware/gralloc1.h>
|
||||
#include <log/log.h>
|
||||
#ifdef __cplusplus
|
||||
#include <cinttypes>
|
||||
|
||||
#define GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER 1
|
||||
#define GRALLOC_MODULE_PERFORM_GET_STRIDE 2
|
||||
#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE 3
|
||||
#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE 4
|
||||
#define GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES 5
|
||||
#define GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE 6
|
||||
#define GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO 7
|
||||
#define GRALLOC_MODULE_PERFORM_GET_MAP_SECURE_BUFFER_INFO 8
|
||||
#define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG 9
|
||||
#define GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS 10
|
||||
#define GRALLOC_MODULE_PERFORM_GET_IGC 11
|
||||
#define GRALLOC_MODULE_PERFORM_SET_IGC 12
|
||||
#define GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE 13
|
||||
#define GRALLOC1_MODULE_PERFORM_GET_BUFFER_SIZE_AND_DIMENSIONS 14
|
||||
#define GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG 15
|
||||
#define GRALLOC_MODULE_PERFORM_GET_GRAPHICS_METADATA 16
|
||||
#endif
|
||||
|
||||
#define GRALLOC1_FUNCTION_PERFORM 0x00001000
|
||||
|
||||
|
@ -52,7 +36,12 @@ typedef gralloc1_error_t (*GRALLOC1_PFN_PERFORM)(gralloc1_device_t *device, int
|
|||
#define PRIV_HANDLE_CONST(exp) static_cast<const private_handle_t*>(exp)
|
||||
|
||||
#pragma pack(push, 4)
|
||||
#ifdef __cplusplus
|
||||
struct private_handle_t : public native_handle_t {
|
||||
#else
|
||||
struct private_handle_t {
|
||||
native_handle_t nativeHandle;
|
||||
#endif
|
||||
enum {
|
||||
PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
|
||||
PRIV_FLAGS_USES_ION = 0x00000008,
|
||||
|
@ -77,6 +66,7 @@ struct private_handle_t : public native_handle_t {
|
|||
PRIV_FLAGS_UBWC_ALIGNED = 0x08000000,
|
||||
PRIV_FLAGS_DISP_CONSUMER = 0x10000000,
|
||||
PRIV_FLAGS_CLIENT_ALLOCATED = 0x20000000, // Ion buffer allocated outside of gralloc
|
||||
PRIV_FLAGS_UBWC_ALIGNED_PI = 0x40000000, // PI format
|
||||
};
|
||||
|
||||
// file-descriptors dup'd over IPC
|
||||
|
@ -102,7 +92,7 @@ struct private_handle_t : public native_handle_t {
|
|||
uint64_t base;
|
||||
uint64_t base_metadata;
|
||||
uint64_t gpuaddr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
static const int kNumFds = 2;
|
||||
static const int kMagic = 'gmsm';
|
||||
|
||||
|
@ -150,18 +140,19 @@ struct private_handle_t : public native_handle_t {
|
|||
auto* hnd = static_cast<const private_handle_t*>(h);
|
||||
if (!h || h->version != sizeof(native_handle) || h->numInts != NumInts() ||
|
||||
h->numFds != kNumFds) {
|
||||
ALOGE("Invalid gralloc handle (at %p): ver(%d/%zu) ints(%d/%d) fds(%d/%d) ",
|
||||
h, h ? h->version : -1, sizeof(native_handle), h ? h->numInts : -1, NumInts(),
|
||||
ALOGE("Invalid gralloc handle (at %p): ver(%d/%zu) ints(%d/%d) fds(%d/%d)", h,
|
||||
h ? h->version : -1, sizeof(native_handle), h ? h->numInts : -1, NumInts(),
|
||||
h ? h->numFds : -1, kNumFds);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (hnd->magic != kMagic) {
|
||||
ALOGE("magic(%c%c%c%c/%c%c%c%c)",
|
||||
ALOGE("handle = %p invalid magic(%c%c%c%c/%c%c%c%c)", hnd,
|
||||
hnd ? (((hnd->magic >> 24) & 0xFF) ? ((hnd->magic >> 24) & 0xFF) : '-') : '?',
|
||||
hnd ? (((hnd->magic >> 16) & 0xFF) ? ((hnd->magic >> 16) & 0xFF) : '-') : '?',
|
||||
hnd ? (((hnd->magic >> 8) & 0xFF) ? ((hnd->magic >> 8) & 0xFF) : '-') : '?',
|
||||
hnd ? (((hnd->magic >> 0) & 0xFF) ? ((hnd->magic >> 0) & 0xFF) : '-') : '?',
|
||||
(kMagic >> 24) & 0xFF, (kMagic >> 16) & 0xFF, (kMagic >> 8) & 0xFF, (kMagic >> 0) & 0xFF);
|
||||
(kMagic >> 24) & 0xFF, (kMagic >> 16) & 0xFF, (kMagic >> 8) & 0xFF,
|
||||
(kMagic >> 0) & 0xFF);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -192,6 +183,7 @@ struct private_handle_t : public native_handle_t {
|
|||
uint64_t GetUsage() const { return usage; }
|
||||
|
||||
uint64_t GetBackingstore() const { return id; }
|
||||
#endif
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
662
tools/qtimapper-shim/ext/gr_utils.cpp
Normal file
662
tools/qtimapper-shim/ext/gr_utils.cpp
Normal file
|
@ -0,0 +1,662 @@
|
|||
/*
|
||||
* Copyright (c) 2011-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.
|
||||
*/
|
||||
|
||||
#include "gr_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "gr_adreno_info.h"
|
||||
|
||||
#define ASTC_BLOCK_SIZE 16
|
||||
|
||||
#ifndef COLOR_FMT_P010_UBWC
|
||||
#define COLOR_FMT_P010_UBWC 9
|
||||
#endif
|
||||
|
||||
namespace gralloc {
|
||||
|
||||
bool IsUncompressedRGBFormat(int format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
case HAL_PIXEL_FORMAT_R_8:
|
||||
case HAL_PIXEL_FORMAT_RG_88:
|
||||
case HAL_PIXEL_FORMAT_BGRX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ARGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XRGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XBGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
case HAL_PIXEL_FORMAT_BGR_888:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsCompressedRGBFormat(int format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t GetBppForUncompressedRGB(int format) {
|
||||
uint32_t bpp = 0;
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
bpp = 8;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ARGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XRGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRX_1010102:
|
||||
case HAL_PIXEL_FORMAT_XBGR_2101010:
|
||||
bpp = 4;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_BGR_888:
|
||||
bpp = 3;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
bpp = 2;
|
||||
break;
|
||||
default:
|
||||
ALOGE("Error : %s New format request = 0x%x", __FUNCTION__, format);
|
||||
break;
|
||||
}
|
||||
|
||||
return bpp;
|
||||
}
|
||||
|
||||
bool CpuCanAccess(uint64_t usage) {
|
||||
return CpuCanRead(usage) || CpuCanWrite(usage);
|
||||
}
|
||||
|
||||
bool CpuCanRead(uint64_t usage) {
|
||||
if (usage & BufferUsage::CPU_READ_MASK) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CpuCanWrite(uint64_t usage) {
|
||||
if (usage & BufferUsage::CPU_WRITE_MASK) {
|
||||
// Application intends to use CPU for rendering
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t GetDataAlignment(int format, uint64_t usage) {
|
||||
uint32_t align = UINT(getpagesize());
|
||||
if (format == HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED) {
|
||||
align = SIZE_8K;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::PROTECTED) {
|
||||
if ((usage & BufferUsage::CAMERA_OUTPUT) || (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY)) {
|
||||
// The alignment here reflects qsee mmu V7L/V8L requirement
|
||||
align = SZ_2M;
|
||||
} else {
|
||||
align = SECURE_ALIGN;
|
||||
}
|
||||
}
|
||||
|
||||
return align;
|
||||
}
|
||||
|
||||
bool IsGPUFlagSupported(uint64_t usage) {
|
||||
bool ret = true;
|
||||
if ((usage & BufferUsage::GPU_MIPMAP_COMPLETE)) {
|
||||
ALOGE("GPU_MIPMAP_COMPLETE not supported");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::GPU_CUBE_MAP)) {
|
||||
ALOGE("GPU_CUBE_MAP not supported");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Returns the final buffer size meant to be allocated with ion
|
||||
unsigned int GetSize(const BufferInfo& info, unsigned int alignedw, unsigned int alignedh) {
|
||||
unsigned int size = 0;
|
||||
int format = info.format;
|
||||
int width = info.width;
|
||||
int height = info.height;
|
||||
uint64_t usage = info.usage;
|
||||
|
||||
if (!IsGPUFlagSupported(usage)) {
|
||||
ALOGE("Unsupported GPU usage flags present 0x%" PRIx64, usage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IsUBwcEnabled(format, usage)) {
|
||||
size = GetUBwcSize(width, height, format, alignedw, alignedh);
|
||||
} else if (IsUncompressedRGBFormat(format)) {
|
||||
uint32_t bpp = GetBppForUncompressedRGB(format);
|
||||
size = alignedw * alignedh * bpp;
|
||||
} else if (IsCompressedRGBFormat(format)) {
|
||||
size = alignedw * alignedh * ASTC_BLOCK_SIZE;
|
||||
} else {
|
||||
// Below switch should be for only YUV/custom formats
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RAW16:
|
||||
case HAL_PIXEL_FORMAT_Y16:
|
||||
size = alignedw * alignedh * 2;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RAW10:
|
||||
case HAL_PIXEL_FORMAT_RAW12:
|
||||
size = ALIGN(alignedw * alignedh, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RAW8:
|
||||
case HAL_PIXEL_FORMAT_Y8:
|
||||
size = alignedw * alignedh * 1;
|
||||
break;
|
||||
// adreno formats
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO: // NV21
|
||||
size = ALIGN(alignedw * alignedh, SIZE_4K);
|
||||
size += (unsigned int)ALIGN(2 * ALIGN(width / 2, 32) * ALIGN(height / 2, 32), SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED: // NV12
|
||||
// The chroma plane is subsampled,
|
||||
// but the pitch in bytes is unchanged
|
||||
// The GPU needs 4K alignment, but the video decoder needs 8K
|
||||
size = ALIGN(alignedw * alignedh, SIZE_8K);
|
||||
size += ALIGN(alignedw * (unsigned int)ALIGN(height / 2, 32), SIZE_8K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YV12:
|
||||
if ((format == HAL_PIXEL_FORMAT_YV12) && ((width & 1) || (height & 1))) {
|
||||
ALOGE("w or h is odd for the YV12 format");
|
||||
return 0;
|
||||
}
|
||||
size = alignedw * alignedh + (ALIGN(alignedw / 2, 16) * (alignedh / 2)) * 2;
|
||||
size = ALIGN(size, (unsigned int)SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
|
||||
size = ALIGN((alignedw * alignedh) + (alignedw * alignedh) / 2 + 1, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010:
|
||||
size = ALIGN((alignedw * alignedh * 2) + (alignedw * alignedh) + 1, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_422_SP:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_422_I:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_422_I:
|
||||
case HAL_PIXEL_FORMAT_CbYCrY_422_I:
|
||||
if (width & 1) {
|
||||
ALOGE("width is odd for the YUV422_SP format");
|
||||
return 0;
|
||||
}
|
||||
size = ALIGN(alignedw * alignedh * 2, SIZE_4K);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_BLOB:
|
||||
case HAL_PIXEL_FORMAT_RAW_OPAQUE:
|
||||
if (height != 1) {
|
||||
ALOGE("%s: Buffers with HAL_PIXEL_FORMAT_BLOB must have height 1 ", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
size = (unsigned int)width;
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_NV21_ZSL:
|
||||
size = ALIGN((alignedw * alignedh) + (alignedw * alignedh) / 2, SIZE_4K);
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: Unrecognized pixel format: 0x%x", __FUNCTION__, format);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
auto align = GetDataAlignment(format, usage);
|
||||
size = ALIGN(size, align) * info.layer_count;
|
||||
return size;
|
||||
}
|
||||
|
||||
// Explicitly defined UBWC formats
|
||||
bool IsUBwcFormat(int format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_P010_UBWC:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsUBwcSupported(int format) {
|
||||
// Existing HAL formats with UBWC support
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_16:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
|
||||
case HAL_PIXEL_FORMAT_DEPTH_32F:
|
||||
case HAL_PIXEL_FORMAT_STENCIL_8:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsUBwcPISupported(int format, uint64_t usage) {
|
||||
if (usage & BufferUsage::COMPOSER_OVERLAY || !(usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// As of now only two formats
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC: {
|
||||
if ((usage & BufferUsage::GPU_TEXTURE) || (usage & BufferUsage::GPU_RENDER_TARGET)) {
|
||||
if (AdrenoMemInfo::GetInstance()) {
|
||||
return AdrenoMemInfo::GetInstance()->IsPISupportedByGPU(format, usage);
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsUBwcEnabled(int format, uint64_t usage) {
|
||||
// Allow UBWC, if client is using an explicitly defined UBWC pixel format.
|
||||
if (IsUBwcFormat(format)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow UBWC, if an OpenGL client sets UBWC usage flag and GPU plus MDP
|
||||
// support the format. OR if a non-OpenGL client like Rotator, sets UBWC
|
||||
// usage flag and MDP supports the format.
|
||||
if (((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) ||
|
||||
(usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI) ||
|
||||
(usage & BufferUsage::COMPOSER_CLIENT_TARGET)) &&
|
||||
IsUBwcSupported(format)) {
|
||||
bool enable = true;
|
||||
// Query GPU for UBWC only if buffer is intended to be used by GPU.
|
||||
if ((usage & BufferUsage::GPU_TEXTURE) || (usage & BufferUsage::GPU_RENDER_TARGET)) {
|
||||
if (AdrenoMemInfo::GetInstance()) {
|
||||
enable = AdrenoMemInfo::GetInstance()->IsUBWCSupportedByGPU(format);
|
||||
}
|
||||
}
|
||||
|
||||
// Allow UBWC, only if CPU usage flags are not set
|
||||
if (enable && !(CpuCanAccess(usage))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GetRgbUBwcBlockSize(uint32_t bpp, int* block_width, int* block_height) {
|
||||
*block_width = 0;
|
||||
*block_height = 0;
|
||||
|
||||
switch (bpp) {
|
||||
case 2:
|
||||
case 4:
|
||||
*block_width = 16;
|
||||
*block_height = 4;
|
||||
break;
|
||||
case 8:
|
||||
*block_width = 8;
|
||||
*block_height = 4;
|
||||
break;
|
||||
case 16:
|
||||
*block_width = 4;
|
||||
*block_height = 4;
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: Unsupported bpp: %d", __FUNCTION__, bpp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int GetRgbUBwcMetaBufferSize(int width, int height, uint32_t bpp) {
|
||||
unsigned int size = 0;
|
||||
int meta_width, meta_height;
|
||||
int block_width, block_height;
|
||||
|
||||
GetRgbUBwcBlockSize(bpp, &block_width, &block_height);
|
||||
if (!block_width || !block_height) {
|
||||
ALOGE("%s: Unsupported bpp: %d", __FUNCTION__, bpp);
|
||||
return size;
|
||||
}
|
||||
|
||||
// Align meta buffer height to 16 blocks
|
||||
meta_height = ALIGN(((height + block_height - 1) / block_height), 16);
|
||||
|
||||
// Align meta buffer width to 64 blocks
|
||||
meta_width = ALIGN(((width + block_width - 1) / block_width), 64);
|
||||
|
||||
// Align meta buffer size to 4K
|
||||
size = (unsigned int)ALIGN((meta_width * meta_height), 4096);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
unsigned int GetUBwcSize(int width, int height, int format, unsigned int alignedw,
|
||||
unsigned int alignedh) {
|
||||
unsigned int size = 0;
|
||||
uint32_t bpp = 0;
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
bpp = GetBppForUncompressedRGB(format);
|
||||
size = alignedw * alignedh * bpp;
|
||||
size += GetRgbUBwcMetaBufferSize(width, height, bpp);
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s: Unsupported pixel format: 0x%x", __FUNCTION__, format);
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
unsigned int GetRgbMetaSize(int format, uint32_t width, uint32_t height, uint64_t usage) {
|
||||
unsigned int meta_size = 0;
|
||||
if (!IsUBwcEnabled(format, usage)) {
|
||||
return meta_size;
|
||||
}
|
||||
uint32_t bpp = GetBppForUncompressedRGB(format);
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_BGR_565:
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBX_1010102:
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
meta_size = GetRgbUBwcMetaBufferSize(width, height, bpp);
|
||||
break;
|
||||
default:
|
||||
ALOGE("%s:Unsupported RGB format: 0x%x", __FUNCTION__, format);
|
||||
break;
|
||||
}
|
||||
return meta_size;
|
||||
}
|
||||
|
||||
bool CanUseAdrenoForSize(int buffer_type, uint64_t usage) {
|
||||
if (buffer_type == BUFFER_TYPE_VIDEO || !GetAdrenoSizeAPIStatus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::PROTECTED) &&
|
||||
((usage & BufferUsage::CAMERA_OUTPUT) || (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetAdrenoSizeAPIStatus() {
|
||||
AdrenoMemInfo* adreno_mem_info = AdrenoMemInfo::GetInstance();
|
||||
if (adreno_mem_info) {
|
||||
return adreno_mem_info->AdrenoSizeAPIAvaliable();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UseUncached(int format, uint64_t usage) {
|
||||
if ((usage & GRALLOC_USAGE_PRIVATE_UNCACHED) || (usage & BufferUsage::PROTECTED)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// CPU read rarely
|
||||
if ((usage & BufferUsage::CPU_READ_MASK) == static_cast<uint64_t>(BufferUsage::CPU_READ_RARELY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// CPU write rarely
|
||||
if ((usage & BufferUsage::CPU_WRITE_MASK) ==
|
||||
static_cast<uint64_t>(BufferUsage::CPU_WRITE_RARELY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((usage & BufferUsage::SENSOR_DIRECT_DATA) || (usage & BufferUsage::GPU_DATA_BUFFER)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (format && IsUBwcEnabled(format, usage)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t GetHandleFlags(int format, uint64_t usage) {
|
||||
uint64_t priv_flags = 0;
|
||||
|
||||
if (usage & BufferUsage::VIDEO_ENCODER) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_VIDEO_ENCODER;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::CAMERA_OUTPUT) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CAMERA_WRITE;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::CAMERA_INPUT) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CAMERA_READ;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::COMPOSER_OVERLAY) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_DISP_CONSUMER;
|
||||
}
|
||||
|
||||
if (usage & BufferUsage::GPU_TEXTURE) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_HW_TEXTURE;
|
||||
}
|
||||
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_SECURE_DISPLAY;
|
||||
}
|
||||
|
||||
if (IsUBwcEnabled(format, usage)) {
|
||||
if (IsUBwcPISupported(format, usage)) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED_PI;
|
||||
} else {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
if (usage & (BufferUsage::CPU_READ_MASK | BufferUsage::CPU_WRITE_MASK)) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CPU_RENDERED;
|
||||
}
|
||||
|
||||
if ((usage & (BufferUsage::VIDEO_ENCODER | BufferUsage::VIDEO_DECODER |
|
||||
BufferUsage::CAMERA_OUTPUT | BufferUsage::GPU_RENDER_TARGET))) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_NON_CPU_WRITER;
|
||||
}
|
||||
|
||||
if (!UseUncached(format, usage)) {
|
||||
priv_flags |= private_handle_t::PRIV_FLAGS_CACHED;
|
||||
}
|
||||
|
||||
return priv_flags;
|
||||
}
|
||||
|
||||
int GetImplDefinedFormat(uint64_t usage, int format) {
|
||||
int gr_format = format;
|
||||
|
||||
// If input format is HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED then based on
|
||||
// the usage bits, gralloc assigns a format.
|
||||
if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED ||
|
||||
format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
if ((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC || usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC_PI) &&
|
||||
format != HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC;
|
||||
} else if (usage & BufferUsage::VIDEO_ENCODER) {
|
||||
if (usage & GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER) {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ENCODEABLE; // NV21
|
||||
} else if (usage & GRALLOC_USAGE_PRIVATE_HEIF) {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV12_HEIF;
|
||||
} else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS;
|
||||
} else {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV12_ENCODEABLE; // NV12
|
||||
}
|
||||
} else if (usage & BufferUsage::CAMERA_INPUT) {
|
||||
if (usage & BufferUsage::CAMERA_OUTPUT) {
|
||||
// Assumed ZSL if both producer and consumer camera flags set
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ZSL; // NV21
|
||||
} else {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCrCb_420_SP; // NV21
|
||||
}
|
||||
} else if (usage & BufferUsage::CAMERA_OUTPUT) {
|
||||
if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ZSL; // NV21
|
||||
} else {
|
||||
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS; // NV12 preview
|
||||
}
|
||||
} else if (usage & BufferUsage::COMPOSER_OVERLAY) {
|
||||
// XXX: If we still haven't set a format, default to RGBA8888
|
||||
gr_format = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
} else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
// If no other usage flags are detected, default the
|
||||
// flexible YUV format to NV21_ZSL
|
||||
gr_format = HAL_PIXEL_FORMAT_NV21_ZSL;
|
||||
}
|
||||
}
|
||||
|
||||
return gr_format;
|
||||
}
|
||||
|
||||
bool HasAlphaComponent(int32_t format) {
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_5551:
|
||||
case HAL_PIXEL_FORMAT_RGBA_4444:
|
||||
case HAL_PIXEL_FORMAT_RGBA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ARGB_2101010:
|
||||
case HAL_PIXEL_FORMAT_BGRA_1010102:
|
||||
case HAL_PIXEL_FORMAT_ABGR_2101010:
|
||||
case HAL_PIXEL_FORMAT_RGBA_FP16:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void GetRGBPlaneInfo(const BufferInfo& info, int32_t format, int32_t width, int32_t height,
|
||||
int32_t /* flags */, int* plane_count, PlaneLayoutInfo* plane_info) {
|
||||
uint64_t usage = info.usage;
|
||||
*plane_count = 1;
|
||||
uint32_t bpp = 0;
|
||||
if (IsUncompressedRGBFormat(format)) {
|
||||
bpp = GetBppForUncompressedRGB(format);
|
||||
}
|
||||
plane_info->component =
|
||||
(PlaneComponent)(PLANE_COMPONENT_R | PLANE_COMPONENT_G | PLANE_COMPONENT_B);
|
||||
if (HasAlphaComponent(format)) {
|
||||
plane_info->component = (PlaneComponent)(plane_info->component | PLANE_COMPONENT_A);
|
||||
}
|
||||
plane_info->size = GetSize(info, width, height);
|
||||
plane_info->step = bpp;
|
||||
plane_info->offset = GetRgbMetaSize(format, width, height, usage);
|
||||
plane_info->h_subsampling = 0;
|
||||
plane_info->v_subsampling = 0;
|
||||
plane_info->stride = width;
|
||||
plane_info->stride_bytes = width * plane_info->step;
|
||||
plane_info->scanlines = height;
|
||||
}
|
||||
|
||||
} // namespace gralloc
|
156
tools/qtimapper-shim/ext/gr_utils.h
Normal file
156
tools/qtimapper-shim/ext/gr_utils.h
Normal file
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2016,2018-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.
|
||||
*/
|
||||
|
||||
#ifndef __GR_UTILS_H__
|
||||
#define __GR_UTILS_H__
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
#include "types/common.h"
|
||||
|
||||
#define SZ_2M 0x200000
|
||||
#define SZ_1M 0x100000
|
||||
#define SZ_4K 0x1000
|
||||
|
||||
#define SIZE_4K 4096
|
||||
#define SIZE_8K 8192
|
||||
|
||||
#ifdef SLAVE_SIDE_CP
|
||||
#define SECURE_ALIGN SZ_1M
|
||||
#else // MASTER_SIDE_CP
|
||||
#define SECURE_ALIGN SZ_4K
|
||||
#endif
|
||||
|
||||
#define INT(exp) static_cast<int>(exp)
|
||||
#define UINT(exp) static_cast<unsigned int>(exp)
|
||||
|
||||
using android::hardware::graphics::common::V1_1::BufferUsage;
|
||||
|
||||
namespace gralloc {
|
||||
struct BufferInfo {
|
||||
BufferInfo(int w, int h, int f, uint64_t usage = 0)
|
||||
: width(w), height(h), format(f), layer_count(1), usage(usage) {}
|
||||
int width;
|
||||
int height;
|
||||
int format;
|
||||
int layer_count;
|
||||
uint64_t usage;
|
||||
};
|
||||
|
||||
template <class Type1, class Type2>
|
||||
inline Type1 ALIGN(Type1 x, Type2 align) {
|
||||
return (Type1)((x + (Type1)align - 1) & ~((Type1)align - 1));
|
||||
}
|
||||
|
||||
enum PlaneComponent {
|
||||
/* 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,
|
||||
};
|
||||
|
||||
struct PlaneLayoutInfo {
|
||||
/** Components represented the type of plane. */
|
||||
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;
|
||||
|
||||
/** step is the distance in bytes from one pixel value to the next. */
|
||||
int32_t step;
|
||||
|
||||
/** stride of the plane in pixels */
|
||||
int32_t stride;
|
||||
|
||||
/** stride of the plane in in bytes */
|
||||
int32_t stride_bytes;
|
||||
|
||||
/** plane height or vertical stride */
|
||||
int32_t scanlines;
|
||||
|
||||
/** size of the plane in bytes */
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
bool IsCompressedRGBFormat(int format);
|
||||
bool IsUncompressedRGBFormat(int format);
|
||||
uint32_t GetBppForUncompressedRGB(int format);
|
||||
bool CpuCanAccess(uint64_t usage);
|
||||
bool CpuCanRead(uint64_t usage);
|
||||
bool CpuCanWrite(uint64_t usage);
|
||||
unsigned int GetSize(const BufferInfo& d, unsigned int alignedw, unsigned int alignedh);
|
||||
void GetRGBPlaneInfo(const BufferInfo& info, int32_t format, int32_t width, int32_t height,
|
||||
int32_t flags, int* plane_count, PlaneLayoutInfo* plane_info);
|
||||
unsigned int GetRgbMetaSize(int format, uint32_t width, uint32_t height, uint64_t usage);
|
||||
bool IsUBwcFormat(int format);
|
||||
bool IsUBwcSupported(int format);
|
||||
bool IsUBwcPISupported(int format, uint64_t usage);
|
||||
bool IsUBwcEnabled(int format, uint64_t usage);
|
||||
void GetRgbUBwcBlockSize(uint32_t bpp, int* block_width, int* block_height);
|
||||
unsigned int GetRgbUBwcMetaBufferSize(int width, int height, uint32_t bpp);
|
||||
unsigned int GetUBwcSize(int width, int height, int format, unsigned int alignedw,
|
||||
unsigned int alignedh);
|
||||
uint32_t GetDataAlignment(int format, uint64_t usage);
|
||||
bool CanUseAdrenoForSize(int buffer_type, uint64_t usage);
|
||||
bool GetAdrenoSizeAPIStatus();
|
||||
bool UseUncached(int format, uint64_t usage);
|
||||
uint64_t GetHandleFlags(int format, uint64_t usage);
|
||||
int GetImplDefinedFormat(uint64_t usage, int format);
|
||||
int GetCustomFormatFlags(int format, uint64_t usage, int* custom_format, uint64_t* priv_flags);
|
||||
bool IsGPUFlagSupported(uint64_t usage);
|
||||
bool HasAlphaComponent(int32_t format);
|
||||
} // namespace gralloc
|
||||
|
||||
#endif // __GR_UTILS_H__
|
103
tools/qtimapper-shim/ext/gralloc_priv.h
Normal file
103
tools/qtimapper-shim/ext/gralloc_priv.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2021, The Linux Foundation. All rights reserved.
|
||||
* Not a Contribution
|
||||
*
|
||||
* Copyright (C) 2008 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.
|
||||
*/
|
||||
|
||||
#ifndef __GRALLOC_PRIV_H__
|
||||
#define __GRALLOC_PRIV_H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "QtiGrallocDefs.h"
|
||||
#include "gr_priv_handle.h"
|
||||
|
||||
//#pragma message "Warning: gralloc_priv.h is deprecated"
|
||||
|
||||
#define GRALLOC_PROP_PREFIX "vendor.gralloc."
|
||||
#define GRALLOC_PROP(prop_name) GRALLOC_PROP_PREFIX prop_name
|
||||
|
||||
#define DISABLE_UBWC_PROP GRALLOC_PROP("disable_ubwc")
|
||||
#define DISABLE_AHARDWAREBUFFER_PROP GRALLOC_PROP("disable_ahardware_buffer")
|
||||
#define ENABLE_FB_UBWC_PROP GRALLOC_PROP("enable_fb_ubwc")
|
||||
#define MAP_FB_MEMORY_PROP GRALLOC_PROP("map_fb_memory")
|
||||
#define USE_SYSTEM_HEAP_FOR_SENSORS GRALLOC_PROP("use_system_heap_for_sensors")
|
||||
|
||||
#define ROUND_UP_PAGESIZE(x) roundUpToPageSize(x)
|
||||
inline int roundUpToPageSize(int x) {
|
||||
return (x + (getpagesize() - 1)) & ~(getpagesize() - 1);
|
||||
}
|
||||
|
||||
/* Legacy gralloc1 definitions */
|
||||
/* Some clients may still be using the old flags */
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ADSP_HEAP GRALLOC_USAGE_PRIVATE_ADSP_HEAP
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_ALLOC_UBWC GRALLOC_USAGE_PRIVATE_ALLOC_UBWC
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_UNCACHED GRALLOC_USAGE_PRIVATE_UNCACHED
|
||||
#define GRALLOC1_CONSUMER_USAGE_PRIVATE_SECURE_DISPLAY GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_MM_HEAP GRALLOC_USAGE_PRIVATE_MM_HEAP
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT GRALLOC_USAGE_PRIVATE_10BIT
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
|
||||
#define GRALLOC1_CONSUMER_USAGE_PRIVATE_10BIT_TP GRALLOC_USAGE_PRIVATE_10BIT_TP
|
||||
#define GRALLOC1_PRODUCER_USAGE_PRIVATE_VIDEO_NV21_ENCODER GRALLOC_USAGE_PRIVATE_VIDEO_NV21_ENCODER
|
||||
|
||||
// for PERFORM API :
|
||||
#define GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER 1
|
||||
#define GRALLOC_MODULE_PERFORM_GET_STRIDE 2
|
||||
#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_FROM_HANDLE 3
|
||||
#define GRALLOC_MODULE_PERFORM_GET_CUSTOM_STRIDE_AND_HEIGHT_FROM_HANDLE 4
|
||||
#define GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES 5
|
||||
#define GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE 6
|
||||
#define GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO 7
|
||||
#define GRALLOC_MODULE_PERFORM_GET_MAP_SECURE_BUFFER_INFO 8
|
||||
#define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG 9
|
||||
#define GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS 10
|
||||
#define GRALLOC_MODULE_PERFORM_GET_IGC 11
|
||||
#define GRALLOC_MODULE_PERFORM_SET_IGC 12
|
||||
#define GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE 13
|
||||
#define GRALLOC1_MODULE_PERFORM_GET_BUFFER_SIZE_AND_DIMENSIONS 14
|
||||
#define GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG 15
|
||||
#define GRALLOC_MODULE_PERFORM_GET_GRAPHICS_METADATA 16
|
||||
|
||||
/* possible values for inverse gamma correction */
|
||||
#define HAL_IGC_NOT_SPECIFIED 0
|
||||
#define HAL_IGC_s_RGB 1
|
||||
|
||||
/* Color Space: Values maps to ColorSpace_t in qdMetadata.h */
|
||||
#define HAL_CSC_ITU_R_601 0
|
||||
#define HAL_CSC_ITU_R_601_FR 1
|
||||
#define HAL_CSC_ITU_R_709 2
|
||||
#define HAL_CSC_ITU_R_709_FR 3
|
||||
#define HAL_CSC_ITU_R_2020 4
|
||||
#define HAL_CSC_ITU_R_2020_FR 5
|
||||
|
||||
/* possible formats for 3D content*/
|
||||
enum {
|
||||
HAL_NO_3D = 0x0,
|
||||
HAL_3D_SIDE_BY_SIDE_L_R = 0x1,
|
||||
HAL_3D_SIDE_BY_SIDE_R_L = 0x2,
|
||||
HAL_3D_TOP_BOTTOM = 0x4,
|
||||
HAL_3D_IN_SIDE_BY_SIDE_L_R = 0x10000, // unused legacy format
|
||||
};
|
||||
|
||||
/* Flag to determine interlaced content
|
||||
* Value maps to Flags presents in types.hal of QtiMapperextensions
|
||||
*/
|
||||
enum {
|
||||
LAYOUT_INTERLACED_FLAG = 1 << 0,
|
||||
};
|
||||
|
||||
#endif // __GRALLOC_PRIV_H__
|
187
tools/qtimapper-shim/ext/mapper.h
Normal file
187
tools/qtimapper-shim/ext/mapper.h
Normal file
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022, 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
#include "types/mapper.h"
|
||||
|
||||
namespace vendor::qti::hardware::display::mapperextensions::V1_0 {
|
||||
struct IQtiMapperExtensions;
|
||||
}
|
||||
|
||||
namespace android::hardware::graphics::mapper {
|
||||
namespace V2_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
struct BufferDescriptorInfo final {
|
||||
uint32_t width __attribute__((aligned(4)));
|
||||
uint32_t height __attribute__((aligned(4)));
|
||||
uint32_t layerCount __attribute__((aligned(4)));
|
||||
graphics::common::V1_0::PixelFormat format __attribute__((aligned(4)));
|
||||
hidl_bitfield<graphics::common::V1_0::BufferUsage> usage __attribute__((aligned(8)));
|
||||
};
|
||||
|
||||
struct Rect final {
|
||||
int32_t left __attribute__((aligned(4)));
|
||||
int32_t top __attribute__((aligned(4)));
|
||||
int32_t width __attribute__((aligned(4)));
|
||||
int32_t height __attribute__((aligned(4)));
|
||||
};
|
||||
|
||||
#ifdef SHIM_MODE
|
||||
static sp<IMapper> getService(const std::string& /* serviceName */, const bool /* getStub */);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace V2_0
|
||||
namespace V3_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
static sp<IMapper> getService(const std::string& /* serviceName */, const bool /* getStub */);
|
||||
};
|
||||
|
||||
} // namespace V3_0
|
||||
namespace V4_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
static sp<IMapper> getService(const std::string& /* serviceName */, const bool /* getStub */);
|
||||
};
|
||||
|
||||
} // namespace V4_0
|
||||
} // namespace android::hardware::graphics::mapper
|
||||
|
||||
namespace vendor::qti::hardware::display::mapper {
|
||||
namespace V4_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V4_0::IMapper>& /* parent */,
|
||||
bool /* emitError */);
|
||||
};
|
||||
|
||||
} // namespace V4_0
|
||||
namespace V3_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V3_0::IMapper>& /* parent */,
|
||||
bool /* emitError */);
|
||||
};
|
||||
|
||||
} // namespace V3_0
|
||||
#ifdef SHIM_MODE
|
||||
namespace V2_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
using createDescriptor_cb = std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const hidl_vec<uint32_t>& descriptor)>;
|
||||
virtual Return<void> createDescriptor(
|
||||
const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo& descriptorInfo,
|
||||
createDescriptor_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using importBuffer_cb = std::function<void(graphics::mapper::V2_0::Error error, void* buffer)>;
|
||||
virtual Return<void> importBuffer(const hidl_handle& rawHandle, importBuffer_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<graphics::mapper::V2_0::Error> freeBuffer(void* buffer) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using lock_cb = std::function<void(graphics::mapper::V2_0::Error error, void* data)>;
|
||||
virtual Return<void> lock(void* buffer,
|
||||
hidl_bitfield<graphics::common::V1_0::BufferUsage> cpuUsage,
|
||||
const graphics::mapper::V2_0::IMapper::Rect& accessRegion,
|
||||
const hidl_handle& acquireFence, lock_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using lockYCbCr_cb = std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const graphics::mapper::V2_0::YCbCrLayout& layout)>;
|
||||
virtual Return<void> lockYCbCr(void* buffer,
|
||||
hidl_bitfield<graphics::common::V1_0::BufferUsage> cpuUsage,
|
||||
const graphics::mapper::V2_0::IMapper::Rect& accessRegion,
|
||||
const hidl_handle& acquireFence, lockYCbCr_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using unlock_cb =
|
||||
std::function<void(graphics::mapper::V2_0::Error error, const hidl_handle& releaseFence)>;
|
||||
virtual Return<void> unlock(void* buffer, unlock_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<graphics::mapper::V2_0::Error> validateBufferSize(
|
||||
void* buffer, const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo& descriptorInfo,
|
||||
uint32_t stride) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getTransportSize_cb =
|
||||
std::function<void(graphics::mapper::V2_0::Error error, uint32_t numFds, uint32_t numInts)>;
|
||||
virtual Return<void> getTransportSize(void* buffer, getTransportSize_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using createDescriptor_2_1_cb = std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const hidl_vec<uint32_t>& descriptor)>;
|
||||
virtual Return<void> createDescriptor_2_1(
|
||||
const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo& descriptorInfo,
|
||||
createDescriptor_2_1_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getMapperExtensions_cb =
|
||||
std::function<void(graphics::mapper::V2_0::Error error,
|
||||
const ::android::sp<::vendor::qti::hardware::display::mapperextensions::
|
||||
V1_0::IQtiMapperExtensions>& extensions)>;
|
||||
virtual Return<void> getMapperExtensions(getMapperExtensions_cb _hidl_cb);
|
||||
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V2_0::IMapper>& /* parent */,
|
||||
bool /* emitError */);
|
||||
};
|
||||
|
||||
} // namespace V2_0
|
||||
#endif
|
||||
} // namespace vendor::qti::hardware::display::mapper
|
224
tools/qtimapper-shim/ext/mapperextensions.h
Normal file
224
tools/qtimapper-shim/ext/mapperextensions.h
Normal file
|
@ -0,0 +1,224 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022, 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
#include "gralloc_priv.h"
|
||||
#include "types/mapperextensions.h"
|
||||
|
||||
namespace vendor::qti::hardware::display::mapperextensions {
|
||||
namespace V1_0 {
|
||||
|
||||
struct IQtiMapperExtensions : public IBase {
|
||||
IQtiMapperExtensions(){};
|
||||
};
|
||||
|
||||
} // namespace V1_0
|
||||
namespace V1_1 {
|
||||
using Error = V1_0::Error;
|
||||
using PlaneLayout = V1_0::PlaneLayout;
|
||||
|
||||
struct IQtiMapperExtensions : public IBase {
|
||||
IQtiMapperExtensions();
|
||||
|
||||
gralloc1_device_t* gralloc;
|
||||
GRALLOC1_PFN_PERFORM perform;
|
||||
|
||||
using getMapSecureBufferFlag_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, bool mapSecureBuffer)>;
|
||||
virtual ::android::hardware::Return<void> getMapSecureBufferFlag(
|
||||
void* buffer, getMapSecureBufferFlag_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passthrough
|
||||
using getInterlacedFlag_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, bool interlaced)>;
|
||||
virtual ::android::hardware::Return<void> getInterlacedFlag(void* buffer,
|
||||
getInterlacedFlag_cb _hidl_cb);
|
||||
|
||||
using getCustomDimensions_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t stride, int32_t height)>;
|
||||
virtual ::android::hardware::Return<void> getCustomDimensions(void* buffer,
|
||||
getCustomDimensions_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passthrough
|
||||
using getRgbDataAddress_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, void* rgb_data)>;
|
||||
virtual ::android::hardware::Return<void> getRgbDataAddress(void* buffer,
|
||||
getRgbDataAddress_cb _hidl_cb);
|
||||
|
||||
using calculateBufferAttributes_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t aligned_width, int32_t aligned_height, bool ubwc_enabled)>;
|
||||
virtual ::android::hardware::Return<void> calculateBufferAttributes(
|
||||
int32_t width, int32_t height, int32_t format, uint64_t usage,
|
||||
calculateBufferAttributes_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passhthrough
|
||||
using getColorSpace_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t color_space)>;
|
||||
virtual ::android::hardware::Return<void> getColorSpace(void* buffer, getColorSpace_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passthrough with hidl fixups
|
||||
using getYuvPlaneInfo_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
const ::android::hardware::hidl_vec<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout>& layout)>;
|
||||
virtual ::android::hardware::Return<void> getYuvPlaneInfo(void* buffer,
|
||||
getYuvPlaneInfo_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual ::android::hardware::Return<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error>
|
||||
setSingleBufferMode(void* buffer, bool enable) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getCustomFormatFlags_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t format, uint64_t priv_flags)>;
|
||||
virtual ::android::hardware::Return<void> getCustomFormatFlags(int32_t format, uint64_t usage,
|
||||
getCustomFormatFlags_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getFd_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t fd)>;
|
||||
virtual ::android::hardware::Return<void> getFd(void* buffer, getFd_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getWidth_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t width)>;
|
||||
virtual ::android::hardware::Return<void> getWidth(void* buffer, getWidth_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getHeight_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t height)>;
|
||||
virtual ::android::hardware::Return<void> getHeight(void* buffer, getHeight_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getOffset_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t offset)>;
|
||||
virtual ::android::hardware::Return<void> getOffset(void* buffer, getOffset_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getSize_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t size)>;
|
||||
virtual ::android::hardware::Return<void> getSize(void* buffer, getSize_cb _hidl_cb);
|
||||
|
||||
using getUnalignedWidth_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t unaligned_width)>;
|
||||
virtual ::android::hardware::Return<void> getUnalignedWidth(void* buffer,
|
||||
getUnalignedWidth_cb _hidl_cb);
|
||||
|
||||
using getUnalignedHeight_cb =
|
||||
std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error,
|
||||
int32_t unaligned_height)>;
|
||||
virtual ::android::hardware::Return<void> getUnalignedHeight(void* buffer,
|
||||
getUnalignedHeight_cb _hidl_cb);
|
||||
|
||||
using getLayerCount_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t layer_count)>;
|
||||
virtual ::android::hardware::Return<void> getLayerCount(void* buffer, getLayerCount_cb _hidl_cb);
|
||||
|
||||
using getId_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t id)>;
|
||||
virtual ::android::hardware::Return<void> getId(void* buffer, getId_cb _hidl_cb);
|
||||
|
||||
using getUsageFlags_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t usage)>;
|
||||
virtual ::android::hardware::Return<void> getUsageFlags(void* buffer, getUsageFlags_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getFormat_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t format)>;
|
||||
virtual ::android::hardware::Return<void> getFormat(void* buffer, getFormat_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getPrivateFlags_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t flags)>;
|
||||
virtual ::android::hardware::Return<void> getPrivateFlags(void* buffer,
|
||||
getPrivateFlags_cb _hidl_cb);
|
||||
|
||||
using getSurfaceMetadata_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, void* metadata)>;
|
||||
virtual ::android::hardware::Return<void> getSurfaceMetadata(void* buffer,
|
||||
getSurfaceMetadata_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, PAIN
|
||||
using getFormatLayout_cb = std::function<void(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t size,
|
||||
const ::android::hardware::hidl_vec<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout>& plane_info)>;
|
||||
virtual ::android::hardware::Return<void> getFormatLayout(int32_t format, uint64_t usage,
|
||||
int32_t flags, int32_t width,
|
||||
int32_t height,
|
||||
getFormatLayout_cb _hidl_cb);
|
||||
|
||||
// V1.1, Used, passthrough
|
||||
virtual ::android::hardware::Return<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error>
|
||||
getSurfaceMetadata_V1(void* buffer, void* metadata) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
static Return<sp<IQtiMapperExtensions>> castFrom(
|
||||
android::sp<V1_0::IQtiMapperExtensions> const& /* parent */, bool /* emitError */);
|
||||
};
|
||||
|
||||
} // namespace V1_1
|
||||
} // namespace vendor::qti::hardware::display::mapperextensions
|
6744
tools/qtimapper-shim/ext/types/common.h
Normal file
6744
tools/qtimapper-shim/ext/types/common.h
Normal file
File diff suppressed because it is too large
Load diff
250
tools/qtimapper-shim/ext/types/mapper.h
Normal file
250
tools/qtimapper-shim/ext/types/mapper.h
Normal file
|
@ -0,0 +1,250 @@
|
|||
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
||||
#define HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace graphics {
|
||||
namespace mapper {
|
||||
namespace V2_0 {
|
||||
|
||||
// Forward declaration for forward reference support:
|
||||
enum class Error : int32_t;
|
||||
struct YCbCrLayout;
|
||||
|
||||
enum class Error : int32_t {
|
||||
NONE = 0,
|
||||
BAD_DESCRIPTOR = 1,
|
||||
BAD_BUFFER = 2,
|
||||
BAD_VALUE = 3,
|
||||
NO_RESOURCES = 5,
|
||||
UNSUPPORTED = 7,
|
||||
};
|
||||
|
||||
/**
|
||||
* A buffer descriptor is an implementation-defined opaque data returned by
|
||||
* createDescriptor. It describes the properties of a buffer and is consumed
|
||||
* by the allocator.
|
||||
*/
|
||||
typedef ::android::hardware::hidl_vec<uint32_t> BufferDescriptor;
|
||||
|
||||
/**
|
||||
* Structure for describing YCbCr formats for consumption by applications.
|
||||
* This is used with PixelFormat::YCBCR_*_888.
|
||||
*
|
||||
* Buffer chroma subsampling is defined in the format.
|
||||
* e.g. PixelFormat::YCBCR_420_888 has subsampling 4:2:0.
|
||||
*
|
||||
* Buffers must have a 8 bit depth.
|
||||
*
|
||||
* y, cb, and cr point to the first byte of their respective planes.
|
||||
*
|
||||
* Stride describes the distance in bytes from the first value of one row of
|
||||
* the image to the first value of the next row. It includes the width of the
|
||||
* image plus padding.
|
||||
* yStride is the stride of the luma plane.
|
||||
* cStride is the stride of the chroma planes.
|
||||
*
|
||||
* chromaStep is the distance in bytes from one chroma pixel value to the
|
||||
* next. This is 2 bytes for semiplanar (because chroma values are interleaved
|
||||
* and each chroma value is one byte) and 1 for planar.
|
||||
*/
|
||||
struct YCbCrLayout final {
|
||||
void* y;
|
||||
void* cb;
|
||||
void* cr;
|
||||
uint32_t yStride;
|
||||
uint32_t cStride;
|
||||
uint32_t chromaStep;
|
||||
};
|
||||
|
||||
//
|
||||
// type declarations for package
|
||||
//
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(::android::hardware::graphics::mapper::V2_0::Error o);
|
||||
|
||||
constexpr int32_t operator|(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const int32_t lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const int32_t lhs,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const ::android::hardware::graphics::mapper::V2_0::Error lhs,
|
||||
const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t& operator|=(int32_t& v,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t& operator&=(int32_t& v,
|
||||
const ::android::hardware::graphics::mapper::V2_0::Error e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::android::hardware::graphics::mapper::V2_0::YCbCrLayout& o);
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
//
|
||||
// type header definitions for package
|
||||
//
|
||||
|
||||
template <>
|
||||
inline std::string toString<::android::hardware::graphics::mapper::V2_0::Error>(int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<::android::hardware::graphics::mapper::V2_0::Error> flipped =
|
||||
0;
|
||||
bool first = true;
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::NONE) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::NONE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NONE";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::NONE;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_DESCRIPTOR";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_BUFFER";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_VALUE";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NO_RESOURCES";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED) ==
|
||||
static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "UNSUPPORTED";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(::android::hardware::graphics::mapper::V2_0::Error o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::NONE) {
|
||||
return "NONE";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR) {
|
||||
return "BAD_DESCRIPTOR";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER) {
|
||||
return "BAD_BUFFER";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE) {
|
||||
return "BAD_VALUE";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES) {
|
||||
return "NO_RESOURCES";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED) {
|
||||
return "UNSUPPORTED";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::android::hardware::graphics::mapper::V2_0::YCbCrLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".y = ";
|
||||
os += ::android::hardware::toString(o.y);
|
||||
os += ", .cb = ";
|
||||
os += ::android::hardware::toString(o.cb);
|
||||
os += ", .cr = ";
|
||||
os += ::android::hardware::toString(o.cr);
|
||||
os += ", .yStride = ";
|
||||
os += ::android::hardware::toString(o.yStride);
|
||||
os += ", .cStride = ";
|
||||
os += ::android::hardware::toString(o.cStride);
|
||||
os += ", .chromaStep = ";
|
||||
os += ::android::hardware::toString(o.chromaStep);
|
||||
os += "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
} // namespace V2_0
|
||||
} // namespace mapper
|
||||
} // namespace graphics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
//
|
||||
// global type declarations for package
|
||||
//
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::android::hardware::graphics::mapper::V2_0::Error, 6>
|
||||
hidl_enum_values<::android::hardware::graphics::mapper::V2_0::Error> = {
|
||||
::android::hardware::graphics::mapper::V2_0::Error::NONE,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
707
tools/qtimapper-shim/ext/types/mapperextensions.h
Normal file
707
tools/qtimapper-shim/ext/types/mapperextensions.h
Normal file
|
@ -0,0 +1,707 @@
|
|||
#ifndef HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
||||
#define HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
namespace vendor {
|
||||
namespace qti {
|
||||
namespace hardware {
|
||||
namespace display {
|
||||
namespace mapperextensions {
|
||||
namespace V1_0 {
|
||||
|
||||
// Forward declaration for forward reference support:
|
||||
enum class Error : int32_t;
|
||||
struct YCbCrLayout;
|
||||
enum class PlaneComponent : uint32_t;
|
||||
enum class Flags : int32_t;
|
||||
struct PlaneLayout;
|
||||
|
||||
enum class Error : int32_t {
|
||||
NONE = 0,
|
||||
BAD_BUFFER = 2,
|
||||
NO_RESOURCES = 5,
|
||||
UNSUPPORTED = 7,
|
||||
};
|
||||
|
||||
struct YCbCrLayout final {
|
||||
void* y;
|
||||
void* cb;
|
||||
void* cr;
|
||||
uint32_t yStride;
|
||||
uint32_t cStride;
|
||||
uint32_t chromaStep;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plane Component type definitions.
|
||||
*/
|
||||
enum class PlaneComponent : uint32_t {
|
||||
PLANE_COMPONENT_Y = 1u /* (1 << 0) */,
|
||||
PLANE_COMPONENT_Cb = 2u /* (1 << 1) */,
|
||||
PLANE_COMPONENT_Cr = 4u /* (1 << 2) */,
|
||||
PLANE_COMPONENT_R = 1024u /* (1 << 10) */,
|
||||
PLANE_COMPONENT_G = 2048u /* (1 << 11) */,
|
||||
PLANE_COMPONENT_B = 4096u /* (1 << 12) */,
|
||||
PLANE_COMPONENT_A = 1048576u /* (1 << 20) */,
|
||||
PLANE_COMPONENT_RAW = 1073741824u /* (1 << 30) */,
|
||||
PLANE_COMPONENT_META = 2147483648u /* (1 << 31) */,
|
||||
};
|
||||
|
||||
/**
|
||||
* Flags to send with getFormatLayout for extra information for e.g. interlaced,
|
||||
* otherwise send 0.
|
||||
*/
|
||||
enum class Flags : int32_t {
|
||||
LAYOUT_INTERLACED_FLAG = 1 /* (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 final {
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>
|
||||
component __attribute__((aligned(4)));
|
||||
uint32_t h_subsampling __attribute__((aligned(4)));
|
||||
uint32_t v_subsampling __attribute__((aligned(4)));
|
||||
uint32_t offset __attribute__((aligned(4)));
|
||||
int32_t pixel_increment __attribute__((aligned(4)));
|
||||
int32_t stride __attribute__((aligned(4)));
|
||||
int32_t stride_bytes __attribute__((aligned(4)));
|
||||
int32_t scanlines __attribute__((aligned(4)));
|
||||
uint32_t size __attribute__((aligned(4)));
|
||||
};
|
||||
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
component) == 0,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
h_subsampling) == 4,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
v_subsampling) == 8,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
offset) == 12,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
pixel_increment) == 16,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
stride) == 20,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
stride_bytes) == 24,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
scanlines) == 28,
|
||||
"wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout,
|
||||
size) == 32,
|
||||
"wrong offset");
|
||||
static_assert(sizeof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout) == 36,
|
||||
"wrong size");
|
||||
static_assert(__alignof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout) == 4,
|
||||
"wrong alignment");
|
||||
|
||||
//
|
||||
// type declarations for package
|
||||
//
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error o);
|
||||
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t& operator|=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t& operator&=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout& o);
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(uint32_t o);
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent o);
|
||||
|
||||
constexpr uint32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator|(
|
||||
const uint32_t lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(lhs | static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const uint32_t rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr uint32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator&(
|
||||
const uint32_t lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(lhs & static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs,
|
||||
const uint32_t rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr uint32_t& operator|=(
|
||||
uint32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent e) {
|
||||
v |= static_cast<uint32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr uint32_t& operator&=(
|
||||
uint32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent e) {
|
||||
v &= static_cast<uint32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
template <typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags o);
|
||||
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t& operator|=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t& operator&=(
|
||||
int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& o);
|
||||
static inline bool operator==(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs);
|
||||
static inline bool operator!=(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs);
|
||||
|
||||
//
|
||||
// type header definitions for package
|
||||
//
|
||||
|
||||
template <>
|
||||
inline std::string toString<::vendor::qti::hardware::display::mapperextensions::V1_0::Error>(
|
||||
int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error>
|
||||
flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE) ==
|
||||
static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NONE";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER) ==
|
||||
static_cast<int32_t>(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_BUFFER";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES) ==
|
||||
static_cast<int32_t>(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NO_RESOURCES";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED) ==
|
||||
static_cast<int32_t>(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "UNSUPPORTED";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE) {
|
||||
return "NONE";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER) {
|
||||
return "BAD_BUFFER";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES) {
|
||||
return "NO_RESOURCES";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED) {
|
||||
return "UNSUPPORTED";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".y = ";
|
||||
os += ::android::hardware::toString(o.y);
|
||||
os += ", .cb = ";
|
||||
os += ::android::hardware::toString(o.cb);
|
||||
os += ", .cr = ";
|
||||
os += ::android::hardware::toString(o.cr);
|
||||
os += ", .yStride = ";
|
||||
os += ::android::hardware::toString(o.yStride);
|
||||
os += ", .cStride = ";
|
||||
os += ::android::hardware::toString(o.cStride);
|
||||
os += ", .chromaStep = ";
|
||||
os += ::android::hardware::toString(o.chromaStep);
|
||||
os += "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
template <>
|
||||
inline std::string
|
||||
toString<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>(uint32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>
|
||||
flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Y) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_Y)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Y";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_Cb)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Cb";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_Cr)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Cr";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_R) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_R)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_R";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_G) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_G)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_G";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_B) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_B)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_B";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_A) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_A)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_A";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_RAW)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_RAW";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META) ==
|
||||
static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::
|
||||
PlaneComponent::PLANE_COMPONENT_META)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_META";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y) {
|
||||
return "PLANE_COMPONENT_Y";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb) {
|
||||
return "PLANE_COMPONENT_Cb";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr) {
|
||||
return "PLANE_COMPONENT_Cr";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R) {
|
||||
return "PLANE_COMPONENT_R";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G) {
|
||||
return "PLANE_COMPONENT_G";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B) {
|
||||
return "PLANE_COMPONENT_B";
|
||||
}
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A) {
|
||||
return "PLANE_COMPONENT_A";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW) {
|
||||
return "PLANE_COMPONENT_RAW";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META) {
|
||||
return "PLANE_COMPONENT_META";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<uint32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::string toString<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags>(
|
||||
int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags>
|
||||
flipped = 0;
|
||||
bool first = true;
|
||||
if ((o &
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG) ==
|
||||
static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::
|
||||
LAYOUT_INTERLACED_FLAG)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "LAYOUT_INTERLACED_FLAG";
|
||||
first = false;
|
||||
flipped |=
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}
|
||||
os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o ==
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG) {
|
||||
return "LAYOUT_INTERLACED_FLAG";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".component = ";
|
||||
os += ::vendor::qti::hardware::display::mapperextensions::V1_0::toString<
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>(o.component);
|
||||
os += ", .h_subsampling = ";
|
||||
os += ::android::hardware::toString(o.h_subsampling);
|
||||
os += ", .v_subsampling = ";
|
||||
os += ::android::hardware::toString(o.v_subsampling);
|
||||
os += ", .offset = ";
|
||||
os += ::android::hardware::toString(o.offset);
|
||||
os += ", .pixel_increment = ";
|
||||
os += ::android::hardware::toString(o.pixel_increment);
|
||||
os += ", .stride = ";
|
||||
os += ::android::hardware::toString(o.stride);
|
||||
os += ", .stride_bytes = ";
|
||||
os += ::android::hardware::toString(o.stride_bytes);
|
||||
os += ", .scanlines = ";
|
||||
os += ::android::hardware::toString(o.scanlines);
|
||||
os += ", .size = ";
|
||||
os += ::android::hardware::toString(o.size);
|
||||
os += "}";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline bool operator==(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs) {
|
||||
if (lhs.component != rhs.component) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.h_subsampling != rhs.h_subsampling) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.v_subsampling != rhs.v_subsampling) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.offset != rhs.offset) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.pixel_increment != rhs.pixel_increment) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.stride != rhs.stride) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.stride_bytes != rhs.stride_bytes) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.scanlines != rhs.scanlines) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.size != rhs.size) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool operator!=(
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs,
|
||||
const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
} // namespace V1_0
|
||||
} // namespace mapperextensions
|
||||
} // namespace display
|
||||
} // namespace hardware
|
||||
} // namespace qti
|
||||
} // namespace vendor
|
||||
|
||||
//
|
||||
// global type declarations for package
|
||||
//
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::Error, 4>
|
||||
hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::Error> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent, 9>
|
||||
hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cb,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_Cr,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_RAW,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::
|
||||
PLANE_COMPONENT_META,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template <>
|
||||
constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags, 1>
|
||||
hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include "types/common.h"
|
||||
|
||||
using namespace android::hardware;
|
||||
using namespace android;
|
||||
|
||||
/* Simplified version of hidl::base::V1_0::IBase */
|
||||
struct IBase : virtual public RefBase {
|
||||
virtual bool isRemote() const;
|
||||
|
||||
using interfaceChain_cb = std::function<void(const hidl_vec<hidl_string> &descriptors)>;
|
||||
virtual Return<void> interfaceChain(interfaceChain_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> debug(const hidl_handle &fd, const hidl_vec<hidl_string> &options) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using interfaceDescriptor_cb = std::function<void(const hidl_string &descriptor)>;
|
||||
virtual Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getHashChain_cb = std::function<void(const hidl_vec<hidl_array<uint8_t, 32>> &hashchain)>;
|
||||
virtual Return<void> getHashChain(getHashChain_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> setHALInstrumentation() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<bool> linkToDeath(const sp<hidl_death_recipient> &recipient, uint64_t cookie) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> ping() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getDebugInfo_cb = std::function<void(const hidl::base::V1_0::DebugInfo &info)>;
|
||||
virtual Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<void> notifySyspropsChanged() {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<bool> unlinkToDeath(const sp<hidl_death_recipient> &recipient) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
};
|
|
@ -1,160 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022, 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
#include "types/mapper.h"
|
||||
|
||||
namespace vendor::qti::hardware::display::mapperextensions::V1_0 {
|
||||
struct IQtiMapperExtensions;
|
||||
}
|
||||
|
||||
namespace android::hardware::graphics::mapper {
|
||||
namespace V2_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
struct BufferDescriptorInfo final {
|
||||
uint32_t width __attribute__ ((aligned(4)));
|
||||
uint32_t height __attribute__ ((aligned(4)));
|
||||
uint32_t layerCount __attribute__ ((aligned(4)));
|
||||
graphics::common::V1_0::PixelFormat format __attribute__ ((aligned(4)));
|
||||
hidl_bitfield<graphics::common::V1_0::BufferUsage> usage __attribute__ ((aligned(8)));
|
||||
};
|
||||
|
||||
struct Rect final {
|
||||
int32_t left __attribute__ ((aligned(4)));
|
||||
int32_t top __attribute__ ((aligned(4)));
|
||||
int32_t width __attribute__ ((aligned(4)));
|
||||
int32_t height __attribute__ ((aligned(4)));
|
||||
};
|
||||
|
||||
|
||||
static sp<IMapper> getService(const std::string &/* serviceName */, const bool /* getStub */);
|
||||
};
|
||||
|
||||
}
|
||||
namespace V3_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
static sp<IMapper> getService(const std::string &/* serviceName */, const bool /* getStub */);
|
||||
};
|
||||
|
||||
}
|
||||
namespace V4_0 {
|
||||
|
||||
struct IMapper : public IBase {
|
||||
static sp<IMapper> getService(const std::string &/* serviceName */, const bool /* getStub */);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace vendor::qti::hardware::display::mapper {
|
||||
namespace V4_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V4_0::IMapper> &/* parent */, bool /* emitError */);
|
||||
};
|
||||
|
||||
}
|
||||
namespace V3_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V3_0::IMapper> &/* parent */, bool /* emitError */);
|
||||
};
|
||||
|
||||
}
|
||||
namespace V2_0 {
|
||||
|
||||
struct IQtiMapper : public IBase {
|
||||
using createDescriptor_cb = std::function<void(graphics::mapper::V2_0::Error error, const hidl_vec<uint32_t> &descriptor)>;
|
||||
virtual Return<void> createDescriptor(const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo &descriptorInfo, createDescriptor_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using importBuffer_cb = std::function<void(graphics::mapper::V2_0::Error error, void *buffer)>;
|
||||
virtual Return<void> importBuffer(const hidl_handle &rawHandle, importBuffer_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<graphics::mapper::V2_0::Error> freeBuffer(void *buffer) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using lock_cb = std::function<void(graphics::mapper::V2_0::Error error, void *data)>;
|
||||
virtual Return<void> lock(void *buffer, hidl_bitfield<graphics::common::V1_0::BufferUsage> cpuUsage, const graphics::mapper::V2_0::IMapper::Rect &accessRegion, const hidl_handle &acquireFence, lock_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using lockYCbCr_cb = std::function<void(graphics::mapper::V2_0::Error error, const graphics::mapper::V2_0::YCbCrLayout &layout)>;
|
||||
virtual Return<void> lockYCbCr(void *buffer, hidl_bitfield<graphics::common::V1_0::BufferUsage> cpuUsage, const graphics::mapper::V2_0::IMapper::Rect &accessRegion, const hidl_handle &acquireFence, lockYCbCr_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using unlock_cb = std::function<void(graphics::mapper::V2_0::Error error, const hidl_handle &releaseFence)>;
|
||||
virtual Return<void> unlock(void *buffer, unlock_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual Return<graphics::mapper::V2_0::Error> validateBufferSize(void *buffer, const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo &descriptorInfo, uint32_t stride) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getTransportSize_cb = std::function<void(graphics::mapper::V2_0::Error error, uint32_t numFds, uint32_t numInts)>;
|
||||
virtual Return<void> getTransportSize(void *buffer, getTransportSize_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using createDescriptor_2_1_cb = std::function<void(graphics::mapper::V2_0::Error error, const hidl_vec<uint32_t> &descriptor)>;
|
||||
virtual Return<void> createDescriptor_2_1(const graphics::mapper::V2_0::IMapper::BufferDescriptorInfo &descriptorInfo, createDescriptor_2_1_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getMapperExtensions_cb = std::function<void(graphics::mapper::V2_0::Error error, const ::android::sp<::vendor::qti::hardware::display::mapperextensions::V1_0::IQtiMapperExtensions> &extensions)>;
|
||||
virtual Return<void> getMapperExtensions(getMapperExtensions_cb _hidl_cb);
|
||||
|
||||
static Return<sp<IQtiMapper>> castFrom(const sp<graphics::mapper::V2_0::IMapper> &/* parent */, bool /* emitError */);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022, 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
#include "types/mapperextensions.h"
|
||||
#include "gr_priv_handle.h"
|
||||
|
||||
namespace vendor::qti::hardware::display::mapperextensions {
|
||||
namespace V1_0 {
|
||||
|
||||
struct IQtiMapperExtensions : public IBase {
|
||||
IQtiMapperExtensions() {};
|
||||
};
|
||||
|
||||
}
|
||||
namespace V1_1 {
|
||||
|
||||
struct IQtiMapperExtensions : public IBase {
|
||||
IQtiMapperExtensions();
|
||||
|
||||
gralloc1_device_t *gralloc;
|
||||
GRALLOC1_PFN_PERFORM perform;
|
||||
|
||||
using getMapSecureBufferFlag_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, bool mapSecureBuffer)>;
|
||||
virtual ::android::hardware::Return<void> getMapSecureBufferFlag(void *buffer, getMapSecureBufferFlag_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passthrough
|
||||
using getInterlacedFlag_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, bool interlaced)>;
|
||||
virtual ::android::hardware::Return<void> getInterlacedFlag(void *buffer, getInterlacedFlag_cb _hidl_cb);
|
||||
|
||||
using getCustomDimensions_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t stride, int32_t height)>;
|
||||
virtual ::android::hardware::Return<void> getCustomDimensions(void *buffer, getCustomDimensions_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passthrough
|
||||
using getRgbDataAddress_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, void *rgb_data)>;
|
||||
virtual ::android::hardware::Return<void> getRgbDataAddress(void *buffer, getRgbDataAddress_cb _hidl_cb);
|
||||
|
||||
using calculateBufferAttributes_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t aligned_width, int32_t aligned_height, bool ubwc_enabled)>;
|
||||
virtual ::android::hardware::Return<void> calculateBufferAttributes(int32_t width, int32_t height, int32_t format, uint64_t usage, calculateBufferAttributes_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passhthrough
|
||||
using getColorSpace_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t color_space)>;
|
||||
virtual ::android::hardware::Return<void> getColorSpace(void *buffer, getColorSpace_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, passthrough with hidl fixups
|
||||
using getYuvPlaneInfo_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, const ::android::hardware::hidl_vec<::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout> &layout)>;
|
||||
virtual ::android::hardware::Return<void> getYuvPlaneInfo(void *buffer, getYuvPlaneInfo_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
virtual ::android::hardware::Return<::vendor::qti::hardware::display::mapperextensions::V1_0::Error> setSingleBufferMode(void *buffer, bool enable) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
using getCustomFormatFlags_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t format, uint64_t priv_flags)>;
|
||||
virtual ::android::hardware::Return<void> getCustomFormatFlags(int32_t format, uint64_t usage, getCustomFormatFlags_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getFd_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t fd)>;
|
||||
virtual ::android::hardware::Return<void> getFd(void *buffer, getFd_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getWidth_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t width)>;
|
||||
virtual ::android::hardware::Return<void> getWidth(void *buffer, getWidth_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getHeight_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t height)>;
|
||||
virtual ::android::hardware::Return<void> getHeight(void *buffer, getHeight_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getOffset_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t offset)>;
|
||||
virtual ::android::hardware::Return<void> getOffset(void *buffer, getOffset_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getSize_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t size)>;
|
||||
virtual ::android::hardware::Return<void> getSize(void *buffer, getSize_cb _hidl_cb);
|
||||
|
||||
using getUnalignedWidth_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t unaligned_width)>;
|
||||
virtual ::android::hardware::Return<void> getUnalignedWidth(void *buffer, getUnalignedWidth_cb _hidl_cb);
|
||||
|
||||
using getUnalignedHeight_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t unaligned_height)>;
|
||||
virtual ::android::hardware::Return<void> getUnalignedHeight(void *buffer, getUnalignedHeight_cb _hidl_cb);
|
||||
|
||||
using getLayerCount_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t layer_count)>;
|
||||
virtual ::android::hardware::Return<void> getLayerCount(void *buffer, getLayerCount_cb _hidl_cb);
|
||||
|
||||
using getId_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t id)>;
|
||||
virtual ::android::hardware::Return<void> getId(void *buffer, getId_cb _hidl_cb);
|
||||
|
||||
using getUsageFlags_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t usage)>;
|
||||
virtual ::android::hardware::Return<void> getUsageFlags(void *buffer, getUsageFlags_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getFormat_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t format)>;
|
||||
virtual ::android::hardware::Return<void> getFormat(void *buffer, getFormat_cb _hidl_cb);
|
||||
|
||||
// Used, cast private data with no passthrough
|
||||
using getPrivateFlags_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, int32_t flags)>;
|
||||
virtual ::android::hardware::Return<void> getPrivateFlags(void *buffer, getPrivateFlags_cb _hidl_cb);
|
||||
|
||||
using getSurfaceMetadata_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, void *metadata)>;
|
||||
virtual ::android::hardware::Return<void> getSurfaceMetadata(void *buffer, getSurfaceMetadata_cb _hidl_cb) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
// Used, PAIN
|
||||
using getFormatLayout_cb = std::function<void(::vendor::qti::hardware::display::mapperextensions::V1_0::Error error, uint64_t size, const ::android::hardware::hidl_vec<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout> &plane_info)>;
|
||||
virtual ::android::hardware::Return<void> getFormatLayout(int32_t format, uint64_t usage, int32_t flags, int32_t width, int32_t height, getFormatLayout_cb _hidl_cb) {
|
||||
ALOGE("%s fail", __func__);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// V1.1, Used, passthrough
|
||||
virtual ::android::hardware::Return<::vendor::qti::hardware::display::mapperextensions::V1_0::Error> getSurfaceMetadata_V1(void *buffer, void *metadata) {
|
||||
ALOGE("%s", __func__);
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
static Return<sp<IQtiMapperExtensions>> castFrom(android::sp<V1_0::IQtiMapperExtensions> const &/* parent */, bool /* emitError */);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,231 +0,0 @@
|
|||
#ifndef HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
||||
#define HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace graphics {
|
||||
namespace mapper {
|
||||
namespace V2_0 {
|
||||
|
||||
// Forward declaration for forward reference support:
|
||||
enum class Error : int32_t;
|
||||
struct YCbCrLayout;
|
||||
|
||||
enum class Error : int32_t {
|
||||
NONE = 0,
|
||||
BAD_DESCRIPTOR = 1,
|
||||
BAD_BUFFER = 2,
|
||||
BAD_VALUE = 3,
|
||||
NO_RESOURCES = 5,
|
||||
UNSUPPORTED = 7,
|
||||
};
|
||||
|
||||
/**
|
||||
* A buffer descriptor is an implementation-defined opaque data returned by
|
||||
* createDescriptor. It describes the properties of a buffer and is consumed
|
||||
* by the allocator.
|
||||
*/
|
||||
typedef ::android::hardware::hidl_vec<uint32_t> BufferDescriptor;
|
||||
|
||||
/**
|
||||
* Structure for describing YCbCr formats for consumption by applications.
|
||||
* This is used with PixelFormat::YCBCR_*_888.
|
||||
*
|
||||
* Buffer chroma subsampling is defined in the format.
|
||||
* e.g. PixelFormat::YCBCR_420_888 has subsampling 4:2:0.
|
||||
*
|
||||
* Buffers must have a 8 bit depth.
|
||||
*
|
||||
* y, cb, and cr point to the first byte of their respective planes.
|
||||
*
|
||||
* Stride describes the distance in bytes from the first value of one row of
|
||||
* the image to the first value of the next row. It includes the width of the
|
||||
* image plus padding.
|
||||
* yStride is the stride of the luma plane.
|
||||
* cStride is the stride of the chroma planes.
|
||||
*
|
||||
* chromaStep is the distance in bytes from one chroma pixel value to the
|
||||
* next. This is 2 bytes for semiplanar (because chroma values are interleaved
|
||||
* and each chroma value is one byte) and 1 for planar.
|
||||
*/
|
||||
struct YCbCrLayout final {
|
||||
void* y;
|
||||
void* cb;
|
||||
void* cr;
|
||||
uint32_t yStride;
|
||||
uint32_t cStride;
|
||||
uint32_t chromaStep;
|
||||
};
|
||||
|
||||
//
|
||||
// type declarations for package
|
||||
//
|
||||
|
||||
template<typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(::android::hardware::graphics::mapper::V2_0::Error o);
|
||||
|
||||
constexpr int32_t operator|(const ::android::hardware::graphics::mapper::V2_0::Error lhs, const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const int32_t lhs, const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const ::android::hardware::graphics::mapper::V2_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(const ::android::hardware::graphics::mapper::V2_0::Error lhs, const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const int32_t lhs, const ::android::hardware::graphics::mapper::V2_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const ::android::hardware::graphics::mapper::V2_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t &operator|=(int32_t& v, const ::android::hardware::graphics::mapper::V2_0::Error e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t &operator&=(int32_t& v, const ::android::hardware::graphics::mapper::V2_0::Error e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(const ::android::hardware::graphics::mapper::V2_0::YCbCrLayout& o);
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
//
|
||||
// type header definitions for package
|
||||
//
|
||||
|
||||
template<>
|
||||
inline std::string toString<::android::hardware::graphics::mapper::V2_0::Error>(int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<::android::hardware::graphics::mapper::V2_0::Error> flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::NONE) == static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::NONE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NONE";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::NONE;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR) == static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_DESCRIPTOR";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER) == static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_BUFFER";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE) == static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_VALUE";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES) == static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NO_RESOURCES";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES;
|
||||
}
|
||||
if ((o & ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED) == static_cast<int32_t>(::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "UNSUPPORTED";
|
||||
first = false;
|
||||
flipped |= ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(::android::hardware::graphics::mapper::V2_0::Error o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::NONE) {
|
||||
return "NONE";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR) {
|
||||
return "BAD_DESCRIPTOR";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER) {
|
||||
return "BAD_BUFFER";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE) {
|
||||
return "BAD_VALUE";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES) {
|
||||
return "NO_RESOURCES";
|
||||
}
|
||||
if (o == ::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED) {
|
||||
return "UNSUPPORTED";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(const ::android::hardware::graphics::mapper::V2_0::YCbCrLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".y = ";
|
||||
os += ::android::hardware::toString(o.y);
|
||||
os += ", .cb = ";
|
||||
os += ::android::hardware::toString(o.cb);
|
||||
os += ", .cr = ";
|
||||
os += ::android::hardware::toString(o.cr);
|
||||
os += ", .yStride = ";
|
||||
os += ::android::hardware::toString(o.yStride);
|
||||
os += ", .cStride = ";
|
||||
os += ::android::hardware::toString(o.cStride);
|
||||
os += ", .chromaStep = ";
|
||||
os += ::android::hardware::toString(o.chromaStep);
|
||||
os += "}"; return os;
|
||||
}
|
||||
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
|
||||
} // namespace V2_0
|
||||
} // namespace mapper
|
||||
} // namespace graphics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
//
|
||||
// global type declarations for package
|
||||
//
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template<> constexpr std::array<::android::hardware::graphics::mapper::V2_0::Error, 6> hidl_enum_values<::android::hardware::graphics::mapper::V2_0::Error> = {
|
||||
::android::hardware::graphics::mapper::V2_0::Error::NONE,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_DESCRIPTOR,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_BUFFER,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::BAD_VALUE,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::NO_RESOURCES,
|
||||
::android::hardware::graphics::mapper::V2_0::Error::UNSUPPORTED,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
|
||||
#endif // HIDL_GENERATED_ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
|
|
@ -1,553 +0,0 @@
|
|||
#ifndef HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
||||
#define HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
||||
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
namespace vendor {
|
||||
namespace qti {
|
||||
namespace hardware {
|
||||
namespace display {
|
||||
namespace mapperextensions {
|
||||
namespace V1_0 {
|
||||
|
||||
// Forward declaration for forward reference support:
|
||||
enum class Error : int32_t;
|
||||
struct YCbCrLayout;
|
||||
enum class PlaneComponent : uint32_t;
|
||||
enum class Flags : int32_t;
|
||||
struct PlaneLayout;
|
||||
|
||||
enum class Error : int32_t {
|
||||
NONE = 0,
|
||||
BAD_BUFFER = 2,
|
||||
NO_RESOURCES = 5,
|
||||
UNSUPPORTED = 7,
|
||||
};
|
||||
|
||||
struct YCbCrLayout final {
|
||||
void* y;
|
||||
void* cb;
|
||||
void* cr;
|
||||
uint32_t yStride;
|
||||
uint32_t cStride;
|
||||
uint32_t chromaStep;
|
||||
};
|
||||
|
||||
/**
|
||||
* Plane Component type definitions.
|
||||
*/
|
||||
enum class PlaneComponent : uint32_t {
|
||||
PLANE_COMPONENT_Y = 1u /* (1 << 0) */,
|
||||
PLANE_COMPONENT_Cb = 2u /* (1 << 1) */,
|
||||
PLANE_COMPONENT_Cr = 4u /* (1 << 2) */,
|
||||
PLANE_COMPONENT_R = 1024u /* (1 << 10) */,
|
||||
PLANE_COMPONENT_G = 2048u /* (1 << 11) */,
|
||||
PLANE_COMPONENT_B = 4096u /* (1 << 12) */,
|
||||
PLANE_COMPONENT_A = 1048576u /* (1 << 20) */,
|
||||
PLANE_COMPONENT_RAW = 1073741824u /* (1 << 30) */,
|
||||
PLANE_COMPONENT_META = 2147483648u /* (1 << 31) */,
|
||||
};
|
||||
|
||||
/**
|
||||
* Flags to send with getFormatLayout for extra information for e.g. interlaced,
|
||||
* otherwise send 0.
|
||||
*/
|
||||
enum class Flags : int32_t {
|
||||
LAYOUT_INTERLACED_FLAG = 1 /* (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 final {
|
||||
::android::hardware::hidl_bitfield<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent> component __attribute__ ((aligned(4)));
|
||||
uint32_t h_subsampling __attribute__ ((aligned(4)));
|
||||
uint32_t v_subsampling __attribute__ ((aligned(4)));
|
||||
uint32_t offset __attribute__ ((aligned(4)));
|
||||
int32_t pixel_increment __attribute__ ((aligned(4)));
|
||||
int32_t stride __attribute__ ((aligned(4)));
|
||||
int32_t stride_bytes __attribute__ ((aligned(4)));
|
||||
int32_t scanlines __attribute__ ((aligned(4)));
|
||||
uint32_t size __attribute__ ((aligned(4)));
|
||||
};
|
||||
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, component) == 0, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, h_subsampling) == 4, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, v_subsampling) == 8, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, offset) == 12, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, pixel_increment) == 16, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, stride) == 20, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, stride_bytes) == 24, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, scanlines) == 28, "wrong offset");
|
||||
static_assert(offsetof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout, size) == 32, "wrong offset");
|
||||
static_assert(sizeof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout) == 36, "wrong size");
|
||||
static_assert(__alignof(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout) == 4, "wrong alignment");
|
||||
|
||||
//
|
||||
// type declarations for package
|
||||
//
|
||||
|
||||
template<typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(::vendor::qti::hardware::display::mapperextensions::V1_0::Error o);
|
||||
|
||||
constexpr int32_t operator|(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t &operator|=(int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t &operator&=(int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Error e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(const ::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout& o);
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
template<typename>
|
||||
static inline std::string toString(uint32_t o);
|
||||
static inline std::string toString(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent o);
|
||||
|
||||
constexpr uint32_t operator|(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator|(const uint32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(lhs | static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator|(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs, const uint32_t rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr uint32_t operator&(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator&(const uint32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent rhs) {
|
||||
return static_cast<uint32_t>(lhs & static_cast<uint32_t>(rhs));
|
||||
}
|
||||
constexpr uint32_t operator&(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent lhs, const uint32_t rhs) {
|
||||
return static_cast<uint32_t>(static_cast<uint32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr uint32_t &operator|=(uint32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent e) {
|
||||
v |= static_cast<uint32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr uint32_t &operator&=(uint32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent e) {
|
||||
v &= static_cast<uint32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
template<typename>
|
||||
static inline std::string toString(int32_t o);
|
||||
static inline std::string toString(::vendor::qti::hardware::display::mapperextensions::V1_0::Flags o);
|
||||
|
||||
constexpr int32_t operator|(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator|(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs);
|
||||
}
|
||||
constexpr int32_t operator&(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const int32_t lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags rhs) {
|
||||
return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs));
|
||||
}
|
||||
constexpr int32_t operator&(const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags lhs, const int32_t rhs) {
|
||||
return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs);
|
||||
}
|
||||
constexpr int32_t &operator|=(int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags e) {
|
||||
v |= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
constexpr int32_t &operator&=(int32_t& v, const ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags e) {
|
||||
v &= static_cast<int32_t>(e);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline std::string toString(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& o);
|
||||
static inline bool operator==(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs);
|
||||
static inline bool operator!=(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs);
|
||||
|
||||
//
|
||||
// type header definitions for package
|
||||
//
|
||||
|
||||
template<>
|
||||
inline std::string toString<::vendor::qti::hardware::display::mapperextensions::V1_0::Error>(int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<::vendor::qti::hardware::display::mapperextensions::V1_0::Error> flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE) == static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NONE";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER) == static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "BAD_BUFFER";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES) == static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "NO_RESOURCES";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED) == static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "UNSUPPORTED";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(::vendor::qti::hardware::display::mapperextensions::V1_0::Error o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE) {
|
||||
return "NONE";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER) {
|
||||
return "BAD_BUFFER";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES) {
|
||||
return "NO_RESOURCES";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED) {
|
||||
return "UNSUPPORTED";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(const ::vendor::qti::hardware::display::mapperextensions::V1_0::YCbCrLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".y = ";
|
||||
os += ::android::hardware::toString(o.y);
|
||||
os += ", .cb = ";
|
||||
os += ::android::hardware::toString(o.cb);
|
||||
os += ", .cr = ";
|
||||
os += ::android::hardware::toString(o.cr);
|
||||
os += ", .yStride = ";
|
||||
os += ::android::hardware::toString(o.yStride);
|
||||
os += ", .cStride = ";
|
||||
os += ::android::hardware::toString(o.cStride);
|
||||
os += ", .chromaStep = ";
|
||||
os += ::android::hardware::toString(o.chromaStep);
|
||||
os += "}"; return os;
|
||||
}
|
||||
|
||||
// operator== and operator!= are not generated for YCbCrLayout
|
||||
|
||||
template<>
|
||||
inline std::string toString<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>(uint32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent> flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Y";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cb) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cb)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Cb";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cb;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cr) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cr)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_Cr";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cr;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_R";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_G";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_B";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_A";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_RAW) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_RAW)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_RAW";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_RAW;
|
||||
}
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_META) == static_cast<uint32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_META)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "PLANE_COMPONENT_META";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_META;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y) {
|
||||
return "PLANE_COMPONENT_Y";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cb) {
|
||||
return "PLANE_COMPONENT_Cb";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cr) {
|
||||
return "PLANE_COMPONENT_Cr";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R) {
|
||||
return "PLANE_COMPONENT_R";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G) {
|
||||
return "PLANE_COMPONENT_G";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B) {
|
||||
return "PLANE_COMPONENT_B";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A) {
|
||||
return "PLANE_COMPONENT_A";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_RAW) {
|
||||
return "PLANE_COMPONENT_RAW";
|
||||
}
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_META) {
|
||||
return "PLANE_COMPONENT_META";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<uint32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline std::string toString<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags>(int32_t o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
std::string os;
|
||||
::android::hardware::hidl_bitfield<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags> flipped = 0;
|
||||
bool first = true;
|
||||
if ((o & ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG) == static_cast<int32_t>(::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG)) {
|
||||
os += (first ? "" : " | ");
|
||||
os += "LAYOUT_INTERLACED_FLAG";
|
||||
first = false;
|
||||
flipped |= ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG;
|
||||
}
|
||||
if (o != flipped) {
|
||||
os += (first ? "" : " | ");
|
||||
os += toHexString(o & (~flipped));
|
||||
}os += " (";
|
||||
os += toHexString(o);
|
||||
os += ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(::vendor::qti::hardware::display::mapperextensions::V1_0::Flags o) {
|
||||
using ::android::hardware::details::toHexString;
|
||||
if (o == ::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG) {
|
||||
return "LAYOUT_INTERLACED_FLAG";
|
||||
}
|
||||
std::string os;
|
||||
os += toHexString(static_cast<int32_t>(o));
|
||||
return os;
|
||||
}
|
||||
|
||||
static inline std::string toString(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& o) {
|
||||
using ::android::hardware::toString;
|
||||
std::string os;
|
||||
os += "{";
|
||||
os += ".component = ";
|
||||
os += ::vendor::qti::hardware::display::mapperextensions::V1_0::toString<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent>(o.component);
|
||||
os += ", .h_subsampling = ";
|
||||
os += ::android::hardware::toString(o.h_subsampling);
|
||||
os += ", .v_subsampling = ";
|
||||
os += ::android::hardware::toString(o.v_subsampling);
|
||||
os += ", .offset = ";
|
||||
os += ::android::hardware::toString(o.offset);
|
||||
os += ", .pixel_increment = ";
|
||||
os += ::android::hardware::toString(o.pixel_increment);
|
||||
os += ", .stride = ";
|
||||
os += ::android::hardware::toString(o.stride);
|
||||
os += ", .stride_bytes = ";
|
||||
os += ::android::hardware::toString(o.stride_bytes);
|
||||
os += ", .scanlines = ";
|
||||
os += ::android::hardware::toString(o.scanlines);
|
||||
os += ", .size = ";
|
||||
os += ::android::hardware::toString(o.size);
|
||||
os += "}"; return os;
|
||||
}
|
||||
|
||||
static inline bool operator==(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs) {
|
||||
if (lhs.component != rhs.component) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.h_subsampling != rhs.h_subsampling) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.v_subsampling != rhs.v_subsampling) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.offset != rhs.offset) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.pixel_increment != rhs.pixel_increment) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.stride != rhs.stride) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.stride_bytes != rhs.stride_bytes) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.scanlines != rhs.scanlines) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.size != rhs.size) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool operator!=(const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& lhs, const ::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneLayout& rhs){
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
} // namespace V1_0
|
||||
} // namespace mapperextensions
|
||||
} // namespace display
|
||||
} // namespace hardware
|
||||
} // namespace qti
|
||||
} // namespace vendor
|
||||
|
||||
//
|
||||
// global type declarations for package
|
||||
//
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template<> constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::Error, 4> hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::Error> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NONE,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::BAD_BUFFER,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::NO_RESOURCES,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Error::UNSUPPORTED,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template<> constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent, 9> hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Y,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cb,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_Cr,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_R,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_G,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_B,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_A,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_RAW,
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::PlaneComponent::PLANE_COMPONENT_META,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace details {
|
||||
template<> constexpr std::array<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags, 1> hidl_enum_values<::vendor::qti::hardware::display::mapperextensions::V1_0::Flags> = {
|
||||
::vendor::qti::hardware::display::mapperextensions::V1_0::Flags::LAYOUT_INTERLACED_FLAG,
|
||||
};
|
||||
} // namespace details
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
|
||||
#endif // HIDL_GENERATED_VENDOR_QTI_HARDWARE_DISPLAY_MAPPEREXTENSIONS_V1_0_TYPES_H
|
|
@ -29,16 +29,20 @@
|
|||
|
||||
#define LOG_TAG "qtimapper-shim"
|
||||
|
||||
#include <android/hidl/base/1.0/BpHwBase.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <log/log.h>
|
||||
#include <utils/NativeHandle.h>
|
||||
#include <utils/misc.h>
|
||||
#include <android/hidl/base/1.0/BpHwBase.h>
|
||||
#include <log/log.h>
|
||||
#include "ext_headers/common.h"
|
||||
#include "ext_headers/mapper.h"
|
||||
#include "ext_headers/mapperextensions.h"
|
||||
|
||||
#define SHIM_MODE 1
|
||||
|
||||
#include "ext/common.h"
|
||||
#include "ext/gr_utils.h"
|
||||
#include "ext/mapper.h"
|
||||
#include "ext/mapperextensions.h"
|
||||
|
||||
using namespace android::hardware;
|
||||
using namespace android;
|
||||
|
@ -54,53 +58,57 @@ sp<IMapper> IMapper::getService(const std::string &/* serviceName */, const bool
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace V2_0
|
||||
namespace V3_0 {
|
||||
|
||||
sp<IMapper> IMapper::getService(const std::string& /* serviceName */, const bool /* getStub */) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace V3_0
|
||||
namespace V4_0 {
|
||||
|
||||
sp<IMapper> IMapper::getService(const std::string& /* serviceName */, const bool /* getStub */) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace V4_0
|
||||
} // namespace android::hardware::graphics::mapper
|
||||
namespace vendor::qti::hardware::display {
|
||||
namespace mapper {
|
||||
namespace V4_0 {
|
||||
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V4_0::IMapper> &/* parent */, bool /* emitV1_0::Error */) {
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V4_0::IMapper>& /* parent */,
|
||||
bool /* emitError */) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace V4_0
|
||||
namespace V3_0 {
|
||||
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V3_0::IMapper> &/* parent */, bool /* emitV1_0::Error */) {
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V3_0::IMapper>& /* parent */,
|
||||
bool /* emitError */) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace V3_0
|
||||
namespace V2_0 {
|
||||
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V2_0::IMapper> &/* parent */, bool /* emitV1_0::Error */) {
|
||||
Return<sp<IQtiMapper>> IQtiMapper::castFrom(const sp<graphics::mapper::V2_0::IMapper>& /* parent */,
|
||||
bool /* emitError */) {
|
||||
return new IQtiMapper();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapper::getMapperExtensions(getMapperExtensions_cb _hidl_cb) {
|
||||
sp<mapperextensions::V1_0::IQtiMapperExtensions> ext{new mapperextensions::V1_0::IQtiMapperExtensions()};
|
||||
sp<mapperextensions::V1_0::IQtiMapperExtensions> ext{
|
||||
new mapperextensions::V1_0::IQtiMapperExtensions()};
|
||||
_hidl_cb(graphics::mapper::V2_0::Error::NONE, ext);
|
||||
ALOGD("IQtiMapperExtensions shim active");
|
||||
return Void();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace V2_0
|
||||
} // namespace mapper
|
||||
namespace mapperextensions {
|
||||
namespace V1_1 {
|
||||
|
||||
|
@ -116,7 +124,8 @@ IQtiMapperExtensions::IQtiMapperExtensions() {
|
|||
std::terminate();
|
||||
}
|
||||
|
||||
perform = reinterpret_cast<GRALLOC1_PFN_PERFORM>(gralloc->getFunction(gralloc, GRALLOC1_FUNCTION_PERFORM));
|
||||
perform = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
|
||||
gralloc->getFunction(gralloc, GRALLOC1_FUNCTION_PERFORM));
|
||||
if (!perform) {
|
||||
ALOGE("Failed to get gralloc perform helper!");
|
||||
std::terminate();
|
||||
|
@ -125,169 +134,243 @@ IQtiMapperExtensions::IQtiMapperExtensions() {
|
|||
ALOGD("Opened gralloc1 HAL");
|
||||
}
|
||||
|
||||
|
||||
Return<sp<IQtiMapperExtensions>> IQtiMapperExtensions::castFrom(android::sp<V1_0::IQtiMapperExtensions> const& /* parent */, bool /* emitV1_0::Error */) {
|
||||
Return<sp<IQtiMapperExtensions>> IQtiMapperExtensions::castFrom(
|
||||
android::sp<V1_0::IQtiMapperExtensions> const& /* parent */, bool /* emitError */) {
|
||||
return new IQtiMapperExtensions();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getRgbDataAddress(void* buffer, getRgbDataAddress_cb _hidl_cb) {
|
||||
void* rgb_data = nullptr;
|
||||
auto err = perform(gralloc, GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS, buffer, &rgb_data) ? V1_0::Error::NONE : V1_0::Error::BAD_BUFFER;
|
||||
|
||||
auto err = perform(gralloc, GRALLOC_MODULE_PERFORM_GET_RGB_DATA_ADDRESS, buffer, &rgb_data)
|
||||
? Error::BAD_BUFFER
|
||||
: Error::NONE;
|
||||
_hidl_cb(err, rgb_data);
|
||||
|
||||
ALOGE("%s: err: %d rgb_data: %p", __func__, err, rgb_data);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getInterlacedFlag(void* buffer, getInterlacedFlag_cb _hidl_cb) {
|
||||
int flag = 0;
|
||||
auto perform = reinterpret_cast<GRALLOC1_PFN_PERFORM>(gralloc->getFunction(gralloc, GRALLOC1_FUNCTION_PERFORM));
|
||||
auto err = perform(gralloc, GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG, buffer, &flag) ? V1_0::Error::NONE : V1_0::Error::BAD_BUFFER;
|
||||
auto perform = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
|
||||
gralloc->getFunction(gralloc, GRALLOC1_FUNCTION_PERFORM));
|
||||
auto err = perform(gralloc, GRALLOC1_MODULE_PERFORM_GET_INTERLACE_FLAG, buffer, &flag)
|
||||
? Error::BAD_BUFFER
|
||||
: Error::NONE;
|
||||
_hidl_cb(err, flag);
|
||||
ALOGE("%s: err: %d flag: %d", __func__, err, flag);
|
||||
return Void();
|
||||
}
|
||||
Return<void> IQtiMapperExtensions::getFd(void* buffer, getFd_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int fd = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
fd = hnd->fd;
|
||||
}
|
||||
hidl_cb(err, fd);
|
||||
ALOGE("%s: fd: %d", __func__, fd);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getWidth(void* buffer, getWidth_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int width = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
width = hnd->width;
|
||||
}
|
||||
hidl_cb(err, width);
|
||||
ALOGE("%s: width: %d", __func__, width);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getHeight(void* buffer, getHeight_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int height = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
height = hnd->height;
|
||||
}
|
||||
hidl_cb(err, height);
|
||||
ALOGE("%s: height: %d", __func__, height);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getFormat(void* buffer, getFormat_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int format = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
format = hnd->format;
|
||||
}
|
||||
hidl_cb(err, format);
|
||||
|
||||
ALOGE("%s: format: %d", __func__, format);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getPrivateFlags(void* buffer, getPrivateFlags_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int flags = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
flags = hnd->flags;
|
||||
}
|
||||
hidl_cb(err, flags);
|
||||
ALOGE("%s: flags: %d", __func__, flags);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getUnalignedWidth(void* buffer, getUnalignedWidth_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int unaligned_width = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
unaligned_width = hnd->unaligned_width;
|
||||
}
|
||||
hidl_cb(err, unaligned_width);
|
||||
|
||||
ALOGE("%s: unaligned_width: %u", __func__, unaligned_width);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getUnalignedHeight(void* buffer, getUnalignedHeight_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
int unaligned_height = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
unaligned_height = hnd->unaligned_height;
|
||||
}
|
||||
hidl_cb(err, unaligned_height);
|
||||
ALOGE("%s: unaligned_height: %u", __func__, unaligned_height);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getLayerCount(void* buffer, getLayerCount_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
unsigned int layer_count = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
layer_count = hnd->layer_count;
|
||||
}
|
||||
hidl_cb(err, layer_count);
|
||||
ALOGE("%s: layer_count: %u", __func__, layer_count);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getId(void* buffer, getId_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
uint64_t id = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
id = hnd->id;
|
||||
}
|
||||
hidl_cb(err, id);
|
||||
ALOGE("%s: id: %" PRIu64, __func__, id);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getUsageFlags(void* buffer, getUsageFlags_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
uint64_t usage = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
usage = hnd->usage;
|
||||
}
|
||||
hidl_cb(err, usage);
|
||||
ALOGE("%s: usage: %" PRIu64, __func__, usage);
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getSize(void* buffer, getSize_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
unsigned int size = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
size = hnd->size;
|
||||
}
|
||||
hidl_cb(err, size);
|
||||
ALOGE("%s: size: %u", __func__, size);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getOffset(void* buffer, getOffset_cb hidl_cb) {
|
||||
auto err = V1_0::Error::BAD_BUFFER;
|
||||
auto err = Error::BAD_BUFFER;
|
||||
unsigned int offset = 0;
|
||||
auto hnd = static_cast<private_handle_t*>(buffer);
|
||||
if (buffer != nullptr && private_handle_t::validate(hnd) == 0) {
|
||||
err = V1_0::Error::NONE;
|
||||
err = Error::NONE;
|
||||
offset = hnd->offset;
|
||||
}
|
||||
hidl_cb(err, offset);
|
||||
ALOGE("%s: offset: %u", __func__, offset);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IQtiMapperExtensions::getFormatLayout(int32_t format, uint64_t usage, int32_t flags,
|
||||
int32_t width, int32_t height,
|
||||
getFormatLayout_cb _hidl_cb) {
|
||||
hidl_vec<PlaneLayout> plane_info;
|
||||
unsigned int alignedw = 0, alignedh = 0, tile_enabled = 0;
|
||||
int plane_count = 0;
|
||||
uint64_t size = 0;
|
||||
int custom_format = gralloc::GetImplDefinedFormat(usage, format);
|
||||
gralloc::BufferInfo info(width, height, custom_format, usage);
|
||||
|
||||
auto err = perform(gralloc, GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES, width, height, custom_format,
|
||||
usage, usage, &alignedw, &alignedh, &tile_enabled)
|
||||
? Error::BAD_BUFFER
|
||||
: Error::NONE;
|
||||
if (err != Error::NONE) {
|
||||
_hidl_cb(err, 0, plane_info);
|
||||
return Void();
|
||||
}
|
||||
|
||||
size = gralloc::GetSize(info, alignedw, alignedh);
|
||||
gralloc::PlaneLayoutInfo plane_layout[8] = {};
|
||||
|
||||
if (gralloc::IsUncompressedRGBFormat(custom_format) ||
|
||||
gralloc::IsCompressedRGBFormat(custom_format)) {
|
||||
gralloc::GetRGBPlaneInfo(info, custom_format, alignedw, alignedh, flags, &plane_count,
|
||||
plane_layout);
|
||||
} else {
|
||||
ALOGE("%s: unsupported format %d", __func__, format);
|
||||
err = Error::BAD_BUFFER;
|
||||
_hidl_cb(err, size, plane_info);
|
||||
return Void();
|
||||
}
|
||||
|
||||
plane_info.resize(plane_count);
|
||||
for (int i = 0; i < plane_count; i++) {
|
||||
plane_info[i].component = plane_layout[i].component;
|
||||
plane_info[i].h_subsampling = plane_layout[i].h_subsampling;
|
||||
plane_info[i].v_subsampling = plane_layout[i].v_subsampling;
|
||||
plane_info[i].offset = plane_layout[i].offset;
|
||||
plane_info[i].pixel_increment = plane_layout[i].step;
|
||||
plane_info[i].stride = plane_layout[i].stride;
|
||||
plane_info[i].stride_bytes = plane_layout[i].stride_bytes;
|
||||
plane_info[i].scanlines = plane_layout[i].scanlines;
|
||||
plane_info[i].size = plane_layout[i].size;
|
||||
}
|
||||
|
||||
_hidl_cb(err, size, plane_info);
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace V1_1
|
||||
} // namespace mapperextensions
|
||||
} // namespace vendor::qti::hardware::display
|
||||
|
|
Loading…
Reference in a new issue