1 /* 2 * Copyright (C) 2016-2017 ARM Limited. All rights reserved. 3 * 4 * Copyright (C) 2008 The Android Open Source Project 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef MALI_GRALLOC_BUFFERDESCRIPTOR_H_ 20 #define MALI_GRALLOC_BUFFERDESCRIPTOR_H_ 21 22 #include <hardware/hardware.h> 23 #include "gralloc_priv.h" 24 #include "mali_gralloc_module.h" 25 #include "mali_gralloc_formats.h" 26 27 #if GRALLOC_USE_GRALLOC1_API == 1 28 #include <hardware/gralloc1.h> 29 #else 30 #include <hardware/gralloc.h> 31 #endif 32 33 typedef uint64_t gralloc_buffer_descriptor_t; 34 35 typedef struct buffer_descriptor 36 { 37 uint32_t width; 38 uint32_t height; 39 uint64_t producer_usage; 40 uint64_t consumer_usage; 41 uint64_t hal_format; 42 43 mali_gralloc_format_type format_type; 44 size_t size; 45 int byte_stride; 46 int pixel_stride; 47 int internalWidth; 48 int internalHeight; 49 uint64_t internal_format; 50 } buffer_descriptor_t; 51 52 #if GRALLOC_USE_GRALLOC1_API == 1 53 int mali_gralloc_create_descriptor_internal(gralloc1_buffer_descriptor_t *outDescriptor); 54 int mali_gralloc_destroy_descriptor_internal(gralloc1_buffer_descriptor_t descriptor); 55 int mali_gralloc_set_dimensions_internal(gralloc1_buffer_descriptor_t descriptor, uint32_t width, uint32_t height); 56 int mali_gralloc_set_format_internal(gralloc1_buffer_descriptor_t descriptor, int32_t format); 57 int mali_gralloc_set_producerusage_internal(gralloc1_buffer_descriptor_t descriptor, uint64_t usage); 58 int mali_gralloc_set_consumerusage_internal(gralloc1_buffer_descriptor_t descriptor, uint64_t usage); 59 60 int mali_gralloc_get_backing_store_internal(buffer_handle_t buffer, gralloc1_backing_store_t *outStore); 61 int mali_gralloc_get_consumer_usage_internal(buffer_handle_t buffer, uint64_t *outUsage); 62 int mali_gralloc_get_dimensions_internal(buffer_handle_t buffer, uint32_t *outWidth, uint32_t *outHeight); 63 int mali_gralloc_get_format_internal(buffer_handle_t buffer, int32_t *outFormat); 64 int mali_gralloc_get_producer_usage_internal(buffer_handle_t buffer, uint64_t *outUsage); 65 #endif 66 int mali_gralloc_query_getstride(buffer_handle_t handle, int *pixelStride); 67 68 #endif /* MALI_GRALLOC_BUFFERDESCRIPTOR_H_ */ 69