we now make sure to drain the buffer queue on disconnect.
this happens only when in synchrnous mode. in async mode
we clear all buffers except the head of the queue.
for extra safety we also catch the null pointer
in updateTexImage (which should never happen) and return
an error.
Bug: 5111008
Change-Id: I5174a6ecbb0de641c6510ef56a611cbb4e9e1f59
this simplifies the code a bit and also makes sure
we reevaluate mAbandoned and mConnectedApi each time
we come back from waiting on mDequeueCondition
Change-Id: I1f8538b62ad321b51ed79d953b700036daba796d
- also log a warning when freeAllBuffers is called with a non empty buffer queue
- rename freeAllBuffers to freeAllBuffersLocked
Change-Id: Idb71fdcf233b9ccae62d5a2a7c3c4bad2501d877
This fixes an issue where the Surface readFromParcel code was leaving
unread parcel data in the case where the Surface was re-used from the
sCachedSurfaces cache. On a cache miss the code is creating a new
Surface from the remainder of the parcel data. On a hit that data was
being left unread, so anything that parcels a Surface followed by
additional arguments may end up reading the wrong values.
Change-Id: I25365159d945c125bd1fcc9f17e39a4f00aece55
the first time a surface was connected, the values returned
by query NATIVE_WINDOW_DEFAULT_{WIDTH|HEIGHT} and
NATIVE_WINDOW_TRANSFORM_HINT were wrong until a call
to queueBuffer was performed.
Bug: 5137366, 5121607
Change-Id: I7ac6b5b0daa876638f6bed7c20f286a6e6d984f6
the original connect/disconnect hooks are deprecated
and replace by api_connect/api_disconnect. the original
hooks are no no-ops.
api_connect/api_disconnect is now only called from the
android framework.
Bug: 5057915
Change-Id: I8ca64cd1acd6cabf915bf54689ec2e5f6dfa495a
This change relaxes an error check in SurfaceTexture::setBufferCount to
allow clients to explicitly set a buffer count of 2. The clients that
will do this are camera and video decode. Previously it was thought
that for those clients we would always use async mode, which requires a
minimum of 3 buffers. However, we now believe that for some devices it
may make sense to use synchronous mode (with 2 buffers) to reduce memory
usage.
Bug: 5088418
Change-Id: I620a0ef75075745be9d6c8219e0246aaf33ba950
The Surface is already using SurfaceTexture internally and it is parcelable. This
is intended to replace and phase out ParcelSurfaceTexture in favor of creating a
new Surface.java object from an existing SurfaceTexture.
Change-Id: I8e2dd86614523da6abed6403e1d705a68fa19fdf
This change removes support for conditionally using the GL_TEXTURE_2D
target for SurfaceTexture textures with RGB buffers. It also enables
and fixes the RGB-based SurfaceTexture tests.
Change-Id: I9a251a981cf66af6b048b2e4c3fe7231e4774f4d
This change adds the 'abandon' method to the SurfaceTexture C++ class.
This method may be used to put the SurfaceTexture in an abandoned state,
causing all ISurfaceTexture methods to fail.
Change-Id: Ibd261f7b73f44e2bec36a8508bf92113cfb7cf95
This change adds a test to ensure that a GL driver that's blocking on a
call to dequeueBuffer does not block other GL threads from rendering and
queueing buffers.
Change-Id: Ifdd234effc534b6a9cf8522ca87f64da5bb0bbd6
- fixed uninitialized variable
- set hint to indentity when transform is too complex
- make sure FrameBufferNativeWindow doesn't fail on needed perform commands
Bug: 4487161
Change-Id: I7cb2b0869b72404732eca7cb2d145ff669e2ed9b
This change removes the SurfaceTexture::getAllocator method, as it's no
longer needed. Proper refcounting of the Gralloc buffers is now handled
by the IGraphicBufferAlloc binder marshalling code.
Change-Id: I5cffa6ebfc1bc5828fb7ce0e0a5b2f55cd8479da
This makes ANativeWindow_lock/ANativeWindow_unlockAndPost work
with ANativeWindows implemented by Surface and SurfaceTextureClient.
Also, Surface now inherits directly from SurfaceTextureClient.
Bug: 5003724
Change-Id: I9f285877c7bae9a262e9a7af91c2bae78804b2ef
This change makes the ANativeWindow connect and disconnect calls result
in an IPC to the SurfaceTexture object. This will allow us to prevent
multiple simultaneous connections from different processes.
Change-Id: Id9aa1003b1335b96ca6bd4a1f5a67aa433d42efb
This change fixes a couple different issues in the
SurfaceTextureGLToGLTest test fixture:
- incorrect use of conditions
- move logging after the locks are acquired
- call the parent class's TearDown method
- clean up the SurfaceTexture before eglTerminate gets called
Change-Id: I6960e5ab7f144225f01a2089d3f849c99fed0b38
This change adds support to SurfaceTextureClient for the new enum values
that can be passed to the ANativeWindow connect call.
Change-Id: I8c15418909e43a15673a9b22a5eb40df6923b273
This change fixes how the Android EGL layer overrides the size and
format of an ANativeWindow in eglCreateWindowSurface. The new behavior
is to leave the size untouched when overriding the format. The previous
behavior was to reset the ANativeWindow to use the default size set by
the ANativeWindow implementation.
It also adds two new 'perform' methods to the ANativeWindow interface:
set_buffers_dimensions and set_buffers_format, and redefines the
behavior of set_buffers_geometry to be the combination of these two new
methods.
Additionally, this change adds an error check for the return value of
the new native_window_set_buffers_format call, which required adding a
(stub) handler for to FramebufferNativeWindow.
Change-Id: I805c7ccd8d4730dfb132d10d8bc3fb058a0b9df1
This change enables the following four SurfaceTextures tests:
UpdateTexImageBeforeFrameFinishedWorks
UpdateTexImageAfterFrameFinishedWorks
RepeatedUpdateTexImageBeforeFrameFinishedWorks
RepeatedUpdateTexImageAfterFrameFinishedWorks
Change-Id: I7632630bc97873e50d4a765ffc44a86f16ae62f1
- put the test window at the front most screen position
- use RGBA_8888 which is a mandatory format
- handle devices that don't support the protected usage flags
Bug: 4950464
Change-Id: I0005fb667cfe094e5978816e2924b294c5ef817e
This change adds a test to verify that proper synchronization is done
when using SurfaceTexture to use CPU generated images as OpenGL ES
textures in 'synchronous mode'. Synchronous mode is particularly tricky
because SurfaceTexture will allow the buffer that's currently bound to
the GL texture to be dequeued. We rely on Gralloc's lock function to
block until this buffer is no longer being used by the OpenGL ES.
Change-Id: I1c4e37f3e9d60ab9a0905a90a1f5060fda8e485c
This change moves the point at which queued buffers get consumed to
after any error checks that could cause updateTexImage to fail. This
way, if updateTexImage returns an error the buffer remains queued.
This change alters the conditions under which the onFrameAvailable
callback gets called by the C++ SurfaceTexture class. The new behavior
is to call the callback whenever a frame gets queued that will be
visible to the buffer consumer. This means that buffers queued in
synchronous mode always trigger the callback, as those buffers will
remain pending until they are consumed. Buffers queued in asynchronous
mode will only trigger the callback if there was not previously an
unconsumed buffer pending.
The new behavior means that a consumer should perform a draw operation
exactly once for every onFrameAvailable call that it recieves. This
change also modifies SurfaceFlinger and the SurfaceTexture JNI to
support of the new behavior.
Change-Id: I8b2c6e00961d3d58b11c6af50b555b6e4c5f5b40
This change makes the SurfaceTexture GL tests use a large (512x512)
framebuffer. The tests now use glViewport to render to a region of the
framebuffer with a size matching that of the texture being drawn. The
Npot test pixel checks must be changed because now the rendered region
is the same size as the texture.
Change-Id: Icc41803189c25e33ba1da7d2470720f0a11f3e4b
This change adds a NULL check when searching the slot list in
SurfaceTextureClient for the slot corresponding to a buffer being
queued or canceled.
Bug: 4645023
Change-Id: I806cbc1e34da118ea33a83c4f25ce8193ba1c3ad
This change increases the Surface layer used for displaying the test
results so that the tests will be visible over other windows in the
system.
Change-Id: I47f147f8743ff2a39d57d551811668371202bd31
Add the concept of synchronous dequeueBuffer in SurfaceTexture
Implement {Surface|SurfaceTextureClient}::setSwapInterval()
Add SurfaceTexture logging
fix onFrameAvailable
This change adds a test to verify that querying the format of a
SurfaceTextureClient immediately after setting it returns the correct
result. The test is currently disabled because it does not pass.
Change-Id: I5bddb39c5bf96d6104624094383d410ed913e9f3
This change disables the UpdateTexImageAfterFrameFinishedWorks test
because it's currently causing deadlocks on some devices.
Change-Id: Ic9186db207e8d656f3af5d86fa138c7d96393c55
This change adds a default tolerance of 2 to all the pixel value checks
in the SurfaceTexture tests.
Change-Id: Id5a7cdffdfae16076e2daf4964a3326105b5ae2c
This change adds some tests to verify streaming images from one GL
thread to another via SurfaceTexture. Currently the tests do not
validate the correctness of the streamed images, but rather simply
verify that this streaming does not cause a deadlock. 3 of the 4 tests
are currently disabled because they do cause deadlocks on some devices.
Change-Id: I5677942053190063b97f370dba96c116711bc3bb
This change adds a test verifying that with no transform set on the
SurfaceTextureClient, the SurfaceTexture will return an identity
transform matrix. It also verifies this same effect in the presence of
an additional call to native_window_set_buffer_count just before the
call to getTransformMatrix.
Bug: 4490420
Change-Id: Ic5adfa29b5696cc2b451433834e3758ef20c5edd
This change moves the computation of the transform matrix out of
getTransformMatrix and instead performs the computation when
updateTexImage gets called. This is needed in order for
getTransformMatrix to succeed even if the buffers have been freed (e.g.
by changing the buffer count) because the computation depends upon the
properties of the current GraphicBuffer.
Change-Id: Ied541ab8747b7ad604f862717135f9a16a816be9
Bug: 4490420
Add support for 9-axis gravity and linear-acceleration sensors
virtual orientation sensor using 9-axis fusion
Change-Id: I6717539373fce781c10e97b6fa59f68a831a592f
The SurfaceTextureSyncModeWaitRetire test was disabled. It is failing
because of the synchronization hacks that were added to SurfaceTexture
to work around bugs in vendor device drivers.
Change-Id: I09a74538bfe14a04833acb6847471e00826cc7fc
This change fixes the MIN_UNDEQUEUED_BUFFERS error check in
dequeueBuffer. The check should only be performed if a buffer has been
queued since the last time the buffer count was changed by the client.
The check must be applied conditionally because video decoders require
all the bufferes to be dequeued and registered before beginning the
decode.
Change-Id: I08d96b380544e395c2fcf0f3983a199bfd695b09
This change fixes up some stale comments, member variable names, log
messages and disables a failing test.
Change-Id: Ic1d3344b18066cf710e4a42838b2417c6b1f2f6c
This change the binder protocol between SurfaceTextureClient
and SurfaceTexture. dequeueBuffer() now takes the requested
parameters for the buffer. SurfaceTexture decides if the
buffer needs to be reallocated and does the allocation
if needed. In that case it returns BUFFER_NEEDS_REALLOCATION
to tell SurfaceTextureClient that it needs to call
requestBuffer (which all parameters have been removed) to
acquire a pointer to the buffer.
dequeueBuffer and requestBuffer could be folded into a single
IPC call, but we chose to optimize the case where buffers are
not created and avoid some complexity in the marshalling code.
Change-Id: I097a7f6f40a3491e10f3f3742eab33999286c304
query() does not modify the object's data, so it needs to be a const method
Change-Id: I67c40a3c865461e6f1cc2193fd2d74286ff6ac8f
Signed-off-by: Iliyan Malchev <malchev@google.com>
This change makes the libgui makefile recurse into the tests directory
so that the tests get built by a top-level make when
TARGET_BUILD_VARIANT=tests.
Change-Id: I6f623cc4b86dfeb00b9d21823316dbd9def23110
This change removes the check that disallowed the creation of an
EGLSurface that would send frames to a SurfaceTexture.
Change-Id: I44c6d5df503cc676a88144d72d39b414692ce4c9
This leak was intentional, it was there to deal with the fact that
some gralloc implementations don't track buffer handles with
file-descriptors so buffers needed to stay alive until there were
registered, which is not guaranteed by binder transactions.
In this new implementation, we use a small BBinder holding a
reference to the buffer, which with tuck into the parcel. This forces
the reference to stay alive until the parcel is destroyed, which
is guaranteed (by construction) to happen after the buffer is
registered.
this allows the public facing API to not expose the previous hack.
Change-Id: I1dd6cd83679a2b7457ad628169e2851acc027143
SurfaceTexture now has the concept of default size a new method,
setDefaultBufferSize() to set it. When the default size is
changed, dequeueBuffer() will return a value telling the
client that it must ask for a new buffer.
The above only applies if the client has not
overriden the buffer size with setGeometry.
Change-Id: I520dc40363054b7e37fdb67d6a2e7bce70326e81
this is the first step in unifying surfacetexture and surface.
for this reason the header files were not moved, as most of them
will eventually go away.
NOTE: currently we keep libsurfaceflinger_client.so as an empty
library to workaround prebuilt binaries wrongly linking against
it.
Change-Id: I130f0de2428e8579033dc41394d093f4e1431a00