Commit Graph

339 Commits

Author SHA1 Message Date
David 'Digit' Turner
c11d87d30a am 5127bebf: am 8790e10a: am 5d7f0875: emulator: opengl: \'large\' buffer optimization
* commit '5127bebff8d3848c96749d80c8c4ad79fc88bb54':
  emulator: opengl: 'large' buffer optimization
2011-09-28 04:46:46 -07:00
David 'Digit' Turner
7dc4d98eb6 am 175512d4: am 5d2e245d: am e72ed049: emulator: opengl: improve gralloc debug traces
* commit '175512d4aba36f5e5be9a12dca64cc27d159ec98':
  emulator: opengl: improve gralloc debug traces
2011-09-28 04:46:45 -07:00
David 'Digit' Turner
640cf6988b am 81488f05: am ac6c7392: am 9a6c0287: emulator: opengl: fix inccorect delete usage.
* commit '81488f055f5a2bd7e5307a0e16d5ff924baf566e':
  emulator: opengl: fix inccorect delete usage.
2011-09-28 04:46:45 -07:00
David 'Digit' Turner
bb1e135697 am f90030a9: am 0bf9070e: am 6aca3d9f: emulator: opengl: add missing EGLDisplay destructor
* commit 'f90030a9bf63d47840c88c6f8022bc0a903df9dd':
  emulator: opengl: add missing EGLDisplay destructor
2011-09-28 04:46:42 -07:00
David 'Digit' Turner
0426ac51b5 am 5703f4d9: am 81ee5461: am 8abfab1b: emulator: opengl: make internal tables const.
* commit '5703f4d9ec04f5e774f8cb154af7fd087bebfffd':
  emulator: opengl: make internal tables const.
2011-09-28 04:46:37 -07:00
David 'Digit' Turner
8790e10a7f am 5d7f0875: emulator: opengl: \'large\' buffer optimization
* commit '5d7f0875e9cda2d6ab37b49f0b6ceed8f0d16f45':
  emulator: opengl: 'large' buffer optimization
2011-09-28 04:28:51 -07:00
David 'Digit' Turner
5d2e245d76 am e72ed049: emulator: opengl: improve gralloc debug traces
* commit 'e72ed049a890da6883b0de09a2263b88b648391a':
  emulator: opengl: improve gralloc debug traces
2011-09-28 04:27:22 -07:00
David 'Digit' Turner
ac6c73921c am 9a6c0287: emulator: opengl: fix inccorect delete usage.
* commit '9a6c02877a128a0236377ee21b78767faa50ad83':
  emulator: opengl: fix inccorect delete usage.
2011-09-28 04:27:21 -07:00
David 'Digit' Turner
0bf9070ec5 am 6aca3d9f: emulator: opengl: add missing EGLDisplay destructor
* commit '6aca3d9f7c8e637ec253ca1d501d8b91d3e63770':
  emulator: opengl: add missing EGLDisplay destructor
2011-09-28 04:27:20 -07:00
David 'Digit' Turner
81ee546174 am 8abfab1b: emulator: opengl: make internal tables const.
* commit '8abfab1baf04ebd57f8eff74485b746d56368014':
  emulator: opengl: make internal tables const.
2011-09-28 04:27:14 -07:00
David 'Digit' Turner
009a020ce9 resolved conflicts for merge of 944b4f80 to master
Change-Id: I83f38f345caa456466d86e46f4f3c94721b7ebd1
2011-09-27 21:27:20 +02: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
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
David 'Digit' Turner
b13cf4ac31 emulator: opengl: Fix the Windows SDK build
Change-Id: I97be6f81af321f75ff5d43b258387fdc039f0210
2011-09-15 12:14:31 +02: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
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
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
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
David 'Digit' Turner
2dfb7b549f emulator: opengl: fix the build
Change-Id: Ia20d15b63a059ed5d86c9087b827bdfa32c41c86
2011-08-26 18:17:13 +02:00
David 'Digit' Turner
91572d15eb emulator: opengl: use bilinear filtering
This patch changes the filter used to scale the GL window
in the rendering library. Instead of nearest-neighbour, use
bi-linear, which will provide for much more pleasant results
when scaling the emulator UI window, or toggling to full-screen
mode.

Change-Id: If2d9e1300fa4878c25e1221eaedb565b9150431a
2011-08-26 17:31:58 +02:00
David 'Digit' Turner
783cc1bb53 emulator: opengl: fallback gralloc module
This patch modifies the gralloc.goldfish module to check
that the emulator does, indeed, support GPU emulation.

If this is not the case, it loads the framebuffer-based fallback
module (gralloc.default) explicitely and uses it instead.

This is necessary because sometimes the emulator will be started
in headless mode in restricted environment, i.e. without access
to the display subsystem or GL libraries, which make GPU emulation
impossible.

We check for ro.kernel.qemu.gles which will be either undefined
or set to 0 if the emulator doesn't support GPU emulation, or 1
otherwise.

Change-Id: Ib6b143e6dcdfb44ff2c5b889138d0fb4118bb461
2011-08-26 17:31:58 +02:00
David 'Digit' Turner
20d5b0a857 emulator: oops, really fix the build
Change-Id: Id8de1b6a069cdc462681cf44bf8ebd84bbd1e6f0
2011-08-25 22:14:29 +02:00
David 'Digit' Turner
8b55909388 emulator: fix the build
Change-Id: Id88f488d441f04b10de3bca8ffe5c37763c4e98e
2011-08-25 22:00:55 +02:00
David 'Digit' Turner
3f88bea9a8 emulator: opengl: Open libGL.dylib as a framework on Mac
This patch modifies GLDispatch.cpp in the translator libraries
to open the Darwin GL library as a framework. Using a hard-coded
system path prevents the requirement to modify LD_LIBRARY_PATH
or DYLD_LIBRARY_PATH to point to the directory that contains the
library.

In this specific case, this is equivalent to

/System/Frameworks/OpenGL.framework/Libraries/libGL.dylib

But is the "kosher" way to open it the library.

Change-Id: Iccd6568d36fc97200617c268f05d7b4ea85f918e
2011-08-25 14:40:43 +02:00
David 'Digit' Turner
47cbdfb291 emulator: opengl: remove debug traces.
You can still re-enable them by uncommenting one line in
development/tools/emulator/opengl/Android.mk

Change-Id: Ie0a640b6f3359b437aba40b124da0892defb00ef
2011-08-24 16:06:21 +02:00
David 'Digit' Turner
cecb6a0e36 emulator: opengl: Make host decoder libraries static
These libraries are only used by libOpenglRender, so make them
static so that their code is included in this shared library
instead. This reduces the shared library dependencies that
will be required from the emulator.

Change-Id: I24438932f0d6b40852b515140ea6950c04124fdd
2011-08-24 16:06:21 +02:00
David 'Digit' Turner
6efe381c82 emulator: opengl: build gralloc driver by default
This patch forces the default definition of BUILD_EMULATOR_OPENGL_DRIVER
to true by default, which is the common case where we will build the
goldfish-specific gralloc hardware module to allow SurfaceFlinger to
use GLES emulation exclusively.

The only reason to define thi to 'false' today is to debug specific
apps, but this requires displaying the GL output in a different window
than the emulator to be usable.

Change-Id: Iaf03a9c780449bb6b991928d324a088021a73203
2011-08-24 16:06:21 +02:00
David 'Digit' Turner
5dfd5b292a emulator: opengl: support moved shared libraries.
It is possible to move the final installation path of a shared
library by using LOCAL_MODULE_PATH/LOCAL_UNSTRIPPED_PATH in its
module declaration.

We do this for example to put certain libraries under /system/lib/egl
or /system/lib/hw.

However, the Android build system has a small bug where you cannot
depend on these shared libraries because it will complain it doesn't
find them under /system/lib, the default install location.

More precisely, consider libfoo defined as:

  include $(CLEAR_VARS)
  LOCAL_MODULE := libfoo
  LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
  ...
  include $(BUILD_SHARED_LIBRARY)

Its final binary will be installed to /system/lib/egl/libfoo.so

Now, let's write a module that depends on it, as:

  include $(CLEAR_VARS)
  LOCAL_MODULE := libbar
  LOCAL_SHARED_LIBRARIES += libfoo
  ...
  include $(BUILD_SHARED_LIBRARY)

The build system will complain there is no rule to define the target
/system/lib/libfoo.so, but the target should be /system/lib/egl/libfoo.so.

A work-around is to define libbar as follows instead:

  include $(CLEAR_VARS)
  LOCAL_MODULE := libbar
  LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_SHARED_LIBRARIES)/egl/libfoo.so
  ...
  include $(BUILD_SHARED_LIBRARY)

This works if you don't need to link against the library when building your
shared library (which is fortunately the case for the GLES emulation
libraries).

That's essentially what this patch implements under common.mk. We update
emugl-set-shared-library-subpath to record that a module has been "moved",
and we avoid adding them to the LOCAL_SHARED_LIBRARIES variable of the
modules that export it.

+ Simplify three Android.mk files accordingly.

Change-Id: Id15bef5359b0daa8d82bfaa5abf9346f00190ab5
2011-08-24 16:01:00 +02:00
David 'Digit' Turner
e2dda38017 emulator: opengl: Avoid conflicts with SDL_CONFIG
Do not redefine SDL_CONFIG to avoid conflicts with the emulator's
build system which depend on its definition. Note that this has
been fixed in another patch (https://review.source.android.com/25684)
but it is also cleaner to do this here.

Change-Id: I1a30d200e467ac7a91a1e6135fa1de34033e8df0
2011-08-24 16:00:56 +02:00
David 'Digit' Turner
0008793af3 emulator: opengl: fix Windows build
Change-Id: I6953feee41cb2e27f884629104ff6b3b9cccabbc
2011-08-24 16:00:55 +02:00
David 'Digit' Turner
503419ca75 Remove obsolete comments
Change-Id: Ibaeca7f3cd17305dd4cac042d6020455c5675e2d
2011-08-23 14:10:46 +02:00
Liran
f7e7e467ce opengles emulator- check framebuffer status fix
add drawValidate when calling glCheckFramebufferStatus
in the draw validate, a color attachement will be added to the
framebuffer if there is no target attached to COLOR_ATTACHMENT
of the framebuffer.
opengl does not allow framebuffer with no color attachement
so CheckFramebufferStatus would return INCOMPLETE status.

We already call drawValidate before any draw, the call was
missing at glCheckFramebufferStatus.

Change-Id: I94b930024c3076ac5fe0f8662d11884729c4f953
2011-08-22 14:11:45 +02:00
Guy Zadickario
4629d2412b opengles emulator: fixes flashing effect on Mac
There is a flashing effect we see on Mac when switching between
drawables (pbuffer and a window) on the same context.
This change make the FrameBuffer object in the renderer to use
two different OpenGL contexts, one which is used while the pbuffer
drawable is bound and another which is used when the subwindow is
bounded during swap. The two contexts share textures so both contexts
have access to all allocated color buffers.

While this fixes the flashing effect on Mac, it should be more effective on
other platforms as well.

Change-Id: I63b49f0cdae8e2785765503750bbf5fbd4d963a1
2011-08-18 13:36:38 +03:00
Guy Zadickario
bdf4c1f436 opengles emulator: fixed EGL sharing context
Wrong share group was set up when two user contexts are sharing !
That means that shared context was not really worked before, now it does.

Change-Id: Ia4edbba0441e309902b2c48c44865342410bae3d
2011-08-18 13:36:38 +03:00
David Turner
ca7a7b0571 Merge "opengles emulator: use bionic tls slot" 2011-08-16 07:35:29 -07:00