[Galaxy S II General] dsixda:
Silly Faces option in camcorder

Hi guys,

There is one outstanding issue that I still cannot solve. It has to do with the "Silly Faces" effects that are in the front and rear camcorder options.

It happens in the following cases:

- Use rear camcorder in 480p mode, then use Silly Faces (problem doesn't happen if you use 720p or 1080p, which are HD).

- Use front camcorder (this is always in 480p), then use Silly Faces option

NOTE: Silly Faces will save in 480p mode no matter what resolution of video you selected.

https://p.twimg.com/AxyVOzMCEAAQUva.jpg

As you can see in the image above, the video preview window shows a distorted image. It is basically me but shown in some strange format. However, the video does get saved properly, so you can run a normal 480x640 video with the funny effects. If you look in the top corner of this image you'll see a thumbnail pic of a funny effect video done on my daughter, which shows that it gets saved properly.

Here is the logcat of what happens during and after the time I select the funny effect:

http://logcat.miui.us/918003

From the logcat above, this is the important part:

I/Adreno200-EGLSUB( 2313): : Android Image
I/Adreno200-EGLSUB( 2313): : Android Image

I/ ( 2313): Face detector initialized

I/Adreno200-EGLSUB( 2313): : Android Image
I/Adreno200-EGLSUB( 2313): : ShadowWindowCreate shadow_window: 0x7feaf8 format :1
I/Adreno200-EGLSUB( 2313): capacity: 2
I/Adreno200-EGLSUB( 2313): shadow_buffers: 0xbe99d8
I/Adreno200-EGLSUB( 2313): os_lock: 0xbedd38
I/Adreno200-EGLSUB( 2313): : Success shadow_buffer: 0x714bd8 id :0
I/Adreno200-EGLSUB( 2313): in_use: 0
I/Adreno200-EGLSUB( 2313): window: 0x7feaf8
I/Adreno200-EGLSUB( 2313): format: 1
I/Adreno200-EGLSUB( 2313): width: 720
I/Adreno200-EGLSUB( 2313): height: 960
I/Adreno200-EGLSUB( 2313): stride: 2944
I/Adreno200-EGLSUB( 2313): size: 2826240
I/Adreno200-EGLSUB( 2313): hostptr :0x5dbc9000
I/Adreno200-EGLSUB( 2313): gpuaddr :1735933952
D/copybit_c2d( 2313): get_temp_buffer E
D/copybit_c2d( 2313): get_temp_buffer X
D/copybit ( 2313): Enter convert_yuv_c2d_to_yuv_android
I/Adreno200-EGLSUB( 173): : Android Image
E/ ( 173): get_mdp_format: unknown color format [0x102]
E/OverlayLIB( 173): Rotator session failed
E/OverlayLIB( 173): mRotInfo:
E/OverlayLIB( 173): session_id -635677312 dst_x 0 dst_y 0 rotations 0 enable 1
E/OverlayLIB( 173): src: width 720 height 960 format (null)
E/OverlayLIB( 173): dst: width 720 height 960 format (null)
E/OverlayLIB( 173): src_rect: x 0 y 0 w 720 h 960
E/OverlayLIB( 173): decZ: freeing the pipe with zorder = 0 for fbdev = 0
E/OverlayLIB( 173): decZ: Pipes in use = 0
E/OverlayLIB( 173): objOvCtrlChannel[0].updateOverlaySource failed
E/msm8660.hwcomposer( 173): prepareOverlay setSource failed
I/Adreno200-EGLSUB( 2313): : Android Image
I/Adreno200-EGLSUB( 2313): : Success shadow_buffer: 0x6cb558 id :1
I/Adreno200-EGLSUB( 2313): in_use: 0
I/Adreno200-EGLSUB( 2313): window: 0x7feaf8
I/Adreno200-EGLSUB( 2313): format: 1
I/Adreno200-EGLSUB( 2313): width: 720
I/Adreno200-EGLSUB( 2313): height: 960
I/Adreno200-EGLSUB( 2313): stride: 2944
I/Adreno200-EGLSUB( 2313): size: 2826240
I/Adreno200-EGLSUB( 2313): hostptr :0x5e229000
I/Adreno200-EGLSUB( 2313): gpuaddr :1738760192
D/msm8660.hwcomposer( 173): Invalid gralloc handle (at 0xcd91d8): ver(13669520/12) ints(12/12) fds(1074222416/2) magic(----/gmsm)

D/copybit ( 2313): Enter convert_yuv_c2d_to_yuv_android
I/Adreno200-EGLSUB( 173): : Android Image
E/OverlayLIB( 173): setTransform: channel is not up
E/msm8660.hwcomposer( 173): prepareOverlay setTransform failed transform 0
I/Adreno200-EGLSUB( 2313): : Android Image
D/copybit ( 2313): Enter convert_yuv_c2d_to_yuv_android
I/Adreno200-EGLSUB( 173): : Android Image
E/OverlayLIB( 173): setTransform: channel is not up
E/msm8660.hwcomposer( 173): prepareOverlay setTransform failed transform 0
I/Adreno200-EGLSUB( 2313): : Android Image
D/copybit ( 2313): Enter convert_yuv_c2d_to_yuv_android
E/OverlayLIB( 173): setTransform: channel is not up
E/msm8660.hwcomposer( 173): prepareOverlay setTransform failed transform 0
D/copybit ( 2313): Enter convert_yuv_c2d_to_yuv_android
E/OverlayLIB( 173): setTransform: channel is not up
E/msm8660.hwcomposer( 173): prepareOverlay setTransform failed transform 0
D/copybit ( 2313): Enter convert_yuv_c2d_to_yuv_android
E/OverlayLIB( 173): setTransform: channel is not up
E/msm8660.hwcomposer( 173): prepareOverlay setTransform failed transform 0
D/copybit ( 2313): Enter convert_yuv_c2d_to_yuv_android
E/OverlayLIB( 173): setTransform: channel is not up
E/msm8660.hwcomposer( 173): prepareOverlay setTransform failed transform 0

Notice above that the procedure "get_mdp_format()" sees an unknown format 0x102 (which is HAL_PIXEL_FORMAT_NV12_ENCODEABLE) for drawing the preview image. I don't think it's important, because in the working modes (when in 720p/1080p rear camcorder) you get the same error but the Silly Faces effects work anyway.

In comparison, if I use the rear camera in 720p or 1080p mode and then start Silly Faces, this is what is shown (in this case it's successful). Note the width/height values are different (544x960 in ths good case, vs 720x960 in the bad case):

I/ ( 905): Face detector initialized
I/Adreno200-EGLSUB( 905): <ShadowWindowCreate:562>: ShadowWindowCreate shadow_window: 0x18f8ae8	format :1
I/Adreno200-EGLSUB( 905):	capacity: 2
I/Adreno200-EGLSUB( 905):	shadow_buffers: 0x190b448
I/Adreno200-EGLSUB( 905):	os_lock: 0x18f8b10
I/Adreno200-EGLSUB( 905): <ShadowBufferCreate:346>: Success shadow_buffer: 0x18f91e8	id :0
I/Adreno200-EGLSUB( 905):	in_use: 0
I/Adreno200-EGLSUB( 905):	window: 0x18f8ae8
I/Adreno200-EGLSUB( 905):	format: 1
I/Adreno200-EGLSUB( 905):	width: 540
I/Adreno200-EGLSUB( 905):	height: 960
I/Adreno200-EGLSUB( 905):	stride: 2176
I/Adreno200-EGLSUB( 905):	size: 2088960
I/Adreno200-EGLSUB( 905):	hostptr :0x5e985000
I/Adreno200-EGLSUB( 905):	gpuaddr :1737064448
I/Adreno200-EGLSUB( 905): <CreateImage:893>: Android Image
I/Adreno200-EGLSUB( 905): <ShadowBufferCreate:346>: Success shadow_buffer: 0x191bb10	id :1
I/Adreno200-EGLSUB( 905):	in_use: 0
I/Adreno200-EGLSUB( 905):	window: 0x18f8ae8
I/Adreno200-EGLSUB( 905):	format: 1
I/Adreno200-EGLSUB( 905):	width: 540
I/Adreno200-EGLSUB( 905):	height: 960
I/Adreno200-EGLSUB( 905):	stride: 2176
I/Adreno200-EGLSUB( 905):	size: 2088960
I/Adreno200-EGLSUB( 905):	hostptr :0x5ec43000
I/Adreno200-EGLSUB( 905):	gpuaddr :1740890112
I/Adreno200-EGLSUB( 174): <CreateImage:893>: Android Image
E/ ( 174): get_mdp_format: unknown color format [0x102]
E/OverlayLIB( 174): Rotator session failed
E/OverlayLIB( 174): mRotInfo:
E/OverlayLIB( 174): session_id -947138368 dst_x 0 dst_y 0 rotations 0 enable 1
[B]E/OverlayLIB( 174): src: width 544 height 960 format (null)
E/OverlayLIB( 174): dst: width 544 height 960 format (null)[/B]
E/OverlayLIB( 174): src_rect: x 0 y 0 w 544 h 960
E/OverlayLIB( 174): decZ: freeing the pipe with zorder = 0 for fbdev = 0
E/OverlayLIB( 174): decZ: Pipes in use = 0
E/OverlayLIB( 174): objOvCtrlChannel[0].updateOverlaySource failed
E/msm8660.hwcomposer( 174): prepareOverlay setSource failed
I/Adreno200-EGLSUB( 905): <CreateImage:893>: Android Image
D/msm8660.hwcomposer( 174): Invalid gralloc handle (at 0x17d13a0): ver(1/12) ints(12/12) fds(32/2) magic(w��/gmsm)
I/Adreno200-EGLSUB( 174): <CreateImage:893>: Android Image
E/OverlayLIB( 174): setTransform: channel is not up
E/msm8660.hwcomposer( 174): prepareOverlay setTransform failed transform 0
I/Adreno200-EGLSUB( 174): <CreateImage:893>: Android Image
E/OverlayLIB( 174): setTransform: channel is not up
E/msm8660.hwcomposer( 174): prepareOverlay setTransform failed transform 0
E/OverlayLIB( 174): setTransform: channel is not up
E/msm8660.hwcomposer( 174): prepareOverlay setTransform failed transform 0

The "convert_yuv_c2d_to_yuv_android" routine being called in the first case (non-working preview) is found in hardware/qcom/display/libcopybit/software_converter.cpp. It is called in this order:

- hardware/qcom/displayliboverlay/copybit_c2d.cpp calls "stretch_copybit_internal()"

- If the width of the image to be displayed is not a multiple of 32, then stretch_copybit_internal() calls copy_image(), which then calls convert_yuv_c2d_to_yuv_android().

In the non-working case, the width was 720, which is not a multiple of 32, whereas in the working case the width was 544, which is a multiple of 32.

In conclusion, it looks like we need to tell the code how to handle displaying the image whenever we start with 480p camcorder mode.

Any help would be appreciated.

My GitHub: http://www.github.com/dsixda