this is the first step of a series of improvements to
BufferQueue. A few things happen in this change:
- setSynchronousMode() goes away as well as the SynchronousModeAllowed flag
- BufferQueue now defaults to (what used to be) synchronous mode
- a new "controlled by app" flag is passed when creating consumers and producers
those flags are used to put the BufferQueue in a mode where it
will never block if both flags are set. This is achieved by:
- returning an error from dequeueBuffer() if it would block
- making sure a buffer is always available by replacing
the previous buffer with the new one in queueBuffer()
(note: this is similar to what asynchrnous mode used to be)
Note: in this change EGL's swap-interval 0 is broken; this will be
fixed in another change.
Change-Id: I691f9507d6e2e158287e3039f2a79a4d4434211d
This change fixes how the MultiTextureConsumerTest.EGLImageTargetWorks checks
for pixels. It removes the call to eglSwapBuffers so that the test does not
rely on EGL swap-preserve behavior, and it makes the test use checkPixel()
rather than doing glReadPixels itself.
Bug: 8349336
Change-Id: I0f446a0083eebd07af6fd208762878b4e367725a
This change increases the pixel difference tolerance of the
SurfaceTextureGLTest.TexturingFromCpuFilledYV12BufferNpot test from 2 to 3.
Bug: 8349135
Change-Id: I82e361a689335f49065cacd8a3fc145d67b125f1
we check that the order in which we destroy GLConsumer wrt.
releasing the corresponding EGLSurface via eglMake(Un)Current
doesn't leak a buffer.
On at least 2 devices this test doesn't pass.
Change-Id: I63ab83951b4b0a977f38571158f948cbd9dc7cec
This change eliminates the uses of a NULL sp<Fence> indicating that no waiting
is required. Instead we use a non-NULL but invalid Fence object for which the
wait methods will return immediately.
Bug: 7892871
Change-Id: I5360aebe3090422ef6920d56c99fc4eedc642e48
The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.
Bug 7736700
Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
This change is a clean up of some of the handling of the maximum number of
buffers that are allowed at once. It mostly renames a few member variables and
methods, but it includes a couple small refactorings.
Change-Id: I9959310f563d09583548d4291e1050a7bbc7d87d
Use only display tokens in the API to refer to new displays.
Don't require the caller to specify the display when creating
a surface (since in general a surface could be shown on
any display).
This is intended to be a minimum change just to update the API.
Note that SurfaceFlinger still uses DisplayID in a few places
internally that might cause some features not to work properly
when there are multiple displays (LayerScreenshot, for example).
Change-Id: I3d91eec2da406eefd97bcd53655d403ad865a7e6
This change updates the uses of ANativeWindow to use the new ANW functions that
accept and return Sync HAL fence file descriptors.
Change-Id: I3ca648b6ac33f7360e86754f924aa072f95242f6
SurfaceTexture would only create an EGLImage for a buffer slot when
BufferQueue returns a GraphicBuffer, i.e. either the slot was acquired
for the first time ever, or the buffer for the slot was reallocated.
But the EGLImage may also need to be re-created for a
previously-acquired buffer if the slot's EGLImage was destroyed during
detachFromContext(); in this case BufferQueue won't return a
GraphicBuffer since SurfaceTexture already has a reference to the
correct buffer.
Bug: 6461693
Change-Id: Ib95d0d757192efe336c5fda0866f857481a6617d
This change adds support for specifying a crop rectangle to a
SurfaceTextureClient that is in post-transformed coordinate space.
Change-Id: I247901de343e71b32850f7ae3bac62dfa612ad3d
Bug: 6299171
This change adds the plumbing to SurfaceTextureClient, BufferQueue, and
SurfaceTexture to get the active rectangle passed to the ANativeWindow to
the buffer consumer.
Change-Id: I35da0889b266327ebb079b6a7136fa3e2e8b00e6
SurfaceTexture will modify the crop rect so it matches
the desired output aspect ratio when the scaling
mode is NATIVE_WINDOW_SCALING_MODE_CROP. Added a test
for this new scaling mode.
Change-Id: I60f24dcbc294b65cd10a393d9e27d40f07d27bb6
BufferQueue's disconnect could race with updateTexImage
where invalid buffers could be released. Additionally
fixed similar bug with setBufferCount. Tests were added
to stress the disconnect mechanism.
Change-Id: I9afa4c64f3e025984e8a9e8d924852a71d044716
This change adds the detachFromContext and attachToContext methods to
SurfaceTexture. These methods allow the SurfaceTexture to switch from
one consumer GLES context to another. This change also includes a few
cleanups to the error return codes in updateTexImage.
Change-Id: I0df1eb599aa7b6f58f07431f242f8f09269559ed
This change adds a check to SurfaceTexture::updateTexImage to verify
that the current GL context is the same as the one that was used for
previous updateTexImage calls.
Change-Id: If02d2f787bcfdb528046dc9ddf6665f8a90e1bf4
This change adds a new callback for BufferQueue consumers to be notified
when the BufferQueue frees some or all of its buffers. This is needed
to retain SurfaceTexture behavior where all buffers would be freed when
the producer disconnects. This change also modifies the
SurfaceTextureGLToGLTest.EglDestroySurfaceUnrefsBuffers test to catch
when the buffers are not freed.
The implementation is a little complicated because it needs to avoid
circular sp<> references across what will be a binder interface (so wp<>
can't be used directly). It also needs to avoid the possibility of
locking the BufferQueue and consumer (e.g. SurfaceTexture) mutexes in
the wrong order.
This change also includes a few additional fixes and test cleanups.
Change-Id: I27b77d0af15cb4b135f4b63573f634f5f0da2182
* commit 'c25972950c2ea62fb085524dbe737c2bf0f08f4a':
SurfaceTexture: fix a couple tests
EGL: default to swap interval 1
SurfaceTexture: clean up some tests
This change fixes some robustness issues with the
EglDestroySurfaceUnrefsBuffers and
EglDestroySurfaceAfterAbandonUnrefsBuffers tests. The tests previously
depended upon GL implementation details that should not have been relied
upon.
Change-Id: I37fd43b56568efe1dbe69d85e892be8a1cf44d20
This change explicitly sets swap interval 1 on the window when an
EGLSurface is created to render to it.
Change-Id: I91eb29dbee3ae4a55076b921f084d503fbe94e03
This change cleans a few things up in the SurfaceTexture tests:
- Wraps a few long lines.
- Refactors the multithreading portions of SurfaceTextureGLToGLTest into
a new test fixture called SurfaceTextureGLThreadToGLTest.
- Changes some of the tests that were creating their own EGLSurface to
use the SurfaceTextureGLToGLTest fixture.
- Reorders the test functions so that they are immediately below to the
test fixture that they use.
Change-Id: I0491ce3528a7ff2b4f1e83602ba290269c087297
This change adds two tests to ensure that eglDestroySurface does not
cause Gralloc buffers to be leaked.
Bug: 5472838
Change-Id: Id675d74e34b6479f2d68314d40de94aede69f142
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
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 enables the following four SurfaceTextures tests:
UpdateTexImageBeforeFrameFinishedWorks
UpdateTexImageAfterFrameFinishedWorks
RepeatedUpdateTexImageBeforeFrameFinishedWorks
RepeatedUpdateTexImageAfterFrameFinishedWorks
Change-Id: I7632630bc97873e50d4a765ffc44a86f16ae62f1
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 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 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