Commit Graph

51 Commits

Author SHA1 Message Date
Mathias Agopian
fcfeb4b597 fixes for [2474091] Saw Poor behaviour playing a video.
- fix a bug when hacking video buffers into gralloc buffers
 where the buffer size was incorrect this was causing the
 "direct-form-texture" mode to fail

- also when the above fails, make sure to revert to the
 "mdp copy mode" before going to "slow mode"

- finally disable completely the "direct-from-texture" mode
 for now. It cannot work because the allocated buffers can't
 respect the GPU constraints (alignment and such). We'll
 have to find a solution for that.
2010-03-08 11:14:20 -08:00
Mathias Agopian
c9e4a12546 minor cleanup. 2010-02-12 18:50:28 -08:00
Mathias Agopian
a7e380396e Add support for direct EGLImageKHR use with pushbuffer API
We now always first try to use the EGLImageKHR directly before
making a copy with copybit. The copy may be needed when
EGLImage doesn't support the requested format, which is
currently the case with YUV.
2010-02-04 17:13:06 -08:00
Chih-Chung Chang
52e7200b6e Add an orientation parameter for overlay, so we can do camera preview in portrait mode. 2010-01-21 20:20:08 -08:00
Mathias Agopian
edfd97c0f2 fix [2324665] texture leak in surfaceflinger when using camera 2010-01-21 16:29:34 -08:00
Mathias Agopian
8c3b597aa7 fix a texture leak introduced recently.
create the texture name once and for all for a given BufferSource
and make sure to recreate it when we're forced to delete the texture.
2010-01-21 16:27:30 -08:00
Mathias Agopian
5fdea8d5b0 fix [2363362] [Sapphire] Corrupted raw picture displayed during snapshot
handled all cases where the scale factor of a video is out of bounds of
supported scale factors in copybit.
2010-01-20 14:31:53 -08:00
Mathias Agopian
ecc99c003b part of fix for [2363362] [Sapphire] Corrupted raw picture displayed during snapshot
make sure to fallback properly to software when copybit operation fails.
with this change, the preview image will at least be displayed in b&w
(since GL doesn't support the yuv format). This would also fix
2363506, but that one is now handled more cleanly.
2010-01-20 14:07:44 -08:00
Mathias Agopian
1faed66086 fix [2363506] [Sapphire] Video playback broken
don't try to use copybit for incompatible buffers
2010-01-20 13:24:14 -08:00
Mathias Agopian
c5e181f8b3 fix [2315900] Monochrome camera preview screen after launching camera
this was introduced by a recent change. when we try to figure out the size of
the yuv->rgb temporary buffer, the output resolution has not been computed yet
and an invalid buffer size is used. most of the time the allocation fails
and the system reverts to "standard" GL will uses onle the Y plane.

the allocation of the temporary buffer is moved to onDraw(), the first
time it is called, by that time, the window is positioned properly.
2009-12-09 15:26:29 -08:00
Mathias Agopian
69ff5de1b7 improve video performance to minimize the tearing effect seen in 720p movies
always rescale videos to their target size using copybit during yuv->rgb
conversion. this improves performance of the GPU pass and doesn't require
linear filtering to be enabled. Also always use 16-bits buffers.

the average processing time for 720p dropped from ~50ms to ~30ms
2009-12-08 19:29:38 -08:00
Mathias Agopian
3e8a81e354 fix [2291418] Camera preview cannot work in Emulator
The image buffer used by glTexImage2d() would be uninitialized when no copybit engine
can be found.
We now always initialize images, since the abscence of copybit is not necessarily fatal.
2009-12-02 16:23:11 -08:00
Mathias Agopian
713795a2e0 fix [2269022] The raw picture displayed post shutter seems to have low-resolution
Make sure to always enable linear filtering in LayerBuffer. This change doesn't affect
devices using overlays.
2009-11-19 14:46:26 -08:00
Mathias Agopian
bbc21b01cf fix [2143798] Need to figure out how to do video on Passion w/ GPU
This builds on the EGLImage solution. We simply use copybit to convert from the
YUV frame into an EGLImage created for that purpose and proceed with the
regular EGLImage code.
We need to do this because "regular" GL doesn't support YUV textures.

We could improve upon this by detecting exacly what the GL supports and bypass
this extra step if not required, but we'll do this later if needed.
2009-11-11 16:44:43 -08:00
Mathias Agopian
6fee064809 fix[2228133] pixelflinger ignores the "vertical stride" leading to artifacts when playing back video
we lost the concept of vertical stride when moving video playback to EGLImage.
Here we bring it back in a somewhat hacky-way that will work only for the
softgl/mdp backend.
2009-11-02 17:48:33 -08:00
Mathias Agopian
863e5fdde8 fix[2222341] Soft reset while going back from camcorder settings
add a way to convert a mapped "pushbuffer" buffer to a gralloc handle
which then can be safely used by surfaceflinger, without including
gralloc_priv.h
2009-10-30 14:48:50 -07:00
Mathias Agopian
df2d929405 return proper error code from eglCreateImageKHR 2009-10-29 16:45:41 -07:00
Mathias Agopian
54ba51dff2 fix [2143798] Need to figure out how to do video
Use EGLImageKHR instead of copybit directly.
    We now have the basis to use streaming YUV textures (well, in fact
    we already are). When/if we use the GPU instead of the MDP we'll
    need to make sure it supports the appropriate YUV format.

    Also make sure we compile if EGL_ANDROID_image_native_buffer is not supported
2009-10-27 13:13:29 -07:00
Mathias Agopian
3330b20303 fix [2167050] glTexImage2D code path buggy in SurfaceFlinger
When EGLImage extension is not available, SurfaceFlinger will fallback to using
glTexImage2D and glTexSubImage2D instead, which requires 50% more memory and an
extra copy. However this code path has never been exercised and had some bugs
which this patch fix.

Mainly the scale factor wasn't computed right when falling back on glDrawElements.
We also fallback to this mode of operation if a buffer doesn't have the adequate
usage bits for EGLImage usage.

This changes only code that is currently not executed. Some refactoring was needed to
keep the change clean. This doesn't change anything functionaly.
2009-10-06 17:00:25 -07:00
Benny Wong
5643261a25 Overlay could not set position or rotation immediately after created, it should be triggered by signalEvent().
Originally from: https://partner.source.android.com/g/#change,1074
2009-09-16 20:24:21 -07:00
Mathias Agopian
b8cfc0f9e1 revert to black video background, since we don't need the color-key anylonger 2009-09-15 19:31:28 -07:00
Mathias Agopian
454ea68139 fix [2037525] Fail to start camera after adb sync new Camera
we ended-up locking a Mutex that had been destroyed.
This happened because we gave an sp<Source> to the outside world,
and were called after LayerBuffer had been destroyed.

Instead we now give a wp<LayerBuffer> to the outside and have it
do the destruction.
2009-09-09 00:50:29 -07:00
Mathias Agopian
4d2de2c769 rename Mutexes to make the code easier to follow 2009-09-08 22:48:24 -07:00
Mathias Agopian
cbb288bfe8 fix [2068105] implement queueBuffer/lockBuffer/dequeueBuffer properly
Rewrote SurfaceFlinger's buffer management from the ground-up.
The design now support an arbitrary number of buffers per surface, however the current implementation is limited to four. Currently only 2 buffers are used in practice.

The main new feature is to be able to dequeue all buffers at once (very important when there are only two). 

A client can dequeue all buffers until there are none available, it can lock all buffers except the last one that is used for composition. The client will block then, until a new buffer is enqueued.

The current implementation requires that buffers are locked in the same order they are dequeued and enqueued in the same order they are locked. Only one buffer can be locked at a time.

eg. Allowed sequence:   DQ, DQ, LOCK, Q, LOCK, Q
eg. Forbidden sequence: DQ, DQ, LOCK, LOCK, Q, Q
2009-09-07 16:32:45 -07:00
Rebecca Schultz Zavin
29aa74c546 Add colorkey to gl clear operation
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2009-09-02 15:57:42 -07:00
Mathias Agopian
cf70e3301b second take, hopefully this time it doesn't break one of the builds: "SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything." 2009-08-11 23:44:13 -07:00
Mathias Agopian
5221271375 second take, hopefully this time it doesn't break one of the builds: "SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything." 2009-08-11 23:32:29 -07:00
Fred Quintana
b2fd4665e6 Revert "SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything."
This reverts commit 8b76a0ac6fbf07254629ed1ea86af014d5abe050.
2009-08-11 20:49:35 -07:00
Mathias Agopian
df37b62c62 SurfaceFlinger will now allocate buffers based on the usage specified by the clients. This allows to allocate the right kind of buffer automatically, without having the user to specify anything.
This change makes SurfaceHolder.setType(GPU) obsolete (it's now ignored).
Added an API to android_native_window_t to allow extending the functionality without ever breaking binary compatibility. This is used to implement the new set_usage() API. This API needs to be called by software renderers because the default is to use usage flags suitable for h/w.
2009-08-11 16:12:56 -07:00
Rebecca Schultz Zavin
1000170033 Add a flag to set whether the overlay has been initialized. Commit needs to be called at least once on each overlay, and it appears that sometimes this
doesn't happen because the visibility never changes.  With this change
the overlay parameter and position will be committed when either the visibility
of the window changes, or on the first call to visibility resolved, if it
hasn't already been done.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2009-07-22 17:17:46 -07:00
Rebecca Schultz Zavin
96df49bb7d Fix hardware overlay so all changes are commited when done. 2009-07-21 11:07:23 -07:00
Mathias Agopian
d512f238a6 add support for out-of-range copybit scaling. camera capture is in color again 2009-06-25 17:41:12 -07:00
Mathias Agopian
240c9fe59e use copybit for eglSwapBuffers() copy-back operations 2009-06-25 15:39:25 -07:00
Mathias Agopian
2ab55a4e31 make use of new eglGetRenderBufferANDROID extension to clean-up a bit a few hacks added recently 2009-06-25 00:09:27 -07:00
Mathias Agopian
5911aa9510 copybit now uses a native_handle_t* instead of a fd/offset 2009-06-24 20:39:16 -07:00
Mathias Agopian
69029eb5ab hack copybit back in for video playback on msm7k. we have h/w accelerated video again 2009-06-24 20:39:16 -07:00
Mathias Agopian
2e12324581 fix a bug causing push-buffer surfaces' identity to be garbage, which resulted in some attributes (size/pos) to fail to be set 2009-06-23 20:06:46 -07:00
Mathias Agopian
1fed11c86a checkpoint. bring back video/camera 2009-06-23 18:08:22 -07:00
Mathias Agopian
f9d932774e fix a memory corruption where a SF Client could be used after it's been destroyed 2009-06-19 17:00:27 -07:00
Mathias Agopian
0926f50664 update surfaceflinger, libui and libagl to the new gralloc api
- Currently the lock/unlock path is naive and is done for each drawing operation (glDrawElements and glDrawArrays). this should be improved eventually.
- factor all the lock/unlock code in SurfaceBuffer.
- fixed "showupdate" so it works even when we don't have preserving eglSwapBuffers().
- improved the situation with the dirty-region and fixed a problem that caused GL apps to not update.
- make use of LightRefBase() where needed, instead of duplicating its implementation
- add LightRefBase::getStrongCount()
- renamed EGLNativeWindowSurface.cpp to FramebufferNativeWindow.cpp

- disabled copybits test, since it clashes with the new gralloc api

- Camera/Video will be fixed later when we rework the overlay apis
2009-05-04 14:17:04 -07:00
Mathias Agopian
550b79f449 get rid of an old hack to work around a bug around glDeleteTextures() in the adreno drivers 2009-04-24 16:31:11 -07:00
Mathias Agopian
9a11206fe7 more Surface lifetime management
Surfaces are now destroyed once all references from the clients are gone, but they go through a partial destruction as soon as the window manager requests it.
This last part is still buggy. see comments in SurfaceFlinger::destroySurface()
2009-04-24 15:00:41 -07:00
Mathias Agopian
076b1cc3a9 Integrate from //sandbox/mathias/donut/...@145728
SurfaceFlinger rework for new EGL driver model support.
2009-04-10 14:24:30 -07:00
The Android Open Source Project
edbf3b6af7 auto import from //depot/cupcake/@135843 2009-03-03 19:31:44 -08:00
The Android Open Source Project
d5193d9394 auto import from //depot/cupcake/@135843 2009-03-03 18:28:45 -08:00
The Android Open Source Project
ac65e0b172 auto import from //branches/cupcake/...@131421 2009-02-13 12:57:50 -08:00
The Android Open Source Project
a6938bab1f auto import from //branches/cupcake/...@130745 2009-02-10 15:44:00 -08:00
The Android Open Source Project
8a7a67538a auto import from //branches/cupcake/...@126645 2009-01-15 16:12:10 -08:00
The Android Open Source Project
276293246e auto import from //branches/cupcake/...@125939 2009-01-09 17:51:23 -08:00
The Android Open Source Project
e09fd9e819 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:43 -08:00