Commit Graph

72 Commits

Author SHA1 Message Date
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
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
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
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
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
77fbf8ddd9 Fix a few typos in EGL wrapper
Change-Id: I3b815ca6ec334ca12088f9721eece33df42b2e46
2010-09-09 11:12:54 -07:00
Mathias Agopian
10cab190ba cleanup EGL a bit. remove unused extension.
Change-Id: Ia87120b076ab1bf7b28f06087878d8161fb46c88
2010-08-27 13:17:32 -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
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
Mathias Agopian
7d21a745ac add a way to easily catch and log GL errors (compile time flag) 2009-10-08 15:58:11 -07:00
Dima Zavin
7695a5865e egl: temporarily also include eglTerminate->eglInitialize hack for 8k
Change-Id: Id5c51e54e733b24e5d5d5de0dcca84ac53afd3a9
Signed-off-by: Dima Zavin <dima@android.com>
2009-09-26 01:00:49 -07:00
Mathias Agopian
8c17384a5e log an error when loading an existing GL driver fails 2009-09-20 16:07:26 -07:00
Mathias Agopian
a69e0ed4a3 fix a bug recently introduced where EGL couldn't be initialized again after it had been terminated once 2009-08-24 21:47:13 -07:00
Mathias Agopian
9429e9c8ad first step for fixing [2066786] EGL object lifetime management doesn't respect the EGL spec
this change fixes the lifetime mgt of EGLSurface, EGLContext and EGLImageKHR in the EGL wrapper.
EGLDisplay is still somewhat bogus and libagl's EGL is still incorrect.

The idea of the change is that EGL objects are put in a list when created and removed when destroyed.
Before each use, we first verify if the object is in the list and if so a reference is taken and kept
for the scope of the whole EGL API being called, if not, an error is returned.

Upon object destruction, the object is simply marked as "terminated" (this is not protected by a lock
because it doesn't really matter). This flag is only used to deny access to the object by other APIs
while it's still valid (for instance current or being used by another function in another thread).
A reference is also removed and the object can then actually be destroyed when going out of scope.
2009-08-21 19:45:44 -07:00
Mathias Agopian
baca89c06a fix a bug in ComponentSizeChooser where it could pick a software EGLConfig instead of a better h/w one.
We now just try to honor the stencil / depth buffer "at least", while doing a "shortest distance" on the colors.
2009-08-20 19:09:34 -07:00
Mathias Agopian
923c661a86 fix bug [2021677] egl driver unloaded after eglTerminate() is called
refactored the code so that:
- EGL APIs that can be called before or after eglInitialize() will work by loading the drivers first
- make eglGetDisplay() a lot more efficient
- make sure that EGL drivers are loaded in a thread-safe way
- don't unload the drivers upon calling eglTerminate(), they're now never unloaded, since there is no safe way to do it (some thread could be running)
- updated our EGL version to 1.4
- return better error codes if errors happen during initialization
2009-08-17 18:07:06 -07:00
Mathias Agopian
24e5f52901 Better error handling in EGL extensions 2009-08-12 21:18:15 -07:00
Mathias Agopian
d274eae545 log opengl-call-with-no-context only once per thread, instead of for each function call 2009-07-31 16:23:03 -07:00
Mathias Agopian
574c16f9f8 GLESv2 couldn't be loaded due to wrong path specification 2009-07-29 11:10:29 -07:00
Android (Google) Code Review
2521f47c4d am 46e28db8: Merge change 6713 into donut
Merge commit '46e28db8818332e3cda4cc410cc89a1ed7ce4db6'

* commit '46e28db8818332e3cda4cc410cc89a1ed7ce4db6':
  fix for [1969185] valgrind errors in new gl stuff
2009-07-09 17:35:26 -07:00
Mathias Agopian
dacd7a33c4 fix for [1969185] valgrind errors in new gl stuff 2009-07-09 17:33:15 -07:00
Marco Nelissen
fc865658b4 Make opengl loader use an absolute path. 2009-07-07 16:18:18 -07:00
Mathias Agopian
8d2e83b9f4 Add eglGetRenderBufferANDROID() extension, which returns the current render buffer as an android_native_buffer_t* 2009-06-25 00:02:44 -07:00
Mathias Agopian
af74213546 fix [1942438] eglGetCurrentSurface() returns bogus value 2009-06-25 00:01:11 -07:00
Mathias Agopian
f51f9c8af3 fix [1942438] eglGetCurrentSurface() returns bogus value 2009-06-24 23:59:16 -07:00
Mathias Agopian
f909cb6c69 remove some spurious debuging LOGD 2009-06-03 18:30:22 -07:00
Mathias Agopian
acdebe352d fix/clean these Android.mk following dbort and joeo's comments 2009-06-03 18:26:58 -07:00
Mathias Agopian
de58697644 implement a real loader for EGL drivers
we now look for a config file in /system/lib/egl/egl.cfg that describes the association of a display to a driver.
these drivers are named: /system/lib/egl/lib{[EGL|GLESv1_CM|GLESv2] | GLES}_$TAG.so
2009-05-28 20:31:40 -07:00
Mathias Agopian
b1a39d67be Added most of the support needed for GLES 2.x 2009-05-27 20:38:06 -07:00
Mathias Agopian
5c846bd6cf make sure to fail to software when the h/w renderer cannot be initialized 2009-05-20 17:58:36 -07:00
Mathias Agopian
614ecde4cb libGLESv1_CM.so doesn't need to depend on libutils or libui 2009-05-18 13:42:18 -07:00