Commit Graph

427 Commits

Author SHA1 Message Date
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
Dave Burke
74ff8c23f4 attempt to fix a deadlock in SurfaceTextureClient::disconnect
- condition wasn't signaled if an error happened between acquire and release
- also replace signal with broadcasts

Bug: 6109450
Change-Id: I8ac03c7eca35c9cc04a00ef7fad36bb9cb3fcef6
2012-03-12 21:49:41 -07:00
Daniel Lam
c2c1f2f24c BufferQueue: fixed issues with buffer slots not available
Bug: 6120953
Change-Id: I61d97d650c8dee0a6d7c19f2f50aa92a5f159095
2012-03-08 23:40:56 -08:00
Mathias Agopian
757507e3a0 Merge "Add ATRACEs for Buffer indices" 2012-03-05 19:41:29 -08:00
Daniel Lam
3fcee50ffa BufferQueue: fixed acquire operation
Bug: 6082872
Change-Id: I897dc61eb84fed953e51f97871cd3ae6321505d4
2012-03-02 11:30:56 -08:00
Mathias Agopian
546ed2d7d9 Add ATRACEs for Buffer indices
Change-Id: I44d7a9a9bf03f418cab2a4854583aac9e533daee
2012-03-01 22:20:24 -08:00
Jamie Gennis
1c8e95cf86 Add tracing to various graphics components.
This change adds ATRACE call tracing to BufferQueue,
SurfaceTextureClient, SurfaceTexture, SurfaceFlinger, Layer, and EGL.

Change-Id: I9d75ed26f5a3f0d1af635da38289520134cfbbb7
2012-02-27 17:50:35 -08:00
Daniel Lam
eae59d2ea7 Removed dependecies between BufferQueue and SurfaceTexture
Refactored SurfaceTexture and BufferQueue such that share
no protected members.  Created an consumer facing interface
for BufferQueue in preparation of connecting SurfaceTexture
and BufferQueue through a binder.

Change-Id: I938e63e085128148c58d0e26c7213b30145c109f
2012-02-27 16:40:48 -08:00
Jamie Gennis
fbb1655916 Merge "Revert "Removed dependecies between BufferQueue and SurfaceTexture"" 2012-02-27 13:23:51 -08:00
Mathias Agopian
90ac799241 fix libgui header location
Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
2012-02-27 13:03:08 -08:00
Daniel Lam
9b10c47e11 Revert "Removed dependecies between BufferQueue and SurfaceTexture"
This reverts commit a631399f71dbc7659d2f241968f85d337726ae61
2012-02-27 11:32:06 -08:00
Daniel Lam
3330238841 Removed dependecies between BufferQueue and SurfaceTexture
Refactored SurfaceTexture and BufferQueue such that share
no protected members.  Created an consumer facing interface
for BufferQueue in preparation of connecting SurfaceTexture
and BufferQueue through a binder.

Change-Id: Iff55e740e36a7f70c9f7a17ee7a5af38e3d21f0f
2012-02-22 20:12:27 -08:00
Daniel Lam
b856052c00 Refactored query function from SurfaceTexture into BufferQueue
Change-Id: Id1cb6cc38d01edb4fcfcad867c5a7693bdcc3ab1
2012-02-09 16:16:51 -08:00
Daniel Lam
6b091c5300 Refactored ISurfaceTexture calls from SurfaceTexture into BufferQueue.
Change-Id: I514f6b802f6b49c9ae27bed37bf0b9d23da03c9a
2012-02-07 13:57:01 -08:00
Mathias Agopian
99fe3c6d3d make sure to ignore SIGPIPE in the write side of BitTube
Change-Id: If4f037f4403d3ecbcd5f91248354765fc0fa13cb
2012-02-06 19:17:56 -08:00
Mathias Agopian
99ce5cdeb3 separate transactions from updates
with this changes, SF transactions are handled as soon as possible
but do not trigger updates. the update is delayed until the next
vsync.

this allows us to work much better without requiring triple-buffering.

Change-Id: I1fa10794d0cf742129f0877698b7b1e1f2ec7401
2012-02-01 20:43:06 -08:00
Daniel Lam
bff957f0bd SurfaceTexture: use fence sync on omap4 & s5pc110
This change enables the use of the EGL_KHR_fence_sync extension in
SurfaceTexture on omap4 and s5pc110 platforms.

Change-Id: Icad5245bab445413ffb8a7c823c296b678bf3250
2012-01-22 15:51:41 -08:00
Glenn Kasten
1db13d7951 Get AID_GRAPHICS from right place
Change-Id: I97b1754dc7260fec083275c71a8f71ebfb2cefa8
2012-01-13 13:45:39 -08:00
Steve Block
e6f43ddce7 Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
2012-01-08 13:19:13 +00:00
Steve Block
32397c1cd3 Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
2012-01-06 10:07:54 +00:00
Steve Block
c267bab3d1 Merge "Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE" 2012-01-05 14:07:02 -08:00
Glenn Kasten
2adea706d4 Merge "Use the standard CC_LIKELY and CC_UNLIKELY macros" 2012-01-05 07:38:29 -08:00
Glenn Kasten
99ed22412d Use the standard CC_LIKELY and CC_UNLIKELY macros
Several source files privately defined macros LIKELY and UNLIKELY in terms
of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and
CC_UNLIKELY which are intended for this purpose.  So rename the private
uses to use the standard names.

In addition, AudioFlinger was relying on the macro expanding to extra ( ).

Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
2012-01-05 07:33:45 -08:00
Steve Block
a19954ab37 Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
2012-01-04 20:05:49 +00:00
Steve Block
9d45368352 Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
2012-01-03 22:38:27 +00:00
Jamie Gennis
ace62f2b79 am 74e0fcae: am a1dee3f5: Merge "SurfaceTexture: fix a verbose-log compile error" into ics-mr1
* commit '74e0fcaed1cd20ae8632224ff5a5404ff1a6e497':
  SurfaceTexture: fix a verbose-log compile error
2011-12-12 16:10:28 -08:00
Jamie Gennis
988637e559 SurfaceTexture: fix a verbose-log compile error
Change-Id: I045231207e068d950bb0cb5085717af5d9454ed1
2011-12-09 15:07:44 -08:00
Mathias Agopian
478ae5eb5a Improve the VSYNC api a bit.
- add the ability to set the vsync delivery rate, when the rate is
set to N>1 (ie: receive every N vsync), SF process' is woken up for
all of vsync, but clients only see the every N events.

- add the concept of one-shot vsync events, with a call-back
to request the next one. currently the call-back is a binder IPC.

Change-Id: I09f71df0b0ba0d88ed997645e2e2497d553c9a1b
2011-12-06 22:43:10 -08:00
Mathias Agopian
a4fbecd119 am 55d3880e: am bb1e7d43: Merge changes I7e973a35,Ib3386fcc into ics-mr1
* commit '55d3880eed3450748eb7b97281e030902ee29c2a':
  SurfaceTexture: add EGL_KHR_fence_sync option
  SurfaceTexture: add a blit-to-FBO test
2011-11-30 10:50:52 -08:00
Jamie Gennis
86edf4f647 SurfaceTexture: add EGL_KHR_fence_sync option
This change adds a compile-time option for SurfaceTexture to use the
EGL_KHR_fence_sync extension to synchronize access to Gralloc buffers.

Bug: 5122031
Change-Id: I7e973a358631fff5308acf377581b811911fe790
2011-11-29 17:09:01 -08:00
Jamie Gennis
fe27e2f468 SurfaceTexture: add a blit-to-FBO test
This change adds a test for blitting (via GL rendering) from a
SurfaceTexture to an FBO.

Change-Id: Ib3386fcc3f37153277f3e37a26347441bb80ab58
2011-11-29 14:52:36 -08:00
Mathias Agopian
d0566bc26f Add support for sending VSYNC events to the framework
use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.

Bug: 1475048
Change-Id: Ia720f64d1b950328b47b22c6a86042e481d35f09
2011-11-29 13:10:25 -08:00
Mathias Agopian
439cf8576d Fix build.
Revert "Add support for sending VSYNC events to the framework"

This reverts commit f3918c5bd4bc9f02f74da42995564150ca2dd382.

Change-Id: I998e3e1aa3fa310829ae973b64fe11b01f6f468f
2011-11-29 13:07:40 -08:00
Mathias Agopian
461afeb9fd Add support for sending VSYNC events to the framework
use gui/DisplayEvent to receive the events. Events are
dispatched through a unix pipe, so the API is compatible
with utils/Looper. see gui/DisplayEvent.h for more info.

Bug: 1475048
Change-Id: If4126023fc9c067e56087ec7d16a8fd542ce1794
2011-11-29 11:44:05 -08:00
Mathias Agopian
3ad3807a5c BitTube::read now handles EAGAIN
Change-Id: Iacda2386342ba0727bbf278f6c597488d5467bb8
2011-11-29 11:42:59 -08:00
Mathias Agopian
41f673c9b3 split ComposerService out of SurfaceComposerClient.h
Change-Id: I1eb691f7ca263d5895d871ab675bb5826e0323c6
2011-11-28 15:21:57 -08:00
Mathias Agopian
6b7c5da722 am cc4d02e0: am 07a2d831: Merge "don\'t report an error when disconnecting from an abandoned surfacetexture" into ics-mr1
* commit 'cc4d02e0cbb99341a0508838c88eeef53180fdfd':
  don't report an error when disconnecting from an abandoned surfacetexture
2011-11-21 21:08:47 -08:00
Mathias Agopian
93a098fb6e am 8390cf39: am 8646cd42: Merge "enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices" into ics-mr1
* commit '8390cf39f8a4f74f7baa91d23cba06894a3fb9b5':
  enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices
2011-11-21 21:08:44 -08:00
Jamie Gennis
185a0a0420 am c2597295: am 53cf2020: Merge changes I37fd43b5,I91eb29db,I0491ce35 into ics-mr1
* commit 'c25972950c2ea62fb085524dbe737c2bf0f08f4a':
  SurfaceTexture: fix a couple tests
  EGL: default to swap interval 1
  SurfaceTexture: clean up some tests
2011-11-21 21:08:21 -08:00
Mathias Agopian
7723773df3 Merge "don't report an error when disconnecting from an abandoned surfacetexture" into ics-mr1 2011-11-21 17:57:31 -08:00
Mathias Agopian
75cf5a7480 Merge "enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices" into ics-mr1 2011-11-21 17:57:20 -08:00
Jamie Gennis
e3603d7d09 SurfaceTexture: fix a couple tests
This change fixes some robustness issues with the
EglDestroySurfaceUnrefsBuffers and
EglDestroySurfaceAfterAbandonUnrefsBuffers tests.  The tests previously
depended upon GL implementation details that should not have been relied
upon.

Change-Id: I37fd43b56568efe1dbe69d85e892be8a1cf44d20
2011-11-21 14:38:15 -08:00
Jamie Gennis
59769469e4 EGL: default to swap interval 1
This change explicitly sets swap interval 1 on the window when an
EGLSurface is created to render to it.

Change-Id: I91eb29dbee3ae4a55076b921f084d503fbe94e03
2011-11-21 14:37:29 -08:00
Jamie Gennis
6f4cdfe0db SurfaceTexture: clean up some tests
This change cleans a few things up in the SurfaceTexture tests:
- Wraps a few long lines.
- Refactors the multithreading portions of SurfaceTextureGLToGLTest into
  a new test fixture called SurfaceTextureGLThreadToGLTest.
- Changes some of the tests that were creating their own EGLSurface to
  use the SurfaceTextureGLToGLTest fixture.
- Reorders the test functions so that they are immediately below to the
  test fixture that they use.

Change-Id: I0491ce3528a7ff2b4f1e83602ba290269c087297
2011-11-21 11:52:02 -08:00
Mathias Agopian
8bee68fac2 am d0df44b5: am 4d71053b: Merge "attempt to fix bug 5313580" into ics-mr1
* commit 'd0df44b5c979e00a19187cea35768ba26557e447':
  attempt to fix bug 5313580
2011-11-18 15:22:59 -08:00
Mathias Agopian
8b8a004148 don't report an error when disconnecting from an abandoned surfacetexture
this happens often with CPU Surfaces, which disconnect long
after their surfacetexture has been abandoned.

Change-Id: If49da03b72f99130e01b2b9bcbd444bb38f7ed4e
2011-11-18 14:32:35 -08:00
Mathias Agopian
7c6eba6669 enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices
this flag should be enabled for all targets, but currently
some have issues with it, so we're turning it on only for
tested targets.

this will hopefully resolve some performance issues.

Bug: 5553562, 5631630
Change-Id: I54c7a9e2068586898ab13e405d95534669260537
2011-11-18 13:50:35 -08:00
Mathias Agopian
6285c6cf10 Merge "attempt to fix bug 5313580" into ics-mr1 2011-11-18 12:11:15 -08:00
Jamie Gennis
b963e22ca2 am 9da22d2c: am 2ba13186: Merge "SurfaceTexture: fix a bug with buffer reallocation" into ics-mr1
* commit '9da22d2cc31069d86a92021d8540bb5a77c9591b':
  SurfaceTexture: fix a bug with buffer reallocation
2011-11-18 02:37:41 -08:00
Mathias Agopian
a36bcd53ac attempt to fix bug 5313580
the working theory here is that a Surface object has become non-promotable
because it lost its last reference; later Surface::readFromParcel is called
the previous surface is found in the cache, but can't be promoted. this causes
a new Surface object to be created which will promptly try to connect to the
CPU_API -- this in turn will fail because the previous (now dead) surface is
still connected.

To fix this, we make sure to disconnect from the SurfaceTexture when
Surface[TextureClient] is destroyed.

Change-Id: I422234868a05d7b7d283e9d5a85f7ab79e65d8a9
2011-11-17 18:46:09 -08:00
Jamie Gennis
e984dd11c1 Merge "SurfaceTexture: fix a bug with buffer reallocation" into ics-mr1 2011-11-17 17:10:47 -08:00
Jamie Gennis
aaa3ecff4b SurfaceTexture: fix a bug with buffer reallocation
This change fixes an issue involving buffer reallocation and the
ALLOW_DEQUEUE_CURRENT_BUFFER mode in SurfaceTexture.  The bug happened
when the buffer slot currently attached to the GL texture was selected
for dequeuing, but the dequeue operation caused the buffer to be
reallocated.  Because the buffer is new, the image producer could fill
the buffer and queue it before an updateTexImage call, which would
result in the "slot %d is current" error in queueBuffer.

Bug: 5631630
Change-Id: Icdd8bc5cad3c7db43953446d9be2603aaea11a8d
2011-11-17 16:00:44 -08:00
Mathias Agopian
1c46c42c16 am abdade71: am 69c17a11: Merge "Revert "enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices"" into ics-mr1
* commit 'abdade71bc17153696fe2abe281c5a3b0c2e5abe':
  Revert "enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices"
2011-11-17 07:48:10 -08:00
Jamie Gennis
ccf5b9febc am 7765fc65: am fd6b64f6: Merge "SurfaceTexture: Fix to return the oldest of free buffers to Client on Dequeue call" into ics-mr1
* commit '7765fc651a9519dd2f0ac9d3374a50e9865c5c99':
  SurfaceTexture: Fix to return the oldest of free buffers to Client on Dequeue call
2011-11-17 05:46:00 -08:00