History log of /frameworks/native/services/surfaceflinger/DisplayDevice.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
021623b5a82e44e8dc1a7def1abfed351187593c 16-Apr-2016 Pablo Ceballos <pceballos@google.com> SF: Fix camera orientation on virtual displays

preview always look upright on the device display. This commit changes
the behavior of this flag slightly. Instead of applying the inverse
transform of the current display when compositing, apply the inverse
transform of the primary display to all displays. This assumes that
the camera orientation is tied to the primary display.

Bug 2628180

Change-Id: I0da22423490a93fe943fd59e6c122aa6aaf30b11
40845df1285b387bcbf8f43ac72228eee2606d80 26-Jan-2016 Pablo Ceballos <pceballos@google.com> SF: Add FenceTracker

FenceTracker tracks all fences in SurfaceFlinger. These timestamps
could be used for debugging, profiling, or be exposed to the

Change-Id: I4297a661c0a7530e744168ac7a2a66c4bca92fd5
9e56aa0fdb5f7121b9b975c6c16db103ea4d2fe9 02-Nov-2015 Dan Stoza <stoza@google.com> Switch SurfaceFlinger to HWC 2.0

Enables SurfaceFlinger to speak to version 2.0 of the Hardware Composer
HAL instead of version 1.x (also removing support for the framebuffer
HAL). By default, however, this functionality is disabled. In order to
enable it, USE_HWC2 must be set to true in Android.mk.

Change-Id: I4589e02ac2165236b10ff2f7cb772f87e0d3daab
b5b3563058c178811d434ab6e8c4ead4a519701b 23-Feb-2016 Pablo Ceballos <pceballos@google.com> SF: check secure layers in screenshot message handler

- Instead of checking for the presence of secure layers on the Binder
thread, check in the message handler. Transactions may have occurred
in between when the check is done and when the screen shot message
is handled.

Bug 23757877

Change-Id: Iec74193996ca72c60f86f7c0f0b2a5dea8d19543
646f54105018e99ef4a30ee41f01f7d1ab66c38e 08-Aug-2014 Jesse Hall <jessehall@google.com> surfaceflinger: fix -Wmismatched-tags warnings

warning: struct 'HWComposer' was previously declared as a class

warning: class 'DisplayInfo' was previously declared as a struct

Change-Id: I13db9f8aab3a957ce8ff8d64598dae1807d6fe7e
d4548dd0272f5a4edee1d7ff070458728848b35c 20-Aug-2014 Jesse Hall <jessehall@google.com> am 514e30a9: am c3d1889e: Merge "surfaceflinger: skip composition for empty frames" into klp-modular-dev

* commit '514e30a96cefad109509ce01622fa7f82f3f318c':
surfaceflinger: skip composition for empty frames
b7a0549c983bef103ce07eb3af5905febc6e538e 15-Aug-2014 Jesse Hall <jessehall@google.com> surfaceflinger: skip composition for empty frames

By not committing the results of composition for empty frames, we
avoid spitting out series of black frames for virtual displays that
don't have visible layers. We still draw one black frame when going
from having layers to not having any. In particular, this avoids
having a series of empty frames due to re-compositing the primary
display in the period between creating the virtual display and adding
layers to it.

Bug: 16786752
Change-Id: I7e9b2ed2e407d8d49c7af736b447d4c6181b0ad8
47e45405d1533aa73307014f7bf371e118695cf3 19-Jul-2014 Michael Lentine <mlentine@google.com> Allow for resizing of Virtual Displays.

Modify SurfaceFlinger to use VirtualDisplaySurface in all cases when a virtual
display is used. Add functionality in VirtualDisplaySurface to resize the
buffers aquired in the QueueBufferOutput. Add transaction support in
SurfaceFlinger for resize. Add the modification of the size in DisplayDevice.

Change-Id: Iae7e3556dc06fd18d470adbbd76f7255f6e6dd6b
Tested: None
6c9e34a98a63033b80bd1c24c7aa1304f912f10a 14-Jul-2014 Michael Lentine <mlentine@google.com> Modified SurfaceFlinger to implment setActiveConfig and getActiveConfig.

This can be used to change the current display mode of the device.

Change-Id: Icdc3fb58389b861dc77b68102083da6f7a96eccb
Tested: None
(cherry picked from commit 2651fa94635a96d653038fb389a0dd827338f8d3)
2c9b11f0291210c9b9513a1a0cce6afebd361b3b 25-May-2014 Prashant Malani <pmalani@google.com> surfaceflinger: Replace blank/unblank with setPowerMode

We replace the blank/unblank calls in surfaceFlinger with a more generic
setPowerMode() routine.

Some displays support different power modes (for example, with reduced
color palettes). Depending on the use case we should be able to toggle
these modes, so as to achieve incremental power savings.

Initially, three power modes will be supported:

HWC_POWER_MODE_OFF will correspond to blanking the display, while
HWC_POWER_MODE_NORMAL will correspond to unblanking. HWC_POWER_MODE_DOZE
will put the display into a low power setting, if it is supported in

If such a low power mode is not supported, it should be treated as a
call to set the mode to HWC_POWER_MODE_NORMAL.

As a consequence of adding the mPowerMode field, the mScreenAcquired is
no longer required, and thus references to it are removed and replaced
equivalent references to mPowerMode.

We also add the glue code to connect the services invocation of setting
a power mode and the HAL implementation in HWComposer.

Bug: 13472578
Change-Id: I431595ecf16d2f2c94259272db3dd42f29636204
Signed-off-by: Prashant Malani <pmalani@google.com>
f3c07d4f70f33c2fe5b14ca8fbcdfa4133cc72c7 05-Feb-2014 Dan Stoza <stoza@google.com> Fix virtual display nesting

This fixes the cycling rendering loop caused by nesting virtual
displays by preventing them from recomposing if their contents
haven't changed.

(cherry-pick from master I600365c0fd5d3ad93e04295d26cf9de177ffc79b)

Bug: 12101046
Change-Id: I6182993d53537781aedb522f97a50f06eed8b80f
7143316af216fa92c31a60d4407b707637382da1 05-Feb-2014 Dan Stoza <stoza@google.com> Fix virtual display nesting

This fixes the cycling rendering loop caused by nesting virtual
displays by preventing them from recomposing if their contents
haven't changed.

Bug: 12101046
Change-Id: I600365c0fd5d3ad93e04295d26cf9de177ffc79b
19e872912af66c53a4350afcc333bbafaf6a2294 24-Dec-2013 Jesse Hall <jessehall@google.com> Implement per-display EGLConfig and configless EGLContext

Bug: 12230666
Change-Id: Icca608b108cbdcab9cf01a9236d8cdbda000a836
Signed-off-by: Jesse Hall <jessehall@google.com>
c1c05de415854eb7a13a16b7e22a22de8515123a 18-Sep-2013 Mathias Agopian <mathias@google.com> fix camera API 2.0 orientation

we add a flag to ANativeWindow::setBufferTransform that means
"apply the inverse rotation of the display this buffer is displayed
onto to".

Bug: 10804238
Change-Id: Id2447676271950463e8dbcef1b95935c5c3f32b2
d2cf8c2f07b4285a224acd262e6f052c37dbc0b0 21-Aug-2013 Jesse Hall <jessehall@google.com> Merge "Provide HWC prepare with a valid output buffer" into klp-dev
028dc8f2d72bc7cd4fbe7808781443125a742f78 21-Aug-2013 Jesse Hall <jessehall@google.com> Provide HWC prepare with a valid output buffer

We weren't dequeing and setting the output buffer until just before
set(). This didn't allow HWC to make decisions in prepare() based on
the output buffer format, dimensions, etc.

Now we dequeue the output buffer at the beginning of the composition
loop and provide it to HWC in prepare. In GLES-only rendering, we may
have to cancel the buffer and acquire a new one if GLES requests a
buffer with properties different than the one we already dequeued.

Bug: 10365313
Change-Id: I96b4b0a851920e4334ef05080d58097d46467ab8
4f4f0943489d9113c66ac22b58cfba8c21dfa879 20-Aug-2013 Mathias Agopian <mathias@google.com> SurfaceFlinger now runs in the process's main thread

it used to spawn its own thread and return the main thread
to the binder thread pool -- this was confusing the naming
of things in the kernel.

Bug: 10331839

Change-Id: I2d13a6d73409a38109300fcbe6a04b4c41cb5d00
9e663de4fe1dcc872373ee530c60a375624671c3 16-Aug-2013 Jesse Hall <jessehall@google.com> Use new HWC display type/count constants.

Change-Id: I774d0c68906ac6dc69268f708c30a6b0868b8816
ff866e7642033d8f68c11eaa16d0afcecf0bab5b 07-Aug-2013 Jesse Hall <jessehall@google.com> Merge "Set the swap interval of virtual display surfaces to 0"
f460f55c84b0a75de749b8a784059f5ff423ed93 07-Aug-2013 Jesse Hall <jessehall@google.com> Set the swap interval of virtual display surfaces to 0

This prevents slow/malicious virtual display consumers from
backpressuring SurfaceFlinger and preventing it from updating other

Bug: 10193714
Change-Id: I3e877d97202628d2d9abea24b66576f38299c14d
db89edc94bd2a78226b407f9f7261e202e7fa325 02-Aug-2013 Mathias Agopian <mathias@google.com> All consumers now take an IGraphicBufferConsumer instead of a BufferQueue

this means they only have access to the consumer end of
the interface. we had a lot of code that assumed consumers
where holding a BufferQueue (i.e.: both ends), so most of
this change is untangling in fix that

Bug: 9265647
Change-Id: Ic2e2596ee14c7535f51bf26d9a897a0fc036d22c
38efe86d9459cf5c96a24a34cc5cbf31fdba7e19 07-Apr-2013 Jesse Hall <jessehall@google.com> Rewrite VirtualDisplaySurface

The previous implementation assumed that the HWC could read and write
the same buffer on frames that involved both GLES and HWC composition.
It turns out some hardware can't do this. The new implementation
maintains a scratch buffer pool to use on these mixed frames, but on
GLES-only or HWC-only frames still does composition directly into the
output buffer.

Bug: 8384764
Change-Id: I7a3addb34fad9bfcbdabbb8b635083e10223df69
875d8e1323536e16dcfc90c9674d7ad32116a69a 08-Jun-2013 Mathias Agopian <mathias@google.com> Refactor SF. Move all GL operations in their own class.

this is the first step to add support for GLES 2.x, this
change breaks the dependency of SF on GLES 1.x by moving
all operation into their own class.

Bug: 8679321

Change-Id: I0d2741eca2cefe67dfd9cf837cac10c4d126928b
74d211ae26a0257c6075a823812e40b55aa1e653 22-Apr-2013 Mathias Agopian <mathias@google.com> clean-up/simplify all dump() APIs

remove the scratch buffer parameter and use
String8::appendFormat() instead.

Change-Id: Ib96c91617c8e7292de87433d15cf6232b7d591b0
02d86567d95b99e1142941ed7ec23a4465822813 25-Mar-2013 Jesse Hall <jessehall@google.com> Clean up HWC state when releasing a DisplayDevice

DisplayDevices can be released when DisplayManager removes them from
the display list, or (for virtual displays) when the surface is set to
NULL. We were only cleaning up HWC resources associated with the
display in the first case.

Bug: 8384764
Change-Id: Id3d226dd7178fbe6d0a2ac4e2660b864ee073de3
ffe1f19ca9707f84cb9fdb06209bf36cd8c2ef0a 22-Mar-2013 Jesse Hall <jessehall@google.com> Fix virtual displays for HWC<=1.1

If we're using a HWC that doesn't support virtual displays, or we have
more virtual displays than HWC supports concurrently, the
VirtualDisplaySurface should simply be a passthrough from source
(GLES) to sink.

This change also tries to distinguish between display types and HWC
display IDs a little better, though there's more to do here. Probably
needs a higher-level rethink; it's too error-prone now.

Bug: 8446838
Change-Id: I708d2cf262ec30177042304f174ca5b8da701df1
99c7dbb24994df2f3e175f7b25dd2c9dd92a72f0 14-Mar-2013 Jesse Hall <jessehall@google.com> Add DisplaySurface abstraction

DisplayDevice now has a DisplaySurface instead of using
FramebufferSurface directly. FramebufferSurface implements
DisplaySurface, and so does the new VirtualDisplaySurface class.
DisplayDevice now always has a surface, not just for virtual displays.

In this change VirtualDisplaySurface is just a stub; buffers still go
directly from GLES to the final consumer.

Bug: 8384764
Change-Id: I57cb668edbc6c37bfebda90b9222d435bf589f37
13127d8921356dff794250e04208c3ed60b3a3df 06-Mar-2013 Mathias Agopian <mathias@google.com> Get rid of LayerBase.

The functionality of LayerBase and Layer is folded
into Layer. There wasn't a need for this abstraction

Change-Id: I66511c08cc3d89009ba4deabf47e26cd4cfeaefb
eabe3140f11e515639e7a70a1286dd6af7352c9e 05-Mar-2013 Jesse Hall <jessehall@google.com> Merge "Init displays to null layer stack" into jb-mr2-dev
01e29054e672301e4adbbca15b3562a59a20f267 20-Feb-2013 Jesse Hall <jessehall@google.com> Init displays to null layer stack

When a display is added, initialize it to use an empty layer stack, so
if it is somehow visible it will show black. It will be assigned the
real layer stack -- along with a projection and other properties -- by
window manager soon. Normally a display remains blanked until window
manager has decided what to show on it, but for HDMI connected at boot
that isn't currently the case.

Bug: 7258935
Change-Id: Ic9bb25f7a9b8d9d3772b097ab1d6fa03bc8780a1
f5f714aa188884098aaecbe39d0bc61b40311c0d 27-Feb-2013 Mathias Agopian <mathias@google.com> apply the projection's viewport to the visibleregion passed to hwc

each desplay's projection's viewport essentially clips each layer,
so this should be reflected in the visibleregion passed to
h/w composer.

DisplayDevice getViewport and getFrame are now guaranteed to return
valid Rects.

Change-Id: I4c25f34fb26af10179eb26d429ca6c384c671e91
766dc49c17dda977bf7b93a5fd8da41c0b737611 31-Oct-2012 Mathias Agopian <mathias@google.com> rework a bit how we scissor the display

the scissor rect is now computed once by DisplayDevice
and is combined with the "undefined" region so that
the letter-boxed area of the screen get cleared in

Bug: 7149437
Change-Id: Id2f30516a5786f32eace7f876ff32028f954f357
dd3cb84cfbe8068790c6233b5829fae9c4a0ee93 20-Oct-2012 Jamie Gennis <jgennis@google.com> SurfaceFlinger: add support for secure displays

This change adds support for displays that are not allowed to display surfaces
with the eSecure flag set. All non-virtual displays are considered secure,
while virtual displays have their secure-ness specified at creation time.

Bug: 7368436
Change-Id: I81ad535d2d1e5a7ff78269017e85b111f0098500
bae92d0d605e99a14731add4f11b72413b2835e5 28-Sep-2012 Mathias Agopian <mathias@google.com> reset GL viewport and project when caputring the screen

Bug: 7241739
Change-Id: I3bb5214b070384de9be2026647865c6c236a4331
9e2463e71796964cfaa06bf09a880875ac3537bc 22-Sep-2012 Mathias Agopian <mathias@google.com> add/remove displays properly on hotplug events

Bug: 7191563
Change-Id: I8f0fbf3b29658c9479443141798e6f288a1f2d52
eba8c688f633f3f3f1b75c2bc64faf799dd2b5f2 20-Sep-2012 Mathias Agopian <mathias@google.com> calculate wether we filter on a per-display basis

Change-Id: I79d80b432b20b3d02428da19add464ac1e2b9378
1d12d8a8e61163b35cf42c51c558a67138014e82 18-Sep-2012 Mathias Agopian <mathias@google.com> improve logging of external displays

Change-Id: I041aebb7fc655aeca98bbf698d15e05d7c12cac9
8dfa92fef9759a881e96ee58d59875d35023aab9 18-Sep-2012 Andy McFadden <fadden@android.com> Plumb display name into SurfaceFlinger

The Surface createDisplay() call takes a display name for debugging.
This change carries it through SurfaceFlinger and displays it in
the "dumpsys SurfaceFlinger" output.

Bug 7058158

Change-Id: I79f3474a8656ff1beb7b478e0dbf2c5de666118a
da27af9832a0170f1fc40ef3f21371c4d30d21b3 14-Sep-2012 Mathias Agopian <mathias@google.com> add support hwc 1.1

Bug: 7124069

Change-Id: I53d705105c4ad8954d3f50ee4f4c8b7ec936b871
00e8c7a88a5b9c4104a71013a713acd3e4d3b77b 05-Sep-2012 Mathias Agopian <mathias@google.com> display projection API now has a single function instead of 3

Change-Id: I9bf46d372b77d547486d4bbe6f1953ec8c65e98f
da8d0a5c0cf9d41915d3b106cad4aaec3e767c11 05-Sep-2012 Mathias Agopian <mathias@google.com> implement display viewport and frame

note: viewport clipping is not implemented yet

Change-Id: I7fde7c4de075d409d95c48bb20ba8ee017f6f00a
3ee454a7bef8bd3d1c9cdd9d17108eb80ebadf2a 28-Aug-2012 Mathias Agopian <mathias@google.com> Eradicate DisplayID.

DisplayDevices are now keyed of the wp<IBinder> the client uses.
DisplayID has now become DisplayType which is just used to identify
physical displays (as opposed to virtual displays such as wifi displays).

Change-Id: I0c5968f2c902dcd699a7e0afacf833ff070c12ea
f435863467ab407f2a482604beed5fa6f0144c62 23-Aug-2012 Mathias Agopian <mathias@google.com> teach HWC about multiple displays

Change-Id: I5e72a83d419a729835cb0e1ec45557b4d3fb56b1
e60b0687c8d49871d0c8786cabe6851f7a7783b5 22-Aug-2012 Mathias Agopian <mathias@google.com> HWComposer now has its own concept of display IDs

HWComposer can now create IDs representing a display
it can deal with. IDs MAIN and HDMI are reserved.
SurfaceFlinger associate HWComposer IDs with a
DisplayDevice and uses that when it talks to HWComposer.

A DisplayDevice doesn't have to have a HWComposer ID,
in that case it just can't use h/w composer composition.

Change-Id: Iec3d7ac92e0c22bf975052ae2847402f58bade71
cd60f99aba9e750700a967db30b74a29145739cf 17-Aug-2012 Mathias Agopian <mathias@google.com> refactor compositing code to avoid multiple eglMakeCurrent() calls

when multiple displays are connected, we ended-up having to
call eglMakeCurrent() twice per display due to a limitation
in EGL. this fixes that.

Change-Id: I11e4584df50f8c24bbecee74e37b28b3ee031d2f
8b736f138cfd9b239a2c7073347a13c489534ae1 14-Aug-2012 Mathias Agopian <mathias@google.com> xdpi / ydpi were reported as 0

Bug: 6975723
Change-Id: Ia7fa37ec11e2308804f5034959a37e508d292d31
e57f292595bec48f65c8088b00ff6beea01217e9 10-Aug-2012 Mathias Agopian <mathias@google.com> make multi-display more real

- displays are represented by a binder on the client side
- c++ clients can now create and modify displays

Change-Id: I203ea5b4beae0819d742ec5171c27568f4e8354b
1e26087493ac0e7d7dc6dea8ad85cfef08b3271f 09-Aug-2012 Mathias Agopian <mathias@google.com> Add a display parameter to HWComposer where needed

- also replace C casts with C++ casts
- only the interface is changed, HWComposer still doesn't
fully handle multiple displays

Change-Id: I48eb89bff2edb76bf1d4d41f46802b9b2a7166a8
28947d7fbf9f486539322e8e12dd057568e180c2 09-Aug-2012 Mathias Agopian <mathias@google.com> now able to set the layer stack on a DisplayDevice

Change-Id: Ia9691cf221b9444c243eb468d9e276a30e600b6b
1a4d883dcc1725892bfb5c28dec255a233186524 03-Aug-2012 Jamie Gennis <jgennis@google.com> surfaceflinger: refactor FrambufferSurface

This change refactors the FramebufferSurface class to inherit from the new
ConsumerBase class.

Bug: 6620200
Change-Id: I46ec942ddb019658e3c5e79465548b171b2261f2
028a7572c81f91e4039b694cde1f55fdb3e483c7 05-Aug-2012 Mathias Agopian <mathias@google.com> DisplayDevice doesn't need weak pointers or polymorphism

let's use a LightRefBase for now.

Change-Id: Ida068fa902343a8f89ffb6d34c2cd4627ab43c6c
4297734c1156fd8ede7e9c61b1e439f9e1c18cd9 05-Aug-2012 Mathias Agopian <mathias@google.com> turn DisplayDevice into a reference-counted object

it's safer this way because this object owns an
EGLSurface which cannot be easily reference-counted.

it also gives us the ability to sub-class it, which
we might want to do soon.

Change-Id: I07358bb052dc5a13b4f2196b2c2b6e6e94c4bb4f
d8552d796cbcb9a89711fc8f97b34838da5cbdb7 05-Aug-2012 Mathias Agopian <mathias@google.com> DisplayDevice only needs ANativeWindow not SurfaceTextureClient

Change-Id: Ib5be5af8bede435c8d5d9fabf586d28d0e74c2cb
888c822c4cb6976aab9256c58bae9e17e3e55c5c 05-Aug-2012 Mathias Agopian <mathias@google.com> remove a dependency of DisplayDevice on the refresh rate

this remove a dependency (not all) on FramebufferSurface

Change-Id: Ie07ce70760cdcedfb41b5b41bea8da45637bf474
92a979a92c34b7de609ce2b1662c73bb8a2728b9 03-Aug-2012 Mathias Agopian <mathias@google.com> We now have a real list of displays.

displays can be dynamically added or removed, and the
list is part of the SF's transaction.

Change-Id: I4186ea39f1317c0e7c044f869004017738968fab
d3ee231eddce0b69ec5e35188dbd0f4a2c3b9ac3 02-Aug-2012 Mathias Agopian <mathias@google.com> cleanups in preparation of bigger changes

- fix typo drawForSreenshot misspelled
- get rid of DisplayDeviceBase
- removed unused or unneeded code
- always pass a DisplayDevice to Layer methods that are called
on a per-display basis (to make it clear that this could be
called more than once per composition).

Change-Id: Id948b7e09fe5c06db0e42d40d6ed75dd095c7f44
0f2f5ff75b7b48ceb64270655ee6b62d09bf4d00 01-Aug-2012 Mathias Agopian <mathias@google.com> rename DisplayHardware to DisplayDevice

Change-Id: I3f7250cd914e0da4f9ec2c9403587bbe12f3cc62