Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Mathias Agopian | 3330b20 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 17 | #define LOG_TAG "GraphicBufferMapper" |
Mathias Agopian | cf56319 | 2012-02-29 20:43:29 -0800 | [diff] [blame] | 18 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 19 | //#define LOG_NDEBUG 0 |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 20 | |
Mathias Agopian | fe2f54f | 2017-02-15 19:48:58 -0800 | [diff] [blame] | 21 | #include <ui/GraphicBufferMapper.h> |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 22 | |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 23 | #include <grallocusage/GrallocUsageConversion.h> |
| 24 | |
Dan Stoza | d318240 | 2014-11-17 12:03:59 -0800 | [diff] [blame] | 25 | // We would eliminate the non-conforming zero-length array, but we can't since |
| 26 | // this is effectively included from the Linux kernel |
| 27 | #pragma clang diagnostic push |
| 28 | #pragma clang diagnostic ignored "-Wzero-length-array" |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 29 | #include <sync/sync.h> |
Dan Stoza | d318240 | 2014-11-17 12:03:59 -0800 | [diff] [blame] | 30 | #pragma clang diagnostic pop |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 31 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 32 | #include <utils/Log.h> |
Mathias Agopian | cf56319 | 2012-02-29 20:43:29 -0800 | [diff] [blame] | 33 | #include <utils/Trace.h> |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 34 | |
Marissa Wall | d380e2c | 2018-12-29 14:17:29 -0800 | [diff] [blame] | 35 | #include <ui/Gralloc.h> |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 36 | #include <ui/Gralloc2.h> |
Marissa Wall | 925bf7f | 2018-12-29 14:27:11 -0800 | [diff] [blame] | 37 | #include <ui/Gralloc3.h> |
Marissa Wall | 87c8ba7 | 2019-06-20 14:20:52 -0700 | [diff] [blame] | 38 | #include <ui/Gralloc4.h> |
Mathias Agopian | a934764 | 2017-02-13 16:42:28 -0800 | [diff] [blame] | 39 | #include <ui/GraphicBuffer.h> |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 40 | |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 41 | #include <system/graphics.h> |
Mathias Agopian | 8b765b7 | 2009-04-10 20:34:46 -0700 | [diff] [blame] | 42 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 43 | namespace android { |
| 44 | // --------------------------------------------------------------------------- |
| 45 | |
Mathias Agopian | 3330b20 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 46 | ANDROID_SINGLETON_STATIC_INSTANCE( GraphicBufferMapper ) |
Mathias Agopian | 4243e66 | 2009-04-15 18:34:24 -0700 | [diff] [blame] | 47 | |
Jesse Hall | eeb4ac7 | 2017-07-06 14:02:29 -0700 | [diff] [blame] | 48 | void GraphicBufferMapper::preloadHal() { |
Marissa Wall | d380e2c | 2018-12-29 14:17:29 -0800 | [diff] [blame] | 49 | Gralloc2Mapper::preload(); |
Marissa Wall | 925bf7f | 2018-12-29 14:27:11 -0800 | [diff] [blame] | 50 | Gralloc3Mapper::preload(); |
Marissa Wall | 87c8ba7 | 2019-06-20 14:20:52 -0700 | [diff] [blame] | 51 | Gralloc4Mapper::preload(); |
Jesse Hall | eeb4ac7 | 2017-07-06 14:02:29 -0700 | [diff] [blame] | 52 | } |
| 53 | |
Marissa Wall | 925bf7f | 2018-12-29 14:27:11 -0800 | [diff] [blame] | 54 | GraphicBufferMapper::GraphicBufferMapper() { |
Marissa Wall | 87c8ba7 | 2019-06-20 14:20:52 -0700 | [diff] [blame] | 55 | mMapper = std::make_unique<const Gralloc4Mapper>(); |
| 56 | if (mMapper->isLoaded()) { |
| 57 | mMapperVersion = Version::GRALLOC_4; |
| 58 | return; |
| 59 | } |
Marissa Wall | 925bf7f | 2018-12-29 14:27:11 -0800 | [diff] [blame] | 60 | mMapper = std::make_unique<const Gralloc3Mapper>(); |
Marissa Wall | 87c8ba7 | 2019-06-20 14:20:52 -0700 | [diff] [blame] | 61 | if (mMapper->isLoaded()) { |
Valerie Hau | d2f4daf | 2019-02-15 13:49:00 -0800 | [diff] [blame] | 62 | mMapperVersion = Version::GRALLOC_3; |
Marissa Wall | 87c8ba7 | 2019-06-20 14:20:52 -0700 | [diff] [blame] | 63 | return; |
| 64 | } |
| 65 | mMapper = std::make_unique<const Gralloc2Mapper>(); |
| 66 | if (mMapper->isLoaded()) { |
| 67 | mMapperVersion = Version::GRALLOC_2; |
| 68 | return; |
Marissa Wall | 925bf7f | 2018-12-29 14:27:11 -0800 | [diff] [blame] | 69 | } |
| 70 | |
Marissa Wall | 87c8ba7 | 2019-06-20 14:20:52 -0700 | [diff] [blame] | 71 | LOG_ALWAYS_FATAL("gralloc-mapper is missing"); |
Marissa Wall | 925bf7f | 2018-12-29 14:27:11 -0800 | [diff] [blame] | 72 | } |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 73 | |
Marissa Wall | 22b2de1 | 2019-12-02 18:11:43 -0800 | [diff] [blame^] | 74 | void GraphicBufferMapper::dumpBuffer(buffer_handle_t bufferHandle, std::string& result, |
| 75 | bool less) const { |
| 76 | result.append(mMapper->dumpBuffer(bufferHandle, less)); |
| 77 | } |
| 78 | |
| 79 | void GraphicBufferMapper::dumpBufferToSystemLog(buffer_handle_t bufferHandle, bool less) { |
| 80 | std::string s; |
| 81 | GraphicBufferMapper::getInstance().dumpBuffer(bufferHandle, s, less); |
| 82 | ALOGD("%s", s.c_str()); |
| 83 | } |
| 84 | |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 85 | status_t GraphicBufferMapper::importBuffer(buffer_handle_t rawHandle, |
Chia-I Wu | dbbe33b | 2017-09-27 15:22:21 -0700 | [diff] [blame] | 86 | uint32_t width, uint32_t height, uint32_t layerCount, |
| 87 | PixelFormat format, uint64_t usage, uint32_t stride, |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 88 | buffer_handle_t* outHandle) |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 89 | { |
Mathias Agopian | cf56319 | 2012-02-29 20:43:29 -0800 | [diff] [blame] | 90 | ATRACE_CALL(); |
Mathias Agopian | 0a75781 | 2010-12-08 16:40:01 -0800 | [diff] [blame] | 91 | |
Chia-I Wu | dbbe33b | 2017-09-27 15:22:21 -0700 | [diff] [blame] | 92 | buffer_handle_t bufferHandle; |
Marissa Wall | 1e77925 | 2018-12-29 12:01:57 -0800 | [diff] [blame] | 93 | status_t error = mMapper->importBuffer(hardware::hidl_handle(rawHandle), &bufferHandle); |
| 94 | if (error != NO_ERROR) { |
Chia-I Wu | dbbe33b | 2017-09-27 15:22:21 -0700 | [diff] [blame] | 95 | ALOGW("importBuffer(%p) failed: %d", rawHandle, error); |
Marissa Wall | 1e77925 | 2018-12-29 12:01:57 -0800 | [diff] [blame] | 96 | return error; |
Chia-I Wu | dbbe33b | 2017-09-27 15:22:21 -0700 | [diff] [blame] | 97 | } |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 98 | |
Marissa Wall | 1e77925 | 2018-12-29 12:01:57 -0800 | [diff] [blame] | 99 | error = mMapper->validateBufferSize(bufferHandle, width, height, format, layerCount, usage, |
| 100 | stride); |
| 101 | if (error != NO_ERROR) { |
Chia-I Wu | dbbe33b | 2017-09-27 15:22:21 -0700 | [diff] [blame] | 102 | ALOGE("validateBufferSize(%p) failed: %d", rawHandle, error); |
| 103 | freeBuffer(bufferHandle); |
| 104 | return static_cast<status_t>(error); |
| 105 | } |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 106 | |
Chia-I Wu | dbbe33b | 2017-09-27 15:22:21 -0700 | [diff] [blame] | 107 | *outHandle = bufferHandle; |
| 108 | |
| 109 | return NO_ERROR; |
| 110 | } |
| 111 | |
| 112 | void GraphicBufferMapper::getTransportSize(buffer_handle_t handle, |
| 113 | uint32_t* outTransportNumFds, uint32_t* outTransportNumInts) |
| 114 | { |
| 115 | mMapper->getTransportSize(handle, outTransportNumFds, outTransportNumInts); |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 116 | } |
| 117 | |
Chia-I Wu | 5bac7f3 | 2017-04-06 12:34:32 -0700 | [diff] [blame] | 118 | status_t GraphicBufferMapper::freeBuffer(buffer_handle_t handle) |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 119 | { |
Mathias Agopian | cf56319 | 2012-02-29 20:43:29 -0800 | [diff] [blame] | 120 | ATRACE_CALL(); |
Mathias Agopian | 0a75781 | 2010-12-08 16:40:01 -0800 | [diff] [blame] | 121 | |
Chia-I Wu | cb8405e | 2017-04-17 15:20:19 -0700 | [diff] [blame] | 122 | mMapper->freeBuffer(handle); |
Chia-I Wu | 9ba189d | 2016-09-22 17:13:08 +0800 | [diff] [blame] | 123 | |
Chia-I Wu | cb8405e | 2017-04-17 15:20:19 -0700 | [diff] [blame] | 124 | return NO_ERROR; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 125 | } |
| 126 | |
Valerie Hau | 0c9fc36 | 2019-01-22 09:17:19 -0800 | [diff] [blame] | 127 | status_t GraphicBufferMapper::lock(buffer_handle_t handle, uint32_t usage, const Rect& bounds, |
| 128 | void** vaddr, int32_t* outBytesPerPixel, |
| 129 | int32_t* outBytesPerStride) { |
| 130 | return lockAsync(handle, usage, bounds, vaddr, -1, outBytesPerPixel, outBytesPerStride); |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 131 | } |
Eino-Ville Talvala | c43946b | 2013-05-04 18:07:43 -0700 | [diff] [blame] | 132 | |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 133 | status_t GraphicBufferMapper::lockYCbCr(buffer_handle_t handle, uint32_t usage, |
| 134 | const Rect& bounds, android_ycbcr *ycbcr) |
| 135 | { |
| 136 | return lockAsyncYCbCr(handle, usage, bounds, ycbcr, -1); |
Eino-Ville Talvala | c43946b | 2013-05-04 18:07:43 -0700 | [diff] [blame] | 137 | } |
| 138 | |
Mathias Agopian | 3330b20 | 2009-10-05 17:07:12 -0700 | [diff] [blame] | 139 | status_t GraphicBufferMapper::unlock(buffer_handle_t handle) |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 140 | { |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 141 | int32_t fenceFd = -1; |
| 142 | status_t error = unlockAsync(handle, &fenceFd); |
Daniel Jarai | e9147c2 | 2017-09-20 11:33:51 +0200 | [diff] [blame] | 143 | if (error == NO_ERROR && fenceFd >= 0) { |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 144 | sync_wait(fenceFd, -1); |
| 145 | close(fenceFd); |
| 146 | } |
| 147 | return error; |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 148 | } |
| 149 | |
Valerie Hau | 0c9fc36 | 2019-01-22 09:17:19 -0800 | [diff] [blame] | 150 | status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle, uint32_t usage, const Rect& bounds, |
| 151 | void** vaddr, int fenceFd, int32_t* outBytesPerPixel, |
| 152 | int32_t* outBytesPerStride) { |
| 153 | return lockAsync(handle, usage, usage, bounds, vaddr, fenceFd, outBytesPerPixel, |
| 154 | outBytesPerStride); |
Craig Donner | e96a325 | 2017-02-02 12:13:34 -0800 | [diff] [blame] | 155 | } |
| 156 | |
Valerie Hau | 0c9fc36 | 2019-01-22 09:17:19 -0800 | [diff] [blame] | 157 | status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle, uint64_t producerUsage, |
| 158 | uint64_t consumerUsage, const Rect& bounds, void** vaddr, |
| 159 | int fenceFd, int32_t* outBytesPerPixel, |
| 160 | int32_t* outBytesPerStride) { |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 161 | ATRACE_CALL(); |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 162 | |
Chia-I Wu | cb8405e | 2017-04-17 15:20:19 -0700 | [diff] [blame] | 163 | const uint64_t usage = static_cast<uint64_t>( |
| 164 | android_convertGralloc1To0Usage(producerUsage, consumerUsage)); |
Valerie Hau | 0c9fc36 | 2019-01-22 09:17:19 -0800 | [diff] [blame] | 165 | return mMapper->lock(handle, usage, bounds, fenceFd, vaddr, outBytesPerPixel, |
| 166 | outBytesPerStride); |
Dan Stoza | 8deb4da | 2016-06-01 18:21:44 -0700 | [diff] [blame] | 167 | } |
| 168 | |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 169 | status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle, |
Dan Stoza | d318240 | 2014-11-17 12:03:59 -0800 | [diff] [blame] | 170 | uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr, int fenceFd) |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 171 | { |
| 172 | ATRACE_CALL(); |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 173 | |
Marissa Wall | 1e77925 | 2018-12-29 12:01:57 -0800 | [diff] [blame] | 174 | return mMapper->lock(handle, usage, bounds, fenceFd, ycbcr); |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | status_t GraphicBufferMapper::unlockAsync(buffer_handle_t handle, int *fenceFd) |
| 178 | { |
| 179 | ATRACE_CALL(); |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 180 | |
Chia-I Wu | cb8405e | 2017-04-17 15:20:19 -0700 | [diff] [blame] | 181 | *fenceFd = mMapper->unlock(handle); |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 182 | |
Chia-I Wu | cb8405e | 2017-04-17 15:20:19 -0700 | [diff] [blame] | 183 | return NO_ERROR; |
Francis Hart | 8f39601 | 2014-04-01 15:30:53 +0300 | [diff] [blame] | 184 | } |
| 185 | |
Valerie Hau | ddbfaeb | 2019-02-01 09:54:20 -0800 | [diff] [blame] | 186 | status_t GraphicBufferMapper::isSupported(uint32_t width, uint32_t height, |
| 187 | android::PixelFormat format, uint32_t layerCount, |
| 188 | uint64_t usage, bool* outSupported) { |
| 189 | return mMapper->isSupported(width, height, format, layerCount, usage, outSupported); |
| 190 | } |
Marissa Wall | 22b2de1 | 2019-12-02 18:11:43 -0800 | [diff] [blame^] | 191 | |
| 192 | status_t GraphicBufferMapper::getBufferId(buffer_handle_t bufferHandle, uint64_t* outBufferId) { |
| 193 | return mMapper->getBufferId(bufferHandle, outBufferId); |
| 194 | } |
| 195 | |
| 196 | status_t GraphicBufferMapper::getName(buffer_handle_t bufferHandle, std::string* outName) { |
| 197 | return mMapper->getName(bufferHandle, outName); |
| 198 | } |
| 199 | |
| 200 | status_t GraphicBufferMapper::getWidth(buffer_handle_t bufferHandle, uint64_t* outWidth) { |
| 201 | return mMapper->getWidth(bufferHandle, outWidth); |
| 202 | } |
| 203 | |
| 204 | status_t GraphicBufferMapper::getHeight(buffer_handle_t bufferHandle, uint64_t* outHeight) { |
| 205 | return mMapper->getHeight(bufferHandle, outHeight); |
| 206 | } |
| 207 | |
| 208 | status_t GraphicBufferMapper::getLayerCount(buffer_handle_t bufferHandle, uint64_t* outLayerCount) { |
| 209 | return mMapper->getLayerCount(bufferHandle, outLayerCount); |
| 210 | } |
| 211 | |
| 212 | status_t GraphicBufferMapper::getPixelFormatRequested(buffer_handle_t bufferHandle, |
| 213 | ui::PixelFormat* outPixelFormatRequested) { |
| 214 | return mMapper->getPixelFormatRequested(bufferHandle, outPixelFormatRequested); |
| 215 | } |
| 216 | |
| 217 | status_t GraphicBufferMapper::getPixelFormatFourCC(buffer_handle_t bufferHandle, |
| 218 | uint32_t* outPixelFormatFourCC) { |
| 219 | return mMapper->getPixelFormatFourCC(bufferHandle, outPixelFormatFourCC); |
| 220 | } |
| 221 | |
| 222 | status_t GraphicBufferMapper::getPixelFormatModifier(buffer_handle_t bufferHandle, |
| 223 | uint64_t* outPixelFormatModifier) { |
| 224 | return mMapper->getPixelFormatModifier(bufferHandle, outPixelFormatModifier); |
| 225 | } |
| 226 | |
| 227 | status_t GraphicBufferMapper::getUsage(buffer_handle_t bufferHandle, uint64_t* outUsage) { |
| 228 | return mMapper->getUsage(bufferHandle, outUsage); |
| 229 | } |
| 230 | |
| 231 | status_t GraphicBufferMapper::getAllocationSize(buffer_handle_t bufferHandle, |
| 232 | uint64_t* outAllocationSize) { |
| 233 | return mMapper->getAllocationSize(bufferHandle, outAllocationSize); |
| 234 | } |
| 235 | |
| 236 | status_t GraphicBufferMapper::getProtectedContent(buffer_handle_t bufferHandle, |
| 237 | uint64_t* outProtectedContent) { |
| 238 | return mMapper->getProtectedContent(bufferHandle, outProtectedContent); |
| 239 | } |
| 240 | |
| 241 | status_t GraphicBufferMapper::getCompression( |
| 242 | buffer_handle_t bufferHandle, |
| 243 | aidl::android::hardware::graphics::common::ExtendableType* outCompression) { |
| 244 | return mMapper->getCompression(bufferHandle, outCompression); |
| 245 | } |
| 246 | |
| 247 | status_t GraphicBufferMapper::getCompression(buffer_handle_t bufferHandle, |
| 248 | ui::Compression* outCompression) { |
| 249 | return mMapper->getCompression(bufferHandle, outCompression); |
| 250 | } |
| 251 | |
| 252 | status_t GraphicBufferMapper::getInterlaced( |
| 253 | buffer_handle_t bufferHandle, |
| 254 | aidl::android::hardware::graphics::common::ExtendableType* outInterlaced) { |
| 255 | return mMapper->getInterlaced(bufferHandle, outInterlaced); |
| 256 | } |
| 257 | |
| 258 | status_t GraphicBufferMapper::getInterlaced(buffer_handle_t bufferHandle, |
| 259 | ui::Interlaced* outInterlaced) { |
| 260 | return mMapper->getInterlaced(bufferHandle, outInterlaced); |
| 261 | } |
| 262 | |
| 263 | status_t GraphicBufferMapper::getChromaSiting( |
| 264 | buffer_handle_t bufferHandle, |
| 265 | aidl::android::hardware::graphics::common::ExtendableType* outChromaSiting) { |
| 266 | return mMapper->getChromaSiting(bufferHandle, outChromaSiting); |
| 267 | } |
| 268 | |
| 269 | status_t GraphicBufferMapper::getChromaSiting(buffer_handle_t bufferHandle, |
| 270 | ui::ChromaSiting* outChromaSiting) { |
| 271 | return mMapper->getChromaSiting(bufferHandle, outChromaSiting); |
| 272 | } |
| 273 | |
| 274 | status_t GraphicBufferMapper::getPlaneLayouts(buffer_handle_t bufferHandle, |
| 275 | std::vector<ui::PlaneLayout>* outPlaneLayouts) { |
| 276 | return mMapper->getPlaneLayouts(bufferHandle, outPlaneLayouts); |
| 277 | } |
| 278 | |
| 279 | status_t GraphicBufferMapper::getDataspace(buffer_handle_t bufferHandle, |
| 280 | ui::Dataspace* outDataspace) { |
| 281 | return mMapper->getDataspace(bufferHandle, outDataspace); |
| 282 | } |
| 283 | |
| 284 | status_t GraphicBufferMapper::getBlendMode(buffer_handle_t bufferHandle, |
| 285 | ui::BlendMode* outBlendMode) { |
| 286 | return mMapper->getBlendMode(bufferHandle, outBlendMode); |
| 287 | } |
| 288 | |
| 289 | status_t GraphicBufferMapper::getDefaultPixelFormatFourCC(uint32_t width, uint32_t height, |
| 290 | PixelFormat format, uint32_t layerCount, |
| 291 | uint64_t usage, |
| 292 | uint32_t* outPixelFormatFourCC) { |
| 293 | return mMapper->getDefaultPixelFormatFourCC(width, height, format, layerCount, usage, |
| 294 | outPixelFormatFourCC); |
| 295 | } |
| 296 | |
| 297 | status_t GraphicBufferMapper::getDefaultPixelFormatModifier(uint32_t width, uint32_t height, |
| 298 | PixelFormat format, uint32_t layerCount, |
| 299 | uint64_t usage, |
| 300 | uint64_t* outPixelFormatModifier) { |
| 301 | return mMapper->getDefaultPixelFormatModifier(width, height, format, layerCount, usage, |
| 302 | outPixelFormatModifier); |
| 303 | } |
| 304 | |
| 305 | status_t GraphicBufferMapper::getDefaultAllocationSize(uint32_t width, uint32_t height, |
| 306 | PixelFormat format, uint32_t layerCount, |
| 307 | uint64_t usage, |
| 308 | uint64_t* outAllocationSize) { |
| 309 | return mMapper->getDefaultAllocationSize(width, height, format, layerCount, usage, |
| 310 | outAllocationSize); |
| 311 | } |
| 312 | |
| 313 | status_t GraphicBufferMapper::getDefaultProtectedContent(uint32_t width, uint32_t height, |
| 314 | PixelFormat format, uint32_t layerCount, |
| 315 | uint64_t usage, |
| 316 | uint64_t* outProtectedContent) { |
| 317 | return mMapper->getDefaultProtectedContent(width, height, format, layerCount, usage, |
| 318 | outProtectedContent); |
| 319 | } |
| 320 | |
| 321 | status_t GraphicBufferMapper::getDefaultCompression( |
| 322 | uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, |
| 323 | aidl::android::hardware::graphics::common::ExtendableType* outCompression) { |
| 324 | return mMapper->getDefaultCompression(width, height, format, layerCount, usage, outCompression); |
| 325 | } |
| 326 | |
| 327 | status_t GraphicBufferMapper::getDefaultCompression(uint32_t width, uint32_t height, |
| 328 | PixelFormat format, uint32_t layerCount, |
| 329 | uint64_t usage, |
| 330 | ui::Compression* outCompression) { |
| 331 | return mMapper->getDefaultCompression(width, height, format, layerCount, usage, outCompression); |
| 332 | } |
| 333 | |
| 334 | status_t GraphicBufferMapper::getDefaultInterlaced( |
| 335 | uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, |
| 336 | aidl::android::hardware::graphics::common::ExtendableType* outInterlaced) { |
| 337 | return mMapper->getDefaultInterlaced(width, height, format, layerCount, usage, outInterlaced); |
| 338 | } |
| 339 | |
| 340 | status_t GraphicBufferMapper::getDefaultInterlaced(uint32_t width, uint32_t height, |
| 341 | PixelFormat format, uint32_t layerCount, |
| 342 | uint64_t usage, ui::Interlaced* outInterlaced) { |
| 343 | return mMapper->getDefaultInterlaced(width, height, format, layerCount, usage, outInterlaced); |
| 344 | } |
| 345 | |
| 346 | status_t GraphicBufferMapper::getDefaultChromaSiting( |
| 347 | uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, |
| 348 | aidl::android::hardware::graphics::common::ExtendableType* outChromaSiting) { |
| 349 | return mMapper->getDefaultChromaSiting(width, height, format, layerCount, usage, |
| 350 | outChromaSiting); |
| 351 | } |
| 352 | |
| 353 | status_t GraphicBufferMapper::getDefaultChromaSiting(uint32_t width, uint32_t height, |
| 354 | PixelFormat format, uint32_t layerCount, |
| 355 | uint64_t usage, |
| 356 | ui::ChromaSiting* outChromaSiting) { |
| 357 | return mMapper->getDefaultChromaSiting(width, height, format, layerCount, usage, |
| 358 | outChromaSiting); |
| 359 | } |
| 360 | |
| 361 | status_t GraphicBufferMapper::getDefaultPlaneLayouts( |
| 362 | uint32_t width, uint32_t height, PixelFormat format, uint32_t layerCount, uint64_t usage, |
| 363 | std::vector<ui::PlaneLayout>* outPlaneLayouts) { |
| 364 | return mMapper->getDefaultPlaneLayouts(width, height, format, layerCount, usage, |
| 365 | outPlaneLayouts); |
| 366 | } |
| 367 | |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 368 | // --------------------------------------------------------------------------- |
Mathias Agopian | 076b1cc | 2009-04-10 14:24:30 -0700 | [diff] [blame] | 369 | }; // namespace android |