Commit Graph

116 Commits

Author SHA1 Message Date
Alistair Strachan 89301eaf21 Fix EGL shim extension injection for GL ES 3 drivers.
The Android EGL shim injects GL_EXT_debug_marker into the ES driver
EXTENSIONS string for the OpenGL ES 1.x and 2.0/3.0/3.1 drivers if
the extension is not already provided. This feature is used by
GLES_trace.

In Open GL ES 3.0 it became possible to query an indexed version of
the EXTENSIONS string via GetStringi(). NUM_EXTENSIONS Gets were
also added to the specification (taken from Open GL).

If the shim does not have to inject the extension, then there is no
problem, as glGetString() and glGetStringi() / NUM_EXTENSIONS will
be consistent. However, if the Android EGL shim injects the
extension, NUM_EXTENSIONS and GetStringi() will report one less
extension than is really available.

Consistency between these methods is tested by the dEQP framework
with the dEQP-GLES3.functional.state_query.string.extensions test.
If the driver does not provide GL_EXT_debug_marker, this test
fails.

This change wraps all of the affected entry points so that the
wrapped driver extensions are never visible directly to dEQP,
eliminating the inconsistency.
2015-05-28 15:34:31 -07:00
Michael Lentine 12c4bdad7b Add rate-limited logging for unimplemented es functions.
Bug: 17322013

Change-Id: I7aa5ab2f76cf344cfb75802edbfd44e8e7526ff1
2014-09-23 08:30:12 -07:00
John Reck 1f246d73d8 Revert "Temporarily turn on callstack logging"
Bug: 13927881

'twas useful and perhaps should be always enabled (please?)
but not like this, so reverting.

This reverts commit db4488565a.

Change-Id: I9a78c6d6e48342ef6ca1f2f7b5303ca47ccc6086
2014-04-24 23:35:26 +00:00
John Reck db4488565a Temporarily turn on callstack logging
Bug: 13745587
 Temporarily turn on callstack logging for gl_no_context() to
 try and track down font cache corruption

Change-Id: I657ee85e811746441c5ce0ffe5adbfb3fb011d4c
2014-04-08 15:05:54 -07:00
Dan Stoza c3289c41e7 Make libEGL build cleanly under 64-bit
Change-Id: I255dfb70b166b7469d59352b1acfc7aececa07de
2014-01-17 15:32:27 -08:00
Mathias Agopian a6bb107434 make sure we have a context when creating the 1st surface
also add an option to dump the stack trace when
calling a GL function without a context.

Change-Id: I57b72bb8c322ac4253c3077bf150621bd9863b69
2013-08-08 16:38:06 -07:00
Mathias Agopian e0ea89ceef improve GLES jumptables
in the common case this saves one instructions per jump
(which will help with the i-cache).

this change also gets rid of the "use slow tls" option,
which was useless. So at least now architectures that don't have
assembly bindings will perform much better.

Change-Id: I31be6c06ad2136b50ef3a1ac14682d7812ad40d2
2013-07-01 15:52:47 -07:00
Mathias Agopian 39c24a20bb fix local include paths
Change-Id: Icb921fa796ec08612dbb2feb7e7161bcb0cf4a99
2013-04-04 23:30:18 -07:00
Mathias Agopian cab25d680e improved CallStack a bit
- added a ctor that updates and dumps the stack immediately
- added a "logtag" parameter to dump()

Change-Id: Ie51c256071d282591752243bdb4f68cf9ff8829d
2013-03-21 17:12:40 -07:00
Jesse Hall 4774338bd0 Add ES3 support to libGLESv2 and tracing tools
Since ES3 is backwards compatible with ES2, a new wrapper isn't
necessary, and the Khronos implementation guidelines recommend
supporting both versions with the same library.

Change-Id: If9bb02be60ce01cc5fe25d1f40c4e7f37244ebf6
2013-02-12 16:36:53 -08:00
Siva Velusamy a73a97728b gltrace: Add support for tracing running applications.
Currently, to activate OpenGL tracing, an application has to be
start with --opengl-trace option (or have a debug prop set).

This CL adds support for tracing an application which may already
be running. This is implemented as follows:
    - DDMS initiates a JDWP message to the VM indicating that
      opengl traces be enabled.
    - When that message is received, a flag is set that indicates
      that tracing should be enabled.
    - The trace flag is checked during every eglSwap() operation,
      and if it finds that tracing should be active and it isn't,
      then it starts the tracing component.

Change-Id: I3347fe89fc06c7404d7aa9360f4b21e5bf36ebcb
2012-12-20 10:38:47 -08:00
Siva Velusamy 6482fa4db0 gltrace: Make sure device is debuggable.
Change-Id: Icc22ff823a2f56733b232b927dd1fa494e9e1e81
2012-11-20 13:39:57 -08:00
Romain Guy d991b40739 am f58475b5: am 60393d45: Merge "Add runtime debugging capabilities to OpenGL" into jb-mr1-dev
* commit 'f58475b5ae4ccb3a31c05c79da8b2914c62a3510':
  Add runtime debugging capabilities to OpenGL
2012-10-18 17:39:13 -07:00
Romain Guy 16928bfeca Add runtime debugging capabilities to OpenGL
The shell property debug.egl.trace can now be set to:

0
  disables tracing
1
  logs all GL calls
error
  checks glGetError after every GL call, logs a stack trace on error
systrace
  logs each GL call to systrace

Change-Id: I34a2a2d4e19c373fd9eaa1b0cd93e67c87378996
2012-10-18 16:16:10 -07:00
Siva Velusamy 2e080904ab gltrace: Do not start gltrace from early_egl_init.
The debugging and tracing levels are initialized both during
early_egl_init and egl_display_t::initialize(). For apps this has
no effect since early_egl_init is called in the context of zygote.
This CL removes the unnecessary call from early_egl_init.

Change-Id: Ibc55c26228cd197f2e2623fbfb2d1a63d0722401
2012-10-10 10:35:41 -07:00
Mathias Agopian 455e360149 assert -eng builds when calling a GL function without a context
Bug: 7241626

Change-Id: I0f1f9361e75e9186af8cff8d98a7d2224b266765
2012-09-26 17:37:53 -07:00
Jesse Hall b29e5e8c26 Increment/decrement a counter around EGL calls
This is in preparation for a change that will hibernate the underlying
EGL when idle. Instead of a bare egl_display_t*, get_display() now
returns a egl_display_ptr, which acts like a smart pointer. The
"wakecount" counter managed by the smart pointer isn't used for
anything in this change. It will be used to make sure we don't
hibernate when any thread is in an EGL call, without having to hold a
mutex for the duration of the call.

Change-Id: Iee52f3549a51162efc3800e1195d3f76bba2f2ce
2012-04-09 21:35:17 -07:00
Siva Velusamy b13c78f852 gltrace: Expose a function to set OpenGL trace level.
This patch adds a function setGlDebugLevel() to libEGL to enable
GL tracing. This will be used by the Java layer to add an option
to "am start" that can enable tracing for a particular application.

Change-Id: Ie1dbdd550f502df8633553595cb33ee9d9ae44e1
2012-03-09 16:43:48 -08:00
Mathias Agopian 7c0441ac27 Don't wrap EGLImageKHR and EGLSyncKHR anymore
this simplify our EGL wrapper implementation a lot.
This wrapping is no longer needed now that we can only
support a single underlaying EGL implementation.

Change-Id: I8213df7ac69daac447f1fe6e37044b78aac4e9a9
2012-02-14 17:14:36 -08:00
Mathias Agopian 7773c435bc EGLConfig is now not remaped to an internal EGLConfig
this is possible now that we support only a single
EGL implementation. this allows a large code simplification.

Change-Id: I7a6b9db4c5d60f4407c6061e7a68729af63d5242
2012-02-13 20:23:15 -08:00
Mathias Agopian ada798b7ca remove multiplexing of multiple EGL implementation
from now on, the system can only have one EGL
implementation. this means the software and h/w renderer
cannot be used at the same time on a device. Of course, the
h/w renderer is always prefered; in its absence we
default to the software renderer.

Change-Id: Ib579f58055dd0ce4c4a99144131efa11c16ca3d3
2012-02-13 18:11:42 -08:00
Mathias Agopian 48d438d05f add support for GL_EXT_debug_marker
This extension is always added to the GL_EXTENSIONS
extension string for the current GL context, regardless
of if it's supported by the h/w driver.

The extension itself will be handled by GLES_trace (eventually),
when GLES_trace is not enabled, it'll result to a no-op.

If the h/w implementation has this extension, we'll call that version
instead of our dummy version.

Change-Id: Ie5dd3387c4d45cd5ed5f03b73bda6045620a96bc
2012-01-29 22:22:09 -08:00
Steve Block e6f43ddce7 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: Ic9c19d30693bd56755f55906127cd6bd7126096c
2012-01-08 13:19:13 +00:00
Siva Velusamy 93a826f78f gltrace: transport buffering and context management
This patch adds two improvements:
1. Protobuf messages are buffered and sent in chunks.
2. Multiple EGL contexts are handled properly: Corresponding
to each EGLContext, a GLTraceContext with a unique ID is created.
On eglMakeCurrent, the appropriate GLTraceContext is set and is
used while tracing subsequent GL Calls in that thread.

Change-Id: I34076376d3e5af205c87c7396ea47659844abd6e
2012-01-04 11:38:37 -08:00
Steve Block 9d45368352 Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE
See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
2012-01-03 22:38:27 +00:00
Siva Velusamy 0469dd6d55 glestrace: Framework for GLES tracing library
This patch provides a framework for tracing GLES 1.0 and 2.0
functions. It is missing a lot of features, but here are the
things it accomplishes:

- Stop building the glesv2dbg library, and build the
    glestrace library instead.
- Replace the hooks for glesv2dbg with the ones for glestrace.
- Add the basics for the trace library. Currently, this
    traces all GL functions, but not all required data is
    sent for all the functions.  As a result, it will not
    be possible to reconstruct the entire GL state on the
    host side.

The files gltrace.pb.* and gltrace_api.* are both generated
using the tools/genapi.py script.

Change-Id: Id60a468f7278657f008bc6ea1df01f9bdfecfdd3
2011-12-02 15:30:17 -08:00
Mathias Agopian f0480de374 fix crash when validating an invalid EGL objects
the code that validated EGL objects dereferenced the object
to access its EGLDisplay -- needed for validation (!).
This was wrong for two reasons, first we dereferenced the object
before validating it (potentially leading to a crash), secondly
we didn't validate that the object existed in the right EGLDisplay.

We now use the EGLDisplay passed by the user API.

Change-Id: I66f9e851d4f8507892a6b1fee3065f124c4e7138
2011-11-14 17:40:21 -08:00
Mathias Agopian ecfe091af3 add an option to EGL to dump stack traces on errors
enable by setting debug.egl.callstack to 1

Change-Id: I7fad9ce71b4c4c5ece97d4f9d139348eab742a3c
2011-09-06 18:06:04 -07:00
Mathias Agopian ccfa5c3364 this should fix the GL debugger
we were checking against to the wrong variable

Change-Id: Iff3f5ab2d6ba5ac0d3d8161011b38e673ee7e67b
2011-09-01 14:55:00 -07:00
Romain Guy e03de93794 Always make GL calls with a valid EGL context.
Bug #5010760

Change-Id: If7500ef69683948e727df1406f458f18b11259d1
2011-07-11 15:33:51 -07:00
Mathias Agopian 1cadb25da1 fix x86 build
Change-Id: I03cfbfeaeb8b13842248856b14b4a23711036e10
2011-05-23 17:48:36 -07:00
Mathias Agopian 5b287a6ea8 eglTerminate() now actually frees up all active egl objects
as specified by the EGL specification, terminated objects's
handles become invalid, the objects themselves are destroyed
when they're not current to some thread.

Change-Id: Id3a4a5736a5bbc3926a9ae8385d43772edb88eeb
2011-05-16 19:03:33 -07:00
Mathias Agopian 518ec112f4 refactor EGL source code
no changes is functionality. split various objects into their own files.
make egl_display objec's lock internal.
2011-05-16 19:02:45 -07:00
Jamie Gennis 1b528fb9d8 EGL: Allow creating a SurfaceTexture EGLSurface.
This change removes the check that disallowed the creation of an
EGLSurface that would send frames to a SurfaceTexture.

Change-Id: I44c6d5df503cc676a88144d72d39b414692ce4c9
2011-04-25 16:41:11 -07:00
David Li 499c6f02e6 GLES2Dbg: use dump.gles2dbg file when fails to create socket
setprop debug.egl.debug_forceUseFile 1: always use file
setprop debug.egl.debug_maxFileSize <int MB>: exit when reached
setprop debug.egl.debug_filePath <path>: may need to make the file
 writable first.
setprop debug.egl.debug_port <unsigned short>
setprop debug.egl.debug_proc <proc cmdline>: to match debuggee process

Change-Id: I34ca1f3092f3abf17e2ded9d1689d0cdef6e07e8
Signed-off-by: David Li <davidxli@google.com>
2011-04-12 15:56:10 -07:00
David Li 864f839e96 GLES2Dbg: change GLES2_dbg to shared library
Change-Id: I493e9bff431bd939f4e80e1e9c614dd557307fa2
Signed-off-by: David Li <davidxli@google.com>
2011-04-12 15:56:10 -07:00
Eric Hassold 7fecf8c1ff Initialize reference counter for egl_display_t
Add missing member initialization for reference counter, used to determine
if a context is ready.

Change-Id: I45f81177ac2851129681f827afe015b60b3cd73c
2011-03-31 16:52:02 -07:00
Eric Hassold 11c01568c3 Make objects collection a member of egl_display object
Move EGL objects (contexts, surfaces, ...) collection from global
static into EGL display object. Since EGL implementation currently
supports only one display, this doesn't change current logic. This
aims at preparing for next coming changes in eglTerminate() to
support per-display cleanup.

Bug: 4152714
Change-Id: I5e424781b89c3c275f9922f943463d5f6b1f6bc6
2011-03-25 14:37:19 -07:00
Eric Hassold 3ede7c133a Check for initialized EGLDisplay when required by specification
Check for initialized display, and set EGL error to EGL_NOT_INITIALIZED
whenever it isn't, for all EGL functions taking an EGLDisplay as argument
and requiring it to have been initialized.

Bug: 3366011
Change-Id: Ib1d8a3a207257995518f4430fe97f8c406c7fc13
2011-03-23 15:59:00 -07:00
David Li 5a0d29009c Merge "GLES2Debugger: Make command exchange async to improve performance." 2011-03-17 14:38:37 -07:00
Mathias Agopian 7d7723d330 am 9405d987: am a05a8ac5: am af831a7b: Merge "fix [4107131] nvidia driver call takes a very long time" into honeycomb-mr1
* commit '9405d98705db1c8102b77ef960f344ac416d165c':
  fix [4107131] nvidia driver call takes a very long time
2011-03-16 16:03:24 -07:00
Mathias Agopian 36bdf14a75 fix [4107131] nvidia driver call takes a very long time
We were leaking all EGLSyncKHR objects, over time the list
would grow and become very slow to operate on.

Bug: 4107131
Change-Id: I6c82daf49fe3189d04550781d64d57c30c95f552
2011-03-16 14:19:03 -07:00
Jamie Gennis 9db01a7c1c am 0ea44ac0: am 00f47af8: Merge "SurfaceTexture: disallow unsupported uses." into honeycomb-mr1
* commit '0ea44ac0deb5cc95d60dd512c3a8f6a1bb69f5d1':
  SurfaceTexture: disallow unsupported uses.
2011-03-15 13:01:27 -07:00
Jamie Gennis 5c0c93a8c4 SurfaceTexture: disallow unsupported uses.
This change makes the ANativeWindow_lock NDK function error out if it is
passed an ANativeWindow with a concrete type that is not Surface.  It
also makes eglCreateWindowSurface fail if it is passed a
SurfaceTextureClient as its 'window' argument.

Bug: 4087277
Change-Id: Ie68c50c52d88f72d8a387f6c094908044c83a88c
2011-03-15 10:37:37 -07:00
David Li 85f33a7168 GLES2Debugger: Make command exchange async to improve performance.
In message loop, use select to check for available commands from client,
 rather than always expecting commands in eglSwapBuffers.

Change-Id: Ifc34dd77c2528c8b9c71f594e3eda4f93400cd2b
Signed-off-by: David Li <davidxli@google.com>
2011-03-11 11:09:09 -08:00
David Li 65948aa046 GLES2Debugger: Added DbgContext and vertex data capturing.
Send VBO related commands to client, which tracks the state.
Maintain index buffer content and vertex attrib pointer/buffer state on server.
During glDrawArrays/Elements, send user memory data to client.

Change-Id: Ia920e90479329b301ae4b5735e833eeb20293c94
Signed-off-by: David Li <davidxli@google.com>
2011-03-10 16:40:37 -08:00
David Li b33d5cff62 Added screenshot after glDraw* option to GLES2 Debugger
Also added timing mode option using utils/Timers.h.
Factored out common code to reduce size.
Improved Protobuf message.
Uploads data from glBufferData and glBufferSubData.

Change-Id: Iaae5e706235d942df81c7eada7223fb0b0583911
Signed-off-by: David Li <davidxli@google.com>
2011-03-04 17:50:48 -08:00
David Li 2f5a6557ef Initial commit of GLESv2 debugger server
Use debug.egl.debug_proc property to match process cmdline.
Binds to TCP:5039 and waits for client connection.
Sends function call parameters, textures and shaders using Protobuf.
Java Eclipse client plug-in is next.

Change-Id: I183b755263663f87e86dde1ad12f527d0445fd57
Signed-off-by: David Li <davidxli@google.com>
2011-03-03 18:28:43 -08:00
Kenny Root af1cf07134 Clean up use of HAVE_ANDROID_OS
HAVE_ANDROID_OS was defined as "1" for targets, but never defined as "0"
for non-targets. Changing them to #ifdef should be safe and matches
all the other uses of HAVE_ANDROID_OS throughout the system.

Change-Id: I82257325a8ae5e4e4371ddfc4dbf51cea8ea0abb
2011-02-16 10:56:32 -08:00
Jamie Gennis f1cde8e0ed Clear all EGL errors when entering EGL funcs.
This changes the clearError function in the EGL wrapper layer to simply
call eglGetError().  That should clear any pending errors from all the
underlying EGL implementations, which is needed to correctly report the
error for the most recently called EGL function.

Change-Id: Iad19c69f0c5305e873f3c2f96d353280d31f7b61
2011-01-31 14:08:23 -08:00