now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.
noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.
Change-Id: I210413d4c8c0998dae05c8620ebfc895d3e6233d
Generally we never want to lock a buffer for write access if it is at
the "head" on the surfaceflinger side. The only exception (1) is when
the buffer is not currently in use AND there is at least one queued
buffer -- in which case, SurfaceFlinger will never use said buffer
anymore, because on the next composition around, it will be able to
retire the first queued buffer.
The logic above relies on SurfaceFlinger always retiring
and locking a buffer before composition -- unfortunately this
didn't happen during a screenshot.
This could leave us in a situation where a buffer is locked by the
application for write, and used by SurfaceFlinger for texturing,
causing a hang.
Here, we fix this issue by never assuming the exception (1), it was
intended as an optimization allowing ANativeWindow::lockBuffer() to
return sooner and was justified when most of SF composition was
done in software. The actual buffer locking is now ensured by
gralloc. We could have handled screenshots in a similar way to
a regular composition, but it could have caused glitches on screen,
essentially, taking a screenshot could cause to skip a frame.
Change-Id: I1f226b1ebdf6918439b687c2723955d55b842c55
when we validate the surface there, most errors are in fact allowed
because it is legal to cancel a buffer after a surface has been
destroyed (for instance). in that case make sure to not log
error messages as they are very confusing.
Change-Id: Iecdfbaf6d9ee5da54d56cd7ea7a0d430c30934b0
This change fixes a horrible hack that I did to allow application
processes to create GraphicBuffer objects by making a binder call to
SurfaceFlinger. This change introduces a new binder interface
specifically for doing this, and does it in such a way that
SurfaceFlinger will maintain a reference to the buffers until the app is
done with them.
Change-Id: Icb240397c6c206d7f69124c1497a829f051cb49b
This change adds a new binder method to the ISurfaceComposer interface.
This IPC is intended to allow SurfaceFlinger clients to allocate gralloc
buffers using SurfaceFlinger as a proxy to gralloc.
Change-Id: Ide9fc283aec5da6268ba62cfed0c3319a50b640d
this is to allow applications to change the format of a surface's
buffer, and have it reflected in EGL; which is needed for
EGLConfig validation.
Change-Id: Iee074c30ad765881e2409c1d37450b05e561c44d
Merge commit '5bfa3a34eaef759c3ec4def76f646eb1c0bf997f'
* commit '5bfa3a34eaef759c3ec4def76f646eb1c0bf997f':
implement part of [3094280] New animation for screen on and screen off
Merge commit '9a12a3c8d4bb20042cf69e07d268e3a04ac71f96'
* commit '9a12a3c8d4bb20042cf69e07d268e3a04ac71f96':
Remove dead code, and make the animation a setting.
turn off the electron beam
- Register buffers with Gralloc when unflattening a GraphicBuffer (rather than
doing it in the Surface class).
- Add support for a GraphicBuffer that wraps an android_native_window_t*.
Change-Id: I029ac086111bbac800e5ca37eb505f558b718cd8
Merge commit 'ff04e97faf75c435e453d4c1caf7eeac8b9c1ceb'
* commit 'ff04e97faf75c435e453d4c1caf7eeac8b9c1ceb':
fix [2835280] Add support for cancelling buffers to ANativeWindow
There is a new ANativeWindow::cancelBuffer() API that can be used to
cancel any dequeued buffer, BEFORE it's been enqueued. The buffer is
returned to the list of availlable buffers. dequeue and cancel are not
mutually thread safe, they must be called from the same thread or
external synchronization must be used.
Change-Id: I86cc7985bace8b6a93ad2c75d2bef5c3c2cb4d61
the core screenshot function now can capture the screen at any lower resolution
performing bilinear filtering.
we also now have some client code to interface with the screenshot service.
it's now possible to request a screenshot at a lower resolution.
Change-Id: I33689bba98507ab928d0898b21596d0d2fe4b953
the core screenshot function now can capture the screen at any lower resolution
performing bilinear filtering.
we also now have some client code to interface with the screenshot service.
it's now possible to request a screenshot at a lower resolution.
Change-Id: I5a3b0e431421800e3aad601d9af8f94adffbc71f
Merge commit '495ad4f22096aa172d025c16c25497e7dad8f2bd'
* commit '495ad4f22096aa172d025c16c25497e7dad8f2bd':
simple test app for screen capture API
add support for [1974164] Be able to take a screen shot on the device
screenshots are taken using ISurfaceComposer::captureScreen() which returns
the size of the screenshot and an IMemoryHeap containing the data.
screenshots have limitations:
- they will always fail if a secure window is up on screen
- require GL_OES_framebuffer_object extension
- in some situation, video planes won't been captured
Change-Id: I741c68a2d2984fb139039301c3349e6780e2cd58
There are 16 events logged in the event log:
SF_APP_DEQUEUE_BEFORE
SF_APP_DEQUEUE_AFTER
SF_APP_LOCK_BEFORE
SF_APP_LOCK_AFTER
SF_APP_QUEUE
SF_REPAINT
SF_COMPOSITION_COMPLETE
SF_UNLOCK_CLIENTS
SF_SWAP_BUFFERS
SF_REPAINT_DONE
SF_FB_POST_BEFORE
SF_FB_POST_AFTER
SF_FB_DEQUEUE_BEFORE
SF_FB_DEQUEUE_AFTER
SF_FB_LOCK_BEFORE
SF_FB_LOCK_AFTER
all events log the buffer conserned and a timestamp in microseconds.
by default the logging is not enabled, to turn it on:
adb shell service call SurfaceFlinger 1006 i31 1
adb shell setprop debug.graphic_log 1
The effect is immediate in SurfaceFlinger, but applications need to be
restarted.
Change-Id: Ifc2e31f7aed072d9a7dede20ff2ce59231edbec1
Merge commit 'bc4389edfbb5777aec1a9af7863b2ca3ade2fa64'
* commit 'bc4389edfbb5777aec1a9af7863b2ca3ade2fa64':
fix [2931513] Add support for setting the orientation of an ANativeWindow
This change makes the camera HAL interface take an ANativeWindow interface from
which all the camera preview buffers will be allocated. The framework code
running in application processes now passes a Surface object rather than an
ISurface to the camera server via Binder when setting the preview surface. The
camera server then forwards that Surface object (which implements the
ANativeWindow interface) to the camera HAL, which uses it to communicate with
SurfaceFlinger to allocate the camera preview buffers.
Change-Id: Ie438f721559cd7de5e4f848a26d96360dda07b5f
this situation happened when the last buffer needed to be resized
(or allocated, the first time). the assumption was that the buffer
was in use by SF itself as the current buffer (obviously, this
assumption made no sense when the buffer had never been allocated, btw).
the system would wait until some other buffer became the "front" buffer.
we fix this problem by entirely removing the requirement that the
buffer being resized cannot be the front buffer. instead, we just
allocate a new buffer and replace the front buffer by the new one.
the downside is that this uses more memory (an extra buffer) for a
brief amount of time while the old buffer is being reallocated and
before it has actually been replaced.
Change-Id: I022e4621209474ceb1c671b23deb4188eaaa7285
This change adds a process-global cache of previously deserialized Surface
objects so that if a Surface object wrapping the same ISurface gets received
again the same Surface can be used. This is important because the 'tail'
pointer in the SharedBufferClient is stored only on the client side, and needs
to be the same for all the Surface objects wrapping an ISurface instance. This
solves the problem by making there only be one Surface object wrapping an
ISurface per process.
Change-Id: I4bf0b8787885c56277622fca053022d2bb638902
Not yet hooked up to anything in the NDK, but requires renaming
the existing android_native_window_t type everywhere.
Change-Id: Iffee6ea39c93b8b34e20fb69e4d2c7c837e5ea2e
Surfaces can now be parcelized and sent to remote
processes. When a surface crosses a process
boundary, it looses its connection with the
current process and gets attached to the new one.
Change-Id: I39c7b055bcd3ea1162ef2718d3d4b866bf7c81c0
this is called for each relayout() and used to create a full Surface (cpp)
which in turn did some heavy work (including an IPC with surfaceflinger),
most of the time to destroy it immediatelly when the returned surface
(the one in the parcel) was the same.
we now more intelligentely read from the parcel and construct the new
object only if needed.
Change-Id: Idfd40d9ac96ffc6d4ae5fd99bcc0773e131e2267
SurfaceComposerClient now only exist on the WindowManager side,
the client side uses the new SurfaceClient class, which only
exposes what a client needs.
also instead of keeping mappings from IBinder to SurfaceComposerClients
we have a SurfaceClient per Surface (referring to the same IBinder), this
is made possible by the fact that SurfaceClient is very light.
Change-Id: I6a1f7015424f07871632a25ed6a502c55abfcfa6
the new native_window_set_buffers_geometry allows
to specify a size and format for all buffers to be
dequeued. the buffer will be scalled to the window's
size.
Change-Id: I2c378b85c88d29cdd827a5f319d5c704d79ba381
this method can be used to change the number of buffers
associated to a native window. the default is two.
Change-Id: I608b959e6b29d77f95edb23c31dc9b099a758f2f
this change introduces R/W locks in the right places.
on the server-side, it guarantees that setBufferCount()
is synchronized with "retire" and "resize".
on the client-side, it guarantees that setBufferCount()
is synchronized with "dequeue", "lockbuffer" and "queue"