Commit Graph

475 Commits

Author SHA1 Message Date
Mathias Agopian 3ca76f416b remove support for glReadPixels screenshot path
this was only needed on some chipset we're not
supporting in KLP.

Change-Id: I2e8fc07f135030bd61d2e241a8e426f1a4316425
2013-08-06 16:07:33 -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
Andy McFadden d9ba9707b0 Merge "Roll back recent change" 2013-08-02 22:34:13 +00:00
Andy McFadden 4b49e08385 Roll back recent change
Disable dropping of frames based on timestamp.  Resume auto-
generating timestamps in Surface.

Bug 10151804

Change-Id: I15de26158e1d7ef22a5b150e685a126dc48ae2b4
2013-08-02 15:31:45 -07:00
Mathias Agopian c1c39f8807 Merge "Binderize the consumer side of BufferQueue" 2013-08-02 20:35:26 +00:00
Andy McFadden 86cd09d388 Merge "Drop frames based on presentation timestamp" 2013-08-02 16:53:11 +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
Andy McFadden 14fab7dd79 Drop frames based on presentation timestamp
If there are two or more buffers pending that are ready for
immediate presentation, drop all but the last one.

Any code that didn't explicitly specify timestamps for buffers
was using the default value (auto-generated "now").  As a result,
surfaceflinger would drop frames whenever more than one buffer
was queued.  We now use zero as the auto-generated timestamp,
and we don't set the timestamp in eglBeginFrame().

Change-Id: I187f42d33de227cd3411ff0dcd3b9ce1961457eb
2013-08-01 15:58:08 -07:00
Mathias Agopian ba93b3f8e4 log an error when dequeueBuffer gets a NULL Fence
Bug: 9858745
Change-Id: If35d6a7d770bf0a42d55bc55880a9ddb721fcfd0
2013-08-01 15:48:40 -07:00
Mathias Agopian e142428a9c Make Flattenable not virtual
Fallout from the Flattenable change, update all its uses.

Additionnaly, fix/tighten size checks when (un)flatten()ing
things.

Removed the assumption by some flattenables (e.g.: Fence)
that the size passed to them would be exact (it can
and will be larger in some cases)

The code in Parcel is a bit complicated so that we don't
have to expose the full implementation (and also to
keep the code smallish).

Change-Id: I0bf1c8aca2a3128491b4f45510bc46667e566dde
2013-07-30 21:19:13 -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 ad678e18b6 single buffer mode for BufferQueue
Bug: 9891035
Change-Id: Id1ab5f911a6dc4c1d8235e65775b3d3635231ad4
2013-07-26 18:45:02 -07:00
Mathias Agopian bf5b849ec7 fix build
Change-Id: I04df8ec96510b16e84054089f7c02609d8fe2b0c
2013-07-26 17:26:16 -07:00
Mathias Agopian c2414bb098 get rid of HAL pixelformats 5551 and 4444
Change-Id: I39409103144c1ba09078c4ddc323a58987fb09ea
2013-07-26 15:43:33 -07:00
Mathias Agopian 9642dba110 Merge "Fix a race in BufferQueue" 2013-07-25 02:17:52 +00:00
Mathias Agopian 6bac363cbd Fix a race in BufferQueue
BufferQueue::dequeueBuffer() could incorrectly return
WOULD_BLOCK while in "cannot block" mode if it happened
while a consumer acquired the last allowed buffer
before releasing the old one (which is a valid thing
to do).

Change-Id: I318e5408871ba85e068ea9ef4dc9b578f1bb1043
2013-07-23 21:55:32 -07:00
Mathias Agopian 207c1e287c fix log messages and bogus error message
also assert when releasing a buffer and it has
been queued

Change-Id: I6f78d9ceb406ec85ff46c7b6d0c047b14063e3d0
2013-07-22 18:00:53 -07:00
Mathias Agopian 26a6f37cc0 make sure to reset the framenumber when a buffer is marked FREE
Change-Id: Ic45929f35553de209801f74e8006fb1bf0b25b45
2013-07-19 17:38:01 -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
Zhijun He b4b63704c0 CpuConsumer: Add set buffer size and format functions.
Add setDefaultBufferSize() and setDefaultBufferFormat(). ImageReader JNI need
them.

Bug: 9254294
Change-Id: I7d2464d43b0ca73fbb834ed22cecbfbb30eef60c
2013-06-10 13:34:01 -07:00
Lajos Molnar 9e3cb55b8f BufferQueue: remove freeAllBuffersExceptHeadLocked()
Now that we are having separate buffer-instances for the buffer-
queue, we can free all buffers; we don't have to keep the head
alive.

Change-Id: I023e9161a2501d99333f8868ce438afa914ec50f
Signed-off-by: Lajos Molnar <lajos@google.com>
Related-to-bug: 7093648
2013-05-23 22:21:13 +00:00
Lajos Molnar c5d7b7d323 BufferQueue: track buffer-queue by instance vs. by reference
Instead of representing the buffer-queue as a vector of buffer
indices, represent them as a vector of BufferItems (copies).
This allows modifying the buffer slots independent of the queued
buffers.

As part of this change, BufferSlot properties that are only
been relevant in the buffer-queue have been removed.

Also, invalid scalingMode in queueBuffer now returns an error.

ConsumerBase has also changed to allow reuse of the same
buffer slots by different buffers.

Change-Id: If2a698fa142b67c69ad41b8eaca6e127eb3ef75b
Signed-off-by: Lajos Molnar <lajos@google.com>
Related-to-bug: 7093648
2013-05-23 22:17:54 +00:00
Mathias Agopian 2381033ad0 am e6eef6c1: am ea74d3b7: make the warning timout of Fence::waitForever() implicit and longer
* commit 'e6eef6c136b007f3a7e1e19884875b855c0c5f95':
  make the warning timout of Fence::waitForever() implicit and longer
2013-05-17 10:18:45 -07:00
Mathias Agopian ea74d3b78d make the warning timout of Fence::waitForever() implicit and longer
- timeout is now 3 seconds instead of 1
- simplifies the API a bit
- allows us to change/tweak this timeout globaly

Bug: 8988871

Change-Id: I8d3c6ec43a372f602fb3f29856710339f86c0ec9
2013-05-16 18:15:57 -07:00
Eino-Ville Talvala d487ca1ab3 am 87ab83d9: am f743e3db: Merge "Add support for HAL_PIXEL_FORMAT_YCbCr_420_888" into jb-mr2-dev
* commit '87ab83d96b9d826e94a7169a6205bcf9c2ee633a':
  Add support for HAL_PIXEL_FORMAT_YCbCr_420_888
2013-05-09 10:19:01 -07:00
Eino-Ville Talvala c43946b931 Add support for HAL_PIXEL_FORMAT_YCbCr_420_888
- Add fields to CpuConsumer::LockedBuffer for new information
- New lock methods for GraphicBuffer and GraphicBufferMapper for
  the format

Bug: 8734880
Change-Id: If31f82c62d64b6942cf4cc6e5715585c03273f12
2013-05-06 17:24:05 -07:00
Jamie Gennis 748b696c05 am 83ad8957: am 5b6ebd71: Merge "libgui_test: fix a couple minor test issues" into jb-mr2-dev
* commit '83ad89579e22228c1a48a2a488b86fc0d41057a6':
  libgui_test: fix a couple minor test issues
2013-04-25 13:50:38 -07:00
Mathias Agopian bdcf1fe2ba Merge changes I0d9f18d1,Ib96c9161
* changes:
  Add a --color option to dumpsys SurfaceFlinger
  clean-up/simplify all dump() APIs
2013-04-24 10:25:34 +00: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 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
Mathias Agopian e692ab9a6b fix uninitialized variables in GLConsumer
mDefaultWidth, mDefaultHeight and mCurrentScallingMode are now
initialized to the same default value that BufferQueue uses.

Change-Id: I0d4da2022b06419d12745716d8ddbd48c8869953
2013-04-22 11:24:02 +02:00
Igor Murashkin 187edf93c6 Merge "BufferItemConsumer: add functions to set default buffer format/size" into jb-mr2-dev 2013-04-17 19:39:53 +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
Igor Murashkin 87d1e3427b BufferItemConsumer: add functions to set default buffer format/size
Bug: 8629088
Change-Id: I06f2e26a70d6dbcfcd70b08b4461e8e401f6e83f
2013-04-16 11:24:40 -07:00
Andy McFadden 53dc9044bf Merge "Updated comments" into jb-mr2-dev 2013-04-11 17:15:52 +00:00
Ying Wang c76e8a20e2 Merge "Add liblog" into jb-mr2-dev 2013-04-10 05:17:07 +00:00
Ying Wang 8a0cb4ee0b Add liblog
Bug: 8580410
Change-Id: I2ca4fa00dde0b574df3619134836bcb9315bd506
2013-04-09 21:55:39 -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
Andy McFadden 753e3415cd Updated comments
Updated many comments.  Added one minor error check.

Change-Id: Ib935dd99d417bada91d2e198008a50dd94269316
2013-04-05 10:44:23 -07:00
Mathias Agopian ca08833d5e don't use compile-time configuration of libgui as much as possible
We now detect at runtime which sync features to use, which
allows us to remove a lot of the compile-time configuration
options. There  is still one option though, to disable
KHR_fence_sync on some devices (which are more efficient
without it).

- added a backdoor to get the vendor's EGL strings

the new logic is:
- use always ANDROID_native_fence_sync if available
- fallback to KHR_fence_sync if available and not disabled
  by the compile-time option
- use KHR_wait_sync if available and either of the above is
  enabled

Change-Id: I9c4b49d9ff1151faf902cc93bd53ea5f205aaabf
2013-03-29 15:33:47 -07:00
Mathias Agopian 2bb716871c replace eglWaitSyncANDROID by eglWaitSyncKHR
Change-Id: I22f1b3588011c88389e249f738f1e6915cc97e72
2013-03-28 14:31:09 -07:00
Mathias Agopian 8000d0694b make sure to unlock the screenshot's buffer on destruction
this fixes a memory leak on various devices

Bug: 8475134
Change-Id: I25924674c803a0cb22371a95c60664c36acb0340
2013-03-26 18:15:35 -07:00