Commit Graph

401 Commits

Author SHA1 Message Date
Jesse Hall
a308d5ff8e Merge "Add/fix copyright notices" 2012-03-07 07:24:21 -08:00
Jesse Hall
f4a20e58aa Add/fix copyright notices
Several EmuGL files were missing copyright notices; added them. Others
had them but below other code, which makes checking for them more
difficult -- I moved these to the top of the file.

These files were all created by GraphTech as a work for hire for AOSP.

Change-Id: Iee67bcf1c9b54ad5aa8a9288ded0382a974c32cb
2012-03-06 16:13:03 -08:00
Jesse Hall
2478dfd351 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-06 16:09:06 -08:00
Jesse Hall
54934b06f1 Delete dead code.
Change-Id: I5b87fac4e2140a903221a1f68b16fa6a96e5effc
2012-03-06 16:09:06 -08:00
Andrew Hsieh
bb6ee33b11 Merge "Fixed crash and 64-bit porting issues" 2012-02-29 16:29:01 -08:00
Andrew Hsieh
b100b6fd6a Fixed crash and 64-bit porting issues
1. "emugen" generates four *dec.cpp files containing code like this
   to decode offset to pointer in stream

   tmp = *(T *)(ptr + 8 + 4 + 4 + 4 + *(size_t *)(ptr +8 + 4 + 4));

   If *dec.cpp are compiled in 64-bit, size_t is 8-byte and dereferencing of
   it is likley to get wild offset for dereferencing of *(T *) to crash the
   code.  Solution is to define tsize_t for "target size_t" instead
   of using host size_t.

2. Cast pointer to "uintptr_t" instead of "unsigned int" for 2nd param of
   ShareGroup::getGlobalName(NamedObjectType, ObjectLocalName/*64bit*/).
3. Instance of EGLSurface, EGLContext and EGLImageKHR are used as 32-bit
   key for std::map< unsigned int, * > SurfacesHndlMap, ContextsHndlMap,
   and ImagesHndlMap, respectively.  Cast pointer to uintptr_t and assert
   upper 32-bit is zero before passing to map::find().
4. Instance of GLeglImageOES is used to eglAttachEGLImage() which expect
   "unsigned int".  Cast it to uintptr_t and assert upper 32-bit is zero.
5. The 5th param to GLEScontext::setPointer is GLvoid* but contains 32-bit
   offset to vbo if bufferName exists.  Cast it to uintptr_t and assert
   upper 32-bit is zero.
6. Use %zu instead of %d to print size_t
7. Cast pointer to (uintptr_t) in many other places

Change-Id: Iba6e5bda08c43376db5b011e9d781481ee1f5a12
2012-02-29 15:54:06 -08:00
Jesse Hall
073e40031c resolved conflicts for merge of c765e79a to master
Change-Id: Id7018ac9f551ec8b224f030d8b04229ac2407a17
2012-02-27 14:12:32 -08:00
Jesse Hall
5333119e45 am a59610fa: am 9e016ede: am cbc7300c: EmuGL: enable SurfaceTexture async mode
* commit 'a59610fab6893530f15a9cfad8cdd97e4c5d578a':
  EmuGL: enable SurfaceTexture async mode
2012-02-27 14:00:23 -08:00
Jesse Hall
124d18041b am 7ef79e49: EmuGL: don\'t [de]queue buffers in eglMakeCurrent
* commit '7ef79e49c7e8f1ecf19a92114f41de39d102a3e8':
  EmuGL: don't [de]queue buffers in eglMakeCurrent
2012-02-27 13:55:39 -08:00
Jesse Hall
9e016ede09 am cbc7300c: EmuGL: enable SurfaceTexture async mode
* commit 'cbc7300cb209a4fd3b250546c72c35b7bb0aa8a1':
  EmuGL: enable SurfaceTexture async mode
2012-02-27 13:55:37 -08:00
Mathias Agopian
a3b1c78767 remove dependency on android_natives_priv.h
Change-Id: If06ea9aeb836d6ceb09745770956a25211f428d3
2012-02-24 18:04:51 -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
f3c068c79a am bcd311ce: am 9cb15c9e: am 8bd39ae1: Merge "EmuGL: GLESv2 support for OES_EGL_image_external" into ics-mr1
* commit 'bcd311ce0b17d892f87d2e31741dc1873491d20f':
  EmuGL: GLESv2 support for OES_EGL_image_external
2012-02-24 12:11:52 -08:00
Jesse Hall
9cb15c9e81 am 8bd39ae1: Merge "EmuGL: GLESv2 support for OES_EGL_image_external" into ics-mr1
* commit '8bd39ae17caac6d275d785ce9420d7e643f15eb9':
  EmuGL: GLESv2 support for OES_EGL_image_external
2012-02-24 12:08:38 -08:00
Jesse Hall
72efa999d1 am ba8c8d15: am 66a386e3: am 00e61338: EmuGL: refinements to GLESv1 image_external
* commit 'ba8c8d1591a25b13047b24c10a1315ff178b2160':
  EmuGL: refinements to GLESv1 image_external
2012-02-23 12:25:49 -08:00
Jesse Hall
1d4fcce585 am 4660966b: am 144e1b59: am ac018fe3: EmuGL: refcount ColorBuffers on the host
* commit '4660966b791d8ea1be086a9ab0c58c672cca36ee':
  EmuGL: refcount ColorBuffers on the host
2012-02-23 12:25:47 -08:00
Jesse Hall
c2aa2cd77e am 2419e67b: am fc7a319e: am 91d4e8e1: GLESv2 translator: don\'t delete EGLImage textures
* commit '2419e67b07de7cdb7f502bb69634b23c147f899a':
  GLESv2 translator: don't delete EGLImage textures
2012-02-23 12:22:30 -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
66a386e33a am 00e61338: EmuGL: refinements to GLESv1 image_external
* commit '00e61338b8374de090e81537047846ca06f88280':
  EmuGL: refinements to GLESv1 image_external
2012-02-22 13:47:27 -08:00
Jesse Hall
144e1b5998 am ac018fe3: EmuGL: refcount ColorBuffers on the host
* commit 'ac018fe3f65e18083a2dd317f73e4139bfa5fee6':
  EmuGL: refcount ColorBuffers on the host
2012-02-22 13:45:42 -08:00
Jesse Hall
fc7a319e5c am 91d4e8e1: GLESv2 translator: don\'t delete EGLImage textures
* commit '91d4e8e195592dbc812441597118452f887ea07d':
  GLESv2 translator: don't delete EGLImage textures
2012-02-22 10:11:31 -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
Mathias Agopian
baa8e96c70 egl.cfg can now only have a single entry
Change-Id: Ic86671e41859dbf40ed4408f62450019c2164015
2012-02-13 20:38:35 -08:00
Jesse Hall
66258220b0 am 165c21e8: am 1276f7ba: am 0e981c83: EmuGL: Fix heap corruption
* commit '165c21e84cf87c6d5ccf085546d6313ea1533c6f':
  EmuGL: Fix heap corruption
2012-02-06 14:39:22 -08:00
Jesse Hall
1276f7ba04 am 0e981c83: EmuGL: Fix heap corruption
* commit '0e981c83041878e6a05b0a996879160fd0f320cf':
  EmuGL: Fix heap corruption
2012-02-06 13:36: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
900f5e8793 am 9b19d582: am 4f66a14d: Merge "EmuGL: handle NULL data in glBufferData" into ics-mr1
* commit '9b19d582d94a343437aacf962b8b95b83361bc10':
  EmuGL: handle NULL data in glBufferData
2012-01-11 17:13:42 -08:00
Jesse Hall
9b19d582d9 am 4f66a14d: Merge "EmuGL: handle NULL data in glBufferData" into ics-mr1
* commit '4f66a14d5311ee94d5a498c8e0049f6b95d4d0d6':
  EmuGL: handle NULL data in glBufferData
2012-01-11 17:12:09 -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
Steve Block
7d47e55717 Merge "Rename LOG_ASSERT to ALOG_ASSERT DO NOT MERGE" 2012-01-10 14:08:30 -08:00
Jesse Hall
5633539268 am d23522e6: am f0baef2f: Merge "EmuGL: misc small cleanups" into ics-mr1
* commit 'd23522e614c517a50222796286a7fffb6c11bd14':
  EmuGL: misc small cleanups
2012-01-09 16:37:28 -08:00
Jesse Hall
8a5b5242a4 am 19b03e4e: am 409c49c5: Merge "EmuGL: fix GL view position in window on OS X" into ics-mr1
* commit '19b03e4ef1e7861b938dd7c52356af5396f456b3':
  EmuGL: fix GL view position in window on OS X
2012-01-09 16:37:27 -08:00
Jesse Hall
d23522e614 am f0baef2f: Merge "EmuGL: misc small cleanups" into ics-mr1
* commit 'f0baef2fed555e87a0910e5aab6b8b763487b350':
  EmuGL: misc small cleanups
2012-01-09 15:53:49 -08:00
Jesse Hall
19b03e4ef1 am 409c49c5: Merge "EmuGL: fix GL view position in window on OS X" into ics-mr1
* commit '409c49c526508b5fa36f8bc6edc1fc70cba5a3e1':
  EmuGL: fix GL view position in window on OS X
2012-01-09 15:53:48 -08:00
Jesse Hall
f0baef2fed Merge "EmuGL: misc small cleanups" into ics-mr1 2012-01-09 15:52:15 -08:00
Steve Block
8ad367c36d Rename LOG_ASSERT to ALOG_ASSERT DO NOT MERGE
See https://android-git.corp.google.com/g/157519

Bug: 5449033
Change-Id: I2eb298dae73ccfd8e9ee8350344d9f5c96f5c422
2012-01-09 21:35:44 +00:00
Steve Block
5a622cba8c Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic6cac56d137f705dfa7266f21e9b0269219bd5d1
2012-01-09 10:39:43 +00:00
Steve Block
6aff44c27e Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I03c41e20d8f5d7f3c7ef1f01506885e3e250e921
2012-01-06 10:06:41 +00: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
Steve Block
112bc5e57e Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: Ia14c98936bb1dc74e681bf2de342ad6861646778
2012-01-03 22:29:55 +00:00
Al Sutton
87879839f1 Fix build on MacOS 10.7 / XCode 4
Ensure the dynamic library library gets linked in with SDL
to fix compilation errors

Change-Id: I32e6929088eaf73d707e89d10392c658b58ec465
2011-12-21 13:21:32 -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