• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 
17 #pragma once
18 
19 #include <cutils/native_handle.h>
20 
21 #include <hardware/hardware.h>
22 
23 struct android_ycbcr;
24 
25 enum {
26     GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U,
27     GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U,
28     GRALLOC_USAGE_HW_TEXTURE = 0x00000100U,
29     GRALLOC_USAGE_HW_RENDER = 0x00000200U,
30 };
31 
32 struct gralloc_module_t {
33     hw_module_t common;
34     int (*registerBuffer)(gralloc_module_t const*, buffer_handle_t);
35     int (*unregisterBuffer)(gralloc_module_t const*, buffer_handle_t);
36     int (*lock)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int, void**);
37     int (*unlock)(gralloc_module_t const*, buffer_handle_t);
38     int (*perform)(gralloc_module_t const*, int, ...);
39     int (*lock_ycbcr)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int,
40                       android_ycbcr*);
41     int (*lockAsync)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int, void**, int);
42     int (*unlockAsync)(gralloc_module_t const*, buffer_handle_t, int*);
43     int (*lockAsync_ycbcr)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int,
44                            android_ycbcr*, int);
45     int32_t (*getTransportSize)(gralloc_module_t const*, buffer_handle_t, uint32_t, uint32_t);
46     int32_t (*validateBufferSize)(gralloc_module_t const*, buffer_handle_t, uint32_t, uint32_t, int32_t, int, uint32_t);
47 
48     void* reserved_proc[1];
49 };
50