Commit Graph

94 Commits

Author SHA1 Message Date
Michael I. Gold
4aea6bff14 egl: clear error on function entry
Clear the current thread error state on entry to API functions as
mandated by the EGL 1.4 specification, section 3.1.  glGetError
returns additional information about the "most recent EGL function".

Change-Id: Ic24c64b39294ffc1a4e43fa72663e076b9d7decf
2011-01-25 15:36:21 -08:00
Michael I. Gold
609bb4dbf0 egl: fix GetProcAddress for EGLimage extensions
Return wrappers from GetProcAddress for glEGLImageTargetTexture2DOES
and glEGLImageTargetRenderbufferStorageOES which unwrap the EGLimage
handle before calling through to the implementation.

Change-Id: I2f5b180ab3ccdb28a4f510a2bd8c2eee941a84df
2011-01-16 18:12:04 -08:00
Michael I. Gold
ca41e36266 egl: expose EGLimage extensions
Add EGL_KHR_gl_texture_cubemap_image and EGL_KHR_gl_renderbuffer_image
to the static EGL extension string since these require no new APIs
beyond what is already required.

Change-Id: I2d1fde86b19bb9eee46b3b977f51784a17cfcc3c
2011-01-16 18:02:52 -08:00
Michael I. Gold
0c3ce2a365 egl: fixes for object refcounts
eglMakeCurrent() would only deref the previous surfaces if the old and
new contexts were the same.  eglTerminate() should not touch TLS.
eglReleaseThread() needs to unbind the current context.

Change-Id: I213b8be77b1a23b5a8a6afaac60643662c8aa010
2010-12-23 16:12:19 -08:00
Mathias Agopian
2fa3af5b43 am 054ae782: am e1752f41: Merge "fix [3258603] \'Quadrant\' benchmark crashes inside eglQueryContext on GB/Crespo" into gingerbread
* commit '054ae78245fe9b4c14bbc372ae77cd0a977ded73':
  fix [3258603] 'Quadrant' benchmark crashes inside eglQueryContext on GB/Crespo
2010-12-08 17:20:39 -08:00
Mathias Agopian
c3ce880972 fix [3258603] 'Quadrant' benchmark crashes inside eglQueryContext on GB/Crespo
eglQueryContext(..., EGL_CONFIG_ID, ...) is dereferencing an uninitialized pointer
due to a typo.

Change-Id: I100addf3150f19cb6dfbce9987fb5239dd240878
2010-12-08 15:34:02 -08:00
Mathias Agopian
b0c48b8993 am 0484a673: am daef0a04: Merge "[3229973, 3247470, ...] set EGLNativeWindowSurface\'s format in EGL" into gingerbread
* commit '0484a673c5839d2be9e615e52c6a45febdf1127b':
  [3229973, 3247470, ...] set EGLNativeWindowSurface's format in EGL
2010-12-06 18:25:58 -08:00
Mathias Agopian
644bb2a29e [3229973, 3247470, ...] set EGLNativeWindowSurface's format in EGL
(there are multiple bugs this should fix)

we now use the EGL_NATIVE_VISUAL_ID of a config to set
the ANativeWindow's format from eglCreateWindowSurface(),
this guarantees that the surface's format will match
whatever EGLConfig the user chose.

this should fix all current and future config/surface format
mismatch and allow users to easily select 32-bits surfaces.

Change-Id: I3835d0eb70c75eeecded3c3509a0a8207554c98b
2010-12-03 14:15:40 -08:00
Mathias Agopian
744026fed6 DO NOT MERGE. workaround [3177481] eglGetProcAddress() returns the wrong pointer for some GL extensions
We just make sure eglGetProcAddress() will return NULL for
 glEGLImageTargetTexture2DOES
 glEGLImageTargetRenderbufferStorageOES

which is better than returning the address of the wrong implementation.

the correct fix is more involved.

Change-Id: I585a1f40e564f862e5dd382224609ccd069cd3b5
2010-11-09 14:41:13 -08:00
Jack Palevich
6132b3703d Trace glUniformXXv and glUniformMatrixXfv calls.
Change-Id: I653021d2174fa1a7343d10b0fd2c29b3e5147be6
2010-10-27 15:37:01 -07:00
Jack Palevich
a2dd6cf599 OpenGL tracing.
Enable with:

adb shell setprop debug.egl.trace 1

Change-Id: Icfbc795f5260141510975228e72234e9aab56a85
2010-10-26 15:21:24 -07:00
Mathias Agopian
30faafb7d3 am 4eb1ad5e: am 524a6d8e: Merge "better fix for [3028370] GL get error should return a valid error if no context is bound." into gingerbread
Merge commit '4eb1ad5e98c7b36f7ac4ec8c3270f9763afd107e'

* commit '4eb1ad5e98c7b36f7ac4ec8c3270f9763afd107e':
  better fix for [3028370] GL get error should return a valid error if no context is bound.
2010-09-23 21:41:30 -07:00
Mathias Agopian
6f0871222f better fix for [3028370] GL get error should return a valid error if no context is bound.
it turns out that we cannot return INVALID_OPERATION from glGetError() because the
GL spec says that it must be called in a loop until it returns GL_NO_ERROR.

now, we always return 0 from GL functions called from a thread with no
context bound. This means that glGetError() will return NO_ERROR in this case,
which is better than returning a random value (which could trap the app in a loop).

if this happens in the main thread of a process, we LOG an error message once.

Change-Id: Id59620e675a890286ef62a257c02b06e0fdcaf69
2010-09-23 16:44:48 -07:00
Mathias Agopian
aa22d20554 am 9c4d7d67: am 5c6c5c7a: fix [3028370] GL get error should return a valid error if no context is bound.
Merge commit '9c4d7d677097981a349c718902e29050dad3d59f'

* commit '9c4d7d677097981a349c718902e29050dad3d59f':
  fix [3028370] GL get error should return a valid error if no context is bound.
2010-09-23 13:28:47 -07:00
Mathias Agopian
05c53113e0 fix [3028370] GL get error should return a valid error if no context is bound.
glGetError() will now always return GL_INVALID_OPERATION if called from a thread
with no GL context bound.

Change-Id: I28ba458871db051bb4f5a26668a1fa123526869c
2010-09-23 13:19:02 -07:00
Mathias Agopian
cd2c51cf45 am d01ce192: am 9d5fac51: Merge "fix small bug in EGL error management" into gingerbread
Merge commit 'd01ce1924a51539c4d47ef1f55913bdf1a018124'

* commit 'd01ce1924a51539c4d47ef1f55913bdf1a018124':
  fix small bug in EGL error management
2010-09-22 14:41:45 -07:00
Mathias Agopian
f3c24f8703 Merge "fix typo EGL_NO_IMAGE_KHR -> EGL_NO_SYNC_KHR" 2010-09-22 14:15:15 -07:00
Mathias Agopian
a93b957e8e fix typo EGL_NO_IMAGE_KHR -> EGL_NO_SYNC_KHR
Change-Id: I38c87803e32030918f2deb06381eabce0faa870c
2010-09-21 16:22:10 -07:00
Mathias Agopian
02dafb5068 fix small bug in EGL error management
make sure to clear our EGL implementation's error when returning
an error from an underlying implementation

Change-Id: Ibce4726cef1f900e4c7f16002345d7a07f8cdf41
2010-09-21 15:43:59 -07:00
Brian Swetland
04b9ff8e26 am 5c746522: am 181e5ea8: Merge "support loading EGL libraries from /vendor/lib/egl as well as /system/lib/egl" into gingerbread
Merge commit '5c7465220d52c64c87fe4566fe109c649ec5c4f7'

* commit '5c7465220d52c64c87fe4566fe109c649ec5c4f7':
  support loading EGL libraries from /vendor/lib/egl as well as /system/lib/egl
2010-09-20 19:32:01 -07:00
Brian Swetland
2b9e4f6a24 support loading EGL libraries from /vendor/lib/egl as well as /system/lib/egl
Change-Id: Idd9ca85ce3ba6c92234375071b53e5365e689062
2010-09-20 12:58:15 -07:00
Mathias Agopian
c291f58585 Add support for KHR_fence_sync
Change-Id: Ie2771b5869c9c8dcf5ecf9318e2ee6d4d1cd5cc9
2010-09-10 14:01:45 -07:00
Mathias Agopian
acd8fd0493 am a9ff29b5: am 6808e6a8: Merge "Fix a few typos in EGL wrapper" into gingerbread
Merge commit 'a9ff29b59cf33e552285a0bff3caf7a44f93f1c0'

* commit 'a9ff29b59cf33e552285a0bff3caf7a44f93f1c0':
  Fix a few typos in EGL wrapper
2010-09-09 14:21:55 -07:00
Mathias Agopian
77fbf8ddd9 Fix a few typos in EGL wrapper
Change-Id: I3b815ca6ec334ca12088f9721eece33df42b2e46
2010-09-09 11:12:54 -07:00
Mathias Agopian
8e4b5a3e6a Add KHR_gl_texture_2D_image extension string. 2010-08-27 16:08:03 -07:00
Mathias Agopian
27e2fac337 cleanup EGL a bit. remove unused extension.
Change-Id: I7758bc7d6dc2e70fc3590fe939ebf71fbcde7059
2010-08-27 15:30:16 -07:00
Mathias Agopian
10cab190ba cleanup EGL a bit. remove unused extension.
Change-Id: Ia87120b076ab1bf7b28f06087878d8161fb46c88
2010-08-27 13:17:32 -07:00
Romain Guy
62d59ed785 am a4ed1c67: am 1e4aa48c: Merge "fix [2912927] Can\'t get NV_draw_path extension to work" into gingerbread
Merge commit 'a4ed1c6788ead0324106d76f497233ee42a1f1ac'

* commit 'a4ed1c6788ead0324106d76f497233ee42a1f1ac':
  fix [2912927] Can't get NV_draw_path extension to work
2010-08-16 07:49:24 -07:00
Mathias Agopian
4a88b52235 fix [2912927] Can't get NV_draw_path extension to work
there was a problem with eglGetProcAddress() which would only work with
GLES 1.x contexts.

Change-Id: I4747671cbf7ed469bb471a377f1d6f36550d24df
2010-08-13 14:17:58 -07:00
Mathias Agopian
5d708a5916 am 553a333d: am 603a34ee: Merge "improve a bit the implementation of eglGetProcAddress" into gingerbread
Merge commit '553a333d4446bb34330da92f02daa515dc597939'

* commit '553a333d4446bb34330da92f02daa515dc597939':
  improve a bit the implementation of eglGetProcAddress
2010-08-10 13:55:34 -07:00
Romain Guy
761eaed2ff Fix tons of bugs and add new text rendering support.
Change-Id: I326c66b10784006f6df2f12d38e120cef94cd0d7
2010-08-10 12:22:01 -07:00
Mathias Agopian
7f781d1552 improve a bit the implementation of eglGetProcAddress
Change-Id: Ie07f33ae2162830df1e4f3d3b5e00fcfb8c350d6
2010-08-09 18:35:43 -07:00
Mathias Agopian
24035338ed fix [2421247] implement eglGetProcAddress(), needed in the ndk
Change-Id: I5027a27b43c0dd449a404024087853ca05bb8e4e
2010-08-02 18:23:36 -07:00
Mathias Agopian
cee79391c8 fix [2870926] Issue 9802: EGL wrapper has not been implemented correctly for eglQuerySurface().
rework how our EGL wrapper manages EGLConfig:

- we now store the EGLConfig with the EGLSurface and EGLContext
  so that we can have easy access to it from eglQueryContext
  and eglQuerySurface.

- EGLConfig now are an index into a sorted table of egl_config_t,
  we use a binary search to retrieve our EGLConfig (the index) from
  the implementation's EGLConfig.

- egl_config_t keeps track of the implementation's index,
  EGLConfig and CONFIG_ID as well as our CONFIG_ID.

In many ways, this implementation is simpler and more robust, as it doesn't
assume anything about the number of implementations nor what EGLConfig is
made of (the previous code assumed EGLConfig didn't usem more than 24-bits).

Change-Id: Id5abe923aacb6e1fd2b63bd8c15d7b04ae824922
2010-07-26 21:14:59 -07:00
Jamie Gennis
4c39f8f9e2 Fix a bug that prevented the creation of EGL shared contexts.
Change-Id: I6b0ec5ef86abdd4e9083067ba297107cfb094df3
2010-07-02 12:05:07 -07:00
Mathias Agopian
11cca925b2 update GL ES stub libraries with the new GL ES headers
Change-Id: I83be94049ddfe3fd7f5bee71a21172ade1498dd5
2010-06-09 18:20:21 -07:00
Mathias Agopian
04aed2149d fix a crasher in our EGL wrapper when attrib_list is NULL in eglChooseConfig
the EGL specification states that this should be treated as though it was
an empty list terminated with EGL_NONE.

Change-Id: I294104370a86b5e5c34c7bcf15c5459eab464631
2010-05-17 14:45:43 -07:00
Mathias Agopian
bf41b11ef8 small cleanup. gEGLImpl should have been static
also added a ctor to initialized it in case we use it ont he stack
one day.

Change-Id: I2736b9bce3d8ba3b74fd029de4c18cca2cdbbf60
2010-04-09 14:26:07 -07:00
Mathias Agopian
8fb47ec10e Fix Android's glEGLImageTargetRenderbufferOES() wrapper
glEGLImageTargetRenderbufferOES() pass the wrapped EGLImage
to the implementation, rather than the unwrapped one.

Change-Id: I149f9ed73e6ab9089110600e1db4311ba7a8c83a
2010-03-29 15:12:19 -07:00
Jack Palevich
81cd084485 Implement eglInitialize / eglTerminate reference counting
Previously we imlpemented the standard semantics for
eglInitialize / eglTerminate, which are that
eglInitialize may be called any number of times,
but the first call to eglTerminate will terminate
the display.

Now we follow reference-countins semantics, which
means that eglTerminate will only terminate the
display when the reference count returns to zero.

This change allows EGL to be used by multiple
independently written modules in the same process.

(Otherwise there is no way for the independent
modules to coordinate their use of the display.)
2010-03-15 21:21:51 -07:00
Mathias Agopian
75bc27803e fix [2189862] Race condition in eglIntialize and eglDestroy
there is now a lock protext a perticular display. it's held during
initialization and destruction.
2010-02-05 16:17:01 -08:00
Mathias Agopian
8063c3ab04 fix [2303866] eglMakeCurrent doesn't return all error messages described in the spec 2010-01-25 11:30:11 -08:00
Gary King
9166f7bfa7 Use correct TLS codepath in graphics libraries
Duplicate ARCH_ARM_HAVE_TLS_REGISTER BoardConfig to proprocessor
HAVE_ARM_TLS_REGISTER define from Bionic's libc Android.mk to ensure that
OpenGL libraries (libEGL, libGLESv1_CM, libGLESv2, libGLES_android) use the
correct codepath in bionic_tls.h for accessing the TLS address
2010-01-12 17:35:35 -08:00
Jack Palevich
01cc538b29 A library for encoding and decoding ETC1 textures.
The ETC1 compressed texture format is commonly
supported by OpenGL ES 2.0-capable devices.
2009-12-31 13:31:04 +08:00
Jack Palevich
66089a33ea Implement Matrix Palette extension.
Adds support for formerly-unimplemented methods:

glCurrentPaletteMatrixOES
glLoadPaletteFromModelViewMatrixOES
glMatrixIndexPointerOES
glWeightPointerOES

The bulk of the changes are related to implementing the two PointerOES
methods, which are implemented pretty much the same way as the existing
Pointer methods were implemented.

This change also changes the way glPointSizePointerOES is implemented,
making it act like all the other Pointer methods. (Previously it was
not handling non-direct-buffer arguments correctly.)

Fixes bug 2308625 "Support matrix palette skinning
in JSR239 and related APIs"

Also updated GLLogWraper to fix two bugs in GLLogWrapper that were
discovered while testing matrix palette skinning support:

a) Handle trying to print the contents of null-but-enabled buffers.
(It's not legal to draw with null-but-enabled buffers, and
in fact some OpenGL drivers will crash if you try to render in this
state, but there's no reason the GLLogWrapper should crash while trying
to debug this situation.

b) Don't read off the end of a vertex buffer with non-zero position when
printing the entire contents of the vertex buffer. Now we only print from
the current position to the end of the buffer.
2009-12-08 15:43:51 +08:00
Mathias Agopian
863e5fdde8 fix[2222341] Soft reset while going back from camcorder settings
add a way to convert a mapped "pushbuffer" buffer to a gralloc handle
which then can be safely used by surfaceflinger, without including
gralloc_priv.h
2009-10-30 14:48:50 -07:00
Mathias Agopian
df2d929405 return proper error code from eglCreateImageKHR 2009-10-29 16:45:41 -07:00
Mathias Agopian
673d2dbaae Use the TLS register if HAVE_ARM_TLS_REGISTER is defined
this will be needed for SMP, but would improve dispatching GL calls a bit
on armv6 and above.
2009-10-19 16:13:46 -07:00
Mathias Agopian
618fa10949 fix [2187212] add support for GLESv2 dispatch based on TLS
Instead of using a different function pointer table for ES 1.x and ES 2.x,
we use a single one that is the union (sort|uniq) of both tables. Two
instances of this table are initialized with pointers to GL ES 1.x and GL ES 2.x
entry-points.
When a context is created, we store its version number and when it is bound to a
thread we set the approruiate table based on the stored version.

This introduce no penalty while dispatching gl calls to the right API version.

[Pending Dr No approval for MR1]
2009-10-14 02:06:37 -07:00
Dima Zavin
4445712fd4 Revert "egl: temporarily also include eglTerminate->eglInitialize hack for 8k"
This reverts commit ed5ecdba36648973be3033a045e2ece8bf039e4a.
2009-10-09 18:23:08 -07:00