Commit Graph

32 Commits

Author SHA1 Message Date
Jamie Gennis c2c8dfd71b SurfaceTexture: fix an error check in dequeueBuffer.
This change fixes the MIN_UNDEQUEUED_BUFFERS error check in
dequeueBuffer.  The check should only be performed if a buffer has been
queued since the last time the buffer count was changed by the client.
The check must be applied conditionally because video decoders require
all the bufferes to be dequeued and registered before beginning the
decode.

Change-Id: I08d96b380544e395c2fcf0f3983a199bfd695b09
2011-05-25 12:27:33 -07:00
Jamie Gennis 8cd5ba4b7f SurfaceTexture: clean up some comments, tests, etc.
This change fixes up some stale comments, member variable names, log
messages and disables a failing test.

Change-Id: Ic1d3344b18066cf710e4a42838b2417c6b1f2f6c
2011-05-25 12:27:33 -07:00
Teng-Hui Zhu d7e291fecd Disable error report temporarily to enable inline video
bug:4435022

Change-Id: I06f05a4781ad432ab71db93f0815eb89cd2e7a69
2011-05-18 14:37:51 -07:00
Mathias Agopian cf46eb9817 fix onFrameAvailable
Change-Id: I391fe9f6684ac9fd4f91416ce18b583f7087d966
2011-05-11 18:01:51 -07:00
Mathias Agopian 68c7794183 Add SurfaceTexture logging
Change-Id: If1b74be5230813fb76429935d88b9d4a7c41700c
2011-05-11 18:01:51 -07:00
Mathias Agopian 8072711307 Implement {Surface|SurfaceTextureClient}::setSwapInterval()
Change-Id: I8382e346ddaa2c4c8ff56ac3ffd7f0109572f188
2011-05-11 18:01:51 -07:00
Mathias Agopian b3e518c820 Add the concept of synchronous dequeueBuffer in SurfaceTexture
Change-Id: Ic94cbab092953243a0746e04bbe1b2eb0cc930ef
2011-05-11 18:01:51 -07:00
Mathias Agopian eafabcdc16 unify SurfaceTexture and Surface
Change-Id: I49da2f5d8408e4cd7e148cfb777bb4ff68cd8f37
2011-05-11 18:01:51 -07:00
Mathias Agopian c04f153353 Fix a bug where setgeometry couldn't be undone
This change the binder protocol between SurfaceTextureClient
and SurfaceTexture. dequeueBuffer() now takes the requested
parameters for the buffer. SurfaceTexture decides if the
buffer needs to be reallocated and does the allocation
if needed. In that case it returns BUFFER_NEEDS_REALLOCATION
to tell SurfaceTextureClient that it needs to call
requestBuffer (which all parameters have been removed) to
acquire a pointer to the buffer.

dequeueBuffer and requestBuffer could be folded into a single
IPC call, but we chose to optimize the case where buffers are
not created and avoid some complexity in the marshalling code.

Change-Id: I097a7f6f40a3491e10f3f3742eab33999286c304
2011-05-11 18:01:51 -07:00
Mathias Agopian cc57d6f883 Fix uninitialized variable in SurfaceTexture
Change-Id: Ie77cdad481fc0522ff5ea3b7e14ce94e07150793
2011-04-27 18:58:46 -07:00
Mathias Agopian 3cd5a11708 Report errors when eglCreateImageKHR fails
Change-Id: Ica39b72ac2505675e619ef4994bd67b98bf6e7da
2011-04-26 15:03:27 -07:00
Mathias Agopian 7e3d7f341a Merge "changes to SurfaceTexture needed for unification with SF" 2011-04-18 19:51:26 -07:00
Mathias Agopian 7a042bf324 changes to SurfaceTexture needed for unification with SF
- implement connect/disconnect
- implement missing query
- handle texture_2d in addition to texture_external_oes

Change-Id: I971a70821f00f22b01f5337de4a7d451177fec4d
2011-04-11 21:19:55 -07:00
Mathias Agopian 4cb18881b5 Fix a GraphicBuffer leak in SurfaceTexture
This leak was intentional, it was there to deal with the fact that
some gralloc implementations don't track buffer handles with
file-descriptors so buffers needed to stay alive until there were
registered, which is not guaranteed by binder transactions.

In this new implementation, we use a small BBinder holding a
reference to the buffer, which with tuck into the parcel. This forces
the reference to stay alive until the parcel is destroyed, which
is guaranteed (by construction) to happen after the buffer is
registered.

this allows the public facing API to not expose the previous hack.

Change-Id: I1dd6cd83679a2b7457ad628169e2851acc027143
2011-04-08 19:28:04 -07:00
Mathias Agopian a5c75c0162 SurfaceTexture can now force the client to request a buffer
SurfaceTexture now has the concept of default size a new method,
setDefaultBufferSize() to set it. When the default size is
changed, dequeueBuffer() will return a value telling the
client that it must ask for a new buffer.

The above only applies if the client has not
overriden the buffer size with setGeometry.

Change-Id: I520dc40363054b7e37fdb67d6a2e7bce70326e81
2011-04-01 14:43:35 -07:00
Eino-Ville Talvala 1d01a12e71 Add support for timestamps into SurfaceTexture.
API addition: The timestamps are represented as nanoseconds from some
arbitrary time point. Like the SurfaceTexture transform matrix, the
timestamp retrieved by getTimestamp is for the last frame sent to the
GL texture using updateTexImage().

Camera HAL change: Expect vendors to set these timestamps using
native_window_set_buffers_timestamp().  For now, they are
autogenerated by SurfaceTextureClient if set_buffers_timestamp() is
never called, but such timing is likely not accurate enough to pass a
CTS test.

bug:3300707

Change-Id: Ife131a0c2a826ac27342e11b8a6c42ff49e1bea7
2011-03-17 13:10:03 -07:00
Jamie Gennis d99c088f35 SurfaceTexture: fix transform matrix computation.
This change fixes the transform matrix computation in SurfaceTexture
when a crop rectangle is specified by the image producer.  It also adds
a test for this case as well as a basic test for the uncropped case.

Bug: 4070775
Change-Id: I1481c9ce9d08fe7f2bff86d3afdeab7d4002b157
2011-03-14 11:30:16 -07:00
Jamie Gennis 9d4d6c101d Add the MIN_UNDEQUEUED_BUFFERS query to ANW.
This change adds a new query to ANativeWindow for getting the minimum
number of buffers that must be left un-dequeued during the steady-state
operation of the ANativeWindow.

Change-Id: Ie8c461fc26b02ecde02ddb4f95bf763662cf1551
Related-Bug: 3356050
2011-02-28 12:24:40 -08:00
Jamie Gennis e839fdad46 am c7839751: am c2efcd2c: Merge "Initialize the SurfaceTexture transform fields." into honeycomb
* commit 'c7839751aa1de52e0c3aab7dd1518b0fc8f2ee0a':
  Initialize the SurfaceTexture transform fields.
2011-02-07 13:47:02 -08:00
Jamie Gennis f73935bb0d Initialize the SurfaceTexture transform fields.
Change-Id: I2c25f15949253a1dbe493fef440e5ef118c40e71
related-bug: 3426067
2011-02-04 13:46:38 -08:00
Jamie Gennis 08b4ea31a8 am 421d94c2: am ecb4b3f0: Merge "Pass the IGraphicBufferAlloc to SurfaceTextureClient." into honeycomb
* commit '421d94c20321e1de528416b279bf148baba47b39':
  Pass the IGraphicBufferAlloc to SurfaceTextureClient.
2011-02-02 16:21:24 -08:00
Jamie Gennis 1b20cde313 Pass the IGraphicBufferAlloc to SurfaceTextureClient.
This change passes a reference to the IGraphicBufferAlloc binder object
to SurfaceTextureClient objects.  When STC objects are created they
query their associated ISurfaceTexture object for the
IGraphicBufferAlloc that the SurfaceTexture uses to allocate buffers.
Having the SurfaceTextureClient hold this reference prevents the
GraphicBufferAlloc in SurfaceFlinger from freeing the allocated buffers
before the SurfaceTextureClient is done with them.

Change-Id: Ib8e30e8b37fdd60438cbb4cb7e9174d0ba6d661c
related-bug: 3362519
2011-02-02 15:31:47 -08:00
Jamie Gennis 0eb8851e8c Clear GL errors before updating a SurfaceTexture.
Change-Id: Ibdac657ae9e9ccae53c63abed9caf1f1513915c2
2011-01-31 15:35:29 -08:00
Jamie Gennis c4d4aeab52 Implement SurfaceTexture frame-available callback.
This change implements the onFrameAvailable callback for the
SurfaceTexture java class.  It includes the C++ SurfaceTexture code as
well as the JNI and Java code to enable the callback.

Change-Id: Ifd8b8e7ad46ee70cba6da1c2e96dab8045d1ea30
2011-01-16 17:28:39 -08:00
Jamie Gennis a214c64d7f Fix SurfaceTexture transform matrix.
Change-Id: I31520c547cafa5cc85cd0f73883ab3a9ff4648e2
2011-01-16 16:35:01 -08:00
Jamie Gennis 9a78c90cd4 Fix remote GraphicBuffer allocation in SurfaceFlinger.
This change fixes a horrible hack that I did to allow application
processes to create GraphicBuffer objects by making a binder call to
SurfaceFlinger.  This change introduces a new binder interface
specifically for doing this, and does it in such a way that
SurfaceFlinger will maintain a reference to the buffers until the app is
done with them.

Change-Id: Icb240397c6c206d7f69124c1497a829f051cb49b
2011-01-13 12:19:04 -08:00
Jamie Gennis 235c424c9a Fix a bug in SurfaceTexture::dequeueBuffer.
This change fixes a bug that allowed the most recently queued buffer to
be returned by dequeueBuffer.  At the next updateTexImage call, the
dequeued buffer would be set as the contents of the texture even though
the client could be writing to it.

Change-Id: I53dc14eed13262475627d5551337df57fd78fe00
2011-01-12 11:28:38 -08:00
Jamie Gennis f238e28500 Implement crop & transform for SurfaceTexture.
This change adds support for the setCrop and setTransform methods of the
SurfaceTexture C++ class.  The crop and transform for the current
texture will be accessed by applications as a single texture coordinate
transform matrix.

Change-Id: I6482bf96f680e5c175364e848936db3908d6c8f8
2011-01-12 11:28:38 -08:00
Jamie Gennis 67eedd74ab Fix a bug in SurfaceTexture::setBufferCount.
We need to reset mCurrentTexture and mLastQueued in setBufferCount
because it frees all of the buffers associated with the buffer slots.

Change-Id: Ie2f834ec1c07ce7a4ab9b2b5fc5fe8c294010c60
2011-01-09 16:40:06 -08:00
Jamie Gennis e70d8b4393 Add method logging to the SurfaceTexture C++ class.
Change-Id: Ic05b05428d34c04634ce9fc3f924ff3322bb2da2
2011-01-09 16:40:06 -08:00
Jamie Gennis 3461e0fadf Initialize the SurfaceTexture buffer slots.
Change-Id: I81a562ad897173f33cd6a2127737718a7db610eb
2011-01-09 16:40:06 -08:00
Jamie Gennis 8ba32fade1 Add the SurfaceTexture C++ implementation.
This change adds the C++ implementation of SurfaceTexture and related
classes. The goal of this is for a SurfaceTexture to be passed to
camera service or Stagefright in place of a Surface to allow camera
preview or decoded video frames to be streamed to an OpenGL ES texture
that an application can use.

Change-Id: I55c83a7017f1ecb81c9c9e3252cbd118b914296c
2011-01-06 13:20:47 -08:00