• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 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 #ifndef ANDROID_EXYNOS_HWC_H_
18 #define ANDROID_EXYNOS_HWC_H_
19 #include <hardware/hwcomposer2.h>
20 #include <cutils/atomic.h>
21 #include "ExynosMPPType.h"
22 #include "ExynosHWCModule.h"
23 #include "ExynosDevice.h"
24 
25 //#define DISABLE_FENCE
26 
27 enum {
28     HWC_CTL_MAX_OVLY_CNT = 100,
29     HWC_CTL_VIDEO_OVLY_CNT = 101,
30     HWC_CTL_DYNAMIC_RECOMP = 102,
31     HWC_CTL_SKIP_STATIC = 103,
32     /* HWC_CTL_DMA_BW_BAL = 104, */
33     HWC_CTL_SECURE_DMA = 105,
34     HWC_CTL_WINDOW_UPDATE = 106,
35     HWC_CTL_FORCE_PANIC = 107,
36     HWC_CTL_FORCE_GPU = 108,
37     HWC_CTL_SKIP_M2M_PROCESSING = 109,
38     HWC_CTL_DISPLAY_MODE = 110,
39     HWC_CTL_SKIP_RESOURCE_ASSIGN = 111,
40     HWC_CTL_SKIP_VALIDATE = 112,
41     HWC_CTL_DUMP_MID_BUF = 200,
42     HWC_CTL_CAPTURE_READBACK = 201,
43     HWC_CTL_ENABLE_COMPOSITION_CROP = 300,
44     HWC_CTL_ENABLE_EXYNOSCOMPOSITION_OPT = 301,
45     HWC_CTL_ENABLE_CLIENTCOMPOSITION_OPT = 302,
46     HWC_CTL_USE_MAX_G2D_SRC = 303,
47     HWC_CTL_ENABLE_HANDLE_LOW_FPS = 304,
48     HWC_CTL_ENABLE_EARLY_START_MPP = 305,
49     HWC_CTL_DDI_RESOLUTION_CHANGE = 306,
50     HWC_CTL_ENABLE_FENCE_TRACER = 307,
51     HWC_CTL_DO_FENCE_FILE_DUMP = 308,
52     HWC_CTL_SYS_FENCE_LOGGING = 309,
53 };
54 
55 class ExynosDevice;
56 
57 hwc2_function_pointer_t exynos_getFunction(struct hwc2_device* device, int32_t descriptor);
58 void exynos_getCapabilities(struct hwc2_device* device, uint32_t* outcount, int32_t* outcapabilities);
59 void exynos_dump(hwc2_device_t* device, uint32_t* outSize, char* outBuffer);
60 int32_t exynos_acceptDisplayChanges(hwc2_device_t* device, hwc2_display_t display);
61 int32_t exynos_createLayer(hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t* outLayer);
62 int32_t exynos_createVirtualDisplay(hwc2_device_t* device, uint32_t width, uint32_t height,
63         int32_t* format, hwc2_display_t* outDisplay);
64 int32_t exynos_destroyLayer(hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer);
65 int32_t exynos_destroyVirtualDisplay(hwc2_device_t* device, hwc2_display_t display);
66 int32_t exynos_getActiveConfig(hwc2_device_t *device, hwc2_display_t display, hwc2_config_t* outConfig);
67 int32_t exynos_getChangedCompositionTypes(hwc2_device_t *device, hwc2_display_t display,
68         uint32_t* outNumElements, hwc2_layer_t* outLayers, int32_t* outTypes);
69 int32_t exynos_getClientTargetSupport(hwc2_device_t *device, hwc2_display_t display, uint32_t width,
70         uint32_t height, int32_t format, int32_t dataSpace);
71 int32_t exynos_getColorModes(hwc2_device_t *device, hwc2_display_t display, uint32_t* outNumModes,
72         int32_t* outModes);
73 int32_t exynos_getDisplayAttribute(hwc2_device_t *device, hwc2_display_t display, hwc2_config_t config,
74         int32_t attribute, int32_t *outValue);
75 int32_t exynos_getDisplayConfigs(hwc2_device_t *device, hwc2_display_t display, uint32_t* outNumConfigs,
76         hwc2_config_t* outConfigs);
77 int32_t exynos_getDisplayName(hwc2_device_t *device, hwc2_display_t display, uint32_t* outSize, char* outName);
78 int32_t exynos_getDisplayRequests(hwc2_device_t *device, hwc2_display_t display, int32_t* outDisplayRequests,
79         uint32_t* outNumElements, hwc2_layer_t* outLayers, int32_t* outLayerRequests);
80 int32_t exynos_getDisplayType(hwc2_device_t *device, hwc2_display_t display, int32_t* outType);
81 int32_t exynos_getDozeSupport(hwc2_device_t *device, hwc2_display_t display, int32_t* outSupport);
82 int32_t exynos_getHdrCapabilities(hwc2_device_t *device, hwc2_display_t display, uint32_t* outNumTypes,
83         int32_t* outTypes, float* outMaxLuminance, float* outMaxAverageLuminance,
84         float* outMinLuminance);
85 int32_t exynos_getMaxVirtualDisplayCount(hwc2_device_t* device);
86 int32_t exynos_getReleaseFences(hwc2_device_t *device, hwc2_display_t display, uint32_t* outNumElements,
87         hwc2_layer_t* outLayers, int32_t* outFences);
88 int32_t exynos_presentDisplay(hwc2_device_t *device, hwc2_display_t display, int32_t* outRetireFence);
89 int32_t exynos_registerCallback(hwc2_device_t* device, int32_t descriptor,
90         hwc2_callback_data_t callbackData, hwc2_function_pointer_t pointer);
91 int32_t exynos_setActiveConfig(hwc2_device_t *device, hwc2_display_t display, hwc2_config_t config);
92 int32_t exynos_setClientTarget(hwc2_device_t *device, hwc2_display_t display, buffer_handle_t target,
93         int32_t acquireFence, int32_t dataspace, hwc_region_t damage);
94 int32_t exynos_setColorMode(hwc2_device_t *device, hwc2_display_t display, int32_t mode);
95 int32_t exynos_setColorTransform(hwc2_device_t *device, hwc2_display_t display, const float* matrix, int32_t hint);
96 int32_t exynos_setCursorPosition(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer,
97         int32_t x, int32_t y);
98 int32_t exynos_setLayerBlendMode(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, int32_t mode);
99 int32_t exynos_setLayerBuffer(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer,
100         buffer_handle_t buffer, int32_t acquireFence);
101 int32_t exynos_setLayerColor(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, hwc_color_t color);
102 int32_t exynos_setLayerCompositionType(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, int32_t type);
103 int32_t exynos_setLayerDataspace(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, int32_t dataspace);
104 int32_t exynos_setLayerDisplayFrame(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer,
105         hwc_rect_t frame);
106 int32_t exynos_setLayerPlaneAlpha(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, float alpha);
107 int32_t exynos_setLayerSidebandStream(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer,
108         const native_handle_t* stream);
109 int32_t exynos_setLayerSourceCrop(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, hwc_frect_t crop);
110 int32_t exynos_setLayerSurfaceDamage(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, hwc_region_t damage);
111 int32_t exynos_setLayerTransform(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, int32_t transform);
112 int32_t exynos_setLayerVisibleRegion(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, hwc_region_t visible);
113 int32_t exynos_setLayerZOrder(hwc2_device_t *device, hwc2_display_t display, hwc2_layer_t layer, uint32_t z);
114 int32_t exynos_setOutputBuffer(hwc2_device_t *device, hwc2_display_t display, buffer_handle_t buffer, int32_t releaseFence);
115 int32_t exynos_setPowerMode(hwc2_device_t *device, hwc2_display_t display, int32_t mode);
116 int32_t exynos_setVsyncEnabled(hwc2_device_t *device, hwc2_display_t display, int32_t enabled);
117 int32_t exynos_validateDisplay(hwc2_device_t *device, hwc2_display_t display,
118         uint32_t* outNumTypes, uint32_t* outNumRequests);
119 int32_t exynos_setLayerPerFrameMetadata(hwc2_device_t* device, hwc2_display_t display,
120         hwc2_layer_t layer, uint32_t numElements,
121         const int32_t* /*hw2_per_frame_metadata_key_t*/ keys,
122         const float* metadata);
123 int32_t exynos_getPerFrameMetadataKeys(hwc2_device_t* device, hwc2_display_t display,
124         uint32_t* outNumKeys, int32_t* /*hwc2_per_frame_metadata_key_t*/ outKeys);
125 int32_t exynos_getRenderIntents(hwc2_device_t* device, hwc2_display_t display, int32_t mode,
126         uint32_t* outNumIntents, int32_t* /*android_render_intent_v1_1_t*/ outIntents);
127 int32_t exynos_setColorModeWithRenderIntent(hwc2_device_t* device, hwc2_display_t display,
128         int32_t /*android_color_mode_t*/ mode,
129         int32_t /*android_render_intent_v1_1_t */ intent);
130 int32_t exynos_getReadbackBufferAttributes(hwc2_device_t *dev, hwc2_display_t display,
131         int32_t* /*android_pixel_format_t*/ outFormat,
132         int32_t* /*android_dataspace_t*/ outDataspace);
133 int32_t exynos_setReadbackBuffer(hwc2_device_t *dev, hwc2_display_t display,
134         buffer_handle_t buffer, int32_t releaseFence);
135 int32_t exynos_getReadbackBufferFence(hwc2_device_t *dev, hwc2_display_t display,
136         int32_t* outFence);
137 
138 int32_t exynos_getDisplayIdentificationData(hwc2_device_t* device, hwc2_display_t display, uint8_t* outPort,
139         uint32_t* outDataSize, uint8_t* outData);
140 int32_t exynos_getDisplayCapabilities(hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumCapabilities,
141         uint32_t* outCapabilities);
142 int32_t exynos_setLayerColorTransform(hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
143         const float* matrix);
144 int32_t exynos_getDisplayedContentSamplingAttributes(hwc2_device_t* device, hwc2_display_t display,
145         int32_t* /* andrmid_pixel_format_t */ format,
146         int32_t* /* android_dataspace_t */ dataspace,
147         uint8_t* /* mask of android_component_t */ supported_components);
148 int32_t exynos_setDisplayedContentSamplingEnabled(hwc2_device_t* device, hwc2_display_t display,
149         int32_t /*hwc2_displayed_content_sampling_t*/ enabled,
150         uint8_t /* mask of android_component_t */ component_mask,
151         uint64_t max_frames);
152 int32_t exynos_getDisplayedContentSample(hwc2_device_t* device, hwc2_display_t display,
153         uint64_t max_frames, uint64_t timestamp,
154         uint64_t* frame_count, int32_t samples_size[4], uint64_t* samples[4]);
155 int32_t exynos_setLayerPerFrameMetadataBlobs(hwc2_device_t* device, hwc2_display_t display,
156         hwc2_layer_t layer, uint32_t numElements, const int32_t* keys, const uint32_t* sizes,
157         const uint8_t* metadata);
158 int32_t exynos_getDisplayBrightnessSupport(hwc2_device_t* device, hwc2_display_t display, bool* outSupport);
159 int32_t exynos_setDisplayBrightness(hwc2_device_t* device, hwc2_display_t display, float brightness);
160 
161 int32_t exynos_GetDisplayConnectionType(hwc2_device_t* device, hwc2_display_t display,
162         uint32_t* /*hwc2_display_connection_type_t*/ outType);
163 int32_t exynos_GetDisplayVsyncPeriod(hwc2_device_t* device, hwc2_display_t display,
164         hwc2_vsync_period_t* outVsyncPeriod);
165 int32_t exynos_SetActiveConfigWithConstraints(hwc2_device_t* device, hwc2_display_t display,
166         hwc2_config_t config, hwc_vsync_period_change_constraints_t* vsyncPeriodChangeConstraints,
167         hwc_vsync_period_change_timeline_t* outTimeline);
168 int32_t exynos_SetAutoLowLatencyMode(hwc2_device_t* device, hwc2_display_t display, bool on);
169 int32_t exynos_GetSupportedContentTypes(hwc2_device_t* device, hwc2_display_t display,
170         uint32_t* outNumSupportedContentTypes, uint32_t* outSupportedContentTypes);
171 int32_t exynos_SetContentType(hwc2_device_t* device, hwc2_display_t display,
172         int32_t /* hwc2_content_type_t */ contentType);
173 int32_t exynos_GetClientTargetProperty(hwc2_device_t* device, hwc2_display_t display,
174         hwc_client_target_property_t* outClientTargetProperty);
175 int32_t exynos_SetLayerGenericMetadata(hwc2_device_t* device, hwc2_display_t display,
176         hwc2_layer_t layer, uint32_t keyLength, const char* key,
177         bool mandatory, uint32_t valueLength, const uint8_t* value);
178 void exynos_GetLayerGenericMetadataKey(hwc2_device_t* device, uint32_t keyIndex,
179         uint32_t* outKeyLength, char* outKey, bool* outMandatory);
180 
181 enum {
182     NO_DRM = 0,
183     NORMAL_DRM,
184     SECURE_DRM,
185 };
186 
187 struct exynos_hwc2_device_t {
188     hwc2_device_t base;
189 	ExynosDevice *device;
190 };
191 #endif
192