Commit Graph

350 Commits

Author SHA1 Message Date
Jesse Hall
25902c0540 am f37a7ed6: GLES translator: don\'t delete EGLImage textures
* commit 'f37a7ed6c5c609a3afc33f81bf50893362917ae6':
  GLES translator: don't delete EGLImage textures
2011-11-22 15:37:32 -08:00
Jesse Hall
f25dc0f673 am faaf1553: EmuGL: set texture info from EGLImage
* commit 'faaf1553cfa39c23ceb198ba7edbd46ff3a11f7a':
  EmuGL: set texture info from EGLImage
2011-11-22 15:37:31 -08:00
Jesse Hall
f37a7ed6c5 GLES translator: don't delete EGLImage textures
When remapping a GLES texture to a different GL texture in
glEGLImageTargetTexture2DOES(), the GLES texture's previous GL texture was
deleted unconditionally. This is bad when it came from an EGLImage and is
therefore owned by (and will continue to be used by) some other object.

The code now skips deleting the old GL texture if it came from an EGLImage.
This mirrors the logic in glDeleteTextures().

Change-Id: I5b650334a7019d824517c2915b1f23961fbbd809
2011-11-21 13:14:19 -08:00
Jesse Hall
faaf1553cf EmuGL: set texture info from EGLImage
The EGL->GL translator implementation of glEGLImageTargetTexture2DOES was
properly replacing uses of the target texture object with the texture object
associated with the EGLImage in the host GL library, but wasn't updating its
own info about the texture (dimensions, etc.). This broke places where the
translator relied on knowing this, e.g. when implementing the GLES glDrawTexi
call on top of GL glDrawArrays.

Change-Id: Ia4aefd89852a2609221c56da76bfac927464c0b2
2011-11-18 14:11:49 -08:00
Mathias Agopian
9c14396791 should fix sdk build
Change-Id: I5b403056f5245eae9a6476d9d573a3b1c25ea0c6
2011-11-15 21:09:15 -08:00
David 'Digit' Turner
a8f182c105 Merge "emulator: opengl: add design document for emulation implementation." 2011-10-19 10:14:13 -07:00
David 'Digit' Turner
0e205e6d6e emulator: opengl: minor fix and reformatting
This patches fixes a minor invalid usage of delete (instead of delete[])
and reformats the source code a little to make it more obvious.

Change-Id: If853d12e74549abcc6682430c837b0f14da81fdc
2011-10-19 17:54:20 +02:00
David 'Digit' Turner
fb2ddf9347 emulator: opengl: add design document for emulation implementation.
This patch adds a rather extensive document explaining the design
of our OpenGLES emulation, both on the guest and the host.

Change-Id: I13cf1eac21e5a8a0be170b5f90100b04f9ae6d75
2011-10-19 16:43:24 +02:00
David 'Digit' Turner
b8b0bacb8c am 7b2cacb4: am 76f63551: am 894a63dd: emulator: opengl: Add custom_write optimization to encoder.
* commit '7b2cacb4523bc564321d0726c8b53b72f6b1c562':
  emulator: opengl: Add custom_write optimization to encoder.
2011-09-28 04:46:47 -07:00
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
76f63551d3 am 894a63dd: emulator: opengl: Add custom_write optimization to encoder.
* commit '894a63dd6eb8a1c675c21a8a10eff8c0118890c8':
  emulator: opengl: Add custom_write optimization to encoder.
2011-09-28 04:28:52 -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
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
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