Commit Graph

880 Commits

Author SHA1 Message Date
Etienne Le Grand c57a019e11 Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
Change-Id: If0f3dbdb5d2e9378e1fed4614baee4e750d0c850
2014-04-04 16:31:09 -07:00
Andy McFadden 87a6784780 Always release a buffer
In GLConsumer's updateAndReleaseLocked(), we must release either
the previously-acquired buffer or the newly-acquired buffer.

Bug 13755224

Change-Id: I96adc255400ed008ba6e6ac1725ab3514c7cc8ba
2014-04-04 15:37:08 -07:00
Mark Salyzyn cece164b23 native gui: 64-bit compile issues
Change-Id: I45f605ff3759fb7ae9f0a6425d557d195f93281e
2014-04-04 10:15:54 -07:00
Wonsik Kim 9cfa49c954 Merge "Declare ownership of native_handle_t object" 2014-04-02 06:13:57 +00:00
Dan Stoza d1c1036555 BufferQueue: Hook up IProducerListener
Actually call the producer listener's callback during
IGraphicBufferConsumer::releaseBuffer

Change-Id: Idfa6bb08d62629cd3a198318e6c6fd6a731e73ef
2014-03-31 14:10:07 -07:00
Dan Stoza f0eaf25e92 BufferQueue: Add producer buffer-released callback
Add a callback to the producer side, onBufferReleased, which will be
called every time the consumer releases a buffer back to the
BufferQueue. This will enable a buffer stream splitter to work
autonomously without having to block on dequeueBuffer.

The binder object used for the callback replaces the generic IBinder
token that was passed into IGraphicBufferProducer::connect to detect
the death of the producer. If a producer does not wish to listen for
buffer release events, it can pass in an instance of the
DummyProducerListener class defined in IProducerListener.h, if it even
cares about death events (BufferQueue doesn't enforce the token being
non-NULL, though perhaps we should).

Change-Id: I23935760673524abeafea2b58dccc3583b368710
2014-03-31 14:10:07 -07:00
Dan Stoza 2443c7903c BufferQueue: Set attached buffers as requested
When a buffer is attached to the producer side, it needs to be marked
as having been requested so that it can be queued successfully.

Change-Id: I90a88b332c415a57921bd094ae635afdf65bff99
2014-03-24 15:03:46 -07:00
Wonsik Kim 0ec54e156b Declare ownership of native_handle_t object
Change-Id: I4e21ff8ea76cfafce943dc059c8f72b42397980e
2014-03-24 15:44:05 +09:00
Dan Stoza 1a0b861790 BufferQueue: Test remote producer and consumer
Adds a test that puts the BufferQueue into its own process and
connects to it over remote binder interfaces. This exposed the fact
that while IGBC was technically binderized, it didn't actually work
when flattened, so this change also fixes that.

Change-Id: I728cdb662a4273ddd3440ed6040a12560313fe68
2014-03-21 11:16:54 -07:00
Wonsik Kim 8ce5c1cc8d Merge "Fill in sideband stream caveat" 2014-03-19 00:41:23 +00:00
Dan Stoza 75555b2eaf Merge "BufferItemConsumer: Use IGBC instead of BQ" 2014-03-18 17:55:06 +00:00
Dan Stoza 14226716f2 Merge "Remove deprecated BufferQueue constructor" 2014-03-18 16:56:15 +00:00
Wonsik Kim 0ee14ca23d Fill in sideband stream caveat
Change-Id: I20db8aea8f13acf31b42db08d90b338da8a5209c
2014-03-17 17:46:53 +09:00
Jesse Hall 49bfda1fbd Fix broken build for more tests
Change-Id: I7bdd12a833233724805d01d993541ee05caa9bf6
2014-03-13 15:09:17 -07:00
Jesse Hall 73ed82f809 Merge "Add sideband streams to BufferQueue and related classes" 2014-03-13 20:28:17 +00:00
Dan Stoza 6d5a7bb970 Remove deprecated BufferQueue constructor
Bug: 13415624
Change-Id: I52f58a4d22296d9fc3cdbd4ad53eb10a785db3ce
2014-03-13 11:39:09 -07:00
Dan Stoza fe50d2a0a1 BufferItemConsumer: Use IGBC instead of BQ
Change-Id: Id1756ac62954ba412f2c23c5fa6e5d760c299347
2014-03-13 11:12:04 -07:00
Dan Stoza f522af7eb6 BufferQueue: Allow returning interfaces as I*/Bn*
This adds a second createBufferQueue method that returns
sp<IGraphicBuffer*> interfaces instead of sp<BnGraphicBuffer*>, since
most clients don't actually need the Binderized versions (but some
might).

Change-Id: Iaf4f719c96ddb6f704afc75cf52be22588173e32
2014-03-12 10:17:20 -07:00
Jesse Hall 399184a4cd Add sideband streams to BufferQueue and related classes
Sideband streams are essentially a device-specific buffer queue that
bypasses the BufferQueue system. They can be used for situations with
hard real-time requirements like high-quality TV and video playback
with A/V sync. A handle to the stream is provided by the source HAL,
and attached to a BufferQueue. The sink HAL can read buffers via the
stream handle rather than acquiring individual buffers from the
BufferQueue.

Change-Id: Ib3f262eddfc520f4bbe3d9b91753ed7dd09d3a9b
2014-03-11 12:23:14 -07:00
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 c0c6a0cd4c Merge "FramebufferNativeWindow.h is obsolete" 2014-03-06 15:31:39 +00: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
Dan Stoza c1ef3efecb Merge "Change BufferQueue into producer/consumer wrapper" 2014-03-05 18:55:13 +00:00
Dan Stoza 3e96f1982f Change BufferQueue into producer/consumer wrapper
Now that BufferQueue has been split into core + producer + consumer,
rewrite BufferQueue to be a thin layer over a producer and consumer
interface. Eventually, this layer will be deprecated in favor of
only using either the producer or consumer interface, as applicable.

Change-Id: I340ae5f5b633b244fb594615ff52ba50b9e2f7e4
2014-03-04 15:58:03 -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
Igor Murashkin 1738d4fca7 am 462fb3a8: Merge "gui: Fix return code assert in CpuConsumer_test."
* commit '462fb3a8d597fffef3d5534544428d5cee9d8c16':
  gui: Fix return code assert in CpuConsumer_test.
2014-03-04 21:10:33 +00:00
Igor Murashkin 462fb3a8d5 Merge "gui: Fix return code assert in CpuConsumer_test." 2014-03-04 21:05:41 +00:00
Dan Stoza 4a07dc8d21 Merge "Split BufferQueue into core + producer + consumer" 2014-03-04 20:03:59 +00:00
Dan Stoza 289ade165e Split BufferQueue into core + producer + consumer
Change-Id: Idc39f1e511d68ce4f02202d35425a419bc0bcd92
2014-03-04 09:33:14 -08:00
Igor Murashkin 0f1889efe7 gui: Surface::dequeueBuffer no locker holds mutex while blocking in binder
- This also fixes a hang in the camera service when trying to shut down
  if the producer is infinitely blocked while trying to get a new buffer.

Bug: 13250382
Change-Id: I32ca82162bb8645b97dbe084e13e05ca05529a42
2014-03-03 11:42:27 -08:00
Dan Stoza fb83d84694 Merge "Fix calls to captureScreen" 2014-02-20 02:43:37 +00:00
Dan Stoza 8d7599633f Fix calls to captureScreen
Change-Id: Ic0ff47afa29f143131906082dff79d4e907b7143
2014-02-19 18:35:30 -08:00
Andy McFadden 44c35ec4a9 Allow "opaque" flag to be updated. DO NOT MERGE
Moves the "opaque layer" from Layer to Layer::State.  This allows
it to be updated as part of a transaction.

Bug 12387406

Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
2014-02-18 15:55:42 -08:00
Dan Stoza c701401f8c Allow disabling layer rotation during screenshots
Add the ability to ignore layers' transformation matrices during
screenshot capture, which will allow the window manager to capture
unrotated images for recents during the device rotation animation.

Bug: 11805195
Change-Id: I854d87bc84ca06ef9a054a454af1c080ee66fbb8
2014-02-14 23:10:42 +00:00
Andy McFadden d592f32df9 Merge "Allow "opaque" flag to be updated" 2014-01-30 21:42:02 +00:00
Andy McFadden 4125a4ffaf Allow "opaque" flag to be updated
Moves the "opaque layer" from Layer to Layer::State.  This allows
it to be updated as part of a transaction.

Bug 12387406

Change-Id: I0a114ce6adf77cd12fb08f96e0691b76c475768d
2014-01-29 17:36:49 -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
Igor Murashkin 4be18a3566 gui: Remove BufferQueue::MIN_UNDEQUEUED_BUFFERS
Change-Id: I7c0cc36046dbbdb9c0e85acfe5027293d1131275
2013-11-18 12:36:15 -08:00
Igor Murashkin 7d2d160cdc gui: Update header docs for IGraphicBufferConsumer/Producer/BufferQueue
Also fix compiler warnings for libgui

Change-Id: I0ee38d9ad5eaa82d55bf812d291da8c433581cef
2013-11-13 17:34:03 -08:00
Andy McFadden 0012dbc3c6 am 251b11c2: am 85075869: Wait for buffers to drain
* commit '251b11c2045b2ae97f2ab270a65e11b4ca49b1b6':
  Wait for buffers to drain
2013-10-18 17:00:26 -07:00
Andy McFadden 251b11c204 am 85075869: Wait for buffers to drain
* commit '8507586903fa803abf535853a169913f2cf2e555':
  Wait for buffers to drain
2013-10-18 16:57:01 -07:00
Andy McFadden 8507586903 Wait for buffers to drain
When a BufferQueue producer disconnects and reconnects, we retain
the previously-queued buffers but empty the slots.  This allows
the number of queued buffers to grow without limit.  The low-memory
killer does not approve.

Bug 11069934

Change-Id: Ia2eaa954c7a3904b54209a3701dba01689e204d8
2013-10-18 23:10:16 +00:00
Aravind Akella 4a1e00fb3a am 1f1e5768: am 5d6aa951: Merge "Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection." into klp-dev
* commit '1f1e576840d5b36a091368abb6fe6610384b6449':
  Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection.
2013-10-10 19:26:34 -07:00
Aravind Akella 1f1e576840 am 5d6aa951: Merge "Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection." into klp-dev
* commit '5d6aa95129a13aae37a60b3e4246a0592dab396d':
  Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection.
2013-10-10 19:21:05 -07:00
Aravind Akella 701166d9f6 Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection.
Change-Id: I4ef2bec80406c517903ab9782dc9eaf3fa8b7f36
2013-10-09 17:26:01 -07:00
Jamie Gennis bd381c6164 am 6be1d210: am f0cf5f10: BufferQueue: fix a test crash
* commit '6be1d210eef392f5745d58a0033572b1af4b2f2a':
  BufferQueue: fix a test crash
2013-10-02 11:19:52 -07:00
Jamie Gennis 6be1d210ee am f0cf5f10: BufferQueue: fix a test crash
* commit 'f0cf5f103cf9c54d59de4ed6f1d8ddd2302dec1b':
  BufferQueue: fix a test crash
2013-10-02 11:16:59 -07:00
Jamie Gennis f0cf5f103c BufferQueue: fix a test crash
Bug: 10935880
Change-Id: If76e9fb055103bad0db7e6c16487532671573149
2013-10-02 18:02:28 +00:00
Jamie Gennis 4e8fd6f30d am 886b1521: am a9c47f32: Merge "GLConsumer: start using EGL_ANDROID_image_crop" into klp-dev
* commit '886b152111cc13dcfe1b47724f5e496f12ccc420':
  GLConsumer: start using EGL_ANDROID_image_crop
2013-10-02 10:44:44 -07:00
Jamie Gennis 886b152111 am a9c47f32: Merge "GLConsumer: start using EGL_ANDROID_image_crop" into klp-dev
* commit 'a9c47f327373cbe48e187442c7f9554d24a75c08':
  GLConsumer: start using EGL_ANDROID_image_crop
2013-10-02 10:41:58 -07:00
Jamie Gennis dbe9245e2e GLConsumer: start using EGL_ANDROID_image_crop
This change makes GLConsumer use the EGL_ANDROID_image_crop extension when
available on a device.  The crop rectangle is passed to the EGL driver when
creating EGLImages, allowing the crop to be performed by the driver rather than
using the texture transform matrix.

Bug: 10897141
Change-Id: I63e9a5d5c85067376abc420e3639154468346311
2013-10-02 17:34:35 +00:00
Eino-Ville Talvala 3473e814a4 am 1160e89d: am d171da97: GLConsumer: Add query for current frame number.
* commit '1160e89d31810f2ba66f8ab502281579115b39b0':
  GLConsumer: Add query for current frame number.
2013-09-20 11:19:41 -07:00
Christopher Ferris 6de9653ac8 Merge "Remove unnecessary include." 2013-09-19 23:16:10 +00:00
Christopher Ferris d142f4b787 Remove unnecessary include.
All these files are including utils/CallStack.h, but none of the code
uses any CallStack objects.

Change-Id: I38c3a346a3bd0ddbff368d0f7f8b3f3d78fc0432
2013-09-19 15:45:03 -07:00
Eino-Ville Talvala 1160e89d31 am d171da97: GLConsumer: Add query for current frame number.
* commit 'd171da973de3c6b30263011334fdcd916739144f':
  GLConsumer: Add query for current frame number.
2013-09-19 14:59:51 -07:00
Eino-Ville Talvala d171da973d GLConsumer: Add query for current frame number.
Surface the underlying frame number of the current texture.

Bug: 10830400
Change-Id: Ide3a7da12ea0aac54588beb6bf00dbfe2cd37653
2013-09-19 13:36:07 -07:00
Mathias Agopian 0f0e845113 am a7e1660b: am c1c05de4: fix camera API 2.0 orientation
* commit 'a7e1660b257326f99261e7c9b2d58c9d2e68d0b0':
  fix camera API 2.0 orientation
2013-09-18 15:36:00 -07:00
Mathias Agopian a7e1660b25 am c1c05de4: fix camera API 2.0 orientation
* commit 'c1c05de415854eb7a13a16b7e22a22de8515123a':
  fix camera API 2.0 orientation
2013-09-18 15:33:38 -07:00
Mathias Agopian c1c05de415 fix camera API 2.0 orientation
we add a flag to ANativeWindow::setBufferTransform that means
"apply the inverse rotation of the display this buffer is displayed
onto to".

Bug: 10804238
Change-Id: Id2447676271950463e8dbcef1b95935c5c3f32b2
2013-09-17 23:45:22 -07: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
Mathias Agopian 7229e98229 am 3f342c11: am 02b62df7: Merge "Make sure do disconnect from a BQ when its client dies." into klp-dev
* commit '3f342c113360eacc1e9c1ff481cb03f700a50117':
  Make sure do disconnect from a BQ when its client dies.
2013-09-17 14:35:29 -07:00
Mathias Agopian 3f342c1133 am 02b62df7: Merge "Make sure do disconnect from a BQ when its client dies." into klp-dev
* commit '02b62df7119b27c89d91d96938d8f4f5232b296b':
  Make sure do disconnect from a BQ when its client dies.
2013-09-17 14:33:09 -07:00
Mathias Agopian 02b62df711 Merge "Make sure do disconnect from a BQ when its client dies." into klp-dev 2013-09-17 21:31:14 +00:00
Jesse Hall cd9fd427ac am b8080d9a: am 2a36497e: Merge "Stop using default value for Surface producerControlledByApp parameter" into klp-dev
* commit 'b8080d9a3b760617c5dde7b1d2d63aa2bcecf3a7':
  Stop using default value for Surface producerControlledByApp parameter
2013-09-16 20:32:34 -07:00
Jesse Hall b8080d9a3b am 2a36497e: Merge "Stop using default value for Surface producerControlledByApp parameter" into klp-dev
* commit '2a36497e45d4d96e35fed89cfdcb09b71459ac3c':
  Stop using default value for Surface producerControlledByApp parameter
2013-09-16 20:30:11 -07:00
Mathias Agopian 365857df8b Make sure do disconnect from a BQ when its client dies.
Bug: 5679534

Change-Id: If447e8673df83fe0b1d6210641e0a48522501a53
2013-09-16 16:15:21 -07:00
Jesse Hall 83cafffeac Stop using default value for Surface producerControlledByApp parameter
Bug: 10785749
Change-Id: Ifbf9340e5eabe621a69e990ec3e05ac51f8db66a
2013-09-16 15:39:55 -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
Mathias Agopian 7c4f236532 am 90ed3e8d: fix a few problems with BitTube
* commit '90ed3e8d7883d9c80fb8bf11b1c593bd8b2b39d0':
  fix a few problems with BitTube
2013-09-11 15:06:10 -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
Mathias Agopian 90ed3e8d78 fix a few problems with BitTube
BitTube used to send objects one at a time and didn't
handle errors properly.

We now send all the objects in one call, which means they
have to be read as a single batch as well. This changes the
BitTube API.

Update SensorService to the new API.

Also added an API to set the size of the send buffer.

Bug: 10641596
Change-Id: I77c70d35e351fdba0416fae4b7ca3b1d56272251
2013-09-10 21:10:53 -07:00
Aravind Akella e29df8b929 am a5552de9: Merge "Sensor batching. Changes to the native code." into klp-dev
* commit 'a5552de96f0cff9fb1947d8d21556bfeccf9cd03':
  Sensor batching. Changes to the native code.
2013-09-03 17:43:44 -07:00
Aravind Akella 724d91d778 Sensor batching. Changes to the native code.
Bug: 10109508
Change-Id: I7333f3aac76125a8226a4c99c901fb904588df04
2013-09-03 17:04:36 -07:00
Jesse Hall 2d28c37269 am 87967c18: Merge "Force async behavior for the virtual display output BufferQueue" into klp-dev
* commit '87967c186995d1500875c495cba8f04f7cff76cc':
  Force async behavior for the virtual display output BufferQueue
2013-08-30 14:19:13 -07:00
Jesse Hall 8db92553e9 Force async behavior for the virtual display output BufferQueue
Bug: 10551087
Change-Id: I40bbb2b87d64420939a0ea309254f281437dab56
2013-08-29 16:09:11 -07:00
Eino-Ville Talvala 169636c62b am b6aea00c: Merge "Surface: Fix controlledByApp parameter" into klp-dev
* commit 'b6aea00c7843705fdc6d265d7e15b3df52e86009':
  Surface: Fix controlledByApp parameter
2013-08-22 12:26:51 -07:00
Eino-Ville Talvala 7895e90e29 Surface: Fix controlledByApp parameter
Bug: 10425641
Change-Id: I1a47e2ce4ecbdb8e67030a5d9ddf6604c5e2497d
2013-08-21 12:05:42 -07:00
Andy McFadden f94705f5fb am 8b308ed7: Fix build
* commit '8b308ed70ed782f68c8075aac2a6b66bbfcdb9af':
  Fix build
2013-08-19 09:51:16 -07:00
Andy McFadden 8b308ed70e Fix build
Neglected the "checkbuild"-built tests.

Change-Id: I202692f1a6d1e306c88e820c959d07d16e7c6a00
2013-08-19 08:56:07 -07:00
Andy McFadden 30290a557e am 90f59bf9: Merge "Re-enable frame dropping for non-auto timestamps" into klp-dev
* commit '90f59bf9eba79b27629505bc2709d84e7c811c8b':
  Re-enable frame dropping for non-auto timestamps
2013-08-19 07:29:11 -07:00
Andy McFadden 3c25621ad7 Re-enable frame dropping for non-auto timestamps
This change adds an entire field to note whether the timestamp was
auto-generated by Surface or supplied by the application.

The value is used when deciding whether or not to drop frames based
on buffer presentation timestamps.  If a desired presentation time
was set explicitly, BufferQueue will use that value to decide if a
frame should be dropped.  If the timestamp was generated by Surface
at the time the buffer was queued, the timestamp is ignored.

Bug 10151804

Change-Id: Ibd571a7578351063b813cbdad2ddbeed70655ba5
2013-08-16 15:15:16 -07:00
Igor Murashkin 0ba1a16bbb am e60a0b1e: Merge "gui: CpuConsumer::lockNextBuffer change return code when too many bufs acquired" into klp-dev
* commit 'e60a0b1e6a29d79b4d0ec0374446cb829bcadee4':
  gui: CpuConsumer::lockNextBuffer change return code when too many bufs acquired
2013-08-16 14:07:10 -07:00
Igor Murashkin a5b7513711 gui: CpuConsumer::lockNextBuffer change return code when too many bufs acquired
- Return NOT_ENOUGH_DATA instead of INVALID_OPERATION when too many
  buffers have already been locked.
- INVALID_OPERATION is nominally used when something irrecoverable happens,
  but in this case the client just needs to call unlockBuffer to go back into a
  good state.

Bug: 10333400
Change-Id: I3a034d77de85741429f832a90eedd670afa1dc94
2013-08-14 20:17:17 -07:00
Mathias Agopian 70986f0034 am c6bae007: Fix build. optional tests were broken.
* commit 'c6bae007e6e29b585fc1207f84b378a480006173':
  Fix build. optional tests were broken.
2013-08-14 16:33:04 -07:00
Mathias Agopian c6bae007e6 Fix build. optional tests were broken.
Change-Id: Iba9f5cb57f134559e1f9c55e293578d9f5d8cb96
2013-08-14 16:27:19 -07:00
Mathias Agopian b881700ab1 am 56f825e7: Merge "SurfaceFlinger now uses GLES 2.x when available" into klp-dev
* commit '56f825e7ab9f83706a74dcd4825c7bc839e49ae4':
  SurfaceFlinger now uses GLES 2.x when available
2013-08-14 15:45:21 -07:00
Mathias Agopian 3f84483382 SurfaceFlinger now uses GLES 2.x when available
Bug: 8679321

Change-Id: I2b152d01fb4e2de2ea9fe87f1ddbd6826d7520d7
2013-08-13 16:07:45 -07:00
Jesse Hall 771ed8d71b am fc43e16a: Merge "Graphics:Add error check when create GraphicBuffer"
* commit 'fc43e16a5693bca0edfc82c650fb606971e47138':
  Graphics:Add error check when create GraphicBuffer
2013-08-13 12:06:31 -07:00
Lingyun Zhu 2aff702548 Graphics:Add error check when create GraphicBuffer
Change-Id: Ib0ca59bf1dfe4ae0266c29c91c1dbe3d02c0904e
Author: Lingyun Zhu <lingyun.zhu@intel.com>
Signed-off-by: Lingyun Zhu <lingyun.zhu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 50141
2013-08-13 11:51:48 -07:00
Mathias Agopian 45155969dc make sure GLConsumer::releaseTexImage() works after detachFromContext()
Change-Id: I27e0bc57e927d47b2b98113ee37b5396bcc72019
2013-08-12 23:45:28 -07:00
Mathias Agopian 9870c9b66c make GLConsumer's debug texture static
this is so that we don't burn a gralloc handle and a bit
of memory per GLConsumer.

Change-Id: I30c3e7ec45d7f1b5426aca8e06c7716870877706
2013-08-08 17:46:48 -07:00
Jesse Hall 6c913be9ca Add ISurfaceComposer::destroyDisplay
Bug: 10191053
Change-Id: Ia89286f95421344a60ffedaaca5825c4e3cd7f9e
2013-08-08 13:12:29 -07:00
Mathias Agopian 45263e2475 don't hardcode debug texture dimensions
Change-Id: I356333801d246a8cafb3e977a77dc7325e8b822d
2013-08-07 13:35:20 -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 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
Jean-Baptiste Queru b6a0ca7276 Tweaks for forward compatibility
Change-Id: Id6a96521b3fd5bd2a034fe89cfa4d3a179a66328
2013-07-16 09:38:03 -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
Jesse Hall 13f01cbdbd Pass sp<Fence>s around instead of file descriptors
Change-Id: Iac70584a2207940730e8f803a543e4e9a4000c47
2013-03-22 09:56:58 -07:00
Eino-Ville Talvala aaebffd52f Merge "CpuConsumer: Properly track acquired buffers" into jb-mr2-dev 2013-03-21 16:39:14 +00:00
Ramanan Rajeswaran ac006439bb Merge "Revert "Revert "Change SurfaceControl setPosition to take floats""" into jb-mr2-dev 2013-03-21 15:52:49 +00:00
Ramanan Rajeswaran d6480c020b Revert "Revert "Change SurfaceControl setPosition to take floats""
This reverts commit bbb57f3331

Change-Id: Ib8f039f530d6b8175b5205c6c0008b135d4001a2
2013-03-21 15:49:59 +00:00
Mathias Agopian 7c1a487ba8 fix build. update test to new API
Change-Id: I31ca84c85edff3e2ff90c554769e058110f27d49
2013-03-20 15:56:04 -07:00
Mathias Agopian abe815dd69 rework how we take screenshots for a CPU consumer
We're not using IMemoryHeap as a transport anymore,
instead we're providing a CpuConsumer and use the
IGraphicBufferProducer version of the screenshot API.

However, some GPU drivers don't support properly
a GPU to CPU path, to work around this, we use a
temporary BufferQueue on the server side for the
GL rendering, and we use glReadPixels into the
CpuConsumer (we're now using a CPU to CPU path
which is always supported).

Currently this "wrapping" is always performed,
but it can be bypassed on devices that support
the GPU to CPU path.

This also addresses a DoS attack vector on
SurfaceFlinger, where an application could
consume all of SF's filedescriptors by creating
a lot of screenshots in a row.

Bug: 8390553

Change-Id: I9e81514c2a7711b9bb393f74305be7d2abe08f1c
2013-03-19 22:22:21 -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 35ffa6a868 Surface can now be created only from an IGraphicBufferProducer
it can't write itself to a parcel, nor can it be created from a
parcel.

Change-Id: I69165d5c54d6024b3e546e80d8b57e3dedda7893
2013-03-12 18:45:09 -07:00
Mathias Agopian 4d9b822e2c get rid of ISurface
ISurface was only used to get the IGraphicBufferProducer from
a Layer. It's now replaced by a BBinder subclass / IBinder and
is only used as a handle to the surface, to both refer to it
and manage its life-time.

Also cleaned-up a bit the ISurfaceComposer interface and
"create layer" code path.

Change-Id: I68d0e02d57b862cffb31d5168c3bc10cea0906eb
2013-03-12 17:11:48 -07:00
Mathias Agopian d2d5a64aa2 workaround a deadlock when taking screenshots into a surface
When disconnecting from BufferQueue, we now drain the queue
except the head (which means in the screenshot case we won't
have to block, but we might not have a buffer to show, this
will appear as an error in the log).

Bug: 8362363
Change-Id: If80989aac3c917beea2ebddf3cbb502849d394da
2013-03-11 17:59:59 -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
Eino-Ville Talvala 042ecee2ab CpuConsumer: Properly track acquired buffers
CpuConsumer cannot simply assume a slot's buffer is the same buffer
between acquire and release, and therefore it could be possible for
the same slot to get used for a second acquired buffer, if there's a
producer disconnect in between. This would cause a problem when the
first buffer is released by the consumer.

Instead, use an independent list of acquired buffers to properly track
their state.

Bug: 8291751
Change-Id: I0241ad8704e53d47318c7179b13daed8181b1fab
2013-03-05 15:25:06 -08:00
Igor Murashkin f082323c0d Merge "CpuConsumer_test: Extend test with new formats RGBA8888 and optional Y8/Y16" into jb-mr2-dev 2013-03-05 21:58:00 +00: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 306f18c5fb Merge "rework screenshot API and implementation" into jb-mr2-dev 2013-03-05 02:30:13 +00:00
Jesse Hall 006a601f22 Fix reading NULL Surfaces from Parcels
Writing a NULL Surface was being read as a non-NULL Surface with NULL
mGraphicBufferProducer. Before the SurfaceTextureClient -> Surface
refactoring, you'd get a NULL Surface, and some code relies on that.

Bug: 8291161
Change-Id: I477bfe8882693e53a5f604a3d2c9e3cfe24473b4
2013-03-02 20:06:42 -08:00
Mathias Agopian 2a9fc493df rework screenshot API and implementation
- SurfaceFlinger now supports to take a screenshot
  directly into an IGraphicBufferProducer

- reimplement the IMemoryHeap screenshot on top
  of the above

- reimplement LayerScreenshot such that its
  BufferQueue is directly used as the destination
  of the screenshot. LayerScreenshot is now a thin
  wrapper around Layer

Bug: 6940974

Change-Id: I69a2096b44b91acbb99eba16f83a9c78d94e0d10
2013-03-01 22:53:39 -08:00
Dave Burke bbb57f3331 Revert "Change SurfaceControl setPosition to take floats"
Temporary, to fix weekend build, until we get Nvidia code drop.

This reverts commit 9a867a8798

DO NOT MERGE

Change-Id: I7b5dbc4db46ef3d97dc8598057d5487d6971178b
2013-03-01 16:06:48 -08:00
Eino-Ville Talvala eb0d12963d CpuConsumer: Add optional asynchronous mode
Bug: 8290146
Bug: 8291751

Change-Id: I9c8ac4bff38b0411e987a204e540d018dba6d0b4
2013-02-28 15:51:24 -08:00
Eino-Ville Talvala 64d8b1903e CpuConsumer: Don't unlock buffers on producer disconnect
Bug: 8291751

Change-Id: I062a3d34b41183d07fb6b9109cdb6bf0c0c75672
2013-02-28 14:20:28 -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
Michael Wright 9a867a8798 Change SurfaceControl setPosition to take floats
Bug: 8153162
Change-Id: If3c4b7a3e124ace25999eb9a569dc9a806a1fbc2
2013-02-21 22:42:07 -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
Mathias Agopian ac9fa427d4 get rid of Surface identity and token
we use the IBinder instead.

Change-Id: I4aa0b58869ba43f19980013620051e5a261b062d
2013-02-13 15:27:08 -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 466a192d20 Minor tweaks.
Change-Id: I9f82f574112141b6aa074c42303056cd52d5c478
2013-01-08 11:25:51 -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
Jamie Gennis 3c1ada9822 Merge "SurfaceTextureClient: remove a deprecated ctor" 2012-12-12 12:16:21 -08:00
Jamie Gennis 4def860030 SurfaceTextureClient: remove a deprecated ctor
Change-Id: Ibf2746fdca26851677cd90199c60eab80f6d0c73
2012-12-12 12:13:54 -08:00
Jamie Gennis c6f04666c2 Merge "SurfaceFlinger: Move GraphicBufferAlloc to libgui" 2012-12-12 10:56:42 -08:00
Jamie Gennis 392edd88cb SurfaceFlinger: Move GraphicBufferAlloc to libgui
This change moves the GraphicBufferAlloc class from SurfaceFlinger to libgui.

Change-Id: Idf31d2004efa2651b60590733f73c4a7b831e8a9
2012-12-11 17:54:29 -08:00
Andy McFadden 97eba8904c Avoid unnecessary texture bind
In SurfaceFlingerConsumer, check to see if native fence sync is
enabled.  If so, defer the texture binding step to Layer::onDraw.

Change-Id: I7d4034a31c0143207eea2509dfa13ef3820f9b8c
2012-12-11 16:26:51 -08:00
Andy McFadden bf974abe92 Refactor SurfaceTexture a bit.
Rearranges updateTexImage() so that the SurfaceFlinger-specific
behavior is in a new SurfaceFlingerConsumer subclass.

SurfaceTexture behavior should not be altered.  Instead of
acquire-bind-release we now do acquire-release-bind, but since
it's all done with the lock held there shouldn't be any
externally-visible change.

Change-Id: Ia566e4727945e2cfb9359fc6d2a8f8af64d7b7b7
2012-12-11 09:42:51 -08:00
Jamie Gennis a436799668 am 50f8d285: am d4e70620: am 72c3f7d8: Revert "ConsumerBase: free buffers outside the lock"
* commit '50f8d2856b6644059b31684687842bf9c1f2e814':
  Revert "ConsumerBase: free buffers outside the lock"
2012-12-07 11:09:12 -08:00
Jamie Gennis 72c3f7d881 Revert "ConsumerBase: free buffers outside the lock"
This reverts commit b21a4e3b5f.
2012-12-07 10:33:07 -08:00
Jamie Gennis b5fe96b813 am 05989772: am 3ed2736c: am b21a4e3b: ConsumerBase: free buffers outside the lock
* commit '05989772d5b46cd5328e88d546f04deef39cc3c8':
  ConsumerBase: free buffers outside the lock
2012-12-06 23:24:25 -08:00
Jamie Gennis b21a4e3b5f ConsumerBase: free buffers outside the lock
This change makes ConsumerBase::onBuffersReleased hold a reference to all its
gralloc buffers until after the mutex is unlocked.  This prevents slow
gralloc::free calls from causing lock contention with rendering threads.

Bug: 7675940
Change-Id: I0ec805d1b612afeeecfffec03f982371d27d93be
2012-12-06 18:17:35 -08:00
Mathias Agopian 73d5662e4c fix typo that broke all the builds
cherry pick into master since auto-merger is blocked

Bug: 7584338
Change-Id: Ie7d7c238de1fd224b3b0bae9669a8dcb2f700a79
2012-11-19 22:13:49 -08:00
Mathias Agopian 764c197c6f fix typo that broke all the builds
Bug: 7584338
Change-Id: Ieb8c27a544ac583af9aa1e0376e33a673d2d9673
2012-11-19 16:50:24 -08:00
Mathias Agopian bd3e837ec7 am c208cdd4: am 1d3612f1: am 2a8c49eb: fix an out-of-bounds memory access
* commit 'c208cdd402d767228a34074d589c6368cc656b7d':
  fix an out-of-bounds memory access
2012-11-19 15:17:27 -08:00
Mathias Agopian 2a8c49eb5d fix an out-of-bounds memory access
in this particular case, this OOB is always harmless
(and that's why it didn't get fixed from MR1), however,
it interfers with valgrind debugging.

Change-Id: Ic977e03287e59c4b124a89146c9023bd0cb540a8
2012-11-15 17:19:48 -08:00
Igor Murashkin 74284b9467 Merge "Change ConsumerBase's FrameAvailableListener to be a weak pointer" 2012-11-05 13:47:37 -08:00
Igor Murashkin a4a3149a36 Change ConsumerBase's FrameAvailableListener to be a weak pointer
This prevents strong reference cycles when the listener implementation also
holds a strong pointer to the ConsumerBase

Bug: 7425644
Change-Id: I1514b13a32b18d421c902dddebec0765a989c55c
2012-11-05 13:39:02 -08:00
Jeff Brown f3f7db6346 Allow global transactions to nest.
This change fixes a number of small glitches that can occur when
multiple components in the same process are updating surfaces.
One would expect that updates to disjoint sets of surfaces would
not collide but this is not the case.  The first component to
close the global transaction causes all pending updates to
be applied, including those that another component might not
have finished setting up if it also had an open transaction
at the same time.

Change-Id: I99345958581abbe0e1e325a5bcba37e8941a313a
2012-11-02 14:02:52 -07:00
Jamie Gennis dd3cb84cfb SurfaceFlinger: add support for secure displays
This change adds support for displays that are not allowed to display surfaces
with the eSecure flag set.  All non-virtual displays are considered secure,
while virtual displays have their secure-ness specified at creation time.

Bug: 7368436
Change-Id: I81ad535d2d1e5a7ff78269017e85b111f0098500
2012-10-22 13:41:21 -07:00
Jamie Gennis 7f79a2bd5c Merge "BufferQueue: alloc without holding the lock" into jb-mr1-dev 2012-10-17 09:32:43 -07:00
Jamie Gennis 2d5e230292 SurfaceFlinger: add animation transactions
This change adds a transaction flag for WindowManager to indicate that a
transaction is being used to animate windows around the screen.  SurfaceFlinger
will not allow more than one of these transactions to be outstanding at a time
to prevent the animation "frames" from being dropped.

Bug: 7353840
Change-Id: I6488a6e0e1ed13d27356d2203c9dc766dc6b1759
2012-10-15 19:09:04 -07:00
Jamie Gennis 1efe099a51 BufferQueue: alloc without holding the lock
This change makes BufferQueue::dequeueBuffer release its mutex before
allocating new buffers.  This should alleviate lock contention in
SurfaceFlinger where SF's main thread can get blocked waiting for an allocation
operation to complete.

Bug: 7335075
Change-Id: I1b000539cc616a695afab2e9c68507db69e57b13
2012-10-11 20:08:26 -07:00
Jeff Brown 2a09bb3219 Add blankDisplay/unblankDisplay to SurfaceComposerClient.
Bug: 7309812
Change-Id: Ia401d642094a46c62f0d26c65da1d11341e203a1
2012-10-08 19:13:57 -07:00
Jesse Hall 9504eb915c Fix race condition in ConsumerBase::addReleaseFence()
This needs the ConsumerBase mutex locked, but wasn't locking it. Two
of the four places that called it already held the lock so were fine.
Now addReleaseFence() takes the lock itself, and I added
addReleaseFenceLocked() for the two already-locked callers, since in
one of them dropping the lock would be inconvenient.

Bug: 7289269
Change-Id: I7a5628adb516f8eec782aa6c14128202f96d7b0a
2012-10-05 14:40:50 -07:00
Stephen Hines d920670f25 Fix missing parens in CleanSpec.mk.
Change-Id: I0440a942d3e685d619ec9cc402d3293cb3f52df1
2012-10-04 20:05:19 -07:00
Raph Levien 3fbbd076ad Fix broken CleanSpec.mk in libs/gui
The CleanSpec is missing parens, which causes $P to be interpreted as a
single variable, and the following printed to the log:

Clean step: rm -rf RODUCT_OUT/obj/SHARED_LIBRARIES/libgui_intermediates

This patch adds parens as needed.

Change-Id: I587998fa67a4884418c286360a577cdbb6ea9a21
2012-10-04 19:00:45 -07:00
Jamie Gennis a573945df7 libgui: enable fence support for exynos5
Change-Id: Iffc48412b8c951116a956a3ac7dab8d75eed13da
Bug: 7238122
2012-10-03 15:55:14 -07:00
Jamie Gennis 3fd12e41af libgui: fix up compile options
This change adds debug info to SurfaceFlinger's dumpsys to indicate that the
USE_WAIT_SYNC compile option was enabled, and it removes the
ALLOW_DEQUEUE_CURRENT_BUFFER option.

Bug: 7238122
Change-Id: I70e08e34c2ef58aa6d2f88229e781a119f84b5a9
2012-10-03 15:05:58 -07:00
Jesse Hall ba607d53c6 Add Fence::waitForever which logs a warning timeout, and use it
Bug: 7217641
Change-Id: If0c1a613ead307c4045a47824174bf40c72bc7d7
2012-10-02 16:29:46 -07:00
Andy McFadden c01a79d77b Pass display arg to blank/unblank
This allows us to blank and unblank displays other than the built-in
display (e.g. HDMI).

Bug: 7240511
Change-Id: I89ea13f9e497be74c3e1231d0c62fb558e93e0f8
2012-09-28 13:04:16 -07:00
Iliyan Malchev 38b657265c Revert "Compatibility work around for bad graphics driver dependency."
This reverts commit a50b51c03a

Change-Id: Ibdcd776a7f241dbb2475403ea04f939249774c41
2012-09-27 15:52:12 -07:00
Andy McFadden 4803b74e2a Show build config in dumpsys SurfaceFlinger
This adds a line to the "dumpsys SurfaceFlinger" output that shows
build-time configuration values.

Example:
 Build configuration: [sf HAS_CONTEXT_PRIORITY] [libui] \
  [libgui USE_FENCE_SYNC]

Bug 7206633

Change-Id: Ibe1856b459d34a4be6ee83a4ebfd2807e6cc68a0
2012-09-25 11:31:46 -07:00
Mathias Agopian e96e9e1093 fix a crasher in SurfaceTexture's setFilteringEnabled
bug: 7211067
Change-Id: Id8658a8df429d76c20ab9112858b38e52343dc9c
2012-09-24 19:26:11 -07:00
Jamie Gennis 7aff4a5de4 ConsumerBase: make fence names meaningful
Change-Id: I3580120cb63c027c327e80ec70e68650b75395de
2012-09-24 12:25:53 -07:00
Jamie Gennis d1b330de41 SurfaceTexture: fix an out of bounds array write
This change fixes an issue causing the mEglContext member of a SurfaceTexture
to get incorrectly zeroed out.  This would happen when a call to
ConsumerBase::releaseBufferLocked resulted in the current buffer being freed.
Freeing the current buffer would set SurfaceTexture::mCurrentTexture to -1,
which would then be used by SurfaceTexture::releaseBufferLocked to reset the
current slot's EGLSyncKHR to EGL_NO_SYNC_KHR (= 0).  This would overwrite the
mEglContext field, resulting in context mismatch errors in
SurfaceTexture::doGLFenceWaitLocked.

The fix is to simply use the buffer slot that's passed in to
SurfaceTexture::releaseBufferLocked rather than mCurrentTexture.

Change-Id: I0e5e2bd88fcbb354c35a3744f317716fff3e0e41
2012-09-21 12:15:22 -07:00
Jeff Boody 42223f6fdd gui: conditionally set USE_NATIVE_FENCE_SYNC for msm8960
Change-Id: Ib7ad11597ef7c79162a0b0a49a1b8ae16d192c10
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-09-18 19:36:12 -07:00
Jamie Gennis 3941cb240d SurfaceTexture: default to doing GL sync
This change makes updateTexImage default to performing the necessary
synchronization and adds an argument for SurfaceFlinger to disable that
synchronization so that it can be performed lazily.

Change-Id: I7c20923cc786634126fbf7021c9d2541aa77be5d
Bug: 6991805
2012-09-18 10:59:40 -07:00
Andy McFadden 8dfa92fef9 Plumb display name into SurfaceFlinger
The Surface createDisplay() call takes a display name for debugging.
This change carries it through SurfaceFlinger and displays it in
the "dumpsys SurfaceFlinger" output.

Bug 7058158

Change-Id: I79f3474a8656ff1beb7b478e0dbf2c5de666118a
2012-09-18 09:20:23 -07: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
Andy McFadden 6905205c8d Fix transform hints
The hints were being set a little too late, so the pre-rotation stuff
wasn't quite working.

Bug 7054997

Change-Id: Id8d5c626db7a76f768ba762a145b315878ee08e6
2012-09-16 11:39:09 -07:00
Andy McFadden c272430960 Merge "Watch for SurfaceFlinger death" into jb-mr1-dev 2012-09-12 13:22:35 -07:00
Jamie Gennis 98ff0597bd SurfaceTexture: eglDestroySync after duping its fd
This change adds a call to eglDestroySync after we've dup'd the fd for the
Android fence that the EGLSyncKHR object wraps.

Change-Id: I4fa6ece863260793630d70bb9a69d6284d05d99e
2012-09-10 14:49:42 -07:00
Jamie Gennis 61e04b92bd SurfaceTexture: use eglWaitSync
This change adds a compile-option to use eglWaitSyncANDROID to ensure that
texturing operations that access the current buffer of a SurfaceTexture do not
occur until the buffer is completely written.  It also moves this
synchronization into a new SurfaceTexture method called doGLFenceWait and
changes SurfaceFlinger's Layer class to use that method rather than performing
its own wait on the fence.

Change-Id: I70afa88086ca7ff49a80e3cd03d423767db7cb88
2012-09-10 13:27:23 -07:00
Jamie Gennis 01dbf5539b SurfaceTexture: use EGL-created native fences
This change adds support for using Android fences that come from EGLSyncKHR
objects as the release fence for a buffer.

Change-Id: Ice192ce2ec001020f909a2018afdf0f17b24dec9
2012-09-09 12:58:23 -07:00
Andy McFadden 6652b3edcb Watch for SurfaceFlinger death
The ComposerService object wasn't watching for SurfaceFlinger
restarts, which doesn't usually matter because the app framework
restarts when SurfaceFlinger dies.  However, mediaserver continues
to run, which means its ComposerService object was trying to use
a dead handle, and playback of DRM movies was failing.

This adds a DeathRecipient listener and some logic to re-establish
the SurfaceFlinger connection.

Bug 6645813

Change-Id: I07581b881d3835601aa57d5358c8259d93bc4515
2012-09-06 18:54:42 -07:00
Jamie Gennis b272541546 libgui: move fence handling into ConsumerBase
This change moves some common fence handling code into the base class for
BufferQueue consumer classes.  It also makes the ConsumerBase class initialize
a buffer slot's fence with the acquire fence every time a buffer is acquired.

Change-Id: I0bd88bc269e919653b659bfb3ebfb04dd61692a0
2012-09-06 17:54:53 -07:00
Mathias Agopian 00e8c7a88a display projection API now has a single function instead of 3
Change-Id: I9bf46d372b77d547486d4bbe6f1953ec8c65e98f
2012-09-04 19:30:46 -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
Jamie Gennis fdb6b49dfa libgui: disable CpuConsumer tests
This change disables the CpuConsumer tests because they require a Gralloc
format that is not supported on all devices.

Change-Id: Ifaa618062c1dae53d9fcb9e16ba92c480d3dbd0c
2012-08-31 15:54:21 -07:00
Jamie Gennis 4697528eac SurfaceTexture: fix a few tests
Change-Id: Ic74fe8791361f8fe91ad7149720fafd4cc154ac1
2012-08-30 18:38:11 -07:00
Jamie Gennis d69097f936 libgui: add some error checks
This change adds a few error checks both in the framework and in some tests.

Change-Id: I2baf2676942a0dc15866e75852a775a0091ed16d
2012-08-30 18:38:11 -07:00
Jamie Gennis 5e5efde787 BufferQueue: add a check for the max acquired bufs
This change adds an error check to ensure that consumers don't acquire more
buffers than the maximum that they set.

Change-Id: I026643564bde52732e4ee6146972b207ddbbba77
2012-08-30 18:38:11 -07:00
Jamie Gennis 72f096fb1a BufferQueue: use max acquired buffer count
This change makes BufferQueue derive the min undequeued buffer count from a max
acquired buffer count that is set by the consumer.  This value may be set at
any time that a producer is not connected to the BufferQueue rather than at
BufferQueue construction time.

Change-Id: Icf9f1d91ec612a079968ba0a4621deffe48f4e22
2012-08-30 18:26:09 -07:00
Jamie Gennis 1847f7fd79 Merge "BufferQueue: simplify max buffer count handling" into jb-mr1-dev 2012-08-30 18:23:27 -07:00
Jamie Gennis 2b97769823 Merge "BufferQueue: clean up buffer counting" into jb-mr1-dev 2012-08-30 18:21:11 -07:00
Wink Saville 94f261556c Revert "A vendor ril depends on a native screen shot code."
This reverts commit 9b5782baf0.

A new ril for toro, hack no longer needed.
2012-08-30 11:53:55 -07:00
Jamie Gennis e191e6c348 BufferQueue: simplify max buffer count handling
This change reworks how the maximum buffer count is computed.

Change-Id: I7d3745814b9bd6f6f447f86bfea8eb7729914ebf
2012-08-29 15:35:34 -07:00
Jamie Gennis 31a353da22 BufferQueue: clean up buffer counting
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
2012-08-29 15:35:34 -07:00
Wink Saville 9b5782baf0 A vendor ril depends on a native screen shot code.
Add a temporary shim until the vendor fixes the ril.

Bug: 7073467
Change-Id: Ia95a58bd90677c03406c988d1c29ae785f8662f2
2012-08-28 16:20:50 -07:00
Jeff Brown a50b51c03a Compatibility work around for bad graphics driver dependency.
This is a compatibility shim for one product whose drivers
are depending on SurfaceComposerClient::getDisplayInfo(
int, DisplayInfo*) when it really shouldn't.

Revert this patch when the problem has been resolved.

Bug: 7065398
Change-Id: I6542691b81fd1b1e1d79500a62e82d40a3d51db7
2012-08-27 17:20:53 -07:00
Jeff Brown 380223bf1b Remove unused "layer" argument from show().
Change-Id: I8944a9f4a27c330b11e5e837c69b88c8f84145ba
2012-08-27 14:40:17 -07:00
Jeff Brown 9d4e3d2f42 Banish DisplayID from the SurfaceFlinger API.
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
2012-08-27 14:40:17 -07:00
Jamie Gennis 490aee0fc5 Merge "SurfaceTexture: inherit from ConsumerBase (try 2)" into jb-mr1-dev 2012-08-24 11:11:07 -07:00
Eino-Ville Talvala 0493044503 Merge "Add BufferItemConsumer, a simple BufferQueue consumer." into jb-mr1-dev 2012-08-21 16:46:05 -07:00
Jamie Gennis 9fea3421ff SurfaceTexture: inherit from ConsumerBase (try 2)
This change makes SurfaceTexture inherit from ConsumerBase.  It removes all of
the functionality from SurfaceTexture that is now provided by the base class.
This includes fixes for two bugs that were found after checking this change in
the first time and then reverting it.

Change-Id: Ie2d9f4f27cfef26fdac341de3152e842b01a58d2
2012-08-21 16:41:03 -07:00
Eino-Ville Talvala e232fdca2a Add BufferItemConsumer, a simple BufferQueue consumer.
BufferItemConsumer allows for acquiring BufferQueue's BufferItems,
which contain all the data and metadata the BufferQueue has for a
given graphics buffer.

This consumer is useful when direct access to the native buffer_handles
is needed by the client.

Also includes a minor cleanup of CpuConsumer's use of 'virtual'.

Bug: 6243944
Change-Id: If7dc4192b15ac499555f1eda42a85140f2434795
2012-08-21 15:46:35 -07:00
Eino-Ville Talvala 84a9a3c0ec Merge "CpuConsumer: inherit from ConsumerBase" into jb-mr1-dev 2012-08-20 16:18:11 -07:00
Eino-Ville Talvala f57e7540d4 CpuConsumer: inherit from ConsumerBase
Change-Id: I55178b1d673ffa0fbc6e63ef47642c64d4d03228
2012-08-20 15:44:40 -07:00
Jamie Gennis 729f48082e Merge "Revert "SurfaceTexture: inherit from ConsumerBase"" into jb-mr1-dev 2012-08-20 14:33:24 -07:00
Jamie Gennis f7f6345068 Merge "Revert "SurfaceTexture: call ConsumerBase::freeBufferLocked"" into jb-mr1-dev 2012-08-20 14:33:16 -07:00
Jamie Gennis ce7a6c0fc9 Revert "SurfaceTexture: inherit from ConsumerBase"
This reverts commit ed059a8d75

Change-Id: I72542c2595771a40c2c88251e0d6eb54e305b99b
2012-08-20 14:28:53 -07:00
Jamie Gennis 483bccd0d9 Revert "SurfaceTexture: call ConsumerBase::freeBufferLocked"
This reverts commit f8d33c652b

Change-Id: I1ff2e1cc85824a8fac1051f573d2931db81af511
2012-08-20 14:28:21 -07:00
Jamie Gennis 220ef10c5f Merge "SurfaceTexture: call ConsumerBase::freeBufferLocked" into jb-mr1-dev 2012-08-20 12:39:38 -07:00
Jamie Gennis f8d33c652b SurfaceTexture: call ConsumerBase::freeBufferLocked
This change fixes SurfaceTexture::freeBufferLocked so that it calls the base
class implementation.

Change-Id: I45d76fb2eb02c1fa6e4e917823ead83e2086bd15
2012-08-20 11:30:44 -07:00
Jean-Baptiste Queru d3bbcaff6f resolved conflicts for merge of 21938749 to jb-mr1-dev
Change-Id: I17da10797736f3772a143e2015fe25df0bb3eb3f
2012-08-20 10:22:33 -07:00
Jamie Gennis 2c7eb92b63 Merge "SurfaceTexture: inherit from ConsumerBase" into jb-mr1-dev 2012-08-17 15:35:17 -07:00
Mathias Agopian 818b46058a display states can't share the dirty flags
Change-Id: Ifade9f2f1a0df9a36aede77a6cf5eee4be534f98
2012-08-16 20:58:57 -07:00
Jamie Gennis ed059a8d75 SurfaceTexture: inherit from ConsumerBase
This change makes SurfaceTexture inherit from ConsumerBase.  It removes all of
the functionality from SurfaceTexture that is now provided by the base class.

Change-Id: I4a881df42810a14ee32d4ef7c8772a8f2510f4c7
2012-08-16 18:11:02 -07:00
Mathias Agopian 8683fca395 improve [un]marshalling of non-binder objects
this change introduces a new class LightFlattenable<> which is
a protocol to flatten simple objects that don't require
binders or file descriptors; the benefit of this protocol is that
it doesn't require the objects to have a virtual table and give us
a consitant way of doing this.

we also introduce an implementation of this protocol for
POD structures, LightFlattenablePod<>.

Parcel has been update to handle this protocol automatically.

Sensor, Rect, Point and Region now use this new protocol.

Change-Id: Icb3ce7fa1d785249eb666f39c2129f2fc143ea4a
2012-08-13 02:46:05 -07:00
Mathias Agopian e57f292595 make multi-display more real
- displays are represented by a binder on the client side
- c++ clients can now create and modify displays

Change-Id: I203ea5b4beae0819d742ec5171c27568f4e8354b
2012-08-10 17:32:33 -07:00
Mathias Agopian 3165cc21cf libgui includes refactoring
Change-Id: I1d24ec17f5003ec2abab5f7472daaff4cc4cc2d3
2012-08-10 13:18:24 -07:00
Jamie Gennis 3d1d09c0c1 SurfaceTexture: Fix a fence fd leak.
Bug: 6949010
Change-Id: I289992c964504b4fe5458dbd19b248a841ef043f
2012-08-08 15:39:55 -07:00
Jamie Gennis 45cb2ba1d5 SurfaceTexture: fix an out of bounds array access
Bug: 6879028
Change-Id: Ic3d35a9384c0a6dfa4000e7743a6f6859608b0bf
2012-08-06 18:55:01 -07:00
Jamie Gennis 1a4d883dcc surfaceflinger: refactor FrambufferSurface
This change refactors the FramebufferSurface class to inherit from the new
ConsumerBase class.

Bug: 6620200
Change-Id: I46ec942ddb019658e3c5e79465548b171b2261f2
2012-08-06 18:55:01 -07:00
Mathias Agopian 72131d9ef1 remove unneeded dependencies in libhardware
Change-Id: Ibb8d698d594216d0746b0e7270cf87d7e5acab2b
2012-08-04 20:22:32 -07:00
Mathias Agopian 92efd84f37 screen-off animation won't be handled by SF anymore
Change-Id: Idc41386804ae7d7eb981c36e1bc55c270870c8d0
2012-08-03 13:22:58 -07:00
Romain Guy 4f9c284de4 Add missing break in switch statement
Change-Id: I6206cc9ca46c4e2f125d3d820256280586ad66a1
2012-08-01 19:16:59 -07:00
Jamie Gennis 12bd497f28 libgui: enable EGL_fence_sync usage for exynos5
Bug: 6876502
Change-Id: I2ec2800881dcba9e4f6ff32ffa1341a2de01f0a2
2012-07-31 17:07:53 -07:00
Mathias Agopian c666cae2d5 get rid of the shared-memory control block
Change-Id: If814060aca1d2ff2619d4adcd57296983d207f7f
2012-07-25 21:13:10 -07:00
Mathias Agopian 8785578391 add a layerStack attribute to Layers.
this attribute can be set through a regular transaction using
SurfaceComposerClient (just like any other attribute, eg: position or size)

Change-Id: I701a47c677ea6442ca713728a93335328cd2b172
2012-07-24 21:42:27 -07:00
Mathias Agopian 8b33f03232 update SF binder protocol to support setting display attributes
no change of functionality -- the old behavior is implemented
on top of this new protocol.
this new protocol will allow, eventually, to pass informations
about displays and layer stacks.

Change-Id: Ic6c2295e61ec8ecbc8ce01ab7664e35d928202fc
2012-07-24 20:43:54 -07:00
Jeff Brown 6501e9944d Remove freeze(), unfreeze() and setFreezeTint().
This is all dead code.

Change-Id: I646673aac793a6ec45021c370a2450f0ea4fbcce
2012-07-16 15:38:18 -07:00
Jeff Brown f9176a93a5 Remove freezeDisplay(), which is no-op.
Change-Id: I2b70249a1545636fd6d98b58057b22f9529cad21
2012-07-16 14:58:11 -07:00
Steve Critchlow 47ad361cee Fix error trap in SurfaceTexture Client
There was an issue in Surface::lock where failure to lock a surface
resulted in two bad things happening:
- success was returned to the caller (it was apparently locked).
- an uninitialised pointer was returned as the buffer.

Change-Id: I8b0df81400e0fa0542a8bb993d76923ac96b686e
2012-07-10 14:09:10 +02:00
Jesse Hall e7db724bed Fix check for fence merge success
Change-Id: I9b16526ebfe4ffabf7c4372cca9b192ce046aa21
2012-07-03 13:41:54 -07:00
Jesse Hall dc5b485f74 Pass fence to HWC on first use of buffer
Also do a CPU-wait on the fence before using it for GL composition.

Change-Id: I0f645a42a44803276cae11b904e5a26d65871562
2012-06-30 21:38:51 -07:00
Jesse Hall b42b1ac158 Return fence from acquireBuffer
Change-Id: Iab22054c1dc4fd84affab3cc5bbdcd5a1e689666
2012-06-30 21:38:51 -07:00
Jesse Hall c777b0b3b9 Pass fences with buffers from SurfaceTextureClient
Change-Id: I09b49433788d01e8b2b3684bb4d0112be29538d3
2012-06-30 21:38:51 -07:00
Jesse Hall 02a7be74dd Merge "Clarify aborted updateTexImage use of fences" 2012-06-29 09:54:25 -07:00
Jesse Hall 962174da03 Merge "Return fence to client in dequeuBuffer" 2012-06-29 09:54:08 -07:00
Jesse Hall d58c304cc6 Clarify aborted updateTexImage use of fences
When updateTexImage acquires a buffer but then aborts (due to an error
or the buffer being rejected), it releases the newly-acquired buffer.
It was passing the buffer slot's fences to releaseBuffer, even though
they hadn't been created after the acquire yet. This wasn't a bug,
since the fences would be cleared just after the buffer slot was last
released, but explicitly passing null fences makes this clearer.

Change-Id: I087f2ec3fd02c40f57782c1fca24eb9567e2943d
2012-06-28 17:08:42 -07:00
Jesse Hall f9783af225 Return fence to client in dequeuBuffer
Change-Id: Ic19750793ad993f0e85391f3cabd743ba565d4c9
2012-06-28 17:08:42 -07:00
Mathias Agopian 3094df359d First prototype atttempting to support an external display
both API and implementation will change, this is just a prototype
intended to show feasability.

SurfaceFlinger is passed an ISurfaceTexture through a new
callback, it is in turn used to create an EGLSurface which
surfaceflinger will draw into in addition to the main screen.

Change-Id: Id0bbb0b854bb7bae44d57246a90b65d4567f9a21
2012-06-28 15:51:08 -07:00
Jesse Hall f785754009 Pass fences from BufferQueue to SurfaceTextureClient
ISurfaceTexture::dequeueBuffer now returns the buffer's fence for the
client to wait on. For BufferQueue, this means passing it through
Binder so it can be returned to the SurfaceTextureClient. Now
SurfaceTextureClient is responsible for waiting on the fence in
dequeueBuffer instead of BufferQueue: one step closer to the goal.

Change-Id: I677ae758bcd23acee2d784b8cec11b32cccc196d
2012-06-21 22:21:12 -07:00
Jesse Hall ef19414bd8 Transfer HWC release fences to BufferQueue
After a HWC set, each SurfaceFlinger Layer retrieves the release fence
HWC returned and gives it to the layer's SurfaceTexture. The
SurfaceTexture accumulates the fences into a merged fence until the
next updateTexImage, then passes the merged fence to the BufferQueue
in releaseBuffer.

In a follow-on change, BufferQueue will return the fence along with
the buffer slot in dequeueBuffer. For now, dequeueBuffer waits for the
fence to signal before returning.

The releaseFence default value for BufferQueue::releaseBuffer() is
temporary to avoid transient build breaks with a multi-project
checkin. It'll disappear in the next change.

Change-Id: Iaa9a0d5775235585d9cbf453d3a64623d08013d9
2012-06-21 22:21:12 -07:00
Jamie Gennis d8e812ce6f Update ANativeWindow clients for sync
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
2012-06-20 15:48:30 -07:00
Mathias Agopian 3e87601170 Implement SurfaceFlinger's ANW on top of BufferQueue
SF now has its own implementation of ANW for the
framebuffer and it uses BufferQueue. FramebufferNativeWindow
is now only used by stand-alone apps.

Change-Id: Iddeb24087df62bd92b0f78e391dda9b97ddc859c
2012-06-13 18:07:47 -07:00
Colin Cross 8e533069e5 surfaceflinger: replace early suspend with binder call from PowerManager
SurfaceFlinger will no longer directly synchronize with early suspend.
Instead, PowerManagerService will synchronize with SurfaceFlinger to
ensure that a black frame has been drawn on the display, and then
trigger all early suspend handlers.

Change-Id: I07acdd628440d23fdb69db94319ec5d65d3f4919
2012-06-07 16:28:30 -07:00
Mathias Agopian 2466e402a0 am 584fcb32: am 2c8207e9: add the ability to reject buffers in SurfaceTexture::updateTexImage
* commit '584fcb3218e07d7b4cc0aeaef41faa4e891b45a4':
  add the ability to reject buffers in SurfaceTexture::updateTexImage
2012-05-29 19:53:52 -07:00
Mathias Agopian 2c8207e962 add the ability to reject buffers in SurfaceTexture::updateTexImage
SurfaceFlinger is using this new feature to reject buffers that
don't have the right size.

Bug: 6498869
Change-Id: I8a7250a47db6c082a357b703feb3b9d0fc8d3443
2012-05-23 18:01:33 -07:00
Jesse Hall c20bd43b8a am 138a8d75: am e1082496: Enable SurfaceTexture fence sync for the emulator
* commit '138a8d7510e6ba8a402ffacc38c7cc5bfaa5e571':
  Enable SurfaceTexture fence sync for the emulator
2012-05-22 21:29:27 -07:00
Jesse Hall e10824965c Enable SurfaceTexture fence sync for the emulator
The host-accelerated GL ES driver doesn't do the implicit
synchronization required when fence sync isn't used.

Bug: 6515813
Change-Id: I6a667f2db6b519f3557b5abda78775f767841dae
2012-05-22 16:46:17 -07:00
Mathias Agopian 69df645759 am 83f1d839: am 7e477bfe: make sure BufferQueue releases newly acquired buffers on failures
* commit '83f1d83975345bada9886e9ea0ef2b950d90cd77':
  make sure BufferQueue releases newly acquired buffers on failures
2012-05-21 14:27:29 -07:00
Mathias Agopian 49b97c857e am ac4a4825: am f899e411: Remove misleading and wrong ALOGW
* commit 'ac4a48251180a79ae19e3a7112537c3d0fa260c6':
  Remove misleading and wrong ALOGW
2012-05-21 14:11:46 -07:00
Jesse Hall f336014c8d am bd56aabb: am 515f19da: Merge "Recreate EGLImage for previously used slots" into jb-dev
* commit 'bd56aabb92097546073c8dd8949bb03161e72c56':
  Recreate EGLImage for previously used slots
2012-05-21 12:41:02 -07:00
Mathias Agopian 7e477bfe11 make sure BufferQueue releases newly acquired buffers on failures
this prevents SurfaceTexture producer to hang in dequeueBuffer()
when something goes wrong in the consumer.
only the consumer gets an error and the current frame is kept
instead of the new one. the producer is unaware of the problem.

Bug: 6476587
Change-Id: Ie6db5526632aabc3e60229b93dfe29c19491ade4
2012-05-18 16:50:58 -07:00
Mathias Agopian f899e4113a Remove misleading and wrong ALOGW
Bug: 6476587
Change-Id: I4345f1100db02786bb50ad83ca7b559cad301706
2012-05-18 15:32:28 -07:00
Jesse Hall 90ed8508ed Recreate EGLImage for previously used slots
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
2012-05-17 11:25:21 -07:00
Jamie Gennis a74eb25cbc am dd739965: Merge changes I32fbc2b6,Ifd0ed05b into jb-dev
* commit 'dd73996552938ac5165a35f09d389abedcf421ef':
  SurfaceFlinger: recompute visible regions less
  libgui: remove setPostTransformCrop
2012-05-15 11:44:04 -07:00
Eino-Ville Talvala e41b318bc4 Add a BufferQueue CPU consumer.
Aimed for use cases where gralloc buffers need to be consumed by CPU
users, such as camera image data streams.

The CpuConsumer is a synchronous queue, which exposes raw pointers to
the underlying graphics buffers to applications. Multiple buffers may
be acquired at once, up to the limit set at time of construction.

Change-Id: If1d99f12471438e95a69696e40685948778055fd
2012-05-14 18:04:01 -07:00
Jamie Gennis b7a6b96301 libgui: remove setPostTransformCrop
This change removes the setPostTransformCrop function from
SurfaceTextureClient.  It also includes a small logging fix in BufferQueue.

Bug: 6299171
Change-Id: Ifd0ed05b95dad6085e7a8267fda4d69b76ea3bad
2012-05-14 15:41:22 -07:00
Jamie Gennis f15a83f581 SurfaceFlinger: add a crop to the layer state
This change adds a crop rectangle specified in window coordinates to the layer
state.  The all window pixels outside this crop rectangle are treated as though
they were fully transparent.  This change also adds the plumbing necessary for
WindowManager to set that crop.

Change-Id: I582bc445dc8c97d4c943d4db8d582a6ef5a66081
2012-05-11 03:16:02 -07:00
Jamie Gennis cd1806e210 libgui: improve some logging and dumping
This change updates some of the SurfaceTextureClient and BufferQueue logging
and dumping to include the crop, transform and scaling mode.  It also removes
the uses of the NO_SCALE_CROP scaling mode enum, which was added by accident in
a previous change.

Change-Id: I62912716a1e48885fb22f12b92678aa13f10fcd9
Bug: 6470541
2012-05-10 15:35:22 -07:00
Jamie Gennis 82c53806ad Merge "SurfaceTexture: improve texture matrix computation" into jb-dev 2012-05-09 12:52:25 -07:00
Jamie Gennis cae7c0b955 Merge "libgui: Add support for post-xform crops." into jb-dev 2012-05-09 12:51:57 -07:00
Jamie Gennis 5c1139fea3 SurfaceTexture: improve texture matrix computation
This change reduces the shrinking of the crop rectangle in some cases.  It adds
a way to inform the SurfaceTexture that its texture will be used without
bilinear interpolation, and uses knowledge of the pixel format to avoid
shrinking unecessarily.

Change-Id: I72365f39f74ecb7fcc51b4cf42f2d0fa97727212
2012-05-08 17:08:33 -07:00
Jamie Gennis d72f233ffa libgui: Add support for post-xform crops.
This change adds support for specifying a crop rectangle to a
SurfaceTextureClient that is in post-transformed coordinate space.

Change-Id: I247901de343e71b32850f7ae3bac62dfa612ad3d
Bug: 6299171
2012-05-08 17:08:33 -07:00
Mathias Agopian 29267fe849 return errors properly in BitTube and SensorEventQueue
Change-Id: Idf31179f9fcc666e287c7b01b2007431cb60127d
2012-05-07 18:22:16 -07:00
Mathias Agopian 2ebc4d6d94 set a Sensor's version properly
Bug: 6447433
Change-Id: Iaa5d074a8137d9543ea78c2c6f63a750774b3057
2012-05-04 15:47:13 -07:00
Jamie Gennis 5c8a608497 SurfaceTexture: fix a memory leak
This change fixes a memory leak.

Bug: 6414806
Change-Id: I43536689b4219a042749aec2096a1d5c4e664ae3
2012-05-02 13:10:56 -07:00
Jamie Gennis efc7ab6dce libgui: Add plumbing for active rectangle
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
2012-04-24 17:34:38 -07:00
Daniel Lam f4b322801d SurfaceTexture: detachFromContext fixed
Fixed AttachToContextSucceeds test SurfaceTexture test by
not deleting the current texture when cleaning up memory.

Bug: 6363186
Change-Id: Ib886bfe6bb86e25ea4825d18b5008afba6b33eae
2012-04-24 17:25:00 -07:00
Mathias Agopian 2488b20aec add a way to query whether an ANativeWindow consumer is running ahead of the producer
Change-Id: Ibccfa1feb56db2ab11f0c0934ce2d570a2b65ae2
2012-04-23 20:06:02 -07:00
Mathias Agopian 24202f5676 update the binder protocol for connect to match that of queueBuffer
indeed, connect and queueBuffer return the same data, so it's
easier to have them use the same protocol.

Change-Id: I4f9fa3be0a80c9ab0a7a4039b282ae843aab02e1
2012-04-23 20:06:02 -07:00
Mathias Agopian a0db308c3d remove SurfaceTexture::connect()
use BufferQueue::connect() instead

Change-Id: I04aab7cf11304bf962cde38470747f3b19ddba42
2012-04-23 20:06:02 -07:00
Eino-Ville Talvala 6c47034f5e Fix BufferQueue verbose log
Change-Id: Id80742b5c1fd2960cc2eda3a9ba2db1078df5320
2012-04-18 14:47:12 -07:00
Eino-Ville Talvala 85b217668d Remove fixed USAGE_HW_TEXTURE flag from BufferQueue.
USAGE_HW_TEXTURE applies to SurfaceTexture, not to all uses of
BufferQueue. Refactor accordingly.

Change-Id: Ic7add5e1f2bbec3d3e796ba7f15eaa0633945d8f
2012-04-18 10:56:06 -07:00
Jamie Gennis 9aa74dbc70 SurfaceTexture: fix a memory leak
This change fixes an issue where we were sometimes setting the SurfaceTexture's
EGLDisplay to EGL_NO_DISPLAY in detachFromContext, and then subsequently
abandoning the texture.  Abandoning while in the detached state would result in
the eglDestroyImageKHR calls failing, which resulted in a memory leak.

Bug: 6302694
Change-Id: I24c1de0dac029a83c7508075fb8aaeaed96a14ea
2012-04-17 15:53:31 -07:00
Jamie Gennis 2efa4b2bb0 Merge changes Id79430f9,I541d3046
* changes:
  BufferQueue: check before tracing buffer index
  SurfaceTexture: shrink all sides when cropping
2012-04-17 15:52:49 -07:00
Jamie Gennis 695e331f01 BufferQueue: check before tracing buffer index
This change adds a check on ATRACE_ENABLED before calling snprintf to trace the
buffer index.

Change-Id: Id79430f9c69706393efd3d10780a4cc97055e9e0
2012-04-16 20:36:25 -07:00
Jamie Gennis 91a6826d67 SurfaceTexture: shrink all sides when cropping
This change makes SurfaceTexture include an offset for all sides of the crop
region when cropping.  This keeps the image centered, to minimize the visual
changes when switching between the texture transform matrix-based cropping and
something that does proper cropping (e.g. HWComposer).

Change-Id: I541d3046fd92e49221b488444df36d490924d1c5
2012-04-16 20:33:54 -07:00
Mathias Agopian 82ca93bf66 Merge "s/w rendered apps can now use n-buffering (n>2)" 2012-04-16 15:59:39 -07:00
Mathias Agopian 172a62a224 make sure to pass the transform-hint on ANW.connect
this optimization was probably lost during ST refactoring.

Change-Id: I845978c4b718cb91941d15b30484837f19714abe
2012-04-16 00:08:26 -07:00
Mathias Agopian ac6035a12a s/w rendered apps can now use n-buffering (n>2)
Bug: 6311881
Change-Id: I6e52e281e8d432430aad011f6d9dcf35d7b4ac7d
2012-04-13 16:04:44 -07:00
Mathias Agopian b364be8e55 fix a typo causing pre-rotation to never work
Change-Id: I8d698ec52d53ef1a553b887c7329413e1f49cc72
2012-04-12 19:40:28 -07:00
Daniel Lam 016c8cbce4 Enabled cropping support in SurfaceTexture
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
2012-04-12 17:49:03 -07:00
Jamie Gennis a96b6bdea3 SurfaceTexture: work around a compiler bug
This change works around a compiler bug with the GCC 4.6 toolchain.

Bug: 6292211
Change-Id: I004c4750d92a29f193a37d8e605a28fdc3b7f076
2012-04-11 18:37:54 -07:00
Jamie Gennis c2c380259b SurfaceTexture: add a test for user sizes & prerotation
This change adds 3 tests for:
- User-overridden buffer size
- Transform hint
- User-overridden buffer size with transform hint

Change-Id: Ib15ea354685e436822c506099613b2bffa7b68c9
2012-04-11 18:37:54 -07:00
Michael I. Gold 55a701459d SurfaceTextureClient: support for application buffer dimensions
Add a new API native_window_set_buffers_user_dimensions to allow native
applications to override the native window size for the default buffer size.
This has lower precedence than the existing
native_window_set_buffers_dimensions and allows the two to co-exist.

Change-Id: Ie73590e1c94ef0dadbce500bd0941dfabbcace3c
2012-04-11 18:37:54 -07:00
Mathias Agopian f0bc2f1d8d use in/out structures for queueBuffer() IPC
Change-Id: Ie125df2444b62a9a2200586a717dca268852afc9
2012-04-10 21:04:12 -07:00
Daniel Lam fbcda930dd BufferQueue returns proper code on acquire
Also removed unnecessary debug messages from
SurfaceTextureClient.

Change-Id: I291897a44170142f9d42a007b008823fad4683e0
2012-04-09 23:21:33 -07:00
Daniel Lam abe61bfda4 BufferQueue no longer hardcodes buffer counts
BufferQueue is now more flexible as it can be used
by SurfaceMediaSource in addition to SurfaceTexture.

Change-Id: I4222be8918d63372c44fcd412d9ad241c6a3eeb9
2012-04-06 21:02:13 -07:00
Jamie Gennis 8cce8a9a75 Merge "Fixed disconnect bug in SurfaceTexture" 2012-04-06 09:05:49 -07:00
Mathias Agopian 7b5be95cb3 use a socketpair instead of a pipe in BitTube
Bug: 6252830
Change-Id: Ia7a7b08409517214136261c05569dc5959a597ab
2012-04-02 18:41:10 -07:00
Daniel Lam 9abe1ebc95 Fixed disconnect bug in SurfaceTexture
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
2012-04-02 14:55:01 -07:00
Jamie Gennis 0e1080f887 Merge "SurfaceTexture: add context attach & detach" 2012-04-01 15:41:24 -07:00
Jamie Gennis 74bed55fff SurfaceTexture: add context attach & detach
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
2012-03-30 16:47:28 -07:00
Mathias Agopian 851ef8f1bf reduce IPC with BufferQueue
collapse setCrop, setTransform and setScalingMode to queueBuffer()
this ends up simplifying things quite a bit and reducing the numnber
of IPC needed per frame.

Change-Id: I3a13c07603abe4e76b8251e6380b107fde22e6d9
2012-03-30 15:16:30 -07:00
Jamie Gennis 9285a16450 Merge "Refactored DummyConsumer" 2012-03-29 13:57:10 -07:00
Daniel Lam 9d61a28d72 Refactored DummyConsumer
DummyConsumer no longer uses a ProxyConsumerListener

Change-Id: I0a99428b3f9dae82cb47d5da3589de77653f3d7c
2012-03-27 16:47:12 -07:00
Colin Cross 9e0b1f880b remove libandroid.so from targets that don't need it
pdk builds don't have libandroid.so available.  Remove it from
projects that aren't actually using it.

Change-Id: I100dc84aaf8160c1062a122ef6d5aec0534d73fa
2012-03-27 13:57:43 -07:00
Daniel Lam f71c4ae136 Added a DummyConsumer for use with BufferQueue.
The DummyConsumer is a consumer that can connect to BufferQueue
that does nothing.  It is required as BufferQueue checks
if a consumer is connected.  Also fixes a bug where SurfaceTexture
was reusing old texture slots.

Bug: 6172739
Change-Id: I5e7a118dd4d07807ba4c763200242b5ee7d3412b
2012-03-26 15:29:35 -07:00
Mathias Agopian b0e76f456a remove dependency of EGL on ndk header
Change-Id: Ia6e489b5b4f028864bdf54923e81f604710dd8ad
2012-03-23 14:15:44 -07:00
Jamie Gennis ce56137218 libgui: have ST::updateTexImage check the GL ctx
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
2012-03-19 18:33:05 -07:00
Jamie Gennis fa5b40ebb8 libgui: add BQ consumer buffer free notifications
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
2012-03-19 15:09:09 -07:00
Daniel Lam b267579ba8 SurfaceTexture: Fully refactored from BufferQueue
SurfaceTexture and BufferQueue are separate objects.

Change-Id: I230bc0ae6f78d0f9b2b5df902f40ab443ed5a055
2012-03-13 14:39:07 -07:00