Commit Graph

57 Commits

Author SHA1 Message Date
Saurabh Shah a887c19994 SF: Add support for all flips of panel mount
Add support for all flips of panel mount, H, V, HV (180). Property
persist.panel.mountflip can be set to 1 for H-Flip, 2 for V-Flip,
3 for HV-Flip (180 / inverse mount).

Change-Id: Ide7b8378ad6a423e5d7335fedc27d480a25b53ae
CRs-fixed: 990622
2016-07-20 04:16:16 -07:00
Steve Kondik af9298115c Revert "surfaceflinger: Consolidate display orientation compensation hooks"
* This is completely breaking graphics.

This reverts commit f8e2372ad7.

Change-Id: I1d694f4228199891a191ce3fb924cec71a6100f0
2015-11-10 23:58:46 +01:00
Ricardo Cerqueira f8e2372ad7 surfaceflinger: Consolidate display orientation compensation hooks
Dedupe rotation calculation code and make rotation a statically
available property in the DisplayDevice

Change-Id: Ic517ab0d2c05026cd6fa46d664aab7926be17b62
2015-11-10 10:56:31 -08:00
Ramkumar Radhakrishnan cfd539bf4a sf: This is a combination of following changes.
Author: Prabhanjan Kandula<pkandula@codeaurora.org>
SF: Add support for inverse mounted panels.

Add 180 rotation in SF to account for inverse mounted panels.
The framework will be unaffected and use policies for a 0 mounted
panel. SF changes the global transform and silently induces the H,V
flips. Similar flips are added to screenshots as well.

CRs-Fixed: 894147

Change-Id: I6e9576ee734ee85097491eaa1e8e94cfb3731e0f

Author: Ramkumar Radhakrishnan<ramkumar@codeaurora.org>
SF: Clear visible region of layer appropriately.

Clear visible region of layer having layer stack id different than
the display layer stack id to ensure that the layer won't be present
on the wrong display layer list.

Change-Id: I59289fea63ec7a2451d4715cfe7926ba34fdb8e3

Change-Id: I5ad08a6013aa173d621ee80c766a6e19e1086a35
2015-10-06 03:22:26 -06:00
Jesse Hall 646f541050 surfaceflinger: fix -Wmismatched-tags warnings
warning: struct 'HWComposer' was previously declared as a class
[-Wmismatched-tags]

warning: class 'DisplayInfo' was previously declared as a struct
[-Wmismatched-tags]

Change-Id: I13db9f8aab3a957ce8ff8d64598dae1807d6fe7e
2014-09-04 10:07:28 -07:00
Jesse Hall d4548dd027 am 514e30a9: am c3d1889e: Merge "surfaceflinger: skip composition for empty frames" into klp-modular-dev
* commit '514e30a96cefad109509ce01622fa7f82f3f318c':
  surfaceflinger: skip composition for empty frames
2014-08-20 20:02:02 +00:00
Jesse Hall b7a0549c98 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
2014-08-19 22:15:43 -07:00
Michael Lentine 47e45405d1 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
2014-07-30 14:36:25 -07:00
Michael Lentine 6c9e34a98a 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 2651fa9463)
2014-07-29 16:56:30 +00:00
Prashant Malani 2c9b11f029 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
- HWC_POWER_MODE_DOZE
- HWC_POWER_MODE_NORMAL

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
hardware.

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>
2014-06-05 16:35:52 -07:00
Dan Stoza f3c07d4f70 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
2014-04-22 16:19:02 -07:00
Dan Stoza 7143316af2 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
2014-02-04 16:46:54 -08:00
Jesse Hall 19e872912a Implement per-display EGLConfig and configless EGLContext
Bug: 12230666
Change-Id: Icca608b108cbdcab9cf01a9236d8cdbda000a836
Signed-off-by: Jesse Hall <jessehall@google.com>
2013-12-23 21:53:39 -08:00
Mathias Agopian c1c05de415 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
2013-09-17 23:45:22 -07:00
Jesse Hall d2cf8c2f07 Merge "Provide HWC prepare with a valid output buffer" into klp-dev 2013-08-21 14:38:51 +00:00
Jesse Hall 028dc8f2d7 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
2013-08-20 16:35:32 -07:00
Mathias Agopian 4f4f094348 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
2013-08-20 11:16:45 -07:00
Jesse Hall 9e663de4fe Use new HWC display type/count constants.
Change-Id: I774d0c68906ac6dc69268f708c30a6b0868b8816
2013-08-16 14:28:37 -07:00
Jesse Hall ff866e7642 Merge "Set the swap interval of virtual display surfaces to 0" 2013-08-07 15:23:00 +00:00
Jesse Hall f460f55c84 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
displays.

Bug: 10193714
Change-Id: I3e877d97202628d2d9abea24b66576f38299c14d
2013-08-06 19:32:02 -07:00
Mathias Agopian db89edc94b 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
2013-08-06 20:05:36 +00:00
Jesse Hall 38efe86d94 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
2013-07-15 13:59:41 -07:00
Mathias Agopian 875d8e1323 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
2013-07-03 14:39:27 -07:00
Mathias Agopian 74d211ae26 clean-up/simplify all dump() APIs
remove the scratch buffer parameter and use
String8::appendFormat() instead.

Change-Id: Ib96c91617c8e7292de87433d15cf6232b7d591b0
2013-04-22 21:51:28 +02:00
Jesse Hall 02d86567d9 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
2013-03-27 14:58:09 -07:00
Jesse Hall ffe1f19ca9 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
2013-03-22 15:27:58 -07:00
Jesse Hall 99c7dbb249 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
2013-03-18 14:21:16 -07:00
Mathias Agopian 13127d8921 Get rid of LayerBase.
The functionality of LayerBase and Layer is folded
into Layer. There wasn't a need for this abstraction
anymore.

Change-Id: I66511c08cc3d89009ba4deabf47e26cd4cfeaefb
2013-03-05 19:52:30 -08:00
Jesse Hall eabe3140f1 Merge "Init displays to null layer stack" into jb-mr2-dev 2013-03-05 01:04:54 +00:00
Jesse Hall 01e29054e6 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
2013-02-28 21:05:30 -08:00
Mathias Agopian f5f714aa18 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
2013-02-28 18:43:04 -08:00
Mathias Agopian 766dc49c17 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
drawWormhole.

Bug: 7149437
Change-Id: Id2f30516a5786f32eace7f876ff32028f954f357
2012-10-31 14:22:51 -07:00
Jamie Gennis dd3cb84cfb 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
2012-10-22 13:41:21 -07:00
Mathias Agopian bae92d0d60 reset GL viewport and project when caputring the screen
Bug: 7241739
Change-Id: I3bb5214b070384de9be2026647865c6c236a4331
2012-09-28 13:34:26 -07:00
Mathias Agopian 9e2463e717 add/remove displays properly on hotplug events
Bug: 7191563
Change-Id: I8f0fbf3b29658c9479443141798e6f288a1f2d52
2012-09-21 18:26:16 -07:00
Mathias Agopian eba8c688f6 calculate wether we filter on a per-display basis
Change-Id: I79d80b432b20b3d02428da19add464ac1e2b9378
2012-09-20 17:13:58 -07:00
Mathias Agopian 1d12d8a8e6 improve logging of external displays
Change-Id: I041aebb7fc655aeca98bbf698d15e05d7c12cac9
2012-09-18 14:42:32 -07:00
Andy McFadden 8dfa92fef9 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
2012-09-18 09:20:23 -07:00
Mathias Agopian da27af9832 add support hwc 1.1
Bug: 7124069

Change-Id: I53d705105c4ad8954d3f50ee4f4c8b7ec936b871
2012-09-17 18:57:53 -07:00
Mathias Agopian 00e8c7a88a display projection API now has a single function instead of 3
Change-Id: I9bf46d372b77d547486d4bbe6f1953ec8c65e98f
2012-09-04 19:30:46 -07:00
Mathias Agopian da8d0a5c0c implement display viewport and frame
note: viewport clipping is not implemented yet

Change-Id: I7fde7c4de075d409d95c48bb20ba8ee017f6f00a
2012-09-04 16:59:06 -07:00
Mathias Agopian 3ee454a7be 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
2012-08-27 17:43:43 -07:00
Mathias Agopian f435863467 teach HWC about multiple displays
Change-Id: I5e72a83d419a729835cb0e1ec45557b4d3fb56b1
2012-08-23 17:41:38 -07:00
Mathias Agopian e60b0687c8 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
2012-08-23 16:03:37 -07:00
Mathias Agopian cd60f99aba 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
2012-08-16 20:58:58 -07:00
Mathias Agopian 8b736f138c xdpi / ydpi were reported as 0
Bug: 6975723
Change-Id: Ia7fa37ec11e2308804f5034959a37e508d292d31
2012-08-13 17:54:26 -07:00
Mathias Agopian e57f292595 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
2012-08-10 17:32:33 -07:00
Mathias Agopian 1e26087493 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
2012-08-10 13:18:24 -07:00
Mathias Agopian 28947d7fbf now able to set the layer stack on a DisplayDevice
Change-Id: Ia9691cf221b9444c243eb468d9e276a30e600b6b
2012-08-10 13:18:23 -07:00
Jamie Gennis 1a4d883dcc surfaceflinger: refactor FrambufferSurface
This change refactors the FramebufferSurface class to inherit from the new
ConsumerBase class.

Bug: 6620200
Change-Id: I46ec942ddb019658e3c5e79465548b171b2261f2
2012-08-06 18:55:01 -07:00