blob: 391131d16baa3763f64cb66570eb68a8dac91d16 [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 Agopiandb89edc2013-08-02 01:40:18 -070059 const sp<IGraphicBufferProducer>& producer,
Mathias Agopiana4912602012-07-12 14:25:33 -070060 EGLConfig config)
Mathias Agopian92a979a2012-08-02 18:32:23 -070061 : mFlinger(flinger),
Jesse Hallffe1f192013-03-22 15:13:48 -070062 mType(type), mHwcDisplayId(hwcId),
Chih-Wei Huang27e25622013-01-07 17:33:56 +080063 mDisplayToken(displayToken),
Jesse Hall99c7dbb2013-03-14 14:29:29 -070064 mDisplaySurface(displaySurface),
Mathias Agopian92a979a2012-08-02 18:32:23 -070065 mDisplay(EGL_NO_DISPLAY),
66 mSurface(EGL_NO_SURFACE),
67 mContext(EGL_NO_CONTEXT),
Mathias Agopian92a979a2012-08-02 18:32:23 -070068 mDisplayWidth(), mDisplayHeight(), mFormat(),
69 mFlags(),
70 mPageFlipCount(),
Jamie Gennisdd3cb842012-10-19 18:19:11 -070071 mIsSecure(isSecure),
Mathias Agopian92a979a2012-08-02 18:32:23 -070072 mSecureLayerVisible(false),
73 mScreenAcquired(false),
Jesse Hall01e29052013-02-19 16:13:35 -080074 mLayerStack(NO_LAYER_STACK),
Mathias Agopianda8d0a52012-09-04 15:05:38 -070075 mOrientation()
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080076{
Mathias Agopiandb89edc2013-08-02 01:40:18 -070077 mNativeWindow = new Surface(producer);
Jesse Hallffe1f192013-03-22 15:13:48 -070078 ANativeWindow* const window = mNativeWindow.get();
79
80 int format;
81 window->query(window, NATIVE_WINDOW_FORMAT, &format);
82
83 /*
84 * Create our display's surface
85 */
86
87 EGLSurface surface;
88 EGLint w, h;
89 EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
90 surface = eglCreateWindowSurface(display, config, window, NULL);
91 eglQuerySurface(display, surface, EGL_WIDTH, &mDisplayWidth);
92 eglQuerySurface(display, surface, EGL_HEIGHT, &mDisplayHeight);
93
94 mDisplay = display;
95 mSurface = surface;
96 mFormat = format;
97 mPageFlipCount = 0;
98 mViewport.makeInvalid();
99 mFrame.makeInvalid();
100
101 // virtual displays are always considered enabled
102 mScreenAcquired = (mType >= DisplayDevice::DISPLAY_VIRTUAL);
103
104 // Name the display. The name will be replaced shortly if the display
105 // was created with createDisplay().
106 switch (mType) {
107 case DISPLAY_PRIMARY:
108 mDisplayName = "Built-in Screen";
109 break;
110 case DISPLAY_EXTERNAL:
111 mDisplayName = "HDMI Screen";
112 break;
113 default:
114 mDisplayName = "Virtual Screen"; // e.g. Overlay #n
115 break;
116 }
117
118 // initialize the display orientation transform.
119 setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800120}
121
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700122DisplayDevice::~DisplayDevice() {
Mathias Agopian92a979a2012-08-02 18:32:23 -0700123 if (mSurface != EGL_NO_SURFACE) {
124 eglDestroySurface(mDisplay, mSurface);
125 mSurface = EGL_NO_SURFACE;
126 }
127}
128
Jesse Hall02d86562013-03-25 14:43:23 -0700129void DisplayDevice::disconnect(HWComposer& hwc) {
130 if (mHwcDisplayId >= 0) {
131 hwc.disconnectDisplay(mHwcDisplayId);
132 if (mHwcDisplayId >= DISPLAY_VIRTUAL)
133 hwc.freeDisplayId(mHwcDisplayId);
134 mHwcDisplayId = -1;
135 }
136}
137
Mathias Agopian92a979a2012-08-02 18:32:23 -0700138bool DisplayDevice::isValid() const {
139 return mFlinger != NULL;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800140}
141
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700142int DisplayDevice::getWidth() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700143 return mDisplayWidth;
144}
145
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700146int DisplayDevice::getHeight() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700147 return mDisplayHeight;
148}
149
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700150PixelFormat DisplayDevice::getFormat() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700151 return mFormat;
152}
153
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700154EGLSurface DisplayDevice::getEGLSurface() const {
Mathias Agopiana4912602012-07-12 14:25:33 -0700155 return mSurface;
156}
157
Mathias Agopian9e2463e2012-09-21 18:26:16 -0700158void DisplayDevice::setDisplayName(const String8& displayName) {
159 if (!displayName.isEmpty()) {
160 // never override the name with an empty name
161 mDisplayName = displayName;
162 }
163}
164
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700165uint32_t DisplayDevice::getPageFlipCount() const {
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700166 return mPageFlipCount;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800167}
168
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700169status_t DisplayDevice::compositionComplete() const {
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700170 return mDisplaySurface->compositionComplete();
Mathias Agopian74faca22009-09-17 16:18:16 -0700171}
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800172
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700173void DisplayDevice::flip(const Region& dirty) const
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800174{
Mathias Agopian875d8e12013-06-07 15:35:48 -0700175 mFlinger->getRenderEngine().checkErrors();
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800176
177 EGLDisplay dpy = mDisplay;
178 EGLSurface surface = mSurface;
179
Jesse Hall01e29052013-02-19 16:13:35 -0800180#ifdef EGL_ANDROID_swap_rectangle
Mathias Agopiandf3ca302009-05-04 19:29:25 -0700181 if (mFlags & SWAP_RECTANGLE) {
Mathias Agopianb8a55602009-06-26 19:06:36 -0700182 const Region newDirty(dirty.intersect(bounds()));
183 const Rect b(newDirty.getBounds());
Mathias Agopiandf3ca302009-05-04 19:29:25 -0700184 eglSetSwapRectangleANDROID(dpy, surface,
185 b.left, b.top, b.width(), b.height());
Jesse Hall01e29052013-02-19 16:13:35 -0800186 }
Mathias Agopian5e78e092009-06-11 17:19:54 -0700187#endif
Mathias Agopiand8707032012-09-18 01:21:55 -0700188
Mathias Agopian076b1cc2009-04-10 14:24:30 -0700189 mPageFlipCount++;
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800190}
191
Jesse Hall38efe862013-04-06 23:12:29 -0700192status_t DisplayDevice::prepareFrame(const HWComposer& hwc) const {
193 DisplaySurface::CompositionType compositionType;
194 bool haveGles = hwc.hasGlesComposition(mHwcDisplayId);
195 bool haveHwc = hwc.hasHwcComposition(mHwcDisplayId);
196 if (haveGles && haveHwc) {
197 compositionType = DisplaySurface::COMPOSITION_MIXED;
198 } else if (haveGles) {
199 compositionType = DisplaySurface::COMPOSITION_GLES;
200 } else if (haveHwc) {
201 compositionType = DisplaySurface::COMPOSITION_HWC;
202 } else {
203 // Nothing to do -- when turning the screen off we get a frame like
204 // this. Call it a HWC frame since we won't be doing any GLES work but
205 // will do a prepare/set cycle.
206 compositionType = DisplaySurface::COMPOSITION_HWC;
207 }
208 return mDisplaySurface->prepareFrame(compositionType);
209}
210
Mathias Agopianda27af92012-09-13 18:17:13 -0700211void DisplayDevice::swapBuffers(HWComposer& hwc) const {
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700212 // We need to call eglSwapBuffers() unless:
213 // (a) there was no GLES composition this frame, or
214 // (b) we're using a legacy HWC with no framebuffer target support (in
215 // which case HWComposer::commit() handles things).
216 if (hwc.initCheck() != NO_ERROR ||
217 (hwc.hasGlesComposition(mHwcDisplayId) &&
218 hwc.supportsFramebufferTarget())) {
219 EGLBoolean success = eglSwapBuffers(mDisplay, mSurface);
220 if (!success) {
221 EGLint error = eglGetError();
222 if (error == EGL_CONTEXT_LOST ||
223 mType == DisplayDevice::DISPLAY_PRIMARY) {
224 LOG_ALWAYS_FATAL("eglSwapBuffers(%p, %p) failed with 0x%08x",
225 mDisplay, mSurface, error);
226 } else {
227 ALOGE("eglSwapBuffers(%p, %p) failed with 0x%08x",
228 mDisplay, mSurface, error);
Mathias Agopianda27af92012-09-13 18:17:13 -0700229 }
230 }
231 }
Mathias Agopian52e21482012-09-24 18:07:21 -0700232
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700233 status_t result = mDisplaySurface->advanceFrame();
234 if (result != NO_ERROR) {
235 ALOGE("[%s] failed pushing new frame to HWC: %d",
236 mDisplayName.string(), result);
Mathias Agopian32341382012-09-25 19:16:28 -0700237 }
Mathias Agopianda27af92012-09-13 18:17:13 -0700238}
239
240void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const {
241 if (hwc.initCheck() == NO_ERROR) {
Jesse Hall851cfe82013-03-20 13:44:00 -0700242 mDisplaySurface->onFrameCommitted();
Mathias Agopianda27af92012-09-13 18:17:13 -0700243 }
244}
245
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700246uint32_t DisplayDevice::getFlags() const
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -0800247{
248 return mFlags;
249}
250
Mathias Agopian875d8e12013-06-07 15:35:48 -0700251EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, EGLContext ctx) const {
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700252 EGLBoolean result = EGL_TRUE;
Mathias Agopian52bbb1a2012-07-31 19:01:53 -0700253 EGLSurface sur = eglGetCurrentSurface(EGL_DRAW);
Mathias Agopian875d8e12013-06-07 15:35:48 -0700254 if (sur != mSurface) {
255 result = eglMakeCurrent(dpy, mSurface, mSurface, ctx);
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700256 if (result == EGL_TRUE) {
Mathias Agopian875d8e12013-06-07 15:35:48 -0700257 setViewportAndProjection();
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700258 }
Mathias Agopian52bbb1a2012-07-31 19:01:53 -0700259 }
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700260 return result;
Mathias Agopian52bbb1a2012-07-31 19:01:53 -0700261}
262
Mathias Agopian875d8e12013-06-07 15:35:48 -0700263void DisplayDevice::setViewportAndProjection() const {
264 size_t w = mDisplayWidth;
265 size_t h = mDisplayHeight;
266 mFlinger->getRenderEngine().setViewportAndProjection(w, h);
Mathias Agopianbae92d02012-09-28 01:00:47 -0700267}
268
Mathias Agopian1b031492012-06-20 17:51:20 -0700269// ----------------------------------------------------------------------------
270
Mathias Agopian13127d82013-03-05 17:47:11 -0800271void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers) {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700272 mVisibleLayersSortedByZ = layers;
Mathias Agopianef7b9c72012-08-10 15:22:19 -0700273 mSecureLayerVisible = false;
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700274 size_t count = layers.size();
275 for (size_t i=0 ; i<count ; i++) {
Mathias Agopian13127d82013-03-05 17:47:11 -0800276 const sp<Layer>& layer(layers[i]);
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800277 if (layer->isSecure()) {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700278 mSecureLayerVisible = true;
279 }
280 }
281}
282
Mathias Agopian13127d82013-03-05 17:47:11 -0800283const Vector< sp<Layer> >& DisplayDevice::getVisibleLayersSortedByZ() const {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700284 return mVisibleLayersSortedByZ;
285}
286
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700287bool DisplayDevice::getSecureLayerVisible() const {
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700288 return mSecureLayerVisible;
289}
290
Mathias Agopiancd60f992012-08-16 16:28:27 -0700291Region DisplayDevice::getDirtyRegion(bool repaintEverything) const {
292 Region dirty;
Mathias Agopiancd60f992012-08-16 16:28:27 -0700293 if (repaintEverything) {
294 dirty.set(getBounds());
295 } else {
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700296 const Transform& planeTransform(mGlobalTransform);
Mathias Agopiancd60f992012-08-16 16:28:27 -0700297 dirty = planeTransform.transform(this->dirtyRegion);
298 dirty.andSelf(getBounds());
299 }
300 return dirty;
301}
302
Mathias Agopian3b1d2b62012-07-11 13:48:17 -0700303// ----------------------------------------------------------------------------
304
Mathias Agopiand3ee2312012-08-02 14:01:42 -0700305bool DisplayDevice::canDraw() const {
306 return mScreenAcquired;
307}
308
309void DisplayDevice::releaseScreen() const {
310 mScreenAcquired = false;
311}
312
313void DisplayDevice::acquireScreen() const {
314 mScreenAcquired = true;
315}
316
317bool DisplayDevice::isScreenAcquired() const {
318 return mScreenAcquired;
319}
320
321// ----------------------------------------------------------------------------
322
Mathias Agopian28947d72012-08-08 18:51:15 -0700323void DisplayDevice::setLayerStack(uint32_t stack) {
324 mLayerStack = stack;
325 dirtyRegion.set(bounds());
326}
327
328// ----------------------------------------------------------------------------
329
Mathias Agopian0f2f5ff2012-07-31 23:09:07 -0700330status_t DisplayDevice::orientationToTransfrom(
Mathias Agopian1b031492012-06-20 17:51:20 -0700331 int orientation, int w, int h, Transform* tr)
332{
333 uint32_t flags = 0;
334 switch (orientation) {
Mathias Agopian3165cc22012-08-08 19:42:09 -0700335 case DisplayState::eOrientationDefault:
Mathias Agopian1b031492012-06-20 17:51:20 -0700336 flags = Transform::ROT_0;
337 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700338 case DisplayState::eOrientation90:
Mathias Agopian1b031492012-06-20 17:51:20 -0700339 flags = Transform::ROT_90;
340 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700341 case DisplayState::eOrientation180:
Mathias Agopian1b031492012-06-20 17:51:20 -0700342 flags = Transform::ROT_180;
343 break;
Mathias Agopian3165cc22012-08-08 19:42:09 -0700344 case DisplayState::eOrientation270:
Mathias Agopian1b031492012-06-20 17:51:20 -0700345 flags = Transform::ROT_270;
346 break;
347 default:
348 return BAD_VALUE;
349 }
350 tr->set(flags, w, h);
351 return NO_ERROR;
352}
353
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700354void DisplayDevice::setProjection(int orientation,
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800355 const Rect& newViewport, const Rect& newFrame) {
356 Rect viewport(newViewport);
357 Rect frame(newFrame);
358
359 const int w = mDisplayWidth;
360 const int h = mDisplayHeight;
361
362 Transform R;
363 DisplayDevice::orientationToTransfrom(orientation, w, h, &R);
364
365 if (!frame.isValid()) {
366 // the destination frame can be invalid if it has never been set,
367 // in that case we assume the whole display frame.
368 frame = Rect(w, h);
369 }
370
371 if (viewport.isEmpty()) {
372 // viewport can be invalid if it has never been set, in that case
373 // we assume the whole display size.
374 // it's also invalid to have an empty viewport, so we handle that
375 // case in the same way.
376 viewport = Rect(w, h);
377 if (R.getOrientation() & Transform::ROT_90) {
378 // viewport is always specified in the logical orientation
379 // of the display (ie: post-rotation).
380 swap(viewport.right, viewport.bottom);
381 }
382 }
383
384 dirtyRegion.set(getBounds());
385
386 Transform TL, TP, S;
387 float src_width = viewport.width();
388 float src_height = viewport.height();
389 float dst_width = frame.width();
390 float dst_height = frame.height();
391 if (src_width != dst_width || src_height != dst_height) {
392 float sx = dst_width / src_width;
393 float sy = dst_height / src_height;
394 S.set(sx, 0, 0, sy);
395 }
396
397 float src_x = viewport.left;
398 float src_y = viewport.top;
399 float dst_x = frame.left;
400 float dst_y = frame.top;
401 TL.set(-src_x, -src_y);
402 TP.set(dst_x, dst_y);
403
404 // The viewport and frame are both in the logical orientation.
405 // Apply the logical translation, scale to physical size, apply the
406 // physical translation and finally rotate to the physical orientation.
407 mGlobalTransform = R * TP * S * TL;
408
409 const uint8_t type = mGlobalTransform.getType();
410 mNeedsFiltering = (!mGlobalTransform.preserveRects() ||
411 (type >= Transform::SCALE));
412
413 mScissor = mGlobalTransform.transform(viewport);
414 if (mScissor.isEmpty()) {
Mathias Agopian6c7f25a2013-05-09 20:37:10 -0700415 mScissor = getBounds();
Mathias Agopianf5f714a2013-02-26 16:54:05 -0800416 }
417
Mathias Agopianda8d0a52012-09-04 15:05:38 -0700418 mOrientation = orientation;
Mathias Agopian00e8c7a2012-09-04 19:30:46 -0700419 mViewport = viewport;
420 mFrame = frame;
Mathias Agopian1b031492012-06-20 17:51:20 -0700421}
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700422
Mathias Agopian74d211a2013-04-22 16:55:35 +0200423void DisplayDevice::dump(String8& result) const {
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700424 const Transform& tr(mGlobalTransform);
Mathias Agopian74d211a2013-04-22 16:55:35 +0200425 result.appendFormat(
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700426 "+ DisplayDevice: %s\n"
Jesse Hall02d86562013-03-25 14:43:23 -0700427 " type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p, orient=%2d (type=%08x), "
Jamie Gennisdd3cb842012-10-19 18:19:11 -0700428 "flips=%u, isSecure=%d, secureVis=%d, acquired=%d, numLayers=%u\n"
Mathias Agopian766dc492012-10-30 18:08:06 -0700429 " v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], s:[%d,%d,%d,%d],"
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700430 "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 -0700431 mDisplayName.string(), mType, mHwcDisplayId,
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700432 mLayerStack, mDisplayWidth, mDisplayHeight, mNativeWindow.get(),
433 mOrientation, tr.getType(), getPageFlipCount(),
Jamie Gennisdd3cb842012-10-19 18:19:11 -0700434 mIsSecure, mSecureLayerVisible, mScreenAcquired, mVisibleLayersSortedByZ.size(),
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700435 mViewport.left, mViewport.top, mViewport.right, mViewport.bottom,
436 mFrame.left, mFrame.top, mFrame.right, mFrame.bottom,
Mathias Agopian766dc492012-10-30 18:08:06 -0700437 mScissor.left, mScissor.top, mScissor.right, mScissor.bottom,
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700438 tr[0][0], tr[1][0], tr[2][0],
439 tr[0][1], tr[1][1], tr[2][1],
440 tr[0][2], tr[1][2], tr[2][2]);
441
Jesse Hall99c7dbb2013-03-14 14:29:29 -0700442 String8 surfaceDump;
443 mDisplaySurface->dump(surfaceDump);
444 result.append(surfaceDump);
Mathias Agopian1d12d8a2012-09-18 01:38:00 -0700445}