Commit Graph

83 Commits

Author SHA1 Message Date
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
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
Mathias Agopian
c554d2b8ad Merge "Revert "enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices"" into ics-mr1 2011-11-16 16:13:38 -08:00
Mathias Agopian
c21180ee67 Revert "enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices"
This reverts commit e7758be6da85728df6b4215f413660c67c5a9740.

Seemed to cause failures un SurfaceTexture.

Bug: 5627450
2011-11-16 15:59:13 -08:00
Jamie Gennis
c1ef3c4d7d Merge "SurfaceTexture: Fix to return the oldest of free buffers to Client on Dequeue call" into ics-mr1 2011-11-16 11:34:30 -08:00
Mathias Agopian
029f760674 am 556a406c: am 3aa684ec: Merge "enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices" into ics-mr1
* commit '556a406cf4dd8a7faa318e0d522d899f8b9da7dc':
  enable ALLOW_DEQUEUE_CURRENT_BUFFER for tegra devices
2011-11-15 13:11:19 -08:00
Sunita Nadampalli
a929748ddb SurfaceTexture: Fix to return the oldest of free buffers to Client on Dequeue call
Surface Texture dequeue logic is modified to return the oldest of the
free buffers to Client on dequeue call.

Currently dequeue method is returning the first buffer index which is free.
The parsing is done in ascending order of the buffer slot indices.
This leads to returning the buffer which has been just queued to composer,
and hence display, and this defeats the purpose of having minimum dequeue count
as 2 in asynchrnouse mode.

This is fixed by checking all the free slots and returning the oldest buffer.

Change-Id: Ibbac10593c3994c278c601af0480b171635ecdd4
Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
2011-11-15 11:43:35 -08:00
Mathias Agopian
251ce852cc 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
Change-Id: I939992b4cd0debea980dec0127c72be2dff33af8
2011-11-14 19:17:37 -08:00
Jamie Gennis
eade85c60c am c5ce130f: Merge "SurfaceTexture: various logging improvements" into ics-mr1
* commit 'c5ce130f658303299bf55091373951f7fd33ae36':
  SurfaceTexture: various logging improvements
2011-11-03 18:57:21 +00:00
Jamie Gennis
6ee96ad6a3 SurfaceTexture: various logging improvements
Change-Id: I1f7216276547a1e9f9343c88c6cc1c24efcdcdbc
2011-11-01 15:48:42 -07:00
Steve Block
6807e59e0f Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
2011-10-26 09:57:54 +01:00
Jamie Gennis
fb1b5a2f33 SurfaceTexture: parameterize the texture target
This change adds a hack to allow Android Browser to use a SurfaceTexture
to stream RGBA images to a GL_TEXTURE_2D texture object.

Change-Id: Idb90064d5d4b920959ef3be7451362ac5012460e
2011-09-30 14:19:41 -07:00
Jamie Gennis
fa28c35c21 SurfaceTexture: add name support
This change adds support for setting a string that can be used to
identify a SurfaceTexture object in log messages.

Change-Id: Ib4ee085f36c8830dc964c05ef1654f5a55dfcd60
2011-09-22 17:49:10 -07:00
Mathias Agopian
06649fece4 cleanup: fix typos in logs
Change-Id: Ib5744564a873ea2b84100174673dc4d3ae109fcf
2011-09-16 11:56:40 -07:00
Mathias Agopian
70e3f81d0f make sure to re-initialize SurfaceTexture to its default state on disconnect
this caused problems where the NavigationBar would disapear or be
drawn in the wrong orientation.

Change-Id: I083c41338db83a4afd14f427caec2f31c180d734
2011-08-25 17:03:30 -07:00
Mathias Agopian
29b5762efc don't return the current buffer from dequeueBuffer
we were not reseting mCurrentTexture in some situations
which in turn caused dequeueBuffers() return a
"FREE" buffer that was also current.
Very often it was harmless, but it created a race with
updateTexImage() which could cause the following
queueBuffers() to fail.

Bug: 5156325
Change-Id: If15a31dc869117543d220d6e5562c57116cbabdb
2011-08-17 15:49:13 -07:00
Mathias Agopian
3902be629b fix a small race condition when returning the default width/height of a SurfaceTexture
Change-Id: I581bf609505dfb5d4ec5957b2ef2c77df6cfb15f
2011-08-17 12:45:40 -07:00
Dave Burke
4925ee11f9 Revert "error out when SurfaceTexture APIs are called while not connected"
This reverts commit a04cda9986366ab480ad8008c4d923271b05d78e.

Conflicts:

	include/gui/SurfaceTexture.h
	libs/gui/SurfaceTexture.cpp

Change-Id: Ib655016462c496ee2a27f7cb33a6e8b18cfe684a
2011-08-11 15:13:19 +01:00
Mathias Agopian
8e19c2e97e fix a crasher in SurfaceTexture::updateTexImage()
we now make sure to drain the buffer queue on disconnect.
this happens only when in synchrnous mode. in async mode
we clear all buffers except the head of the queue.

for extra safety we also catch the null pointer
in updateTexImage (which should  never happen) and return
an error.

Bug: 5111008

Change-Id: I5174a6ecbb0de641c6510ef56a611cbb4e9e1f59
2011-08-10 17:35:52 -07:00
Mathias Agopian
2560d14ce8 rework dequeueBuffer()'s main loop.
this simplifies the code a bit and also makes sure
we reevaluate mAbandoned and mConnectedApi each time
we come back from waiting on mDequeueCondition

Change-Id: I1f8538b62ad321b51ed79d953b700036daba796d
2011-08-10 17:35:26 -07:00
Mathias Agopian
ef51b99219 error out when SurfaceTexture APIs are called while not connected
- also log a warning when freeAllBuffers is called with a non empty buffer queue
- rename freeAllBuffers to freeAllBuffersLocked

Change-Id: Idb71fdcf233b9ccae62d5a2a7c3c4bad2501d877
2011-08-10 17:33:46 -07:00
Mathias Agopian
2db6f0a40b fix a crasher in dumpsys
Bug: 5141729
Change-Id: Ib104d49c8660621180966be099198fe29c5bebf5
2011-08-09 15:49:26 -07:00
Mathias Agopian
b0c15c9908 free all buffers when ANativeWindow::disconnect is called
Change-Id: Ie06e73e5b44398cda9e99876f78175b5eef765dc
2011-08-08 20:25:45 -07:00
Mathias Agopian
5bfc24515b return correct value from query after connecting a surface
the first time a surface was connected, the values returned
by query NATIVE_WINDOW_DEFAULT_{WIDTH|HEIGHT} and
NATIVE_WINDOW_TRANSFORM_HINT were wrong until a call
to queueBuffer was performed.

Bug: 5137366, 5121607
Change-Id: I7ac6b5b0daa876638f6bed7c20f286a6e6d984f6
2011-08-08 20:25:44 -07:00
Mathias Agopian
af08d8ab6d Merge "improve dumpsys SurfaceFlinger output" 2011-08-08 20:13:16 -07:00
Mathias Agopian
e47498f8f2 add some logs to track a crash in eglCreateImageKHR
Bug: 5111008

Change-Id: I3e7f5b986151e80cbded39e0dec057770da52fc1
2011-08-08 19:36:22 -07:00
Mathias Agopian
ad795baecc improve dumpsys SurfaceFlinger output
we now output the handle and size of all buffers of each layer.

Change-Id: I8d011ee4ae9199f4198bd07bed770ec3bcf02986
2011-08-08 16:02:13 -07:00
Mathias Agopian
97a9884edc Add a 'release' method to the SurfaceTexture public Java API
Bug: 5063618
Change-Id: I689cb0c01c14e597ccfb4eb0972e64fa570bd4e8
2011-08-03 17:23:44 -07:00
Jamie Gennis
1c121f68fc SurfaceTexture: allow set_buffer_count(2)
This change relaxes an error check in SurfaceTexture::setBufferCount to
allow clients to explicitly set a buffer count of 2.  The clients that
will do this are camera and video decode.  Previously it was thought
that for those clients we would always use async mode, which requires a
minimum of 3 buffers.  However, we now believe that for some devices it
may make sense to use synchronous mode (with 2 buffers) to reduce memory
usage.

Bug: 5088418
Change-Id: I620a0ef75075745be9d6c8219e0246aaf33ba950
2011-07-30 16:00:11 -07:00
Mathias Agopian
96e108271b Merge "remove dead code and member variables." 2011-07-26 12:08:07 -07:00
Mathias Agopian
3fbce7c560 remove dead code and member variables.
also fix some comments and improve debugging logs.

Change-Id: I83e55309f306332b59e1ec46104c4a7fffbf3c97
2011-07-25 20:03:43 -07:00
Jamie Gennis
fa1e002cec Merge "SurfaceTexture: enable RGB external textures" 2011-07-25 11:46:51 -07:00
Jamie Gennis
1f8e09f40d SurfaceTexture: enable RGB external textures
This change removes support for conditionally using the GL_TEXTURE_2D
target for SurfaceTexture textures with RGB buffers.  It also enables
and fixes the RGB-based SurfaceTexture tests.

Change-Id: I9a251a981cf66af6b048b2e4c3fe7231e4774f4d
2011-07-22 15:45:18 -07:00
Jamie Gennis
7b305fffc3 SurfaceTexture: add the abandon method.
This change adds the 'abandon' method to the SurfaceTexture C++ class.
This method may be used to put the SurfaceTexture in an abandoned state,
causing all ISurfaceTexture methods to fail.

Change-Id: Ibd261f7b73f44e2bec36a8508bf92113cfb7cf95
2011-07-22 14:20:41 -07:00
Jamie Gennis
976f494d53 SurfaceTexture: remove getAllocator
This change removes the SurfaceTexture::getAllocator method, as it's no
longer needed.  Proper refcounting of the Gralloc buffers is now handled
by the IGraphicBufferAlloc binder marshalling code.

Change-Id: I5cffa6ebfc1bc5828fb7ce0e0a5b2f55cd8479da
2011-07-21 14:32:56 -07:00
Mathias Agopian
97c602c5af implement: "Add an ANativeWindow API for SurfaceFlinger to suggest an optimal buffer orientation"
Bug: 4487161
Change-Id: I883f34efe542c2a566d04966f873374f40c50092
2011-07-19 15:24:46 -07:00
Mathias Agopian
933389f758 use SurfaceTexture new scaling mode in SF
SF now obeys SurfaceTexture's scaling mode instead
of inferring it from the buffer's size

Change-Id: I4d50e9851abedd7e64bfcfc8af9eefb9fb668529
2011-07-19 13:05:12 -07:00
Mathias Agopian
7734ebfe47 Add set_scaling_mode() to ANativeWindow.
This allows to specify the scaling mode independently from
the buffer size.

Change-Id: Iaa2baa660445531a97d3fac192e580f4929c5d3b
2011-07-19 13:05:11 -07:00
Mathias Agopian
8f9dbf9e13 move lock/unlock implementaion outside of Surface into SurfaceTextureClient
This makes ANativeWindow_lock/ANativeWindow_unlockAndPost work
with ANativeWindows implemented by Surface and SurfaceTextureClient.

Also, Surface now inherits directly from SurfaceTextureClient.

Bug: 5003724
Change-Id: I9f285877c7bae9a262e9a7af91c2bae78804b2ef
2011-07-15 17:47:08 -07:00
Jamie Gennis
fe0a87b546 SurfaceTexture: make (dis)connect into an IPC
This change makes the ANativeWindow connect and disconnect calls result
in an IPC to the SurfaceTexture object.  This will allow us to prevent
multiple simultaneous connections from different processes.

Change-Id: Id9aa1003b1335b96ca6bd4a1f5a67aa433d42efb
2011-07-14 17:48:32 -07:00
Mathias Agopian
d9e8c64c3d return an error code with gralloc buffer allocation failures
Change-Id: I471e5d37ea7a42fc8a0f93446ee3b4229da37807
2011-07-01 14:53:49 -07:00
Pannag Sanketi
19e0a8bfe9 Merge "Minor fix in SurfaceTexture" 2011-06-30 18:38:18 -07:00
Pannag Sanketi
292a31a4c2 Minor fix in SurfaceTexture
Change-Id: Ic859715becf3e6d5107bd8beb8c577034d00ec52
2011-06-30 15:41:19 -07:00
Jamie Gennis
50c4efc2a4 SurfaceTexture: consume buffers after err checks
This change moves the point at which queued buffers get consumed to
after any error checks that could cause updateTexImage to fail.  This
way, if updateTexImage returns an error the buffer remains queued.
2011-06-27 15:45:40 -07:00
Jamie Gennis
3d8063b02e SurfaceTexture: change onFrameAvailable behavior
This change alters the conditions under which the onFrameAvailable
callback gets called by the C++ SurfaceTexture class.  The new behavior
is to call the callback whenever a frame gets queued that will be
visible to the buffer consumer.  This means that buffers queued in
synchronous mode always trigger the callback, as those buffers will
remain pending until they are consumed.  Buffers queued in asynchronous
mode will only trigger the callback if there was not previously an
unconsumed buffer pending.

The new behavior means that a consumer should perform a draw operation
exactly once for every onFrameAvailable call that it recieves.  This
change also modifies SurfaceFlinger and the SurfaceTexture JNI to
support of the new behavior.

Change-Id: I8b2c6e00961d3d58b11c6af50b555b6e4c5f5b40
2011-06-27 15:45:39 -07:00
Grace Kloba
14a0e58074 Add allowSynchronousMode to SurfaceTexture constructor.
Change-Id: I54f30a3c16bbe6b813f3bcd1d389da5627531304
2011-06-23 21:21:47 -07:00
Mathias Agopian
e122079be6 Temporarily don't return the current buffer in synchronous mode
activate synchronous mode by default.
2011-06-13 15:51:35 -07:00