Commit Graph

135 Commits

Author SHA1 Message Date
Dan Stoza
9f3053de78 BufferQueue: Allow detaching/reattaching buffers
Adds detachBuffer and attachBuffer calls to both the producer and
consumer sides of BufferQueue. Buffers may be detached while dequeued
by the producer or acquired by the consumer, and when attached, enter
the dequeued and acquired states, respectively.

Bug: 13173343
Change-Id: Ic152692b0a94d99e0135b9bfa62747dab2a54220
2014-03-10 16:45:38 -07:00
Andy McFadden
2e336496c3 FramebufferNativeWindow.h is obsolete
This adds a deprecation #warning to the header.

Change-Id: Ia32f16e491cb01d435ec8846dda3d9a7d1a9cfc5
2014-03-05 15:42:53 -08:00
Igor Murashkin
8be494eb09 am 1738d4fc: am 462fb3a8: Merge "gui: Fix return code assert in CpuConsumer_test."
* commit '1738d4fca78b7678d09d5c8898e1f80fa63b4a6d':
  gui: Fix return code assert in CpuConsumer_test.
2014-03-04 22:35:04 +00:00
Dan Stoza
8d7599633f Fix calls to captureScreen
Change-Id: Ic0ff47afa29f143131906082dff79d4e907b7143
2014-02-19 18:35:30 -08:00
Dan Stoza
b8072d84ba libgui: Fix segfault in SRGB tests
Make the test exit cleanly if the output buffer is never mapped.

Bug: 12761226
Change-Id: If789f02198851a17b11ee06f612f9ba7e06da754
2014-01-29 15:02:14 -08:00
Dan Stoza
6a5d35dd5c libgui: Add a test for SRGB surfaces
Add SRGBTest.RenderToSRGBSurface, which validates that passing the
SRGB colorspace attributes to eglCreateWindowSurface actually
results in an SRGB surface by comparing the output values to those
of a standard RGB surface.

Change-Id: I3d5fef8070ed8fa2357ddd1c5fcc849ae3fbd12a
2014-01-07 16:43:39 -08:00
Dan Stoza
3ed4e0b365 libgui: Add a test suite for SRGB testing
This is the start of an SRGB test suite. Currently it has a test for
SRGB texture reads in GLES3.

Change-Id: I553ee2691dc92b98cae7a003084d4e2823d40d95
2013-12-12 10:58:56 -08:00
Dan Stoza
cb1fcdedaa libgui: Split SurfaceTexture tests into more files
Extract the many different test fixtures and suites in SurfaceTexture_test.cpp
into separate files. No real functional changes, just tweaking headers to keep
things building (and adding a few copyright headers I forgot last time).

Change-Id: Id801bd5d617f0cc61d22508fb9b71b41694bdecf
2013-12-09 09:52:02 -08:00
Alistair Strachan
8f76b6bedf gui: Fix return code assert in CpuConsumer_test.
The CpuConsumer error code was changed recently from INVALID_OPERATION to
NOT_ENOUGH_DATA, however the CpuConsumer_test was not updated. This change
fixes the return code checked by CpuConsumer_test so the test no longer
fails.

Change-Id: Ie548ddcb313fa34c130ac63355090cb44ac15ebf
2013-12-04 14:57:22 -08:00
Dan Stoza
f3730fb8f7 libgui: Fix a couple of minor bugs, extract GLTest
Fix a couple of minor bugs in existing tests, and extract the GLTest class into
its own files.

Change-Id: I7d9570a0d3dbc9c5d7f9b13f2017607af42744b3
2013-11-26 15:48:53 -08:00
Igor Murashkin
7ea777f097 gui: Add tests for IGraphicBufferProducer
* Basic tests only. Needs more complicated queue/dequeue tests.
* Also needs consumer-side tests to really be thorough.

Change-Id: I1099dd56d65b6e9dfa15377726d6054ce657c0ca
2013-11-21 14:06:13 -08:00
Mathias Agopian
2285c008fa am e803e609: am 799f5126: Fix build (tests)
* commit 'e803e6095e007563df939326fdd3ca5109619a42':
  Fix build (tests)
2013-09-17 16:01:38 -07:00
Mathias Agopian
e803e6095e am 799f5126: Fix build (tests)
* commit '799f51268006f319f6ae538dca670bfc7f522688':
  Fix build (tests)
2013-09-17 15:58:55 -07:00
Mathias Agopian
799f512680 Fix build (tests)
Change-Id: I5b233ef448e5e7eec3818c6586dfea138b28f7b6
2013-09-17 15:55:18 -07:00
Kenny Root
06ef81bd70 resolved conflicts for merge of 1852eb4f to klp-dev-plus-aosp
Change-Id: I7217c0e859b384a042c02fe339e745996c6ef49e
2013-09-12 11:51:34 -07:00
Kenny Root
c668871ac3 Use canonical UniquePtr.h file
Change-Id: Icc75bca078ffaf0c09b88ce5e897d666d1054063
2013-09-11 23:25:08 -07:00
Kenny Root
0ae966033d Remove copy of UniquePtr.h
The UniquePtr.h file is no longer in libcore/... so there is no need to
have this extra copy of it anymore.

Change-Id: I4ec4f86d2844e524b50441c3a9100a50a6a45b1a
2013-09-11 14:29:20 -07:00
Andy McFadden
8b308ed70e Fix build
Neglected the "checkbuild"-built tests.

Change-Id: I202692f1a6d1e306c88e820c959d07d16e7c6a00
2013-08-19 08:56:07 -07:00
Mathias Agopian
c6bae007e6 Fix build. optional tests were broken.
Change-Id: Iba9f5cb57f134559e1f9c55e293578d9f5d8cb96
2013-08-14 16:27:19 -07:00
Mathias Agopian
5f51ed9499 fix tests more
Change-Id: I05c3dd6a22440844f8bd071f4c2b620b2bd8c720
2013-08-06 16:47:04 -07:00
Mathias Agopian
3dce3360e7 fix tests
Change-Id: I0f4d613481eda2c44a2d631a81d75de7e52e7a62
2013-08-06 16:42:05 -07:00
Mathias Agopian
126b9c8e95 Fix build. 3rd attempt
Change-Id: I4317b34fd07890ea7cf9db51be42d72ef21aca89
2013-08-06 15:19:15 -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
Eino-Ville Talvala
687821c05b Merge "BufferQueue: Support query of consumer usage bits" 2013-08-05 21:10:45 +00:00
Mathias Agopian
a4e19521ac Binderize the consumer side of BufferQueue
While currently untested, this should allow to move the
BuffereQueue in the consumer process and have everything
work as usual.

Bug: 9265647

Change-Id: I9ca8f099f7c65b9a27b7e7a3643b46d1b58eacfc
2013-08-01 17:20:08 -07:00
Eino-Ville Talvala
f7c6087bcc BufferQueue: Support query of consumer usage bits
Bug: 9592202
Change-Id: I61a17758200e61adaca695b426db3df0f6637d4c
2013-07-30 21:38:34 +00:00
Mathias Agopian
bf5b849ec7 fix build
Change-Id: I04df8ec96510b16e84054089f7c02609d8fe2b0c
2013-07-26 17:26:16 -07:00
Mathias Agopian
7cdd786fa8 Make ANW.setSwapInterval(0) work again
we can now queue/dequeue a buffer in asynchrnous mode by using the
async parameter to these calls. async mode is only specified
with those calls (it is not modal anymore).

as a consequence it can only be specified when the buffer count
is not overidden, as error is returned otherwise.

Change-Id: Ic63f4f96f671cb9d65c4cecbcc192615e09a8b6b
2013-07-19 17:38:01 -07:00
Mathias Agopian
a3fbda3cef BuffferQueue disconnect is now always asynchrnous
we tag queued buffers with the "bufferqueue cannot block" flag
and use that bit to discard a buffer in the queue by new ones
comming in. this allows us to remove the buffer queue drain in
disconnect while maintaining the right behaviour if it gets
connected again (since each buffer remembers how it was enqueued).

Change-Id: I1e703d363a687b70b19ba49cef32213116e8bd3f
2013-07-18 22:28:18 -07:00
Mathias Agopian
595264f1af BufferQueue improvements and APIs changes
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
2013-07-18 22:28:18 -07:00
Ying Wang
6fda52bc7d always pass the BufferQueue explicitely to consumers
to fix tests build.

Change-Id: I70b9cf5b0d76df709e474181eeb7c42a54ecf43a
2013-07-15 22:20:35 -07:00
Mathias Agopian
8f938a5338 always pass the BufferQueue explicitely to consumers
Change-Id: I883b0a7b19d8e722f9ab714ba6f49e658b02ca86
2013-07-12 22:06:26 -07:00
Andy McFadden
1585c4d9fb Pay attention to buffer timestamps
When acquiring a buffer, SurfaceFlinger now computes the expected
presentation time and passes it to the BufferQueue acquireBuffer()
method.  If it's not yet time to display the buffer, acquireBuffer()
returns PRESENT_LATER instead of a buffer.

The current implementation of the expected-present-time computation
uses approximations and guesswork.

Bug 7900302

Change-Id: If9345611c5983a11a811935aaf27d6388a5036f1
2013-07-10 15:38:40 -07:00
Jamie Gennis
ea2d942dda libgui_test: fix a couple minor test issues
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
2013-04-24 01:08:02 +00:00
Mathias Agopian
f31510a2ac Add a test that checks multi-texturing works with GL_TEXTURE_EXTERNAL_OES
Bug: 8395618
Change-Id: I160d29699593b11058533ca753e275d5deeb3b54
2013-04-16 23:32:38 -07:00
Jamie Gennis
e6a0f5028b libgui_test: increase the tolerance for a YUV test
This change increases the pixel difference tolerance of the
SurfaceTextureGLTest.TexturingFromCpuFilledYV12BufferNpot test from 2 to 3.

Bug: 8349135
Change-Id: I82e361a689335f49065cacd8a3fc145d67b125f1
2013-04-08 14:42:22 -07:00
Jamie Gennis
ad669b04f4 libgui: fix an EGLImage leak
This moves the call to ConsumerBase::abandon from the ConsumerBase dtor to
ConsumerBase::onLastStrongRef.  The abandon call relies on virtual methods to
perform the clean-up, so calling it from the ConsumerBase dtor after the
derived classes dtors ran was skipping some of the clean-up.  The
onLastStrongRef method should get called just before the most derived class's
dtor gets called.

Bug: 8349135
Change-Id: I836946826927cc1ed69c049049f525f92b17a269
2013-04-08 14:42:22 -07:00
Mathias Agopian
7c1a487ba8 fix build. update test to new API
Change-Id: I31ca84c85edff3e2ff90c554769e058110f27d49
2013-03-20 15:56:04 -07:00
Jesse Hall
4c00cc1114 Fix argument types in IGraphicBufferProducer methods
Bug: 8384764
Change-Id: I7a3f1e1a0584a70af04f9eafef900505389d2202
2013-03-18 14:16:02 -07:00
Mathias Agopian
7589b2a797 add two libgui tests
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
2013-03-08 13:22:03 -08:00
Igor Murashkin
29e2047cb4 CpuConsumer_test: Extend test with new formats RGBA8888 and optional Y8/Y16
Change-Id: I0a0f6ce73516883bf50c749a1759abbdb3748e08
2013-03-05 13:55:31 -08:00
Mathias Agopian
993e14fe10 Added a test that checks the error behavior of ConsumerBase::abandon
We check that calling eglSwapBuffers() on an abandonned BufferQueue
return EGL_BAD_SURFACE -- this is to ensure consistancy between
drivers.

Change-Id: Ibb548e0cf767ceee69f2fc4a85811d15a6522277
2013-02-25 16:51:31 -08:00
Mathias Agopian
cf0b8c85fb get rid of Surface::getISurfaceTexture()
this was there just for legacy reasons.

Change-Id: I0a48d6e04d7efa65033f9f10c91bba557f16ae8b
2013-02-19 18:24:40 -08:00
Mathias Agopian
e3c697fb92 Refactoring: Rename SurfaceTextureClient to Surface
Change-Id: Ibed34175ae273608393aaa5f0a7df207dc40d709
2013-02-14 19:19:05 -08:00
Jamie Gennis
1df8c34585 libgui: disallow NULL Fence pointers
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
2013-02-12 18:15:38 -08:00
Andy McFadden
2adaf04fab Rename ISurfaceTexture and SurfaceTexture
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
2012-12-18 13:10:48 -08:00
Jamie Gennis
c911ea5318 stop using a deprecated SurfaceTextureClient ctor
Change-Id: I8c8282a0debd551db290dd6849faf272a88c704c
2012-12-12 12:38:36 -08:00
Andy McFadden
71f683ac8d New test
Added a test to confirm that the transform hint is being respected.

Bug: 7162482
Change-Id: I892fe962f8cf2759ff951b4f5065b9ac2732c3d1
2012-09-16 12:53:41 -07:00
Jamie Gennis
c68f2ecfa0 BufferQueue: add a setMaxAcquiredBufferCount check
This change adds a check to verify the validity of the value passed to
setMaxAcquiredBufferCount.

Change-Id: I39730557aa58261e678bd6e4fce11bab78e98362
2012-09-04 14:54:34 -07:00
Jamie Gennis
9e75ddda93 libgui: add BufferQueue test infrastructure
This change adds some infrastructure for testing the BufferQueue class.  It
also includes a test that tests the new check in BufferQueue::acquireBuffer
that prevents the consumer from acquiring more than one buffer beyond the max
acquired buffer count that was set.

Change-Id: I38554ad3f9a53d2ddeba7ef0deee35ec2e2f9775
2012-08-31 17:02:49 -07:00