Commit Graph

141 Commits

Author SHA1 Message Date
Jamie Gennis
e68a52b0a2 SurfaceTexture: fix a test deadlock
This change fixes a test issue that resulted in a deadlock.

Change-Id: I4729e8dd47c8f5fea49bfeff3cea58627ead6d04
Bug: 5174876
2011-08-30 19:06: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
87a96ea9ea Fix an issue where Surface::lock() would never update the output region
this bug was introduced recently. in some situations Surface::lock()
is not able to preserve the content of the back buffer and needs
to tell the caller to redraw everything.

Bug: 5186460
Change-Id: I14e03939ddfc1b7ad2a8b99ad79435314c60e78e
2011-08-23 21:18:36 -07:00
Jamie Gennis
7f7e85898f Merge "SurfaceTexture: fix queues-to-composer" 2011-08-18 14:31:39 -07:00
Jamie Gennis
582270d69d SurfaceTexture: fix queues-to-composer
This change fixes the NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER query of
Surface and SurfaceTextureClient.  Surface now uses the inherited
SurfaceTextureClient implementation of this query.  SurfaceTextureClient
now queries SurfaceFlinger to determine whether buffers that are queued
to its ISurfaceTexture will be sent to SurfaceFlinger (as opposed to
some other process).

Change-Id: Iff187e72f30d454229f07f896b438198978270a8
2011-08-17 18:19:00 -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
3477588d13 Merge "Read leftover parcel data when a parceled Surface is found in the cache." 2011-08-10 19:45:34 -07: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
Ted Bonkenburg
e5d6eb81e2 Read leftover parcel data when a parceled Surface is found in the cache.
This fixes an issue where the Surface readFromParcel code was leaving
unread parcel data in the case where the Surface was re-used from the
sCachedSurfaces cache. On a cache miss the code is creating a new
Surface from the remainder of the parcel data. On a hit that data was
being left unread, so anything that parcels a Surface followed by
additional arguments may end up reading the wrong values.

Change-Id: I25365159d945c125bd1fcc9f17e39a4f00aece55
2011-08-09 22:45:38 -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
Mathias Agopian
d05b34a079 Merge "connect/disconnect is now called from our EGL wrapper" 2011-08-01 16:36:02 -07:00
Mathias Agopian
81a6335052 connect/disconnect is now called from our EGL wrapper
the original connect/disconnect hooks are deprecated
and replace by api_connect/api_disconnect. the original
hooks are no no-ops.
api_connect/api_disconnect is now only called from the
android framework.

Bug: 5057915
Change-Id: I8ca64cd1acd6cabf915bf54689ec2e5f6dfa495a
2011-08-01 14:06:20 -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
Ted Bonkenburg
8d14330bd7 Merge "Add support for creating a Surface from a a SurfaceTexture." 2011-07-25 10:24:30 -07:00
Ted Bonkenburg
bd050ab2af Add support for creating a Surface from a a SurfaceTexture.
The Surface is already using SurfaceTexture internally and it is parcelable. This
is intended to replace and phase out ParcelSurfaceTexture in favor of creating a
new Surface.java object from an existing SurfaceTexture.

Change-Id: I8e2dd86614523da6abed6403e1d705a68fa19fdf
2011-07-22 16:36:44 -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
6e50219aee SurfaceTexture: add a deadlock scenario test
This change adds a test to ensure that a GL driver that's blocking on a
call to dequeueBuffer does not block other GL threads from rendering and
queueing buffers.

Change-Id: Ifdd234effc534b6a9cf8522ca87f64da5bb0bbd6
2011-07-22 14:03:31 -07:00
Jamie Gennis
1259e9d6ac Merge changes I799532f7,I5cffa6eb
* changes:
  SurfaceTexture: fix a comment
  SurfaceTexture: remove getAllocator
2011-07-22 13:34:57 -07:00
Mathias Agopian
bb66c9b5a9 Fix a few issues with NATIVE_WINDOW_TRANSFORM_HINT
- fixed uninitialized variable
- set hint to indentity when transform is too complex
- make sure FrameBufferNativeWindow doesn't fail on needed perform commands

Bug: 4487161
Change-Id: I7cb2b0869b72404732eca7cb2d145ff669e2ed9b
2011-07-21 14:50:29 -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
c10d9d90b2 clean-up. get rid ofunused code and members in Surface[Control].cpp
Change-Id: Ia7790ae28af2c2ac99eae01c2c5044ace4a490a4
2011-07-20 16:53:13 -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
Jamie Gennis
a2f3b90d98 Merge "SurfaceTexture: add a multi-SurfaceTexture test" 2011-07-18 15:00:54 -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
0b7c4953a1 Merge "SurfaceTexture: fix SurfaceTextureGLToGLTest" 2011-07-15 12:35:34 -07:00
Mathias Agopian
2773004a83 fix a typo in ISurfaceTexture IPC code
Change-Id: Ied1d9ddb0d849b17219d0ea3d333ce12be849419
2011-07-14 20:20:58 -07:00
Jamie Gennis
677517ae3f Merge changes Id9aa1003,I8c154189
* changes:
  SurfaceTexture: make (dis)connect into an IPC
  SurfaceTexture: add support for new connect values
2011-07-14 17:54:27 -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
Jamie Gennis
2640bfd168 SurfaceTexture: fix SurfaceTextureGLToGLTest
This change fixes a couple different issues in the
SurfaceTextureGLToGLTest test fixture:
  - incorrect use of conditions
  - move logging after the locks are acquired
  - call the parent class's TearDown method
  - clean up the SurfaceTexture before eglTerminate gets called

Change-Id: I6960e5ab7f144225f01a2089d3f849c99fed0b38
2011-07-14 17:11:47 -07:00
Jamie Gennis
3e646d62e5 SurfaceTexture: add support for new connect values
This change adds support to SurfaceTextureClient for the new enum values
that can be passed to the ANativeWindow connect call.

Change-Id: I8c15418909e43a15673a9b22a5eb40df6923b273
2011-07-14 15:03:33 -07:00
Jeff Brown
7175398247 Merge "Remove the simulator target from all makefiles. Bug: 5010576" 2011-07-12 12:15:07 -07:00
Jeff Brown
baa44b89ec Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
2011-07-11 22:12:16 -07:00
Jamie Gennis
c8251a06df SurfaceTexture: add a multi-SurfaceTexture test
This change adds a test that does simple, unverified GL rendering to
multiple SurfaceTextures.

Change-Id: I51a41d68ae5a27e01ae93842242897b0d3558ca6
2011-07-11 19:06:39 -07:00
Jamie Gennis
bee205fd58 EGL: fix the ANativeWindow size/fmt override
This change fixes how the Android EGL layer overrides the size and
format of an ANativeWindow in eglCreateWindowSurface.  The new behavior
is to leave the size untouched when overriding the format.  The previous
behavior was to reset the ANativeWindow to use the default size set by
the ANativeWindow implementation.

It also adds two new 'perform' methods to the ANativeWindow interface:
set_buffers_dimensions and set_buffers_format, and redefines the
behavior of set_buffers_geometry to be the combination of these two new
methods.

Additionally, this change adds an error check for the return value of
the new native_window_set_buffers_format call, which required adding a
(stub) handler for to FramebufferNativeWindow.

Change-Id: I805c7ccd8d4730dfb132d10d8bc3fb058a0b9df1
2011-07-11 12:31:45 -07:00