• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (C) 2011-2015 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 #ifndef _LIBRENDER_HWC2_H
17 #define _LIBRENDER_HWC2_H
18 
19 #ifdef _MSC_VER
20 #include <stdint.h>
21 #endif
22 
23 /* Copied from Android source */
24 
25 // Should be identical to graphics-base-v1.0.h
26 typedef enum {
27     HAL_TRANSFORM_FLIP_H = 1,   // (1 << 0)
28     HAL_TRANSFORM_FLIP_V = 2,   // (1 << 1)
29     HAL_TRANSFORM_ROT_90 = 4,   // (1 << 2)
30     HAL_TRANSFORM_ROT_180 = 3,  // (FLIP_H | FLIP_V)
31     HAL_TRANSFORM_ROT_270 = 7,  // ((FLIP_H | FLIP_V) | ROT_90)
32 } android_transform_t;
33 
34 // Should be identical to hwcomposer_defs.h
35 typedef struct hwc_color {
36     uint8_t r;
37     uint8_t g;
38     uint8_t b;
39     uint8_t a;
40 } hwc_color_t;
41 typedef struct hwc_frect {
42     float left;
43     float top;
44     float right;
45     float bottom;
46 } hwc_frect_t;
47 typedef struct hwc_rect {
48     int left;
49     int top;
50     int right;
51     int bottom;
52 } hwc_rect_t;
53 
54 typedef enum {
55     /* flip source image horizontally */
56     HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H,
57     /* flip source image vertically */
58     HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,
59     /* rotate source image 90 degrees clock-wise */
60     HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,
61     /* rotate source image 180 degrees */
62     HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,
63     /* rotate source image 270 degrees clock-wise */
64     HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,
65     /* flip source image horizontally, the rotate 90 degrees clock-wise */
66     HWC_TRANSFORM_FLIP_H_ROT_90 = HAL_TRANSFORM_FLIP_H | HAL_TRANSFORM_ROT_90,
67     /* flip source image vertically, the rotate 90 degrees clock-wise */
68     HWC_TRANSFORM_FLIP_V_ROT_90 = HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90,
69 } hwc_transform_t;
70 
71 // Should be identical to hwcomposer2.h
72 typedef enum {
73     HWC2_COMPOSITION_INVALID = 0,
74     HWC2_COMPOSITION_CLIENT = 1,
75     HWC2_COMPOSITION_DEVICE = 2,
76     HWC2_COMPOSITION_SOLID_COLOR = 3,
77     HWC2_COMPOSITION_CURSOR = 4,
78     HWC2_COMPOSITION_SIDEBAND = 5,
79 } hwc2_composition_t;
80 typedef enum {
81     HWC2_BLEND_MODE_INVALID = 0,
82     HWC2_BLEND_MODE_NONE = 1,
83     HWC2_BLEND_MODE_PREMULTIPLIED = 2,
84     HWC2_BLEND_MODE_COVERAGE = 3,
85 } hwc2_blend_mode_t;
86 
87 // Should be identical to EmuHwc2.h
88 typedef struct compose_layer {
89     uint32_t cbHandle;
90     hwc2_composition_t composeMode;
91     hwc_rect_t displayFrame;
92     hwc_frect_t crop;
93     int32_t blendMode;
94     float alpha;
95     hwc_color_t color;
96     hwc_transform_t transform;
97 } ComposeLayer;
98 typedef struct compose_device {
99     uint32_t version;
100     uint32_t targetHandle;
101     uint32_t numLayers;
102     struct compose_layer layer[0];
103 } ComposeDevice;
104 typedef struct compose_device_v2 {
105     uint32_t version;
106     uint32_t displayId;
107     uint32_t targetHandle;
108     uint32_t numLayers;
109     struct compose_layer layer[0];
110 } ComposeDevice_v2;
111 
112 #endif
113