Commit Graph

1990 Commits

Author SHA1 Message Date
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
Jeff Brown f0083bf528 Merge "Add a very simple helper function to log slow functions." into jb-mr1-dev 2012-08-13 23:35:08 -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
Jeff Brown 6f12d57325 Add a very simple helper function to log slow functions.
Change-Id: I2e2e072206d02b572a330dd25857c161b5b563bf
2012-08-10 22:03:55 -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
Mathias Agopian 69973992d5 improve Vector<> safety checks
- make errors that will always cause a memory corruption always fatal
  (for eg: KeyedVector<>::editValue{For|At}() failure)
- make other errors fatal in debug mode, those that can be caught by
  the caller.
- fix typos

Change-Id: I65cc7d81035c37ce2906fc4500c50e5d5b5c49eb
2012-08-10 13:15:00 -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 14bd369e4b Merge changes Ic3d35a93,I46ec942d into jb-mr1-dev
* changes:
  SurfaceTexture: fix an out of bounds array access
  surfaceflinger: refactor FrambufferSurface
2012-08-06 19:15:51 -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 53095e25d6 libutils cleanup: remove unused or seldom used code from misc.{cpp|h}
Change-Id: I72206f16619d81887e3b85603494563faab3b445
2012-08-05 12:41:16 -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 e21facef01 Merge "log more info on fence sync_merge error" into jb-mr1-dev 2012-07-30 15:22:00 -07:00
Mathias Agopian d83d67b5d5 log more info on fence sync_merge error
also fix a typo where the wrong value was passed to sterror.

Change-Id: I4df2abe582e14c8f816b65818f4593a6bd3c23ea
2012-07-30 15:10:35 -07:00
Ed Heyl 747c480b0e Merge remote-tracking branch 'goog/jb-dev-mako' into jb-mr1-dev
Conflicts:
	include/media/hardware/CryptoAPI.h

Change-Id: I84bf34edbef000558f088bbf1d1e5b55d6217d2e
2012-07-28 09:55:54 -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
Nick Pelly 074cd0c076 Add elapsedRealtimeNano(), and use CLOCK_BOOTTIME where possible.
Change-Id: I4231c8ca32663e6e2cb5b7c126d091f837373807
2012-07-19 16:06:21 -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
Naseer Ahmed 0bc64be3f5 libs/ui: Add support for triple framebuffers
Change-Id: I90dd38deeeda9a3785b87286cc7d252c6f948750
2012-07-09 22:04:19 -07: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
John Grossman ec44ed0758 Utils: Fix a bug in the linear transformation code.
Hand merge from ics-aah

> Utils: Fix a bug in the linear transformation code.
>
> Fix a bug where an incorrect result would be computed if you used the
> linear transformation code to do a reverse transformation (from B's
> domain into A's domain) when the scaler fraction was negative.
>
> Change-Id: I8e5f109314d235a177ab41f65d3c4cd08cff78be
> Signed-off-by: John Grossman <johngro@google.com>

Change-Id: Id90e18f685c61c1a89fd91c32adcf01363b3e8f3
Signed-off-by: John Grossman <johngro@google.com>
2012-06-27 15:34:43 -07:00
Johannes Carlsson 3443b333f1 am db1597a9: Fix shutdown sequence to avoid SIGSEGV when running am command
* commit 'db1597a98958b78dc0d8eced19ae1406382b70d6':
  Fix shutdown sequence to avoid SIGSEGV when running am command
2012-06-25 14:06:56 -07:00
Johannes Carlsson db1597a989 Fix shutdown sequence to avoid SIGSEGV when running am command
When the app_process is shutting down the main thread will close the
binder fd while pool threads are executing an ioctl (in
IPCThreadState::stopProcess called by AppRuntime::onStarted in
app_main.c).

The binder driver will then return all pending calls in ioctl
without any error and with a command. One of the threads gets a
BR_SPAWN_LOOPER which will create a new thread (the other thread
gets a BR_NOOP). This new thread then calls
vm->AttachCurrentThread. Usually this results in a log entry with
"AndroidRuntime: NOTE: attach of thread 'Binder Thread #3' failed",
but sometimes it also causes a SIGSEGV. This depends on the timing
between the new thread an the main thread that calls DestroyJavaVM
(in AndroidRuntime::start).

If IPCThreadState.cpp is compiled with "#define LOG_NDEBUG 0" the
pool thread will loop and hit the
ALOG_ASSERT(mProcess->mDriverFD >= 0) in
IPCThreadState::talkWithDriver.

Crashes like this has been seen when running the am command and
other commands that use the app_process.

This fix makes sure that any command that is received when the driver
fd is closed are ignored and IPCThreadState::talkWithDriver instead
returns an error which will cause the pool thread to exit and detach
itself from the vm. A check to avoid calling ioctl to a fd with -1
was also added in IPCThreadState::threadDestructor.

Another solution might be to change the binder driver so that it
returns an error when the fd is closed (or atleast not a
BR_SPAWN_LOOPER command). It might also be possible to call exit(0)
which is done when System.exit(0) is called from java.

Change-Id: I3d1f0ff64896c44be2a5994b3a90f7a06d27f429
2012-06-25 13:58:47 -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
Jesse Hall a74cbc0649 Move remaining bits of lockBuffer to dequeueBuffer
FramebufferNativeWindow::dequeueBuffer now waits for the next buffer
to be non-front in addition to being free.

Change-Id: I991f154958cc6b488b1241aba83d1f95a0513b3c
2012-06-21 11:56:49 -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
Jamie Gennis f25e183a70 libui: add the Fence class
This change adds the Fence class to libui for to wrap the libsync
functionality.

Change-Id: I93a31baeee608b93c14da807a32013dabf783f84
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 52cf768fc2 Merge "surfaceflinger: replace early suspend with binder call from PowerManager" 2012-06-08 14:14:18 -07:00
Magnus Strandberg bd3ad5b23f am 1ba24574: Aligning native Parcel implementation to Java.
* commit '1ba24574b2debd3ca012adbbd77f12bed4f2d266':
  Aligning native Parcel implementation to Java.
2012-06-08 08:32:28 -07:00
Magnus Strandberg 1ba24574b2 Aligning native Parcel implementation to Java.
The Java implementation of writing the RPC response header
calculates the length of the header including the 4 bytes
specifying the header length but the native implementation
excludes the 4 bytes specifying the length from the header
length.
The native implementation has been aligned to the Java impl.

Change-Id: I325bf272a63152d8fded4cf4e51a906b5a9bfe19
2012-06-08 08:29:01 -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
Jeff Brown 9a6b4c73fa am d5085da3: am 4467bba7: Merge "Support looper callbacks based on smart pointers." into jb-dev
* commit 'd5085da3c0c103bba0c2c927382f7d414275b661':
  Support looper callbacks based on smart pointers.
2012-05-31 18:43:27 -07:00
Jeff Brown ad7b3760ce am 80586761: am dad23789: Merge "Delete unused poll() code." into jb-dev
* commit '805867612c0c11d3bb494cbf454cbb2de21a1b75':
  Delete unused poll() code.
2012-05-31 18:43:26 -07:00
Jeff Brown 27d928474d am dce1547d: am 9e2e781a: Merge "Remove unused statistics code." into jb-dev
* commit 'dce1547d65877b89cec4e52ee8e5b39830911d00':
  Remove unused statistics code.
2012-05-31 18:43:26 -07:00
Jeff Brown 4467bba73a Merge "Support looper callbacks based on smart pointers." into jb-dev 2012-05-31 18:39:13 -07:00
Jeff Brown dad2378911 Merge "Delete unused poll() code." into jb-dev 2012-05-31 18:39:06 -07:00
Jeff Brown 9e2e781aca Merge "Remove unused statistics code." into jb-dev 2012-05-31 18:39:02 -07:00
Jeff Brown af567f73ac Support looper callbacks based on smart pointers.
Bug: 6559630
Change-Id: I5a667f219f431838638acefbc9fa6afa610971bd
2012-05-31 17:16:21 -07:00
Jeff Brown 588d5c8280 Delete unused poll() code.
We don't need this code anymore and it is just in the way.

Bug: 6559630
Change-Id: I1dc9decf85d5ea1feab159c2985da6c20baffdd5
2012-05-30 19:21:12 -07:00
Jeff Brown 1ea51bf519 Remove unused statistics code.
Bug: 6559630
Change-Id: Iacdf4bb4c1c125c09305cbd8cb443c7c80cfc010
2012-05-30 19:17:47 -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
Mathias Agopian 455961ef65 am e0607f05: am 5aed6843: Merge "fix a corruption in Vector<> when adding new items" into jb-dev
* commit 'e0607f0507fe647bd9262facfaf75146c074e933':
  fix a corruption in Vector<> when adding new items
2012-05-21 12:43:25 -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
Mathias Agopian 5aed68434d Merge "fix a corruption in Vector<> when adding new items" into jb-dev 2012-05-17 17:48:09 -07:00
Mathias Agopian a9611c5d5b fix a corruption in Vector<> when adding new items
would happen when vectors are copied and new items is
added in both vectors. we didn't duplicate the underlying
storage when adding items in vectors.

Bug: 6515797
Change-Id: If544c07d96c05821e088d7f2c9b5736f7e306c31
2012-05-17 17:47:44 -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
Glenn Kasten 8d057994a0 am bd113224: Merge "Fix log spam about CPU frequency on one device" into jb-dev
* commit 'bd1132249479e52ddd128171da24327358e2191c':
  Fix log spam about CPU frequency on one device
2012-05-15 11:37:41 -07:00
Jamie Gennis dd73996552 Merge changes I32fbc2b6,Ifd0ed05b into jb-dev
* changes:
  SurfaceFlinger: recompute visible regions less
  libgui: remove setPostTransformCrop
2012-05-15 11:33:42 -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
Glenn Kasten 542af12d10 Fix log spam about CPU frequency on one device
Previous kernels have allowed opening the CPU frequency file regardless
whether the CPU is up or not.  This fixes some log spam on one device
with dynamic hot plug CPU feature, which does not allow opening the CPU
frequency file if CPU is down.

Also, since the file descriptors are global and have long lives, add
the close-on-exec flag.

Change-Id: Ia14a2b9e20038dfb96a573920176a47a96bd3f5a
2012-05-14 16:55:26 -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 b30f0fb45f am f15a83f5: SurfaceFlinger: add a crop to the layer state
* commit 'f15a83f5814219c167f87cb8aaea622fc8493499':
  SurfaceFlinger: add a crop to the layer state
2012-05-14 08:36:53 -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
Glenn Kasten 9121ece5fc am f30fd014: Merge "Workaround for add_tid_to_cgroup failed to write" into jb-dev
* commit 'f30fd01497a53cbff8692721026c3f7b6830158e':
  Workaround for add_tid_to_cgroup failed to write
2012-05-10 17:45:21 -07:00
Glenn Kasten f30fd01497 Merge "Workaround for add_tid_to_cgroup failed to write" into jb-dev 2012-05-10 17:38:34 -07:00
Jamie Gennis 2b4eeac037 am cd1806e2: libgui: improve some logging and dumping
* commit 'cd1806e210f2633423f0fb14d39fa00d03974223':
  libgui: improve some logging and dumping
2012-05-10 16:37:18 -07:00
Glenn Kasten 10cbbd8f1f Workaround for add_tid_to_cgroup failed to write
Bug: 6467109
Change-Id: I6dff8e608d83c7a7c453c25c94ad100f113769b9
2012-05-10 15:52:59 -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
Dianne Hackborn daee0dcb43 am 555f89d8: Add callback hack to find out when to reload system properties.
* commit '555f89d8df316cdc5a25dbedb8614c2ac7a5e0a9':
  Add callback hack to find out when to reload system properties.
2012-05-10 09:31:08 -07:00
Dianne Hackborn 555f89d8df Add callback hack to find out when to reload system properties.
Every IBinder object can accept a new transaction to tell it that
it might want to reload system properties, and in the process
anyone can register a callback to be executed when this happens.

Use this to reload the trace property.

This is very much ONLY for debugging.

Change-Id: I55c67c46f8f3fa9073bef0dfaab4577ed1d47eb4
2012-05-09 14:53:26 -07:00
Jamie Gennis 5ce4b59f6e am 82c53806: Merge "SurfaceTexture: improve texture matrix computation" into jb-dev
* commit '82c53806ada5c314124431ec0a49fa15a6b5f1d6':
  SurfaceTexture: improve texture matrix computation
2012-05-09 12:58:22 -07:00
Jamie Gennis 1a8bfd09ee am cae7c0b9: Merge "libgui: Add support for post-xform crops." into jb-dev
* commit 'cae7c0b955efba6986d9e1fe5a68e48e7a2f806b':
  libgui: Add support for post-xform crops.
2012-05-09 12:58:21 -07:00
Jamie Gennis 8d1afba6f0 am 59df82f3: Merge "libui: add the Rect::transform method" into jb-dev
* commit '59df82f355ac4bb3c08f678432a38c3ef29b3637':
  libui: add the Rect::transform method
2012-05-09 12:58:15 -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 59df82f355 Merge "libui: add the Rect::transform method" into jb-dev 2012-05-09 12:51:39 -07:00
Dianne Hackborn dad60f2aec am 34c65888: Change name of system property for traces.
* commit '34c65888d1842315e987045594e2999442c78f1d':
  Change name of system property for traces.
2012-05-09 01:55:27 -07:00
Mathias Agopian ccb97bd8d1 am ddcb1c2b: Merge "return errors properly in BitTube and SensorEventQueue" into jb-dev
* commit 'ddcb1c2bbd273dff15411c4346bb78d3fa939ab4':
  return errors properly in BitTube and SensorEventQueue
2012-05-09 01:55:27 -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
Dianne Hackborn 34c65888d1 Change name of system property for traces.
This allows the property to be changed from the settings UI.

Change-Id: Ife7424b3549e5bbe51b6ad2fb8e5edde3a9fd608
2012-05-08 14:54:24 -07:00
Mathias Agopian 29267fe849 return errors properly in BitTube and SensorEventQueue
Change-Id: Idf31179f9fcc666e287c7b01b2007431cb60127d
2012-05-07 18:22:16 -07:00
Jamie Gennis 5933280430 libui: add the Rect::transform method
This change adds a method to Rect to transform a rectangle by a graphics HAL
transform.

Change-Id: Ic0d0988e731bdb5662faee41a5927b1242891658
Bug: 6299171
2012-05-07 15:25:52 -07:00
Mathias Agopian 44c27a54e8 am 23789ae9: Merge "set a Sensor\'s version properly" into jb-dev
* commit '23789ae95fd24d15c330bc9cae73975566632f97':
  set a Sensor's version properly
2012-05-04 16:40:30 -07:00
Mathias Agopian 2ebc4d6d94 set a Sensor's version properly
Bug: 6447433
Change-Id: Iaa5d074a8137d9543ea78c2c6f63a750774b3057
2012-05-04 15:47:13 -07:00
Andrew Hsieh 20771abcb1 Merge "Fixed 64-bit porting issues" 2012-05-02 21:58:52 -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
Andrew Hsieh 52016c18c3 Fixed 64-bit porting issues
Fixed two issues about casting between int and pointer which
cause compilation error in 64-bit mode (eg. for 64-bit emulator)

Change-Id: I5ca9a933a239db73e56d6f27de05aa42bd06a650
2012-05-02 12:30:00 +08:00
Mathias Agopian 6b8bef64f7 PixelFormat.UNKNOWN should return an error when queried
Bug: 6294260
Change-Id: Iad6f7bcbdda0a684abca6d9584da611a8b28f7ab
2012-04-24 23:27:31 -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
Glenn Kasten a26e1cfbbc Scheduling group cleanup
Remove C++ APIs androidSetThreadSchedulingGroup and
androidGetThreadSchedulingGroup, and the ANDROID_TGROUP_* constants.

Former callers of these should now use the C APIs set_sched_policy and
get_sched_policy, and the SP_* constants.

Note: debug.sys.noschedgroups is not supported by the C APIs,
this needs to be discussed.

Change-Id: I32bbfc539ef4090faf9ef0320380e8cca9eae07c
2012-04-19 11:32:59 -07:00
Mathias Agopian 9798ff28b8 Merge "add set thread count" 2012-04-18 18:36:16 -07:00
Mathias Agopian 1b80f793d2 add set thread count
Change-Id: I70f02908d8362a465eb8a2a24356f6989847f7ba
2012-04-18 17:50:03 -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
Jeff Brown 992b4c556b Merge "Support tokenizing arbitrary content." 2012-04-17 18:20:55 -07:00
Jeff Brown a8be8fa096 Support tokenizing arbitrary content.
Bug: 6110399
Change-Id: I37be63b68934fd451e6dffbf7d6079553619c0a3
2012-04-17 18:19:50 -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 e8db871de7 double checked locking pattern is not safe on SMP
Change-Id: Ie6dd564bdcd45647cb4d62ab259462e3db112576
2012-04-16 19:30:56 -07:00
Mathias Agopian 3aecbb0715 fix Region const_iterator.
- it returned an empty rect when the region was empty, instead
of returning an empty list of rect.

- also fixed an infinite loop when boolean_operation was given
an empty list of rects

Change-Id: I62225c7dcd2832025bb8f12e6cb3762f2a7b36cb
2012-04-16 18:40:30 -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
Mathias Agopian cac72cdbdf Merge "BufferQueue returns proper code on acquire" 2012-04-10 18:53:50 -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
Mathias Agopian d5caca1d0d Merge "BufferQueue no longer hardcodes buffer counts" 2012-04-09 17:35:00 -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
Glenn Kasten 485744e694 Merge "Add a log tag" 2012-04-06 14:50:42 -07:00
Jamie Gennis 8cce8a9a75 Merge "Fixed disconnect bug in SurfaceTexture" 2012-04-06 09:05:49 -07:00
Glenn Kasten 84ed8001d4 Add a log tag
Change-Id: If30aa8536130cf6ff9918ce97c5e4e8651ae2fef
2012-04-05 13:43:57 -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
Jamie Gennis 87579669e0 Merge "Added a DummyConsumer for use with BufferQueue." 2012-03-26 17:17:49 -07:00
Keun young Park e377d7de18 Merge "add Looper.cpp to build for linux host to use in CTS audio" 2012-03-26 15:30:38 -07:00