Commit Graph

61 Commits

Author SHA1 Message Date
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 83cafffeac Stop using default value for Surface producerControlledByApp parameter
Bug: 10785749
Change-Id: Ifbf9340e5eabe621a69e990ec3e05ac51f8db66a
2013-09-16 15:39:55 -07:00
Mathias Agopian 931bda1c47 reset the gl viewport at each frame for each display
Bug: 10097128, 9506003
Change-Id: Ie0403a631e339a9134216224f3366f46ece58b53
2013-08-28 18:11:46 -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
Andy McFadden 22a99f0fc2 Fix virtual displays for HWC 1.0
We weren't swapping the buffers.

Bug 10366404

Change-Id: I43eb7648231bedf24899da6fc0d9acc09e0b047e
2013-08-20 16:04:47 -07:00
Mathias Agopian 3f84483382 SurfaceFlinger now uses GLES 2.x when available
Bug: 8679321

Change-Id: I2b152d01fb4e2de2ea9fe87f1ddbd6826d7520d7
2013-08-13 16:07:45 -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 6c7f25afb7 reformat Rect.{cpp|h}
Change-Id: I45b1f6646541a1abacce1e70df00a770e47b820e
2013-05-10 18:03:31 -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 851cfe8342 Isolate knowledge that fb target == output buffer
HWComposer didn't allow the virtual display output buffer to be set
directly, instead it always used the framebuffer target buffer.
DisplayDevice was only providing the framebuffer release fence to
DisplaySurfaces after a commit.

This change fixes both of these, so both HWComposer and DisplayDevice
should continue to work if VirtualDisplaySurface changes to use
separate framebuffer and output buffers. It's also more correct since
VirtualDisplaySurface uses the correct release fence when queueing the
buffer to the sink.

Bug: 8384764
Change-Id: I95c71e8d4f67705e23f122259ec8dd5dbce70dcf
2013-03-22 15:27:57 -07:00
Jesse Hall 13f01cbdbd Pass sp<Fence>s around instead of file descriptors
Change-Id: Iac70584a2207940730e8f803a543e4e9a4000c47
2013-03-22 09:56:58 -07:00
Jesse Hall 7414965606 Release virtual display buffer immediately after HWC set
Previously we only queued a virtual display buffer to the sink when
the next frame was about to be displayed. This may delay the "last"
frame of an animation indefinitely. Now we queue the buffer as soon as
HWC set() returns and gives us the release fence.

Bug: 8384764
Change-Id: I3844a188e0f6ef6ff28f3e11477cfa063a924b1a
2013-03-20 11:16:55 -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
Jesse Hall 7adb0f8a9f Minor cleanups/fixes before virtual display refactoring
None of these should change behavior, except for removing some
incorrect log messages when using a virtual display.

- HWComposer::getAndResetReleaseFenceFd() checks the HWC version, so
  no need to do that in the DisplayDevice::onSwapBuffersCompleted().
  However, it should check that mFramebufferSurface is not NULL like
  it is for virtual displays.
- Comment that FramebufferSurface::dump() overrides the non-virtual
  ConsumerBase::dump(), and fix it so the right thing happens
  regardless of the static type of the pointer/reference the callee
  has. FramebufferSurface::dump() could be removed right now, but I'd
  need to bring it back in a later change.
- Use the right enum for validating display type ids.
- Don't try to send hotplug events for virtual displays.
- Mark virtual displays as connected so HWComposer::prepare() doesn't
  think something is wrong when it gets a non-NULL layer list.
- Remove unused FramebufferSurface methods.

Bug: 8384764
Change-Id: Id28a2f9be86b45f4bb7915fdf7752157035f4294
2013-03-18 14:16:02 -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 e3c697fb92 Refactoring: Rename SurfaceTextureClient to Surface
Change-Id: Ibed34175ae273608393aaa5f0a7df207dc40d709
2013-02-14 19:19:05 -08:00
Jesse Hall 7dd35a165d am fc866eb8: am 845ed8fd: Merge "DisplayDevice: initialize mDisplayToken correctly"
* commit 'fc866eb8423cd1d720683946f7d102547718b6c9':
  DisplayDevice: initialize mDisplayToken correctly
2013-01-14 14:41:43 -08:00
Chih-Wei Huang 27e2562868 DisplayDevice: initialize mDisplayToken correctly
mDisplayToken should be initialized by displayToken.

Change-Id: I0a5fec1f1732200a32d10b1575239dceffe6dee4
2013-01-07 17:36:19 +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 b8fc00bfb4 fix typo that prevented proper loging of EGL error code
needed for investigating 7309949

Bug: 7309949
Change-Id: If29a5c08d0e87f46b44ba2e1030be61cb4d1403b
2012-10-09 16:44:48 -07:00
Mathias Agopian 135e5899f7 save/restore viewport properly when taking screenshot
Bug: 7241739
Change-Id: Iba8b9ffc75ab47fbc56169e65da26d96850a9297
2012-09-30 16:43:20 -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 32341381c9 only abort when errors happen on the main display
Bug: 7232690
Change-Id: I2c4b35a82f131da26deea738ef294e100e536d15
2012-09-25 19:16:28 -07:00
Mathias Agopian 52e21483fa handle EGL errors
for now we just restart the runtime.

bug: 7225248
Change-Id: I7638ffe82075a4db9e7e6f9e35cf48afcb5a387a
2012-09-24 18:07:21 -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 d56eff2f49 fix typo in DisplayDevice logs
Change-Id: I593ef674f12073bd9d690946447031394ef9044e
2012-09-19 16:25:29 -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 d870703d55 fix external displays
we were not calling eglSwapBuffers() on external displays
because they can't use HWC which caused us to think they
didn't have GLES composition.

Change-Id: I6cef4ae40b138412d2e6f2acda33c9d222b03a83
2012-09-18 01:21:55 -07:00
Mathias Agopian da27af9832 add support hwc 1.1
Bug: 7124069

Change-Id: I53d705105c4ad8954d3f50ee4f4c8b7ec936b871
2012-09-17 18:57:53 -07:00
Jeff Brown 6e220a6ce6 Fix display projections when translated.
There are two different translations to apply in the logical
orientation, one before scaling and one after.
So translate, scale, translate then rotate.

Bug: 7139798
Change-Id: I0726991cadb62988390e77503dbbaed54f07bfe3
2012-09-13 19:24:43 -07:00
Jesse Hall 6360ec42d4 Fix display projection transforms
Bug: 7139798
Change-Id: I61aafe99180d85563c6880d16bc367fce80e6022
2012-09-12 13:49:10 -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 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 5f20e2d446 reimplement wifi display hack with new external display SF framework
fix a few bugs with external displays

- HWComposer doesn't really handle multiple displays yet
  so there is a lot of ugliness there

- We also need to make sure that external displays are not
  blanked by default

- due to some EGL limitations surfaces being swapped need
  to be current

Change-Id: I82bff05b43bcebd8da863c7c76b4edbc3bc223a9
2012-08-16 20:58:58 -07:00