| // Copyright (C) 2016 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. |
| |
| @internal |
| @serialize |
| class AndroidNativeBufferExtra { |
| u32 Width |
| u32 Height |
| u32 Stride |
| AndroidGraphicsBufferFormat Format |
| AndroidGraphicsBufferUsage Usage |
| } |
| |
| @post_fence |
| extern ref!AndroidNativeBufferExtra GetAndroidNativeBufferExtra(void* buffer) |
| |
| enum AndroidGraphicsBufferFormat { |
| HAL_PIXEL_FORMAT_RGBA_8888 = 0x01, |
| HAL_PIXEL_FORMAT_RGBX_8888 = 0x02, |
| HAL_PIXEL_FORMAT_RGB_888 = 0x03, |
| HAL_PIXEL_FORMAT_RGB_565 = 0x04, |
| HAL_PIXEL_FORMAT_BGRA_8888 = 0x05, |
| HAL_PIXEL_FORMAT_RGBA_5551 = 0x06, |
| HAL_PIXEL_FORMAT_RGBA_4444 = 0x07, |
| HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 |
| } |
| |
| enum AndroidGraphicsBufferUsage { |
| USAGE_SW_READ_NEVER = 0x00000000, |
| USAGE_SW_READ_RARELY = 0x00000002, |
| USAGE_SW_READ_OFTEN = 0x00000003, |
| USAGE_SW_READ_MASK = 0x0000000F, |
| USAGE_SW_WRITE_NEVER = 0x00000000, |
| USAGE_SW_WRITE_RARELY = 0x00000020, |
| USAGE_SW_WRITE_OFTEN = 0x00000030, |
| USAGE_SW_WRITE_MASK = 0x000000F0, |
| USAGE_HW_TEXTURE = 0x00000100, |
| USAGE_HW_RENDER = 0x00000200, |
| USAGE_HW_2D = 0x00000400, |
| USAGE_HW_FB = 0x00001000, |
| USAGE_HW_MASK = 0x00001F00, |
| } |