blob: 4b01e79dfd071df94b3bfdd3a7886ed960fb1b5a [file] [log] [blame]
Sean Paule0c4c3d2015-01-20 16:56:04 -05001/*
2 * Copyright (C) 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
Stéphane Marchesinbe98c8c2015-06-23 16:18:10 -070017#define ATRACE_TAG ATRACE_TAG_GRAPHICS
Sean Paule0c4c3d2015-01-20 16:56:04 -050018#define LOG_TAG "hwcomposer-drm"
19
Zach Reizner7642c922015-10-29 10:11:16 -070020#include "drmhwcomposer.h"
Sean Paul6a55e9f2015-04-30 15:31:06 -040021#include "drmresources.h"
Sean Paulda6270d2015-06-01 14:11:52 -040022#include "importer.h"
Haixia Shid21f5282015-10-05 14:35:09 -070023#include "virtualcompositorworker.h"
Sean Paul4057be32015-05-13 06:23:09 -070024#include "vsyncworker.h"
Sean Paulef8f1f92015-04-29 16:05:23 -040025
Zach Reizner09807052015-08-13 14:53:41 -070026#include <stdlib.h>
27
28#include <map>
29#include <vector>
Zach Reizner4a253652015-09-10 18:30:54 -070030#include <sstream>
Zach Reizner09807052015-08-13 14:53:41 -070031
Sean Paule0c4c3d2015-01-20 16:56:04 -050032#include <errno.h>
Sean Paulef8f1f92015-04-29 16:05:23 -040033#include <fcntl.h>
Sean Paulef8f1f92015-04-29 16:05:23 -040034#include <pthread.h>
Sean Paule0c4c3d2015-01-20 16:56:04 -050035#include <sys/param.h>
Sean Paul9aa5ad32015-01-22 15:47:54 -050036#include <sys/resource.h>
Sean Paule0c4c3d2015-01-20 16:56:04 -050037#include <xf86drm.h>
38#include <xf86drmMode.h>
Sean Paule0c4c3d2015-01-20 16:56:04 -050039
Sean Paulef8f1f92015-04-29 16:05:23 -040040#include <cutils/log.h>
41#include <cutils/properties.h>
Sean Paule0c4c3d2015-01-20 16:56:04 -050042#include <hardware/hardware.h>
43#include <hardware/hwcomposer.h>
Zach Reizner4a253652015-09-10 18:30:54 -070044#include <sw_sync.h>
45#include <sync/sync.h>
Stéphane Marchesinbe98c8c2015-06-23 16:18:10 -070046#include <utils/Trace.h>
Sean Paule0c4c3d2015-01-20 16:56:04 -050047
Sean Paule0c4c3d2015-01-20 16:56:04 -050048#define UM_PER_INCH 25400
49
Sean Paul6a55e9f2015-04-30 15:31:06 -040050namespace android {
Sean Paule0c4c3d2015-01-20 16:56:04 -050051
Zach Reizner4a253652015-09-10 18:30:54 -070052class DummySwSyncTimeline {
53 public:
54 int Init() {
55 int ret = timeline_fd_.Set(sw_sync_timeline_create());
56 if (ret < 0)
57 return ret;
58 return 0;
59 }
60
61 UniqueFd CreateDummyFence() {
62 int ret = sw_sync_fence_create(timeline_fd_.get(), "dummy fence",
63 timeline_pt_ + 1);
64 if (ret < 0) {
65 ALOGE("Failed to create dummy fence %d", ret);
66 return ret;
67 }
68
69 UniqueFd ret_fd(ret);
70
71 ret = sw_sync_timeline_inc(timeline_fd_.get(), 1);
72 if (ret) {
73 ALOGE("Failed to increment dummy sync timeline %d", ret);
74 return ret;
75 }
76
77 ++timeline_pt_;
78 return ret_fd;
79 }
80
81 private:
82 UniqueFd timeline_fd_;
83 int timeline_pt_ = 0;
84};
85
86struct CheckedOutputFd {
87 CheckedOutputFd(int *fd, const char *description,
88 DummySwSyncTimeline &timeline)
89 : fd_(fd), description_(description), timeline_(timeline) {
90 }
91 CheckedOutputFd(CheckedOutputFd &&rhs)
92 : description_(rhs.description_), timeline_(rhs.timeline_) {
93 std::swap(fd_, rhs.fd_);
94 }
95
96 CheckedOutputFd &operator=(const CheckedOutputFd &rhs) = delete;
97
98 ~CheckedOutputFd() {
99 if (fd_ == NULL)
100 return;
101
102 if (*fd_ >= 0)
103 return;
104
105 *fd_ = timeline_.CreateDummyFence().Release();
106
107 if (*fd_ < 0)
108 ALOGE("Failed to fill %s (%p == %d) before destruction",
109 description_.c_str(), fd_, *fd_);
110 }
111
112 private:
113 int *fd_ = NULL;
114 std::string description_;
115 DummySwSyncTimeline &timeline_;
116};
117
Sean Paule42febf2015-05-07 11:35:29 -0700118typedef struct hwc_drm_display {
Sean Paulef8f1f92015-04-29 16:05:23 -0400119 struct hwc_context_t *ctx;
120 int display;
Sean Paul9aa5ad32015-01-22 15:47:54 -0500121
Sean Paul6a55e9f2015-04-30 15:31:06 -0400122 std::vector<uint32_t> config_ids;
Sean Paul9aa5ad32015-01-22 15:47:54 -0500123
Sean Paul4057be32015-05-13 06:23:09 -0700124 VSyncWorker vsync_worker;
Sean Paule42febf2015-05-07 11:35:29 -0700125} hwc_drm_display_t;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500126
127struct hwc_context_t {
Sean Paule42febf2015-05-07 11:35:29 -0700128 // map of display:hwc_drm_display_t
129 typedef std::map<int, hwc_drm_display_t> DisplayMap;
Sean Paulda6270d2015-06-01 14:11:52 -0400130
131 ~hwc_context_t() {
Haixia Shid21f5282015-10-05 14:35:09 -0700132 virtual_compositor_worker.Exit();
Sean Paulda6270d2015-06-01 14:11:52 -0400133 }
134
Sean Paule42febf2015-05-07 11:35:29 -0700135 hwc_composer_device_1_t device;
Zach Reiznerff30b522015-10-28 19:08:45 -0700136 hwc_procs_t const *procs = NULL;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500137
Sean Paule42febf2015-05-07 11:35:29 -0700138 DisplayMap displays;
Sean Paul6a55e9f2015-04-30 15:31:06 -0400139 DrmResources drm;
Zach Reiznerff30b522015-10-28 19:08:45 -0700140 std::unique_ptr<Importer> importer;
Zach Reizner4a253652015-09-10 18:30:54 -0700141 const gralloc_module_t *gralloc;
142 DummySwSyncTimeline dummy_timeline;
Haixia Shid21f5282015-10-05 14:35:09 -0700143 VirtualCompositorWorker virtual_compositor_worker;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500144};
145
Zach Reizner4a253652015-09-10 18:30:54 -0700146static native_handle_t *dup_buffer_handle(buffer_handle_t handle) {
147 native_handle_t *new_handle =
148 native_handle_create(handle->numFds, handle->numInts);
149 if (new_handle == NULL)
150 return NULL;
151
152 const int *old_data = handle->data;
153 int *new_data = new_handle->data;
154 for (int i = 0; i < handle->numFds; i++) {
155 *new_data = dup(*old_data);
156 old_data++;
157 new_data++;
158 }
159 memcpy(new_data, old_data, sizeof(int) * handle->numInts);
160
161 return new_handle;
162}
163
164static void free_buffer_handle(native_handle_t *handle) {
165 int ret = native_handle_close(handle);
166 if (ret)
167 ALOGE("Failed to close native handle %d", ret);
168 ret = native_handle_delete(handle);
169 if (ret)
170 ALOGE("Failed to delete native handle %d", ret);
171}
172
Zach Reiznerf99d53f2015-10-09 13:02:55 -0700173const hwc_drm_bo *DrmHwcBuffer::operator->() const {
Zach Reizner4a253652015-09-10 18:30:54 -0700174 if (importer_ == NULL) {
Zach Reiznerf99d53f2015-10-09 13:02:55 -0700175 ALOGE("Access of non-existent BO");
Zach Reizner4a253652015-09-10 18:30:54 -0700176 exit(1);
177 return NULL;
178 }
179 return &bo_;
180}
181
182void DrmHwcBuffer::Clear() {
183 if (importer_ != NULL) {
184 importer_->ReleaseBuffer(&bo_);
185 importer_ = NULL;
186 }
187}
188
189int DrmHwcBuffer::ImportBuffer(buffer_handle_t handle, Importer *importer) {
190 hwc_drm_bo tmp_bo;
191
192 int ret = importer->ImportBuffer(handle, &tmp_bo);
193 if (ret)
194 return ret;
195
196 if (importer_ != NULL) {
197 importer_->ReleaseBuffer(&bo_);
198 }
199
200 importer_ = importer;
201
202 bo_ = tmp_bo;
203
204 return 0;
205}
206
207int DrmHwcNativeHandle::CopyBufferHandle(buffer_handle_t handle,
208 const gralloc_module_t *gralloc) {
209 native_handle_t *handle_copy = dup_buffer_handle(handle);
210 if (handle_copy == NULL) {
211 ALOGE("Failed to duplicate handle");
212 return -ENOMEM;
213 }
214
215 int ret = gralloc->registerBuffer(gralloc, handle_copy);
216 if (ret) {
217 ALOGE("Failed to register buffer handle %d", ret);
218 free_buffer_handle(handle_copy);
219 return ret;
220 }
221
222 Clear();
223
224 gralloc_ = gralloc;
225 handle_ = handle_copy;
226
227 return 0;
228}
229
230DrmHwcNativeHandle::~DrmHwcNativeHandle() {
231 Clear();
232}
233
234void DrmHwcNativeHandle::Clear() {
235 if (gralloc_ != NULL && handle_ != NULL) {
236 gralloc_->unregisterBuffer(gralloc_, handle_);
237 free_buffer_handle(handle_);
238 gralloc_ = NULL;
239 handle_ = NULL;
240 }
241}
242
243int DrmHwcLayer::InitFromHwcLayer(hwc_layer_1_t *sf_layer, Importer *importer,
244 const gralloc_module_t *gralloc) {
245 sf_handle = sf_layer->handle;
Zach Reizner4a253652015-09-10 18:30:54 -0700246 alpha = sf_layer->planeAlpha;
247
Zach Reizner7e88be92015-10-12 15:20:33 -0700248 source_crop = DrmHwcRect<float>(
249 sf_layer->sourceCropf.left, sf_layer->sourceCropf.top,
250 sf_layer->sourceCropf.right, sf_layer->sourceCropf.bottom);
251 display_frame = DrmHwcRect<int>(
252 sf_layer->displayFrame.left, sf_layer->displayFrame.top,
253 sf_layer->displayFrame.right, sf_layer->displayFrame.bottom);
254
Zach Reizner4a253652015-09-10 18:30:54 -0700255 switch (sf_layer->transform) {
256 case 0:
257 transform = DrmHwcTransform::kIdentity;
258 break;
259 case HWC_TRANSFORM_FLIP_H:
260 transform = DrmHwcTransform::kFlipH;
261 break;
262 case HWC_TRANSFORM_FLIP_V:
263 transform = DrmHwcTransform::kFlipV;
264 break;
265 case HWC_TRANSFORM_ROT_90:
266 transform = DrmHwcTransform::kRotate90;
267 break;
268 case HWC_TRANSFORM_ROT_180:
269 transform = DrmHwcTransform::kRotate180;
270 break;
271 case HWC_TRANSFORM_ROT_270:
272 transform = DrmHwcTransform::kRotate270;
273 break;
274 default:
275 ALOGE("Invalid transform in hwc_layer_1_t %d", sf_layer->transform);
276 return -EINVAL;
277 }
278
279 switch (sf_layer->blending) {
280 case HWC_BLENDING_NONE:
281 blending = DrmHwcBlending::kNone;
282 break;
283 case HWC_BLENDING_PREMULT:
284 blending = DrmHwcBlending::kPreMult;
285 break;
286 case HWC_BLENDING_COVERAGE:
287 blending = DrmHwcBlending::kCoverage;
288 break;
289 default:
290 ALOGE("Invalid blending in hwc_layer_1_t %d", sf_layer->blending);
291 return -EINVAL;
292 }
293
Zach Reizner7e88be92015-10-12 15:20:33 -0700294 int ret = buffer.ImportBuffer(sf_layer->handle, importer);
295 if (ret)
296 return ret;
297
298 ret = handle.CopyBufferHandle(sf_layer->handle, gralloc);
299 if (ret)
300 return ret;
Zach Reizner4a253652015-09-10 18:30:54 -0700301
Zach Reizner36d7c6e2015-10-20 10:58:19 -0700302 ret = gralloc->perform(gralloc, GRALLOC_MODULE_PERFORM_GET_USAGE,
303 handle.get(), &gralloc_buffer_usage);
304 if (ret) {
305 // TODO(zachr): Once GRALLOC_MODULE_PERFORM_GET_USAGE is implemented, remove
306 // "ret = 0" and enable the error logging code.
307 ret = 0;
308#if 0
309 ALOGE("Failed to get usage for buffer %p (%d)", handle.get(), ret);
310 return ret;
311#endif
312 }
313
Zach Reizner4a253652015-09-10 18:30:54 -0700314 return 0;
315}
316
Zach Reiznerc6520e42015-08-13 14:32:09 -0700317static void hwc_dump(struct hwc_composer_device_1 *dev, char *buff,
Sean Paul9046c642015-06-10 17:27:47 -0400318 int buff_len) {
319 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
320 std::ostringstream out;
321
322 ctx->drm.compositor()->Dump(&out);
323 std::string out_str = out.str();
Zach Reiznerfd6dc332015-10-13 21:12:48 -0700324 strncpy(buff, out_str.c_str(),
325 std::min((size_t)buff_len, out_str.length() + 1));
326 buff[buff_len - 1] = '\0';
Sean Paul9046c642015-06-10 17:27:47 -0400327}
328
Sean Paulb386f1b2015-05-13 06:33:23 -0700329static int hwc_prepare(hwc_composer_device_1_t *dev, size_t num_displays,
Sean Paulef8f1f92015-04-29 16:05:23 -0400330 hwc_display_contents_1_t **display_contents) {
Sean Paulb386f1b2015-05-13 06:33:23 -0700331 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Zach Reizner1946fa72015-08-14 11:14:38 -0700332
Sean Paule42febf2015-05-07 11:35:29 -0700333 for (int i = 0; i < (int)num_displays; ++i) {
Sean Paulef8f1f92015-04-29 16:05:23 -0400334 if (!display_contents[i])
335 continue;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500336
Sean Paul6f82f1d2015-10-21 20:05:05 -0400337 bool use_framebuffer_target = false;
Haixia Shid21f5282015-10-05 14:35:09 -0700338 if (i == HWC_DISPLAY_VIRTUAL) {
339 use_framebuffer_target = true;
340 } else {
341 DrmCrtc *crtc = ctx->drm.GetCrtcForDisplay(i);
342 if (!crtc) {
343 ALOGE("No crtc for display %d", i);
344 return -ENODEV;
345 }
Sean Paulb386f1b2015-05-13 06:33:23 -0700346 }
Sean Paulb386f1b2015-05-13 06:33:23 -0700347
Zach Reizner45624d32015-06-10 16:03:01 -0700348 int num_layers = display_contents[i]->numHwLayers;
349 for (int j = 0; j < num_layers; j++) {
Sean Paulb386f1b2015-05-13 06:33:23 -0700350 hwc_layer_1_t *layer = &display_contents[i]->hwLayers[j];
Zach Reizner45624d32015-06-10 16:03:01 -0700351
Haixia Shid21f5282015-10-05 14:35:09 -0700352 if (!use_framebuffer_target) {
Zach Reizner1946fa72015-08-14 11:14:38 -0700353 if (layer->compositionType == HWC_FRAMEBUFFER)
354 layer->compositionType = HWC_OVERLAY;
355 } else {
356 switch (layer->compositionType) {
357 case HWC_OVERLAY:
358 case HWC_BACKGROUND:
359 case HWC_SIDEBAND:
360 case HWC_CURSOR_OVERLAY:
361 layer->compositionType = HWC_FRAMEBUFFER;
362 break;
363 }
364 }
Sean Paulef8f1f92015-04-29 16:05:23 -0400365 }
366 }
Sean Pauldffca952015-02-04 10:19:55 -0800367
Sean Paulef8f1f92015-04-29 16:05:23 -0400368 return 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500369}
370
Zach Reizner09807052015-08-13 14:53:41 -0700371static void hwc_add_layer_to_retire_fence(
372 hwc_layer_1_t *layer, hwc_display_contents_1_t *display_contents) {
Sean Paul04206122015-07-16 15:59:24 -0400373 if (layer->releaseFenceFd < 0)
374 return;
375
376 if (display_contents->retireFenceFd >= 0) {
377 int old_retire_fence = display_contents->retireFenceFd;
Zach Reiznerc6520e42015-08-13 14:32:09 -0700378 display_contents->retireFenceFd =
379 sync_merge("dc_retire", old_retire_fence, layer->releaseFenceFd);
Sean Paul04206122015-07-16 15:59:24 -0400380 close(old_retire_fence);
381 } else {
382 display_contents->retireFenceFd = dup(layer->releaseFenceFd);
383 }
384}
385
Sean Paule0c4c3d2015-01-20 16:56:04 -0500386static int hwc_set(hwc_composer_device_1_t *dev, size_t num_displays,
Zach Reizner4a253652015-09-10 18:30:54 -0700387 hwc_display_contents_1_t **sf_display_contents) {
Stéphane Marchesinbe98c8c2015-06-23 16:18:10 -0700388 ATRACE_CALL();
Sean Paulef8f1f92015-04-29 16:05:23 -0400389 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Zach Reizner4a253652015-09-10 18:30:54 -0700390 int ret = 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500391
Zach Reizner4a253652015-09-10 18:30:54 -0700392 std::vector<CheckedOutputFd> checked_output_fences;
393 std::vector<DrmHwcDisplayContents> displays_contents;
Zach Reizner09807052015-08-13 14:53:41 -0700394 std::vector<DrmCompositionDisplayLayersMap> layers_map;
395 std::vector<std::vector<size_t>> layers_indices;
Zach Reizner4a253652015-09-10 18:30:54 -0700396 displays_contents.reserve(num_displays);
397 // layers_map.reserve(num_displays);
Zach Reizner09807052015-08-13 14:53:41 -0700398 layers_indices.reserve(num_displays);
399
Zach Reizner4a253652015-09-10 18:30:54 -0700400 // Phase one does nothing that would cause errors. Only take ownership of FDs.
401 for (size_t i = 0; i < num_displays; ++i) {
402 hwc_display_contents_1_t *dc = sf_display_contents[i];
403 displays_contents.emplace_back();
404 DrmHwcDisplayContents &display_contents = displays_contents.back();
Haixia Shi7acc59b2015-09-30 10:57:54 -0700405 layers_indices.emplace_back();
406 std::vector<size_t> &indices_to_composite = layers_indices.back();
Zach Reizner4a253652015-09-10 18:30:54 -0700407
408 if (!sf_display_contents[i])
Sean Paulb386f1b2015-05-13 06:33:23 -0700409 continue;
Zach Reizner09807052015-08-13 14:53:41 -0700410
Haixia Shid21f5282015-10-05 14:35:09 -0700411 if (i == HWC_DISPLAY_VIRTUAL) {
412 ctx->virtual_compositor_worker.QueueComposite(dc);
413 continue;
414 }
415
Zach Reizner4a253652015-09-10 18:30:54 -0700416 std::ostringstream display_index_formatter;
417 display_index_formatter << "retire fence for display " << i;
418 std::string display_fence_description(display_index_formatter.str());
419 checked_output_fences.emplace_back(&dc->retireFenceFd,
420 display_fence_description.c_str(),
421 ctx->dummy_timeline);
422 display_contents.retire_fence = OutputFd(&dc->retireFenceFd);
Zach Reizner09807052015-08-13 14:53:41 -0700423
Zach Reizner4a253652015-09-10 18:30:54 -0700424 size_t num_dc_layers = dc->numHwLayers;
Haixia Shi1034bb72015-09-09 12:08:20 -0700425 int framebuffer_target_index = -1;
Zach Reizner4a253652015-09-10 18:30:54 -0700426 for (size_t j = 0; j < num_dc_layers; ++j) {
427 hwc_layer_1_t *sf_layer = &dc->hwLayers[j];
428
429 display_contents.layers.emplace_back();
430 DrmHwcLayer &layer = display_contents.layers.back();
431
432 if (sf_layer->flags & HWC_SKIP_LAYER)
Sean Paulb386f1b2015-05-13 06:33:23 -0700433 continue;
Zach Reizner4a253652015-09-10 18:30:54 -0700434
Sean Paul6f82f1d2015-10-21 20:05:05 -0400435 if (sf_layer->compositionType == HWC_OVERLAY)
436 indices_to_composite.push_back(j);
437 if (sf_layer->compositionType == HWC_FRAMEBUFFER_TARGET)
438 framebuffer_target_index = j;
Zach Reizner4a253652015-09-10 18:30:54 -0700439
440 layer.acquire_fence.Set(sf_layer->acquireFenceFd);
441 sf_layer->acquireFenceFd = -1;
442
443 std::ostringstream layer_fence_formatter;
444 layer_fence_formatter << "release fence for layer " << j << " of display "
445 << i;
446 std::string layer_fence_description(layer_fence_formatter.str());
447 checked_output_fences.emplace_back(&sf_layer->releaseFenceFd,
448 layer_fence_description.c_str(),
449 ctx->dummy_timeline);
450 layer.release_fence = OutputFd(&sf_layer->releaseFenceFd);
Zach Reizner1946fa72015-08-14 11:14:38 -0700451 }
Zach Reizner4a253652015-09-10 18:30:54 -0700452
Sean Paul6f82f1d2015-10-21 20:05:05 -0400453 if (indices_to_composite.empty() && framebuffer_target_index >= 0) {
454 hwc_layer_1_t *sf_layer = &dc->hwLayers[framebuffer_target_index];
455 if (!sf_layer->handle || (sf_layer->flags & HWC_SKIP_LAYER)) {
456 ALOGE(
457 "Expected valid layer with HWC_FRAMEBUFFER_TARGET when all "
458 "HWC_OVERLAY layers are skipped.");
Zach Reizner4a253652015-09-10 18:30:54 -0700459 ret = -EINVAL;
Zach Reizner1946fa72015-08-14 11:14:38 -0700460 }
Sean Paul6f82f1d2015-10-21 20:05:05 -0400461 indices_to_composite.push_back(framebuffer_target_index);
Zach Reizner45624d32015-06-10 16:03:01 -0700462 }
Zach Reizner4a253652015-09-10 18:30:54 -0700463 }
Zach Reizner45624d32015-06-10 16:03:01 -0700464
Zach Reizner4a253652015-09-10 18:30:54 -0700465 if (ret)
466 return ret;
467
468 for (size_t i = 0; i < num_displays; ++i) {
469 hwc_display_contents_1_t *dc = sf_display_contents[i];
470 DrmHwcDisplayContents &display_contents = displays_contents[i];
Haixia Shi2fddd372015-10-15 16:21:48 -0700471 if (!sf_display_contents[i] || i == HWC_DISPLAY_VIRTUAL)
Zach Reizner4a253652015-09-10 18:30:54 -0700472 continue;
473
474 layers_map.emplace_back();
475 DrmCompositionDisplayLayersMap &map = layers_map.back();
Zach Reizneracba14b2015-10-13 18:19:26 -0700476 map.display = i;
Zach Reizner5757e822015-10-16 19:06:31 -0700477 map.geometry_changed =
478 (dc->flags & HWC_GEOMETRY_CHANGED) == HWC_GEOMETRY_CHANGED;
Zach Reizner4a253652015-09-10 18:30:54 -0700479 std::vector<size_t> &indices_to_composite = layers_indices[i];
480 for (size_t j : indices_to_composite) {
481 hwc_layer_1_t *sf_layer = &dc->hwLayers[j];
482
483 DrmHwcLayer &layer = display_contents.layers[j];
484
Zach Reiznerff30b522015-10-28 19:08:45 -0700485 ret = layer.InitFromHwcLayer(sf_layer, ctx->importer.get(), ctx->gralloc);
Zach Reizner7e88be92015-10-12 15:20:33 -0700486 if (ret) {
487 ALOGE("Failed to init composition from layer %d", ret);
488 return ret;
489 }
Zach Reizner4a253652015-09-10 18:30:54 -0700490 map.layers.emplace_back(std::move(layer));
491 }
492 }
493
494 std::unique_ptr<DrmComposition> composition(
Zach Reiznerff30b522015-10-28 19:08:45 -0700495 ctx->drm.compositor()->CreateComposition(ctx->importer.get()));
Zach Reizner4a253652015-09-10 18:30:54 -0700496 if (!composition) {
497 ALOGE("Drm composition init failed");
498 return -EINVAL;
Zach Reizner09807052015-08-13 14:53:41 -0700499 }
Zach Reizner45624d32015-06-10 16:03:01 -0700500
Zach Reizner09807052015-08-13 14:53:41 -0700501 ret = composition->SetLayers(layers_map.size(), layers_map.data());
502 if (ret) {
Zach Reizner09807052015-08-13 14:53:41 -0700503 return -EINVAL;
504 }
Zach Reizner45624d32015-06-10 16:03:01 -0700505
Zach Reizner09807052015-08-13 14:53:41 -0700506 ret = ctx->drm.compositor()->QueueComposition(std::move(composition));
507 if (ret) {
Zach Reizner09807052015-08-13 14:53:41 -0700508 return -EINVAL;
509 }
510
Zach Reizner566da2b2015-10-06 15:39:09 -0700511 for (size_t i = 0; i < num_displays; ++i) {
512 hwc_display_contents_1_t *dc = sf_display_contents[i];
513 if (!dc)
514 continue;
515
516 size_t num_dc_layers = dc->numHwLayers;
517 for (size_t j = 0; j < num_dc_layers; ++j) {
518 hwc_layer_1_t *layer = &dc->hwLayers[j];
519 if (layer->flags & HWC_SKIP_LAYER)
520 continue;
521 hwc_add_layer_to_retire_fence(layer, dc);
522 }
523 }
524
Zach Reizner09807052015-08-13 14:53:41 -0700525 composition.reset(NULL);
526
Sean Paulef8f1f92015-04-29 16:05:23 -0400527 return ret;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500528}
529
Sean Paulef8f1f92015-04-29 16:05:23 -0400530static int hwc_event_control(struct hwc_composer_device_1 *dev, int display,
531 int event, int enabled) {
Sean Paulef8f1f92015-04-29 16:05:23 -0400532 if (event != HWC_EVENT_VSYNC || (enabled != 0 && enabled != 1))
533 return -EINVAL;
Sean Pauleb9e75c2015-01-25 23:31:30 -0500534
Sean Paul4057be32015-05-13 06:23:09 -0700535 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
536 hwc_drm_display_t *hd = &ctx->displays[display];
537 return hd->vsync_worker.VSyncControl(enabled);
Sean Paule0c4c3d2015-01-20 16:56:04 -0500538}
539
Sean Paulef8f1f92015-04-29 16:05:23 -0400540static int hwc_set_power_mode(struct hwc_composer_device_1 *dev, int display,
541 int mode) {
542 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500543
Sean Paul6a55e9f2015-04-30 15:31:06 -0400544 uint64_t dpmsValue = 0;
Sean Paulef8f1f92015-04-29 16:05:23 -0400545 switch (mode) {
546 case HWC_POWER_MODE_OFF:
Sean Paul6a55e9f2015-04-30 15:31:06 -0400547 dpmsValue = DRM_MODE_DPMS_OFF;
Sean Paulef8f1f92015-04-29 16:05:23 -0400548 break;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500549
Sean Paulef8f1f92015-04-29 16:05:23 -0400550 /* We can't support dozing right now, so go full on */
551 case HWC_POWER_MODE_DOZE:
552 case HWC_POWER_MODE_DOZE_SUSPEND:
553 case HWC_POWER_MODE_NORMAL:
Sean Paul6a55e9f2015-04-30 15:31:06 -0400554 dpmsValue = DRM_MODE_DPMS_ON;
Sean Paulef8f1f92015-04-29 16:05:23 -0400555 break;
556 };
Sean Paul6a55e9f2015-04-30 15:31:06 -0400557 return ctx->drm.SetDpmsMode(display, dpmsValue);
Sean Paule0c4c3d2015-01-20 16:56:04 -0500558}
559
Sean Paulef8f1f92015-04-29 16:05:23 -0400560static int hwc_query(struct hwc_composer_device_1 * /* dev */, int what,
561 int *value) {
562 switch (what) {
563 case HWC_BACKGROUND_LAYER_SUPPORTED:
564 *value = 0; /* TODO: We should do this */
565 break;
566 case HWC_VSYNC_PERIOD:
567 ALOGW("Query for deprecated vsync value, returning 60Hz");
568 *value = 1000 * 1000 * 1000 / 60;
569 break;
570 case HWC_DISPLAY_TYPES_SUPPORTED:
Haixia Shi2fddd372015-10-15 16:21:48 -0700571 *value = HWC_DISPLAY_PRIMARY_BIT | HWC_DISPLAY_EXTERNAL_BIT |
572 HWC_DISPLAY_VIRTUAL_BIT;
Sean Paulef8f1f92015-04-29 16:05:23 -0400573 break;
574 }
575 return 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500576}
577
Sean Paulef8f1f92015-04-29 16:05:23 -0400578static void hwc_register_procs(struct hwc_composer_device_1 *dev,
579 hwc_procs_t const *procs) {
580 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500581
Sean Paulef8f1f92015-04-29 16:05:23 -0400582 ctx->procs = procs;
Sean Paul4057be32015-05-13 06:23:09 -0700583
Zach Reiznerff30b522015-10-28 19:08:45 -0700584 for (std::pair<const int, hwc_drm_display> &display_entry : ctx->displays)
585 display_entry.second.vsync_worker.SetProcs(procs);
Sean Paule0c4c3d2015-01-20 16:56:04 -0500586}
587
Sean Paulef8f1f92015-04-29 16:05:23 -0400588static int hwc_get_display_configs(struct hwc_composer_device_1 *dev,
589 int display, uint32_t *configs,
Sean Paul6a55e9f2015-04-30 15:31:06 -0400590 size_t *num_configs) {
591 if (!*num_configs)
Sean Paulef8f1f92015-04-29 16:05:23 -0400592 return 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500593
Sean Paulef8f1f92015-04-29 16:05:23 -0400594 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Sean Paule42febf2015-05-07 11:35:29 -0700595 hwc_drm_display_t *hd = &ctx->displays[display];
Sean Paul6a55e9f2015-04-30 15:31:06 -0400596 hd->config_ids.clear();
597
598 DrmConnector *connector = ctx->drm.GetConnectorForDisplay(display);
599 if (!connector) {
600 ALOGE("Failed to get connector for display %d", display);
Sean Paulef8f1f92015-04-29 16:05:23 -0400601 return -ENODEV;
602 }
Sean Paule0c4c3d2015-01-20 16:56:04 -0500603
Sean Paule42febf2015-05-07 11:35:29 -0700604 int ret = connector->UpdateModes();
Sean Paul6a55e9f2015-04-30 15:31:06 -0400605 if (ret) {
606 ALOGE("Failed to update display modes %d", ret);
Sean Paulef8f1f92015-04-29 16:05:23 -0400607 return ret;
Sean Paulef8f1f92015-04-29 16:05:23 -0400608 }
Sean Paule0c4c3d2015-01-20 16:56:04 -0500609
Zach Reiznerff30b522015-10-28 19:08:45 -0700610 for (const DrmMode &mode : connector->modes()) {
Sean Paul6a55e9f2015-04-30 15:31:06 -0400611 size_t idx = hd->config_ids.size();
612 if (idx == *num_configs)
613 break;
Zach Reiznerff30b522015-10-28 19:08:45 -0700614 hd->config_ids.push_back(mode.id());
615 configs[idx] = mode.id();
Sean Paul6a55e9f2015-04-30 15:31:06 -0400616 }
617 *num_configs = hd->config_ids.size();
618 return *num_configs == 0 ? -1 : 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500619}
620
Sean Paulef8f1f92015-04-29 16:05:23 -0400621static int hwc_get_display_attributes(struct hwc_composer_device_1 *dev,
622 int display, uint32_t config,
623 const uint32_t *attributes,
624 int32_t *values) {
625 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Sean Paul6a55e9f2015-04-30 15:31:06 -0400626 DrmConnector *c = ctx->drm.GetConnectorForDisplay(display);
Sean Paulef8f1f92015-04-29 16:05:23 -0400627 if (!c) {
Sean Paul6a55e9f2015-04-30 15:31:06 -0400628 ALOGE("Failed to get DrmConnector for display %d", display);
Sean Paulef8f1f92015-04-29 16:05:23 -0400629 return -ENODEV;
630 }
Sean Paul6a55e9f2015-04-30 15:31:06 -0400631 DrmMode mode;
Zach Reiznerff30b522015-10-28 19:08:45 -0700632 for (const DrmMode &conn_mode : c->modes()) {
633 if (conn_mode.id() == config) {
634 mode = conn_mode;
Sean Paul6a55e9f2015-04-30 15:31:06 -0400635 break;
636 }
637 }
638 if (mode.id() == 0) {
639 ALOGE("Failed to find active mode for display %d", display);
640 return -ENOENT;
Sean Paulef8f1f92015-04-29 16:05:23 -0400641 }
Sean Paule0c4c3d2015-01-20 16:56:04 -0500642
Sean Paul6a55e9f2015-04-30 15:31:06 -0400643 uint32_t mm_width = c->mm_width();
644 uint32_t mm_height = c->mm_height();
Sean Paulef8f1f92015-04-29 16:05:23 -0400645 for (int i = 0; attributes[i] != HWC_DISPLAY_NO_ATTRIBUTE; ++i) {
646 switch (attributes[i]) {
647 case HWC_DISPLAY_VSYNC_PERIOD:
Sean Paul6a55e9f2015-04-30 15:31:06 -0400648 values[i] = 1000 * 1000 * 1000 / mode.v_refresh();
Sean Paulef8f1f92015-04-29 16:05:23 -0400649 break;
650 case HWC_DISPLAY_WIDTH:
Sean Paul6a55e9f2015-04-30 15:31:06 -0400651 values[i] = mode.h_display();
Sean Paulef8f1f92015-04-29 16:05:23 -0400652 break;
653 case HWC_DISPLAY_HEIGHT:
Sean Paul6a55e9f2015-04-30 15:31:06 -0400654 values[i] = mode.v_display();
Sean Paulef8f1f92015-04-29 16:05:23 -0400655 break;
656 case HWC_DISPLAY_DPI_X:
657 /* Dots per 1000 inches */
Sean Paul6a55e9f2015-04-30 15:31:06 -0400658 values[i] = mm_width ? (mode.h_display() * UM_PER_INCH) / mm_width : 0;
Sean Paulef8f1f92015-04-29 16:05:23 -0400659 break;
660 case HWC_DISPLAY_DPI_Y:
661 /* Dots per 1000 inches */
Sean Paul6a55e9f2015-04-30 15:31:06 -0400662 values[i] =
663 mm_height ? (mode.v_display() * UM_PER_INCH) / mm_height : 0;
Sean Paulef8f1f92015-04-29 16:05:23 -0400664 break;
665 }
666 }
Sean Paulef8f1f92015-04-29 16:05:23 -0400667 return 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500668}
669
Sean Paulef8f1f92015-04-29 16:05:23 -0400670static int hwc_get_active_config(struct hwc_composer_device_1 *dev,
671 int display) {
672 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Sean Paul6a55e9f2015-04-30 15:31:06 -0400673 DrmConnector *c = ctx->drm.GetConnectorForDisplay(display);
674 if (!c) {
675 ALOGE("Failed to get DrmConnector for display %d", display);
Sean Paulef8f1f92015-04-29 16:05:23 -0400676 return -ENODEV;
677 }
Sean Paule0c4c3d2015-01-20 16:56:04 -0500678
Sean Paul6a55e9f2015-04-30 15:31:06 -0400679 DrmMode mode = c->active_mode();
Sean Paule42febf2015-05-07 11:35:29 -0700680 hwc_drm_display_t *hd = &ctx->displays[display];
Sean Paul6a55e9f2015-04-30 15:31:06 -0400681 for (size_t i = 0; i < hd->config_ids.size(); ++i) {
682 if (hd->config_ids[i] == mode.id())
683 return i;
Sean Paulef8f1f92015-04-29 16:05:23 -0400684 }
Sean Paul6a55e9f2015-04-30 15:31:06 -0400685 return -1;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500686}
687
Sean Paulef8f1f92015-04-29 16:05:23 -0400688static int hwc_set_active_config(struct hwc_composer_device_1 *dev, int display,
689 int index) {
690 struct hwc_context_t *ctx = (struct hwc_context_t *)&dev->common;
Sean Paule42febf2015-05-07 11:35:29 -0700691 hwc_drm_display_t *hd = &ctx->displays[display];
Sean Paul6a55e9f2015-04-30 15:31:06 -0400692 if (index >= (int)hd->config_ids.size()) {
693 ALOGE("Invalid config index %d passed in", index);
694 return -EINVAL;
Sean Paulef8f1f92015-04-29 16:05:23 -0400695 }
Sean Paule0c4c3d2015-01-20 16:56:04 -0500696
Sean Paul877be972015-06-03 14:08:27 -0400697 DrmConnector *c = ctx->drm.GetConnectorForDisplay(display);
698 if (!c) {
699 ALOGE("Failed to get connector for display %d", display);
700 return -ENODEV;
701 }
702 DrmMode mode;
Zach Reiznerff30b522015-10-28 19:08:45 -0700703 for (const DrmMode &conn_mode : c->modes()) {
704 if (conn_mode.id() == hd->config_ids[index]) {
705 mode = conn_mode;
Sean Paul877be972015-06-03 14:08:27 -0400706 break;
707 }
708 }
709 if (mode.id() != hd->config_ids[index]) {
710 ALOGE("Could not find active mode for %d/%d", index, hd->config_ids[index]);
711 return -ENOENT;
712 }
713 int ret = ctx->drm.SetDisplayActiveMode(display, mode);
Sean Paul6a55e9f2015-04-30 15:31:06 -0400714 if (ret) {
Sean Paul877be972015-06-03 14:08:27 -0400715 ALOGE("Failed to set active config %d", ret);
Sean Paul6a55e9f2015-04-30 15:31:06 -0400716 return ret;
Sean Paulef8f1f92015-04-29 16:05:23 -0400717 }
Sean Paul6a55e9f2015-04-30 15:31:06 -0400718 return ret;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500719}
720
Sean Paulef8f1f92015-04-29 16:05:23 -0400721static int hwc_device_close(struct hw_device_t *dev) {
722 struct hwc_context_t *ctx = (struct hwc_context_t *)dev;
Sean Paulef8f1f92015-04-29 16:05:23 -0400723 delete ctx;
Sean Paulef8f1f92015-04-29 16:05:23 -0400724 return 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500725}
726
Sean Paul24a26e32015-02-04 10:34:47 -0800727/*
728 * TODO: This function sets the active config to the first one in the list. This
729 * should be fixed such that it selects the preferred mode for the display, or
730 * some other, saner, method of choosing the config.
731 */
Sean Paule42febf2015-05-07 11:35:29 -0700732static int hwc_set_initial_config(hwc_drm_display_t *hd) {
Sean Paulef8f1f92015-04-29 16:05:23 -0400733 uint32_t config;
734 size_t num_configs = 1;
735 int ret = hwc_get_display_configs(&hd->ctx->device, hd->display, &config,
736 &num_configs);
737 if (ret || !num_configs)
738 return 0;
Sean Paul24a26e32015-02-04 10:34:47 -0800739
Sean Paulef8f1f92015-04-29 16:05:23 -0400740 ret = hwc_set_active_config(&hd->ctx->device, hd->display, 0);
741 if (ret) {
742 ALOGE("Failed to set active config d=%d ret=%d", hd->display, ret);
743 return ret;
744 }
Sean Paul24a26e32015-02-04 10:34:47 -0800745
Sean Paulef8f1f92015-04-29 16:05:23 -0400746 return ret;
Sean Paul24a26e32015-02-04 10:34:47 -0800747}
748
Sean Paul6a55e9f2015-04-30 15:31:06 -0400749static int hwc_initialize_display(struct hwc_context_t *ctx, int display) {
Sean Paule42febf2015-05-07 11:35:29 -0700750 hwc_drm_display_t *hd = &ctx->displays[display];
Sean Paulef8f1f92015-04-29 16:05:23 -0400751 hd->ctx = ctx;
752 hd->display = display;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500753
Sean Paulb386f1b2015-05-13 06:33:23 -0700754 int ret = hwc_set_initial_config(hd);
Sean Paulef8f1f92015-04-29 16:05:23 -0400755 if (ret) {
756 ALOGE("Failed to set initial config for d=%d ret=%d", display, ret);
Sean Paulef8f1f92015-04-29 16:05:23 -0400757 return ret;
758 }
Sean Paul24a26e32015-02-04 10:34:47 -0800759
Sean Paul4057be32015-05-13 06:23:09 -0700760 ret = hd->vsync_worker.Init(&ctx->drm, display);
761 if (ret) {
762 ALOGE("Failed to create event worker for display %d %d\n", display, ret);
763 return ret;
764 }
765
Sean Paulef8f1f92015-04-29 16:05:23 -0400766 return 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500767}
768
Sean Paulef8f1f92015-04-29 16:05:23 -0400769static int hwc_enumerate_displays(struct hwc_context_t *ctx) {
Sean Paul6a55e9f2015-04-30 15:31:06 -0400770 int ret;
Zach Reiznerff30b522015-10-28 19:08:45 -0700771 for (auto &conn : ctx->drm.connectors()) {
772 ret = hwc_initialize_display(ctx, conn->display());
Sean Paul6a55e9f2015-04-30 15:31:06 -0400773 if (ret) {
Zach Reiznerff30b522015-10-28 19:08:45 -0700774 ALOGE("Failed to initialize display %d", conn->display());
Sean Paul6a55e9f2015-04-30 15:31:06 -0400775 return ret;
Sean Paulef8f1f92015-04-29 16:05:23 -0400776 }
777 }
Sean Paulef8f1f92015-04-29 16:05:23 -0400778
Haixia Shid21f5282015-10-05 14:35:09 -0700779 ret = ctx->virtual_compositor_worker.Init();
780 if (ret) {
781 ALOGE("Failed to initialize virtual compositor worker");
782 return ret;
783 }
Sean Paulef8f1f92015-04-29 16:05:23 -0400784 return 0;
Sean Paule0c4c3d2015-01-20 16:56:04 -0500785}
786
Sean Paulef8f1f92015-04-29 16:05:23 -0400787static int hwc_device_open(const struct hw_module_t *module, const char *name,
788 struct hw_device_t **dev) {
789 if (strcmp(name, HWC_HARDWARE_COMPOSER)) {
790 ALOGE("Invalid module name- %s", name);
791 return -EINVAL;
792 }
793
Zach Reiznerff30b522015-10-28 19:08:45 -0700794 std::unique_ptr<hwc_context_t> ctx(new hwc_context_t());
Sean Paulef8f1f92015-04-29 16:05:23 -0400795 if (!ctx) {
796 ALOGE("Failed to allocate hwc context");
797 return -ENOMEM;
798 }
799
Sean Paul6a55e9f2015-04-30 15:31:06 -0400800 int ret = ctx->drm.Init();
801 if (ret) {
802 ALOGE("Can't initialize Drm object %d", ret);
Sean Paul6a55e9f2015-04-30 15:31:06 -0400803 return ret;
804 }
805
Zach Reizner4a253652015-09-10 18:30:54 -0700806 ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
807 (const hw_module_t **)&ctx->gralloc);
808 if (ret) {
809 ALOGE("Failed to open gralloc module %d", ret);
Zach Reizner4a253652015-09-10 18:30:54 -0700810 return ret;
811 }
812
813 ret = ctx->dummy_timeline.Init();
814 if (ret) {
815 ALOGE("Failed to create dummy sw sync timeline %d", ret);
816 return ret;
817 }
818
Zach Reiznerff30b522015-10-28 19:08:45 -0700819 ctx->importer.reset(Importer::CreateInstance(&ctx->drm));
Sean Paulda6270d2015-06-01 14:11:52 -0400820 if (!ctx->importer) {
821 ALOGE("Failed to create importer instance");
Sean Paulef8f1f92015-04-29 16:05:23 -0400822 return ret;
823 }
824
Zach Reiznerff30b522015-10-28 19:08:45 -0700825 ret = hwc_enumerate_displays(ctx.get());
Sean Paulef8f1f92015-04-29 16:05:23 -0400826 if (ret) {
827 ALOGE("Failed to enumerate displays: %s", strerror(ret));
Sean Paul6a55e9f2015-04-30 15:31:06 -0400828 return ret;
829 }
830
Sean Paulef8f1f92015-04-29 16:05:23 -0400831 ctx->device.common.tag = HARDWARE_DEVICE_TAG;
832 ctx->device.common.version = HWC_DEVICE_API_VERSION_1_4;
833 ctx->device.common.module = const_cast<hw_module_t *>(module);
834 ctx->device.common.close = hwc_device_close;
835
Sean Paul9046c642015-06-10 17:27:47 -0400836 ctx->device.dump = hwc_dump;
Sean Paulef8f1f92015-04-29 16:05:23 -0400837 ctx->device.prepare = hwc_prepare;
838 ctx->device.set = hwc_set;
839 ctx->device.eventControl = hwc_event_control;
840 ctx->device.setPowerMode = hwc_set_power_mode;
841 ctx->device.query = hwc_query;
842 ctx->device.registerProcs = hwc_register_procs;
843 ctx->device.getDisplayConfigs = hwc_get_display_configs;
844 ctx->device.getDisplayAttributes = hwc_get_display_attributes;
845 ctx->device.getActiveConfig = hwc_get_active_config;
846 ctx->device.setActiveConfig = hwc_set_active_config;
847 ctx->device.setCursorPositionAsync = NULL; /* TODO: Add cursor */
848
849 *dev = &ctx->device.common;
Zach Reiznerff30b522015-10-28 19:08:45 -0700850 ctx.release();
Sean Paulef8f1f92015-04-29 16:05:23 -0400851
852 return 0;
853}
Sean Paul6a55e9f2015-04-30 15:31:06 -0400854}
Sean Paulef8f1f92015-04-29 16:05:23 -0400855
Sean Paul6a55e9f2015-04-30 15:31:06 -0400856static struct hw_module_methods_t hwc_module_methods = {
857 open : android::hwc_device_open
858};
Sean Paule0c4c3d2015-01-20 16:56:04 -0500859
860hwc_module_t HAL_MODULE_INFO_SYM = {
Sean Paulef8f1f92015-04-29 16:05:23 -0400861 common : {
862 tag : HARDWARE_MODULE_TAG,
863 version_major : 1,
864 version_minor : 0,
865 id : HWC_HARDWARE_MODULE_ID,
866 name : "DRM hwcomposer module",
867 author : "The Android Open Source Project",
868 methods : &hwc_module_methods,
869 dso : NULL,
870 reserved : {0},
871 }
Sean Paule0c4c3d2015-01-20 16:56:04 -0500872};