Commit Graph

369 Commits

Author SHA1 Message Date
Jesse Hall
9322c5cb25 Work around a y-invert bug on Macs w/ Intel GPU
On Macs running OS X 10.6 and 10.7 with Intel HD Graphics 3000, some
screens or parts of the screen are displayed upside down. The exact
conditions/sequence that triggers this aren't known yet; I haven't
been able to reproduce it in a standalone test. This also means I
don't know whether it is a driver bug, or a bug in the OpenglRender or
Translator code that just happens to work elsewhere.

Thanks to zhiyuan.li@intel.com for a patch this change is based on.

Change-Id: I04823773818d3b587a6951be48e70b03804b33d0
2012-03-07 10:06:57 -08:00
Jesse Hall
767d089487 Delete dead code.
Change-Id: I5b87fac4e2140a903221a1f68b16fa6a96e5effc
2012-03-07 10:06:37 -08:00
Jesse Hall
7ef79e49c7 EmuGL: don't [de]queue buffers in eglMakeCurrent
Whenever a surface was attached to a context, it was dequeing a new
buffer, and enqueing it when detached. This has the effect of doing a
SwapBuffers on detach/attach cycle, which is just wrong and
occasionally caused visible glitches (e.g. animations going backwards
for one frame). It also broke some SurfaceTexture tests which
(validly) depend on specific buffer production/consumption counts.

Change-Id: Ibd4761e8842871b79fd9edf52272900193cb672d
2012-02-24 15:54:59 -08:00
Jesse Hall
cbc7300cb2 EmuGL: enable SurfaceTexture async mode
Pass the swap interval from eglSwapInterval to the native window so it
can enable/disable SurfaceTexture's async mode. Fixes the deadlock in
SurfaceTextureGLToGLTest.EglDestroySurfaceUnrefsBuffers.

Change-Id: I19bf69247341f5617223722df63d6c7f8cf389c6
2012-02-24 15:54:58 -08:00
Jesse Hall
d6bd1843ce EmuGL: GLESv2 support for OES_EGL_image_external
Change-Id: I8911328d5dcccdf4731bd2d8fd953c12fdec5f1b
2012-02-22 15:03:30 -08:00
Jesse Hall
00e61338b8 EmuGL: refinements to GLESv1 image_external
* EGLImageTargetRenderbufferStorageOES was incorrectly accepting
  TEXTURE_EXTERNAL_OES as a target. Revert that; the host GL will
  correctly reject it with INVALID_ENUM.

* Handle the REQUIRED_TEXTURE_IMAGE_UNITS_OES texparameter query.

* Validate texture parameters set on TEXTURE_EXTERNAL textures;
  otherwise invalid parameters would work on the emulator but not on a
  real device.

Change-Id: I49a088608d58a9822f33e5916bd354eee3709127
2012-02-21 11:13:20 -08:00
Jesse Hall
ac018fe3f6 EmuGL: refcount ColorBuffers on the host
The gralloc API assumes system-wide reference counting of gralloc
buffers. The host-GL accelerated gralloc maps buffers to host-side
ColorBuffer objects, but was destroying them unconditionally in
gralloc_free(), ignoring any additional references from
gralloc_register_buffer().

This affected the SurfaceTexture gralloc buffers used by the
Browser/WebView. For some reason these buffers are actually allocated
by SurfaceFlinger and passed back to the WebView through Binder. But
since SurfaceFlinger doesn't actually need the buffer for anything,
sometime after the WebView has called gralloc_register_buffer()
SurfaceFlinger calls gralloc_free() on it. This caused the host
ColorBuffer to be destroyed long before the WebView is done using it.

Change-Id: I33dbee887a48a6907041cf19e9f38a1f6c983eff
2012-02-21 11:13:20 -08:00
Jesse Hall
91d4e8e195 GLESv2 translator: don't delete EGLImage textures
Copy changes faaf1553cf and
f37a7ed6c5 from the GLESv1 translator to
the GLESv2 translator. After this, both translators use the same logic
for glEGLImageTargetTexture2DOES().

Change-Id: I0a95bf2301df7b7428abc593f38170edf4cbda30
2012-02-21 11:13:19 -08:00
Jesse Hall
0e981c8304 EmuGL: Fix heap corruption
Off-by-two bug when removing textures from the tracking array could
overwrite malloc's mem chunk data structure, usually resulting in a
heap corruption abort on a later malloc/realloc/free.

Bug: 5951738
Change-Id: I11056bb62883373c2a3403f53899347ff8cdabf2
2012-02-03 22:54:24 -08:00
Jesse Hall
5bad48a65e EmuGL: handle NULL data in glBufferData
The data pointer argument to glBufferData can be NULL; this
[re]allocates the buffer while leaving the contents undefined.

Bug: 5833436

Change-Id: Ia1ddf62e2cd2c59d3d631e01d23d7c557ca5a52e
2012-01-11 15:40:29 -08:00
Jesse Hall
f0baef2fed Merge "EmuGL: misc small cleanups" into ics-mr1 2012-01-09 15:52:15 -08:00
Jesse Hall
a592d9c043 EmuGL: misc small cleanups
* Disable verbose debug spam.
* Add missing GL enum to utility function. The default case was
  returning the correct size, so this doesn't fix any bugs, just
  removes some logcat spam.
* Comment and whitespace corrections.

Change-Id: I83fb8644331ae1072d6a8dae9c041da92073089f
2012-01-05 10:50:01 -08:00
Jesse Hall
a4fb8a60b1 EmuGL: fix GL view position in window on OS X
The code that creates the GL-accelerated screen view wasn't converting
the upper-left-relative coordinates used within the emulator to the
lower-left coordinates used by the Cocoa APIs on OS X. Since most
skins have the screen view centered vertically this often just
happened to work.

Bug: 5782118
Change-Id: I2f96ee181e850df5676d10a82d86c94421149b40
2012-01-04 15:03:39 -08:00
Jesse Hall
5d721ef6a1 am b0a30e43: EmuGL: remove broken EGL buffer refcounting
* commit 'b0a30e43889415a9a40b9519392ad3be295b9465':
  EmuGL: remove broken EGL buffer refcounting
2011-12-12 15:23:59 -08:00
Jesse Hall
b0a30e4388 EmuGL: remove broken EGL buffer refcounting
The emulator EGL implementation tried to hold its own reference to
buffers acquired/released with dequeueBuffer/queueBuffer, but was
missing an incRef after dequeueBuffer during swapBuffers.

Since the native window holds a reference to the buffer between
dequeueBuffer and queueBuffer, the EGL reference isn't needed anyway.

Change-Id: I95e4f9f4faf59198f99939cdca6603fe176c56bc
2011-12-12 14:05:16 -08:00
Jesse Hall
c08eaec1e2 am 96cd9c31: Merge "EmuGL: capture VBO contents in GL2Encoder" into ics-mr0
* commit '96cd9c3130b6215534e863b94637b384da8102c9':
  EmuGL: capture VBO contents in GL2Encoder
2011-12-01 14:37:51 -08:00
Jesse Hall
7906431d04 EmuGL: capture VBO contents in GL2Encoder
The glBufferData, glBufferSubData, and glDeleteBuffers entry points
had interception routines in GL2Encoder which cache the data, but they
weren't hooked up. So when glDrawElements tried to retrieve the cached
data it wasn't there.

Change-Id: Iaed11fccaefab3186485be53a0f15c8ca0a255f9
2011-12-01 12:01:27 -08:00
Jesse Hall
3a655154d0 am af4f66be: EmuGL: implement OES_EGL_image_external for GLESv1
* commit 'af4f66be50b17c8b8fce1dda53389bb0a10968ba':
  EmuGL: implement OES_EGL_image_external for GLESv1
2011-11-22 15:43:26 -08:00
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
af4f66be50 EmuGL: implement OES_EGL_image_external for GLESv1
GLESv2 support will come in a followup change but will take advantage
of the GLClientState changes.

Change-Id: Ib6cbb4dafbd071e3b59b1e5d808b3e23656ada92
2011-11-21 13:47:49 -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