Commit Graph

1194 Commits

Author SHA1 Message Date
Vladimir Chtchetkine
55d41f8969 Sets right preview frame properties.
Don't cofuse preview window with preview frames. Preview frames are relevant only
in panoramic mode that receives frames via CAMERA_MSG_PREVIEW_FRAME callback.

Change-Id: Ibecb345e43ba452856b8ca75449264d8d354a9d5
2011-09-23 10:08:28 -07:00
Vladimir Chtchetkine
b3ea171655 Implements camera error reporting.
Change-Id: I5f4f4cd1baab60053e827e0605a92a123c7a086f
2011-09-23 08:34:08 -07:00
David 'Digit' Turner
944b4f80e5 am 6ddbd156: resolved conflicts for merge of 4e6af749 to gingerbread-plus-aosp
* commit '6ddbd1563d84a7b18607aa67c1f5f5e4095f816f':
  emulator: opengl: Back-port GLES emulation from the master tree.
2011-09-23 01:36:15 -07:00
David 'Digit' Turner
6ddbd1563d resolved conflicts for merge of 4e6af749 to gingerbread-plus-aosp
Change-Id: I3a8d71bd9b359a067c2a250db99e855e59c08854
2011-09-23 10:27:34 +02:00
Vladimir Chtchetkine
4d7f7de700 Use actual JPEG quality when compressing picture
Sometimes framework chooses to override the default JPEG quality value (90), so we need to
respect that when compressing frame during picture taking.

Change-Id: Ic7ad8938d33d94d34ecd0b979e5c8c3e8246fd53
2011-09-21 15:33:18 -07:00
Vladimir Chtchetkine
68ec4ac828 Fix video format
Apparently, video pixel format expected by the camera framework is YU12, and not YV12
as it was implemented.

Change-Id: Id33d8aa7f62f6e68276774ca2a7d25c04acd71cc
2011-09-21 14:55:29 -07:00
Vladimir Chtchetkine
1f37cd45f6 Fix callback sequence on picture taking
Also fixes a bug in JPEG converter.

Change-Id: I5bbeec96ec2bb0a9a6a333a3798880bb0b837c65
2011-09-21 14:20:07 -07:00
Vladimir Chtchetkine
a88e749e29 Adds media_profiles.xml file that is required for proper framework setup
This file must be copied over to /system/etc directory inside the emulated system image.

Change-Id: Ia013ed20e1ce7a6f9a3ce162f86e0fd3c97ded31
2011-09-21 06:58:08 -07:00
Vladimir Chtchetkine
dd63895f1f Fix camera ID validation
Check for id being <0 before checking its upper boundary

Change-Id: I92ed1ac78f35b5d6bbdd24cc041b2cfb4c121c74
2011-09-20 14:16:53 -07:00
David 'Digit' Turner
894a63dd6e emulator: opengl: Add custom_write optimization to encoder.
This patch allows an auto-generated GLES encoder function to write
'isLarge' buffers with a custom writer, instead of calling stream->readFully()
directly.

This is intended to allow writing pixel or vertex data that is stored
with a specific stride.

Another patch will introduce the corresponding changes to the .attrib files

Change-Id: I6ca86b968cd3f4db91676bc485ee1e84419e50e0
2011-09-20 15:58:54 +02:00
David 'Digit' Turner
5d7f0875e9 emulator: opengl: 'large' buffer optimization
This patch modifies the guest encoding libraries to avoid
un-necessary copies when sending large buffers (e.g. pixels)
to the host. Instead, the data is sent directly through a
new IOStream method (writeFully()).

On my machine, this improves the NenaMark2 benchmark
(from 50.8 to 57.1 fps). More importantly, this speeds up
the display of non-GL surfaces too, which are sent through
the special rcUpdateColorBuffer() function in gralloc_goldfish.

This is noticeable in many parts of the UI (e.g. when scrolling
through lists).

To tag a given parameter, use the new 'isLarge' variable flag
in the protocol .attrib file.

Implemented for the following encoding functions:

  rcUpdateColorBuffer
  glTexSubImage2D
  glTexImage2Di
  glBufferData
  glBufferSubData
  glCompressedTexImage2D
  glCompressedTexSubImage2D
  glTexImage3DOES
  glTexSubImage3DOES
  glCompressedTexImage3DOES
  glCompressedTexSubImage3DOES

+ Optimize the auto-generated encoder functions to avoid
  repeated function calls (for size computations).

Change-Id: I13a02607b606c40cd05984cd2051b1f3424bc2d0
2011-09-20 15:58:54 +02:00
David 'Digit' Turner
e72ed049a8 emulator: opengl: improve gralloc debug traces
+ shut up the gralloc module for now.

Change-Id: I7d22c63f298c4e50d96655adf4025a65b7405c28
2011-09-20 15:58:54 +02:00
David 'Digit' Turner
9a6c02877a emulator: opengl: fix inccorect delete usage.
Change-Id: I3afc5197d2d13c4698a535ed769a56920e81c94f
2011-09-20 15:58:53 +02:00
David 'Digit' Turner
6aca3d9f7c emulator: opengl: add missing EGLDisplay destructor
Change-Id: I788904a597b7929a7fc7a5db3cf5baa79b9f1936
2011-09-20 15:58:53 +02:00
David 'Digit' Turner
8abfab1baf emulator: opengl: make internal tables const.
+ fix a typo.

Change-Id: I4c290d673de5eff24998b97cfb996d9da17dd006
2011-09-20 15:58:53 +02:00
David 'Digit' Turner
4e6af749d5 emulator: opengl: Back-port GLES emulation from the master tree.
The modules here are only built when BUILD_EMULATOR_OPENGL is defined to true
in your environment or your BoardConfig.mk (see tools/emulator/opengl/Android.mk)

Change-Id: I5f32c35b4452fb5a7b4d5f9fc5870ec1da6032e6
2011-09-20 15:58:41 +02:00
Vladimir Chtchetkine
4bc3b1f3b5 Hookup to cmdline parameters in emulator
Use boot properties, and webcam facing parameters set up by the emulator's cmdline.

Change-Id: I2189e5f67b9d79ad330b5ee275ff30d8851fc326
2011-09-17 11:28:09 -07:00
Vladimir Chtchetkine
95e167dc3c Merge "Implement "takePicture"" 2011-09-16 06:07:07 -07:00
Vladimir Chtchetkine
2a532ee388 Implement "takePicture"
With this CL the camera emulator is capable of taking pictures

Change-Id: I29feea0c75a78c619aaf854a5665a24afb507ba4
2011-09-15 18:24:32 -07:00
Vladimir Chtchetkine
d9d6c74b45 Merge "Separate actual camera device start and frame delivery" 2011-09-15 05:58:18 -07:00
David 'Digit' Turner
b13cf4ac31 emulator: opengl: Fix the Windows SDK build
Change-Id: I97be6f81af321f75ff5d43b258387fdc039f0210
2011-09-15 12:14:31 +02:00
Vladimir Chtchetkine
49842cee05 Separate actual camera device start and frame delivery
These two tasks (starting the camera device, and starting working thread that pulls frames
from the started camera device) should be clearly separated, and should not be combined in
one method (as it was with the 'startCapturing' method).

Change-Id: I779bee924d99d9a87257c6b76791545b76795e72
2011-09-14 18:35:48 -07:00
Vladimir Chtchetkine
ba78a2f1d3 Fix locking issues in the callback notifier
Holding an object lock while macking the callbacks cause deadlocks
due to reentrance to the callabck notifier.

Change-Id: I5f2780989798ebf5c5d7aab34ac233bb5952079d
2011-09-14 14:24:03 -07:00
Vladimir Chtchetkine
4756fada1a Fix typos introduced during style adjustment
Change-Id: Ia9ca4849d4a410aea9d49d2c6246d36c4c7fc8f1
2011-09-14 13:56:48 -07:00
Vladimir Chtchetkine
4d47360672 Fix capture stopping
When stopping the camera, the working thread should be stopped before sending
"stop" query to the emulator: we don't want "frame" queries to be floating around
while we're in the process of stopping the camera.

Change-Id: I16dc56ca1c2e304a07a074302001d2e27100f2ac
2011-09-14 07:06:23 -07:00
Vladimir Chtchetkine
16232484c7 Fix build
Change-Id: Ifb5dd0b11bd616ef5a5a1e79b510b00f1d55672a
2011-09-13 16:02:51 -07:00
Vladimir Chtchetkine
5467be2eef Refactored emulated camera HAL to comply with code style
Change-Id: If57b536ae6b1f9bad4213630488591a3b3cc9fdd
2011-09-13 14:35:25 -07:00
Vladimir Chtchetkine
492332c295 Merge "Implements connection with the emulator" 2011-09-13 09:45:09 -07:00
Vladimir Chtchetkine
33bda47528 Implements connection with the emulator
Change-Id: Ie3910a98e927f7b8ea556c403f8ced27e06bcdec
2011-09-13 09:44:32 -07:00
David 'Digit' Turner
0db6e8dd27 Merge "emulator: opengl: Support named pipes on Win32" 2011-09-13 07:32:29 -07:00
David 'Digit' Turner
b065016640 Merge "emulator: opengl: Add support for unix sockets." 2011-09-13 07:02:38 -07:00
David 'Digit' Turner
bde30e7480 Merge "emulator: opengl: re-enable gralloc builds" 2011-09-13 06:20:29 -07:00
David 'Digit' Turner
3abd13d4d6 emulator: opengl: Support named pipes on Win32
This patch adds support for Win32 named pipes for the communication
channel between the Opengl renderer library and its clients.

Named pipes should be much faster than local TCP sockets on this
platform. Note that by default, TCP sockets are still used. The
emulator needs to call setStreamMode(STREAM_MODE_PIPE) to be able
to use these.

Change-Id: I86d36624cf2b7fdd50f41e1e43c908348dca4657
2011-09-13 14:04:49 +02:00
David 'Digit' Turner
3d76ec1e3c emulator: opengl: Add support for unix sockets.
This patch allows the OpenGLES rendering library to use Unix
sockets instead of TCP ones when communicating with its clients.
On certain benchmarks (e.g. 0xBench teapot), this provides a
noticeable improvement (x1.05 fps) without any other changes.

On practice, Unix sockets are faster than TCP sockets, even
local ones. Also, this introduces a moderate amount of
abstraction that will allow us to use Win32 named pipes
on Windows (where TCP sockets are much slower than they
are on Unix).

Note that by default, TCP streams are still used.
The client (emulator) must call the new API 'setStreamMode'
to change it to STREAM_MODE_UNIX between 'initLibrary' and
'startOpenglRenderer' calls.

+ Adjust callers / user appropriately.

Change-Id: I4105bbf07541f3146b50a58d1a5b51e8cf044fab
2011-09-13 14:03:32 +02:00
David 'Digit' Turner
3598af3850 emulator: opengl: add missing pthread_mutex_destroy
Change-Id: Ib6be00619e06f5ff492a080d1feb2954b626fa26
2011-09-13 14:02:37 +02:00
David 'Digit' Turner
c308bfc05f emulator: opengl: re-enable gralloc builds
This re-enables the build of the gralloc GLES emulation library.

This is only for experimentation / debugging purpose. GLES emulation
is still disabled by default in the emulator. Even if you force-enable
it by using the '-gpu on' flag, this module will not properly yet
and nothing will be displayed.

Change-Id: I8f0ca8805ed99037b011365d08507ca08bff5e75
2011-09-13 13:59:53 +02:00
Vladimir Chtchetkine
b97c2f0b59 Fake camera implementation
The code submitted here builds a camera.goldfish.so module that encapsulates a camera HAL.

The major components of the camera HAL implementation are:
* Generic HAL module implemented in emulated_camera_hal.cpp There is nothing much
  to it: just exporting the required HAL header.
* EmulatedCameraFactory class that manages emulated cameras, and provides handling for
  camera_module_methods_ methods. There is only one object of this class, that is statically
  instantiated when camera.goldfish.so module is loaded.
* EmulatedCamera class that implements camera_device_ops_t API. Objects of this class are
  instantiated during EmulatedCameraFactory construction, and they interact with objects
  of EmulatedCameraDevice class to get frames.
* EmulatedCameraDevice class encapsulates an actual camera device. Objects of this class
  are contained in EmulatedCameraDevice objects, and interact with them as required by the
  API.

The fake camera implementation is shared between EmulatedFakeCamera, and EmulatedFakeCameraDevice
classes. They are pretty light. In fact, EmulatedFakeCamera is nothing more than just a
placeholder for EmulatedFakeCameraDevice instance, and EmulatedFakeCameraDevice does nothing
more, than just drawing a checker board with a bouncing square.

Other components / routines are minor: helpers, wrappers, etc. The code is heavily commented,
so there will be plenty of explanations between the lines.

Change-Id: I4463e14c255c6e3b1dcca17bed5f4efde32d9879
2011-09-12 08:37:48 -07:00
David 'Digit' Turner
1cb2c5455c emulator: opengl: Fix egl.cfg tsdefinition
This fixes the definition of the emulator-specific egl.cfg file
used to indicate to our EGL system library which support modules
are available in the emulator.

We need to list two modules here:

  'emulation' corresponding to GPU emulation
  'android' corresponding to the software renderer

The indices before each name correspond to the 'display' and 'impl'
numbers that are expected by frameworks/base/opengl/libs/EGL/Loader.cpp

In a nutshell, 'display' should always be 0, and 'impl' should be 0
for the software renderer, and 1 for a hardware-based one. See the code
under framewors/base/opengl/libs/EGL/egl.cpp for mode details.

Change-Id: I52c898759200c2dfba9049ed00b31b18e8c37f69
2011-09-02 15:26:14 +02:00
David 'Digit' Turner
1479a6cb84 am 7cd5aeb7: am dda2e51a: am 6ba16ba7: Merge "emulator: opengl: add initLibrary function to render library"
* commit '7cd5aeb7c7a109712a660c89d50fb67d35471081':
  emulator: opengl: add initLibrary function to render library
2011-08-30 09:50:49 -07:00
David 'Digit' Turner
b61218ba1b am 1ff9d194: am b6114c7b: am 7cb797f1: Merge "emulator: opengl: use bilinear filtering"
* commit '1ff9d194e3f252a03555edd90702a368a10e50cc':
  emulator: opengl: use bilinear filtering
2011-08-30 09:50:46 -07:00
David 'Digit' Turner
7cd5aeb7c7 am dda2e51a: am 6ba16ba7: Merge "emulator: opengl: add initLibrary function to render library"
* commit 'dda2e51a15ddfc44b34ec3c35e68f3bc1cfb5786':
  emulator: opengl: add initLibrary function to render library
2011-08-29 18:01:01 -07:00
David 'Digit' Turner
1ff9d194e3 am b6114c7b: am 7cb797f1: Merge "emulator: opengl: use bilinear filtering"
* commit 'b6114c7b66744729b8e0e9142e8b07eba41637d5':
  emulator: opengl: use bilinear filtering
2011-08-29 18:00:56 -07:00
David 'Digit' Turner
34fa5630b7 emulator: opengl: Fix the emulator-specific builds.
The gralloc.goldfish module cannot build in master because
the gralloc interface evolved considerably since gingerbread
(which the current code is based on).

For now, disable it completely, this will make it impossible
to test GPU emulation in the internal master tree for now.

We'll have to port this module to the new world-order to solve
this.

Change-Id: I864217f9c41fd1234f0df497005499800af879e5
2011-08-29 22:20:37 +02:00
David 'Digit' Turner
ec4c093361 am 84e83659: am 13cd2cd4: am 56eca4e0: Merge "emulator: opengl: fix the build"
* commit '84e836590e5fb655c7fd1f49613a4ae9cd2fa963':
  emulator: opengl: fix the build
2011-08-29 11:05:17 -07:00
David 'Digit' Turner
8ef53760d5 am 2276a468: am 846dd223: am dbe3b024: Merge "emulator: opengl: fallback gralloc module"
* commit '2276a468202750d743848810675e62a63ace67bb':
  emulator: opengl: fallback gralloc module
2011-08-29 11:05:10 -07:00
David 'Digit' Turner
c6d73d7af4 am d960239d: am 43946da5: am 7f45e7c1: Merge "emulator: oops, really fix the build"
* commit 'd960239de6371c2368792c6cc75de6d59abe172c':
  emulator: oops, really fix the build
2011-08-29 11:05:01 -07:00
David 'Digit' Turner
bce8ca33d0 am fec153a7: am 9765cb8a: am 2a59fa7d: Merge "emulator: fix the build"
* commit 'fec153a765edf051f3b97610c748d1ab9526cbfa':
  emulator: fix the build
2011-08-29 11:04:57 -07:00
David 'Digit' Turner
6ba16ba752 Merge "emulator: opengl: add initLibrary function to render library" 2011-08-29 08:01:42 -07:00
David 'Digit' Turner
5d1e8b2f28 emulator: opengl: add initLibrary function to render library
This adds an initLibrary() function to libOpenglRender.

It will be used by the emulator to fallback on software rendering
if the library cannot be initialized properly, e.g. if it is not
possible to load the host EGL/GLES libraries.

Change-Id: I41e8ad73a315166e4a15cbee1db72c2552370f46
2011-08-29 16:57:38 +02:00
David 'Digit' Turner
7cb797f1fd Merge "emulator: opengl: use bilinear filtering" 2011-08-29 06:55:32 -07:00