113 Commits

Author SHA1 Message Date
John Reck
849911a9c4 Move Canvas
Change-Id: I83d557af30fc2d5c69d06eedc0f4d52ac41c4210
2015-01-20 12:39:05 -08:00
Tom Hudson
8dfaa49042 Make DisplayListRenderer inherit from Canvas, merge JNI
Incrementally unify the upper layers for Skia and HWUI.
Remove redundant code from GLES20Canvas.java; instead
use inherited mNativeCanvasWrapper and superclass method
definitions.

Moves some unrelated SkPaint utility functions from Renderer
to new utils/PaintUtils.

bug: 15672762
Change-Id: I4ddd4214b8e9eeb95289d054ef423f2542bb5fa5
2015-01-05 15:25:41 -08:00
Leon Scroggins III
18981294a5 Make SkiaCanvas creation call ref() on SkCanvas.
There are two callers of SkiaCanvas::create_canvas(SkCanvas*). In both
cases, we were calling ref() first. It is necessary to call ref() in
both cases, since we have an SkCanvas returned by
SkPictureRecorder::beginRecording, which does not increment the ref
count to account for the caller. (i.e. the SkPictureRecorder has the
only ref until you call ref()).

Rather than leave the ref up to the caller, since the SkiaCanvas does
the unref(), it should also do the ref(). Update it to do so and
document its behavior.

Also, make SkiaCanvas' constructors explicit.

Change-Id: I894d0a71a87587cf8c2b26deb2384dc49ae090ef
2014-12-17 13:20:33 -05:00
Bo Liu
590b8d3601 Merge "Add kModeSync" into lmp-dev 2014-07-24 20:48:02 +00:00
John Reck
09d5cddf67 Add kModeSync
Bug: 16526750

Change-Id: I4c087160e80432739321172fd57880846c8de6e0
2014-07-24 10:36:08 -07:00
Derek Sollenberger
cae05e0b4c Move Canvas.h to a new location so that it can be shared with HWUI.
Bug: 15672762
Change-Id: Ia59e986cd4034e16b2e54e8d594e6941a6c9fb1b
2014-07-25 11:39:37 -04:00
John Reck
0d1f634f4b Add invokeFunctor
Change-Id: I09e675d3e02e3e528642175ada00b2b17fab7652
2014-03-28 20:57:32 -07:00
John Reck
750ca6dbdb Remove kStatusInvoke & kStatusDraw
They are unused

Change-Id: I44ecf1164dc6bc1b09438e733976d5a97a25f00e
2014-03-28 16:43:15 -07:00
Chet Haase
486590963e Skip eglSwapBuffers() call when we do not draw to GL
The fix is to track when we issue GL drawing commands, and to skip the
call to eglSwapBuffers() when a DisplayList does not result in
any actual rendering calls to GL.

Issue #6364143 QuickMuni list items and buttons flicker instead of fade

Change-Id: I60a02c61a58c32d92481a1e814b4c8a49c6a37a3
2012-05-31 17:22:27 -07:00
Chet Haase
7b6a75872b Pass width/height parameters to webview
When webview draws into an fbo layer, it needs to know the
size of that surface to create the rendering transform appropriately.
This change copies in the current viewport size to the structure that
is passed to the webview.

Change-Id: I7160b0836d00834134c799c95a439cdc045e2035
2012-04-11 14:32:02 -07:00
Romain Guy
8f3b8e3299 Allow fine-grained control over functors execution
Adds non-drawing execution mode

Change-Id: I82f92cf1b9a3b9ff2ca6d7427c4e02b73e04e6bf
2012-04-02 15:15:07 -07:00
James Dong
d927a1d996 Deleted the media, camera, drm related files since they are relocated
Change-Id: I9bc5573ee07e30b305b5b879023aa9ec69e10b91
2012-03-28 10:42:44 -07:00
Romain Guy
6554943a1d Use a status_t return type for GL functors
WebView needs more fine-grained control over the behavior of the
framework upon execution of the display lists. The new status_t
allows WebView to requests its functor to be re-executed directly
without causing a redraw of the entire hierarchy.

Change-Id: I97a8141dc5c6eeb6805b6024cc1e76fce07d24cc
2012-03-26 16:45:05 -07:00
Glenn Kasten
18db49a462 Whitespace and indentation
Fix indentation to be multiple of 4.
Make it easier to search:
  sp< not sp < to
  "switch (...)" instead of "switch(...)" (also "if" and "while")
Remove redundant blank line at start or EOF.
Remove whitespace at end of line.
Remove extra blank lines where they don't add value.

Use git diff -b or -w to verify.

Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e
2012-03-13 11:09:47 -07:00
Mathias Agopian
8c79817dc6 remove files that moved to frameworks/native
Change-Id: I140d291e520097b1148930f736823650e08488f7
2012-03-07 19:36:08 -08:00
Mathias Agopian
8335f1cccc fix libgui header location
Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
2012-02-27 13:03:08 -08:00
Mathias Agopian
7d3916ff9c libagl shouldn't export anything
Change-Id: Ia823dbc56aab2a0b8a6063df4348fe6baac124c6
2012-02-27 13:03:04 -08:00
Mathias Agopian
af01feafc3 remove dependency on android_native{s_priv|buffer}.h
Change-Id: Ie4b95f7061c240f37c504414259f92d72c4ffc89
2012-02-24 18:26:01 -08:00
Glenn Kasten
b3db213eb5 Update comments
We no longer put the filename at start of file.

Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
2012-02-14 09:17:59 -08:00
Glenn Kasten
d9d68dcb62 Don't double destruct audio_track_cblk_t
Fortunately audio_track_cblk_t doesn't have a destructor, but for clarity
remove the double destruction.

Also add warning not to add any virtuals to audio_track_cblk_t.

Change-Id: I70ebe1a70460c7002145b2cdf10f9f137396e6f3
2012-02-03 16:16:46 -08:00
Glenn Kasten
bc4de888c1 Make AudioTrack control block volume field private
This is part of the process of abstracting the control block
to make it easier to maintain.

Change-Id: Idb8f461e68dab3bcf268159cc0781651c6fb7094
2012-01-20 16:19:59 -08:00
Glenn Kasten
0632bad8ba Track volume cleanup
Always read and write track volumes atomically. In most places this was
already being done, but there were a couple places where the left and
right channels were read independently.

Changed constant MAX_GAIN_INT to be a uint32_t instead of a float.
It is always used as a uint32_t in comparisons and assignments.
Use MAX_GAIN_INT in more places.

Now that volume is always accessed atomically, removed the union
and alias for uint16_t volume[2], and kept only volumeLR.

Removed volatile as it's meaningless.

In AudioFlinger, clamp the track volumes read from shared memory
before applying master and stream volume.

Change-Id: If65e2b27e5bc3db5bf75540479843041b58433f0
2012-01-17 16:25:17 -08:00
Glenn Kasten
8c17a2f088 Merge "Use size_t for frame size" 2012-01-17 07:27:46 -08:00
Glenn Kasten
4790bd8be8 AudioTrack and AudioFlinger send level cleanup
Add an API to control block for getting/setting send level.
This allow us to make the mSendLevel field private.

Document the lack of barriers.

Use 0.0f to initialize floating-point values (for doc only).

Change-Id: I59f83b00adeb89eeee227e7648625d9a835be7a4
2012-01-13 15:25:14 -08:00
Glenn Kasten
faf354dc7f Use size_t for frame size
except in the control block, where we don't have room.

In AudioFlinger::ThreadBase::TrackBase::getBuffer,
read the frame size from control block only once.

Change-Id: Id6c4bccd4ed3e07d91df6bbea43bae45524f9f4e
2012-01-13 14:58:44 -08:00
Glenn Kasten
e5fb263a36 Audio C++ comments
Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
2011-12-14 14:38:26 -08:00
Mathias Agopian
3f15700a01 split ComposerService out of SurfaceComposerClient.h
Change-Id: I1eb691f7ca263d5895d871ab675bb5826e0323c6
2011-11-28 15:21:57 -08:00
Mathias Agopian
34cb9f2a96 fix Surface positions are not floats
Added Surface.setPosition(float, float) which allows to set a surface's
position in float.

Bug: 5239859
Change-Id: I903aef4ad5b5999142202fb8ea30fe216d805711
2011-08-30 18:51:54 -07:00
Mike Lockwood
c1b9bbb21c Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator build
Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-13 19:45:44 -04:00
Mathias Agopian
439863f3b3 SF transactions are now O(1) wrt IPC instead of O(N).
Change-Id: I57669852cbf6aabae244ea86940a08a5a27ffc43
2011-06-29 15:05:41 -07:00
Mathias Agopian
7bb843ca07 unify SurfaceTexture and Surface
Add the concept of synchronous dequeueBuffer in SurfaceTexture
Implement {Surface|SurfaceTextureClient}::setSwapInterval()
Add SurfaceTexture logging
fix onFrameAvailable
2011-06-13 15:51:35 -07:00
Glenn Kasten
993fccec5b Remove unnecessary level of priority indirection
Change-Id: I942d43973c20a7ace8b0d3f78b4da97e45e996c6
2011-06-01 16:46:29 -07:00
Jean-Michel Trivi
5439223b56 Use channel mask instead of channel count for track creation
Record and playback objects (resp AudioRecord and AudioTrack)
are created using a channel mask, but this information is lost
in the mixer because only the channel count is known to
AudioFlinger. A channel count can always be derived from a
channel mask.

The change consists in:
- disambiguiting variable names for channel masks and counts
- passing the mask information from the client to AudioFlinger
 and the mixer.
- when using the DIRECT ouput, only verifying the format of
 the track is compatible with the output's for PCM.

Change-Id: I50d87bfb7d7afcabdf5f12d4ab75ef3a54132c0e
2011-06-01 10:55:29 -07:00
Mathias Agopian
6b85f17304 remove last traces of copybit
Change-Id: Ia0f13a0ee6f702256482b5eb29d7fa2aa840bfc7
2011-05-02 16:27:21 -07:00
Mathias Agopian
8e86a7aba5 get rid of dependency on copybit HAL module
Change-Id: Ia608099a2426c11a91d33063ba53c93e1eccb428
2011-04-28 19:50:21 -07:00
Eric Laurent
ae29b7632e New fix for issue 4111672: control block flags
The first fix (commit 913af0b4) is problematic because it makes threads
in mediaserver process block on the cblk mutex. This is not permitted
as it can cause audio to skip or worse have a malicious application
prevent all audio playback by keeping the mutex locked.

The fix consists in using atomic operations when modifying the control
block flags.

Also fixed audio_track_cblk_t::framesReady() so that it doesn't block
when called from AudioFlinger (only applies when a loop is active).

Change-Id: Ibf0abb562ced3e9f64118afdd5036854bb959428
2011-04-05 12:05:41 -07:00
Romain Guy
08aa2cbd5e Send WebView the current transform and whether we're drawing a layer.
Bug #3275491

These can be used by WebView to correctly apply alpha and geometric
transforms.

Change-Id: I2ecd4376d68df886dead3c9240317de33f56828f
2011-03-17 12:04:04 -07:00
Eric Laurent
421ddc014b Fix issue 3439872: video chat and bluetooth SCO
This change fixes the stability problems experienced when using
a bluetooth headset supporting both A2DP and SCO. Problems occur
when starting the video chat at which time the A2DP output is being
stopped to start SCO. At that time, active AudioTracks are invalidated
by AudioFlinger so that a new AudioTrack binder interface can be
recreated by the client process on the new mixer thread with correct parameters.
The problem was that the process to restore the binder interface was not
protected against concurrent requests which caused 2 binder interfaces
to be created sometimes. This could lead to permanent client deadlock
if one of the client threads was waiting for a condition of the first
created binder interface while the second one was created (as the AudioFlinger
would only signal conditions on the last one created).
This concurrent request situation is more likely to happen when a client
uses the JAVA AudioTrack as the JNI implementation uses simultaneously the
native AudioTrack callback and write push mechanisms. By doing so, the code
that checks if the binder interface should be restored (in obtainBuffer()) is
much more likely to be called concurrently from two different threads.

The fix consists in protecting the critical binder interface restore phase
with a flag in the AudioTrack control block. The first thread acting upon the binder
interface restore request will raise the flag and the second thread will just wait for
a condition to be signaled when the restore process is complete.

Also protected all accesses to the AudioTrack control block by a mutex to prevent
access while the track is being destroyed and restored. If a mutex cannot be held
(e.g because we call a callback function), acquire a strong reference on the IAudioTrack
to prevent its destruction while the cblk is being accessed.

Modified AudioTrack JNI to use GetByteArrayElements() instead of
GetPrimitiveArrayCritical() when writing audio buffers. Entering a critical section would
cause the JNI to abort if a mediaserver crash occurs during a write due to the AudioSystem
callback being called during the critical section when media server process restarts.
Anyway with current JNI implementation, either versions do not copy data most of the times
and the criticial version does not guaranty no data copy.

The same modifications have been made to AudioRecord.

Change-Id: Idc5aa711a04c3eee180cdd03f44fe17f3c4dcb52
2011-03-08 16:33:15 -08:00
Mathias Agopian
9f81547fc5 Add support for up to 32 buffers per Surface
Bug: 3488016

Change-Id: Ie5536ad77d42a4d0e8270e0fd87ecb73471bcbbc
2011-03-01 14:09:06 -08:00
Mathias Agopian
1d4549ab03 clean-up unneeded code
now that we removed the notion of a "inUse" buffer in surfaceflinger
a lot of code can be simplified / removed.

noteworthy, the whole concept of "unlockClient" wrt. "compositionComplete"
is also gone.

Change-Id: I210413d4c8c0998dae05c8620ebfc895d3e6233d
2011-01-20 12:10:11 -08:00
Mathias Agopian
19f9eda28a fix [3259708] Graphic Buffer Mapper does not support YV12
remove a bunch of a code that was there only to support broken gralloc implementations

Change-Id: I3c1a9172224cbcc283601abfbbd695a20815451f
2010-12-08 16:48:28 -08:00
Jamie Gennis
6c925d00e1 Implement reducing the buffer count of a Surface.
Change-Id: I7f979c60c06d654aa8265002836277434bc1a64f
Bug: 3095167
2010-11-11 14:06:38 -08:00
James Dong
53ebc72fd8 Support extracting thumbnail from rotated video tracks
Change-Id: Ife0a2536aaac5ff1efdf1035b9d2c892773ee16c
2010-11-08 16:52:59 -08:00
Mathias Agopian
8ddd2c72ee fix [2835280] Add support for cancelling buffers to ANativeWindow
There is a new ANativeWindow::cancelBuffer() API that can be used to
cancel any dequeued buffer, BEFORE it's been enqueued. The buffer is
returned to the list of availlable buffers. dequeue and cancel are not
mutually thread safe, they must be called from the same thread or
external synchronization must be used.

Change-Id: I86cc7985bace8b6a93ad2c75d2bef5c3c2cb4d61
2010-10-04 20:10:11 -07:00
Eric Laurent
4712baab81 Issue 3032913: improve AudioTrack recovery time
This issue showed that when an AudioTrack underruns during a too long period
of time and is therefore disabled by audioflinger mixer, it takes an additional
delay of up to 3 seconds to recover.
This fix adds a simple mechanism to recover immediately when the client application
is ready to write data again in the AudioTrack buffer

Also throttle warnings on record overflows

Change-Id: I8b2c71578dd134b9e60a15ee4d91b70f3799cb3d
2010-09-30 17:21:23 -07:00
Mathias Agopian
c9289fa1c4 fix a race in SF buffer management
also remove some unused code.

Change-Id: Iae2c3309b7a08055f3e13a5b866c5c084993e352
2010-08-26 17:42:27 -07:00
Mathias Agopian
e96aa3e859 fix [2931513] Add support for setting the orientation of an ANativeWindow
Also implement support for cropping.

Change-Id: Iba5888dd242bf2feaac9e9ce26e404c1f404c280
2010-08-24 15:40:50 -07:00
Mathias Agopian
51c70e3e41 fix [2873058] Surface::dequeueBuffer blocks on last buffer, i.e. cannot dequeue all allocated buffers at once.
this situation happened when the last buffer needed to be resized
(or allocated, the first time). the assumption was that the buffer
was in use by SF itself as the current buffer (obviously, this
assumption made no sense when the buffer had never been allocated, btw).

the system would wait until some other buffer became the "front" buffer.

we fix this problem by entirely removing the requirement that the
buffer being resized cannot be the front buffer. instead, we just
allocate a new buffer and replace the front buffer by the new one.

the downside is that this uses more memory (an extra buffer) for a
brief amount of time while the old buffer is being reallocated and
before it has actually been replaced.

Change-Id: I022e4621209474ceb1c671b23deb4188eaaa7285
2010-07-27 20:11:35 -07:00
Jeff Brown
46b9ac0ae2 Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now.  To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.

Includes part of the new input event NDK API.  Some details TBD.

To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument.  The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points.  The ViewRoot then
provides the InputChannel to the InputQueue.  Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue.  This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.

There can be zero or more targets for any given input event.  Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets).  Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.

End-to-end event dispatch mostly works!

To do: event injection, rate limiting, ANRs, testing, optimization, etc.

Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-06-13 17:42:16 -07:00
Mathias Agopian
5e14010b1f allow re-targetting of surfaces
Surfaces can now be parcelized and sent to remote
processes. When a surface crosses a process
boundary, it looses its connection with the
current process and gets attached to the new one.

Change-Id: I39c7b055bcd3ea1162ef2718d3d4b866bf7c81c0
2010-06-08 20:10:02 -07:00