blob: 0e3c7c650212d418371524fc42ec304bb4c0957e [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 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
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080017#include <stdlib.h>
18#include <stdio.h>
19#include <string.h>
20#include <math.h>
21
22#include <cutils/properties.h>
23
Mathias Agopian076b1cc2009-04-10 14:24:30 -070024#include <utils/RefBase.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080025#include <utils/Log.h>
26
Mathias Agopianc666cae2012-07-25 18:56:13 -070027#include <ui/DisplayInfo.h>
Mathias Agopian076b1cc2009-04-10 14:24:30 -070028#include <ui/PixelFormat.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080029
Mathias Agopiane3c697f2013-02-14 17:11:02 -080030#include <gui/Surface.h>
Jamie Gennis1a4d8832012-08-02 20:11:05 -070031
Mathias Agopian076b1cc2009-04-10 14:24:30 -070032#include <hardware/gralloc.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080033
Jesse Hall99c7dbb2013-03-14 14:29:29 -070034#include "DisplayHardware/DisplaySurface.h"
Mathias Agopian1b031492012-06-20 17:51:20 -070035#include "DisplayHardware/HWComposer.h"
Mathias Agopian875d8e12013-06-07 15:35:48 -070036#include "RenderEngine/RenderEngine.h"
Mathias Agopian1b031492012-06-20 17:51:20 -070037
Mathias Agopianda8d0a52012-09-04 15:05:38 -070038#include "clz.h"
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -070039#include "DisplayDevice.h"
Mathias Agopianc7d14e22011-08-01 16:32:21 -070040#include "SurfaceFlinger.h"
Mathias Agopian13127d82013-03-05 17:47:11 -080041#include "Layer.h"
Mathias Agopian1f7bec62010-06-25 18:02:21 -070042
Mathias Agopiana4912602012-07-12 14:25:33 -070043// ----------------------------------------------------------------------------
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080044using namespace android;
Mathias Agopiana4912602012-07-12 14:25:33 -070045// ----------------------------------------------------------------------------
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080046
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080047/*
48 * Initialize the display to the specified values.
49 *
50 */
51
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -070052DisplayDevice::DisplayDevice(
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080053 const sp<SurfaceFlinger>& flinger,
Jamie Gennisdd3cb842012-10-19 18:19:11 -070054 DisplayType type,
Jesse Hallffe1f192013-03-22 15:13:48 -070055 int32_t hwcId,
Jamie Gennisdd3cb842012-10-19 18:19:11 -070056 bool isSecure,
57 const wp<IBinder>& displayToken,
Jesse Hall99c7dbb2013-03-14 14:29:29 -070058 const sp<DisplaySurface>& displaySurface,
Mathias Agopiana4912602012-07-12 14:25:33 -070059 EGLConfig config)
Mathias Agopian92a979a2012-08-02 18:32:23 -070060 : mFlinger(flinger),
Jesse Hallffe1f192013-03-22 15:13:48 -070061 mType(type), mHwcDisplayId(hwcId),
Chih-Wei Huang27e25622013-01-07 17:33:56 +080062 mDisplayToken(displayToken),
Jesse Hall99c7dbb2013-03-14 14:29:29 -070063 mDisplaySurface(displaySurface),
Mathias Agopian92a979a2012-08-02 18:32:23 -070064 mDisplay(EGL_NO_DISPLAY),
65 mSurface(EGL_NO_SURFACE),
Mathias Agopian92a979a2012-08-02 18:32:23 -070066 mDisplayWidth(), mDisplayHeight(), mFormat(),
67 mFlags(),
68 mPageFlipCount(),
Jamie Gennisdd3cb842012-10-19 18:19:11 -070069 mIsSecure(isSecure),
Mathias Agopian92a979a2012-08-02 18:32:23 -070070 mSecureLayerVisible(false),
71 mScreenAcquired(false),
Jesse Hall01e29052013-02-19 16:13:35 -080072 mLayerStack(NO_LAYER_STACK),
Mathias Agopianda8d0a52012-09-04 15:05:38 -070073 mOrientation()
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080074{
Jesse Hall99c7dbb2013-03-14 14:29:29 -070075 mNativeWindow = new Surface(mDisplaySurface->getIGraphicBufferProducer());
Jesse Hallffe1f192013-03-22 15:13:48 -070076 ANativeWindow* const window = mNativeWindow.get();
77
78 int format;
79 window->query(window, NATIVE_WINDOW_FORMAT, &format);
80
Jesse Hallf460f552013-08-06 17:08:53 -070081 // Make sure that composition can never be stalled by a virtual display
82 // consumer that isn't processing buffers fast enough. We have to do this
83 // in two places:
84 // * Here, in case the display is composed entirely by HWC.
85 // * In makeCurrent(), using eglSwapInterval. Some EGL drivers set the
86 // window's swap interval in eglMakeCurrent, so they'll override the
87 // interval we set here.
88 if (mType >= DisplayDevice::DISPLAY_VIRTUAL)
89 window->setSwapInterval(window, 0);
90
Jesse Hallffe1f192013-03-22 15:13:48 -070091 /*
92 * Create our display's surface
93 */
94
95 EGLSurface surface;
96 EGLint w, h;
97 EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
98 surface = eglCreateWindowSurface(display, config, window, NULL);
99 eglQuerySurface(display, surface, EGL_WIDTH, &mDisplayWidth);
100 eglQuerySurface(display, surface, EGL_HEIGHT, &mDisplayHeight);
101
102 mDisplay = display;
103 mSurface = surface;
104 mFormat = format;
105 mPageFlipCount = 0;
106 mViewport.makeInvalid();
107 mFrame.makeInvalid();
108
109 // virtual displays are always considered enabled
110 mScreenAcquired = (mType >= DisplayDevice::DISPLAY_VIRTUAL);
111
112 // Name the display. The name will be replaced shortly if the display
113 // was created with createDisplay().
114 switch (mType) {
115 case DISPLAY_PRIMARY:
116 mDisplayName = "Built-in Screen";
117 break;
118 case DISPLAY_EXTERNAL:
119 mDisplayName = "HDMI Screen";
120 break;
121 default:
122 mDisplayName = "Virtual Screen"; // e.g. Overlay #n
123 break;
124 }
125
126 // initialize the display orientation transform.
127 setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800128}
129
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700130DisplayDevice::~DisplayDevice() {
Mathias Agopian92a979a2012-08-02 18:32:23 -0700131 if (mSurface != EGL_NO_SURFACE) {
132 eglDestroySurface(mDisplay, mSurface);
133 mSurface = EGL_NO_SURFACE;
134 }
135}
136
Jesse Hall02d86562013-03-25 14:43:23 -0700137void DisplayDevice::disconnect(HWComposer& hwc) {
138 if (mHwcDisplayId >= 0) {
139 hwc.disconnectDisplay(mHwcDisplayId);
140 if (mHwcDisplayId >= DISPLAY_VIRTUAL)
141 hwc.freeDisplayId(mHwcDisplayId);
142 mHwcDisplayId = -1;
143 }
144}
145
Mathias Agopian92a979a2012-08-02 18:32:23 -0700146bool DisplayDevice::isValid() const {
147 return mFlinger != NULL;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800148}
149
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700150int DisplayDevice::getWidth() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700151 return mDisplayWidth;
152}
153
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700154int DisplayDevice::getHeight() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700155 return mDisplayHeight;
156}
157
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700158PixelFormat DisplayDevice::getFormat() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700159 return mFormat;
160}
161
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700162EGLSurface DisplayDevice::getEGLSurface() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700163 return mSurface;
164}
165
Mathias Agopian9e2463e2012-09-21 18:26:16 -0700166void DisplayDevice::setDisplayName(const String8& displayName) {
167 if (!displayName.isEmpty()) {
168 // never override the name with an empty name
169 mDisplayName = displayName;
170 }
171}
172
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700173uint32_t DisplayDevice::getPageFlipCount() const {
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700174 return mPageFlipCount;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800175}
176
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700177status_t DisplayDevice::compositionComplete() const {
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700178 return mDisplaySurface->compositionComplete();
Mathias Agopian74faca22009-09-17 16:18:16 -0700179}
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800180
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700181void DisplayDevice::flip(const Region& dirty) const
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800182{
Mathias Agopian875d8e12013-06-07 15:35:48 -0700183 mFlinger->getRenderEngine().checkErrors();
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800184
185 EGLDisplay dpy = mDisplay;
186 EGLSurface surface = mSurface;
187
Jesse Hall01e29052013-02-19 16:13:35 -0800188#ifdef EGL_ANDROID_swap_rectangle
Mathias Agopiandf3ca302009-05-04 19:29:25 -0700189 if (mFlags & SWAP_RECTANGLE) {
Mathias Agopianb8a55602009-06-26 19:06:36 -0700190 const Region newDirty(dirty.intersect(bounds()));
191 const Rect b(newDirty.getBounds());
Mathias Agopiandf3ca302009-05-04 19:29:25 -0700192 eglSetSwapRectangleANDROID(dpy, surface,
193 b.left, b.top, b.width(), b.height());
Jesse Hall01e29052013-02-19 16:13:35 -0800194 }
Mathias Agopian5e78e092009-06-11 17:19:54 -0700195#endif
Mathias Agopiand8707032012-09-18 01:21:55 -0700196
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700197 mPageFlipCount++;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800198}
199
Jesse Hall38efe862013-04-06 23:12:29 -0700200status_t DisplayDevice::prepareFrame(const HWComposer& hwc) const {
201 DisplaySurface::CompositionType compositionType;
202 bool haveGles = hwc.hasGlesComposition(mHwcDisplayId);
203 bool haveHwc = hwc.hasHwcComposition(mHwcDisplayId);
204 if (haveGles && haveHwc) {
205 compositionType = DisplaySurface::COMPOSITION_MIXED;
206 } else if (haveGles) {
207 compositionType = DisplaySurface::COMPOSITION_GLES;
208 } else if (haveHwc) {
209 compositionType = DisplaySurface::COMPOSITION_HWC;
210 } else {
211 // Nothing to do -- when turning the screen off we get a frame like
212 // this. Call it a HWC frame since we won't be doing any GLES work but
213 // will do a prepare/set cycle.
214 compositionType = DisplaySurface::COMPOSITION_HWC;
215 }
216 return mDisplaySurface->prepareFrame(compositionType);
217}
218
Mathias Agopianda27af92012-09-13 18:17:13 -0700219void DisplayDevice::swapBuffers(HWComposer& hwc) const {
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700220 // We need to call eglSwapBuffers() unless:
221 // (a) there was no GLES composition this frame, or
222 // (b) we're using a legacy HWC with no framebuffer target support (in
223 // which case HWComposer::commit() handles things).
224 if (hwc.initCheck() != NO_ERROR ||
225 (hwc.hasGlesComposition(mHwcDisplayId) &&
226 hwc.supportsFramebufferTarget())) {
227 EGLBoolean success = eglSwapBuffers(mDisplay, mSurface);
228 if (!success) {
229 EGLint error = eglGetError();
230 if (error == EGL_CONTEXT_LOST ||
231 mType == DisplayDevice::DISPLAY_PRIMARY) {
232 LOG_ALWAYS_FATAL("eglSwapBuffers(%p, %p) failed with 0x%08x",
233 mDisplay, mSurface, error);
234 } else {
235 ALOGE("eglSwapBuffers(%p, %p) failed with 0x%08x",
236 mDisplay, mSurface, error);
Mathias Agopianda27af92012-09-13 18:17:13 -0700237 }
238 }
239 }
Mathias Agopian52e21482012-09-24 18:07:21 -0700240
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700241 status_t result = mDisplaySurface->advanceFrame();
242 if (result != NO_ERROR) {
243 ALOGE("[%s] failed pushing new frame to HWC: %d",
244 mDisplayName.string(), result);
Mathias Agopian32341382012-09-25 19:16:28 -0700245 }
Mathias Agopianda27af92012-09-13 18:17:13 -0700246}
247
248void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const {
249 if (hwc.initCheck() == NO_ERROR) {
Jesse Hall851cfe82013-03-20 13:44:00 -0700250 mDisplaySurface->onFrameCommitted();
Mathias Agopianda27af92012-09-13 18:17:13 -0700251 }
252}
253
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700254uint32_t DisplayDevice::getFlags() const
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800255{
256 return mFlags;
257}
258
Mathias Agopian875d8e12013-06-07 15:35:48 -0700259EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, EGLContext ctx) const {
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700260 EGLBoolean result = EGL_TRUE;
Mathias Agopian52bbb1a2012-07-31 19:01:53 -0700261 EGLSurface sur = eglGetCurrentSurface(EGL_DRAW);
Mathias Agopian875d8e12013-06-07 15:35:48 -0700262 if (sur != mSurface) {
263 result = eglMakeCurrent(dpy, mSurface, mSurface, ctx);
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700264 if (result == EGL_TRUE) {
Jesse Hallf460f552013-08-06 17:08:53 -0700265 if (mType >= DisplayDevice::DISPLAY_VIRTUAL)
266 eglSwapInterval(dpy, 0);
Mathias Agopian875d8e12013-06-07 15:35:48 -0700267 setViewportAndProjection();
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700268 }
Mathias Agopian52bbb1a2012-07-31 19:01:53 -0700269 }
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700270 return result;
Mathias Agopian52bbb1a2012-07-31 19:01:53 -0700271}
272
Mathias Agopian875d8e12013-06-07 15:35:48 -0700273void DisplayDevice::setViewportAndProjection() const {
274 size_t w = mDisplayWidth;
275 size_t h = mDisplayHeight;
276 mFlinger->getRenderEngine().setViewportAndProjection(w, h);
Mathias Agopianbae92d02012-09-28 01:00:47 -0700277}
278
Mathias Agopian1b031492012-06-20 17:51:20 -0700279// ----------------------------------------------------------------------------
280
Mathias Agopian13127d82013-03-05 17:47:11 -0800281void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers) {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700282 mVisibleLayersSortedByZ = layers;
Mathias Agopianef7b9c72012-08-10 15:22:19 -0700283 mSecureLayerVisible = false;
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700284 size_t count = layers.size();
285 for (size_t i=0 ; i<count ; i++) {
Mathias Agopian13127d82013-03-05 17:47:11 -0800286 const sp<Layer>& layer(layers[i]);
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800287 if (layer->isSecure()) {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700288 mSecureLayerVisible = true;
289 }
290 }
291}
292
Mathias Agopian13127d82013-03-05 17:47:11 -0800293const Vector< sp<Layer> >& DisplayDevice::getVisibleLayersSortedByZ() const {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700294 return mVisibleLayersSortedByZ;
295}
296
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700297bool DisplayDevice::getSecureLayerVisible() const {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700298 return mSecureLayerVisible;
299}
300
Mathias Agopiancd60f992012-08-16 16:28:27 -0700301Region DisplayDevice::getDirtyRegion(bool repaintEverything) const {
302 Region dirty;
Mathias Agopiancd60f992012-08-16 16:28:27 -0700303 if (repaintEverything) {
304 dirty.set(getBounds());
305 } else {
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700306 const Transform& planeTransform(mGlobalTransform);
Mathias Agopiancd60f992012-08-16 16:28:27 -0700307 dirty = planeTransform.transform(this->dirtyRegion);
308 dirty.andSelf(getBounds());
309 }
310 return dirty;
311}
312
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700313// ----------------------------------------------------------------------------
314
Mathias Agopiand3ee2312012-08-02 14:01:42 -0700315bool DisplayDevice::canDraw() const {
316 return mScreenAcquired;
317}
318
319void DisplayDevice::releaseScreen() const {
320 mScreenAcquired = false;
321}
322
323void DisplayDevice::acquireScreen() const {
324 mScreenAcquired = true;
325}
326
327bool DisplayDevice::isScreenAcquired() const {
328 return mScreenAcquired;
329}
330
331// ----------------------------------------------------------------------------
332
Mathias Agopian28947d72012-08-08 18:51:15 -0700333void DisplayDevice::setLayerStack(uint32_t stack) {
334 mLayerStack = stack;
335 dirtyRegion.set(bounds());
336}
337
338// ----------------------------------------------------------------------------
339
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700340status_t DisplayDevice::orientationToTransfrom(
Mathias Agopian1b031492012-06-20 17:51:20 -0700341 int orientation, int w, int h, Transform* tr)
342{
343 uint32_t flags = 0;
344 switch (orientation) {
Mathias Agopian3165cc22012-08-08 19:42:09 -0700345 case DisplayState::eOrientationDefault:
Mathias Agopian1b031492012-06-20 17:51:20 -0700346 flags = Transform::ROT_0;
347 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700348 case DisplayState::eOrientation90:
Mathias Agopian1b031492012-06-20 17:51:20 -0700349 flags = Transform::ROT_90;
350 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700351 case DisplayState::eOrientation180:
Mathias Agopian1b031492012-06-20 17:51:20 -0700352 flags = Transform::ROT_180;
353 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700354 case DisplayState::eOrientation270:
Mathias Agopian1b031492012-06-20 17:51:20 -0700355 flags = Transform::ROT_270;
356 break;
357 default:
358 return BAD_VALUE;
359 }
360 tr->set(flags, w, h);
361 return NO_ERROR;
362}
363
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700364void DisplayDevice::setProjection(int orientation,
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800365 const Rect& newViewport, const Rect& newFrame) {
366 Rect viewport(newViewport);
367 Rect frame(newFrame);
368
369 const int w = mDisplayWidth;
370 const int h = mDisplayHeight;
371
372 Transform R;
373 DisplayDevice::orientationToTransfrom(orientation, w, h, &R);
374
375 if (!frame.isValid()) {
376 // the destination frame can be invalid if it has never been set,
377 // in that case we assume the whole display frame.
378 frame = Rect(w, h);
379 }
380
381 if (viewport.isEmpty()) {
382 // viewport can be invalid if it has never been set, in that case
383 // we assume the whole display size.
384 // it's also invalid to have an empty viewport, so we handle that
385 // case in the same way.
386 viewport = Rect(w, h);
387 if (R.getOrientation() & Transform::ROT_90) {
388 // viewport is always specified in the logical orientation
389 // of the display (ie: post-rotation).
390 swap(viewport.right, viewport.bottom);
391 }
392 }
393
394 dirtyRegion.set(getBounds());
395
396 Transform TL, TP, S;
397 float src_width = viewport.width();
398 float src_height = viewport.height();
399 float dst_width = frame.width();
400 float dst_height = frame.height();
401 if (src_width != dst_width || src_height != dst_height) {
402 float sx = dst_width / src_width;
403 float sy = dst_height / src_height;
404 S.set(sx, 0, 0, sy);
405 }
406
407 float src_x = viewport.left;
408 float src_y = viewport.top;
409 float dst_x = frame.left;
410 float dst_y = frame.top;
411 TL.set(-src_x, -src_y);
412 TP.set(dst_x, dst_y);
413
414 // The viewport and frame are both in the logical orientation.
415 // Apply the logical translation, scale to physical size, apply the
416 // physical translation and finally rotate to the physical orientation.
417 mGlobalTransform = R * TP * S * TL;
418
419 const uint8_t type = mGlobalTransform.getType();
420 mNeedsFiltering = (!mGlobalTransform.preserveRects() ||
421 (type >= Transform::SCALE));
422
423 mScissor = mGlobalTransform.transform(viewport);
424 if (mScissor.isEmpty()) {
Mathias Agopian6c7f25a2013-05-09 20:37:10 -0700425 mScissor = getBounds();
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800426 }
427
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700428 mOrientation = orientation;
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700429 mViewport = viewport;
430 mFrame = frame;
Mathias Agopian1b031492012-06-20 17:51:20 -0700431}
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700432
Mathias Agopian74d211a2013-04-22 16:55:35 +0200433void DisplayDevice::dump(String8& result) const {
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700434 const Transform& tr(mGlobalTransform);
Mathias Agopian74d211a2013-04-22 16:55:35 +0200435 result.appendFormat(
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700436 "+ DisplayDevice: %s\n"
Jesse Hall02d86562013-03-25 14:43:23 -0700437 " type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p, orient=%2d (type=%08x), "
Jamie Gennisdd3cb842012-10-19 18:19:11 -0700438 "flips=%u, isSecure=%d, secureVis=%d, acquired=%d, numLayers=%u\n"
Mathias Agopian766dc492012-10-30 18:08:06 -0700439 " v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], s:[%d,%d,%d,%d],"
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700440 "transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n",
Jesse Hall02d86562013-03-25 14:43:23 -0700441 mDisplayName.string(), mType, mHwcDisplayId,
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700442 mLayerStack, mDisplayWidth, mDisplayHeight, mNativeWindow.get(),
443 mOrientation, tr.getType(), getPageFlipCount(),
Jamie Gennisdd3cb842012-10-19 18:19:11 -0700444 mIsSecure, mSecureLayerVisible, mScreenAcquired, mVisibleLayersSortedByZ.size(),
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700445 mViewport.left, mViewport.top, mViewport.right, mViewport.bottom,
446 mFrame.left, mFrame.top, mFrame.right, mFrame.bottom,
Mathias Agopian766dc492012-10-30 18:08:06 -0700447 mScissor.left, mScissor.top, mScissor.right, mScissor.bottom,
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700448 tr[0][0], tr[1][0], tr[2][0],
449 tr[0][1], tr[1][1], tr[2][1],
450 tr[0][2], tr[1][2], tr[2][2]);
451
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700452 String8 surfaceDump;
453 mDisplaySurface->dump(surfaceDump);
454 result.append(surfaceDump);
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700455}