Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
monado
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
monado
Commits
3a537b83
Commit
3a537b83
authored
3 years ago
by
Jakob Bornecrantz
Committed by
Jakob Bornecrantz
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
c/client: Tidy EGL code (NFC)
parent
12489295
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/xrt/compositor/client/comp_egl_glue.c
+71
-51
71 additions, 51 deletions
src/xrt/compositor/client/comp_egl_glue.c
with
71 additions
and
51 deletions
src/xrt/compositor/client/comp_egl_glue.c
+
71
−
51
View file @
3a537b83
...
@@ -32,6 +32,13 @@
...
@@ -32,6 +32,13 @@
#error "This file shouldn't be compiled without EGL"
#error "This file shouldn't be compiled without EGL"
#endif
#endif
/*
*
* Logging.
*
*/
static
enum
u_logging_level
ll
;
static
enum
u_logging_level
ll
;
#define EGL_TRACE(...) U_LOG_IFL_T(ll, __VA_ARGS__)
#define EGL_TRACE(...) U_LOG_IFL_T(ll, __VA_ARGS__)
...
@@ -43,6 +50,12 @@ static enum u_logging_level ll;
...
@@ -43,6 +50,12 @@ static enum u_logging_level ll;
DEBUG_GET_ONCE_LOG_OPTION
(
egl_log
,
"EGL_LOG"
,
U_LOGGING_INFO
)
DEBUG_GET_ONCE_LOG_OPTION
(
egl_log
,
"EGL_LOG"
,
U_LOGGING_INFO
)
/*
*
* Declarations.
*
*/
#ifdef XRT_OS_ANDROID
#ifdef XRT_OS_ANDROID
typedef
const
char
*
EGLAPIENTRY
(
*
PFNEGLQUERYSTRINGIMPLEMENTATIONANDROIDPROC
)(
EGLDisplay
dpy
,
EGLint
name
);
typedef
const
char
*
EGLAPIENTRY
(
*
PFNEGLQUERYSTRINGIMPLEMENTATIONANDROIDPROC
)(
EGLDisplay
dpy
,
EGLint
name
);
#endif
#endif
...
@@ -51,6 +64,64 @@ typedef const char *EGLAPIENTRY (*PFNEGLQUERYSTRINGIMPLEMENTATIONANDROIDPROC)(EG
...
@@ -51,6 +64,64 @@ typedef const char *EGLAPIENTRY (*PFNEGLQUERYSTRINGIMPLEMENTATIONANDROIDPROC)(EG
typedef
EGLBoolean
typedef
EGLBoolean
EGLAPIENTRY
(
*
PFNEGLMAKECURRENTPROC
)(
EGLDisplay
dpy
,
EGLSurface
draw
,
EGLSurface
read
,
EGLContext
ctx
);
EGLAPIENTRY
(
*
PFNEGLMAKECURRENTPROC
)(
EGLDisplay
dpy
,
EGLSurface
draw
,
EGLSurface
read
,
EGLContext
ctx
);
/*
*
* Old helper.
*
*/
struct
old_helper
{
EGLDisplay
dpy
;
EGLContext
ctx
;
EGLSurface
read
,
draw
;
};
static
inline
struct
old_helper
old_save
(
void
)
{
struct
old_helper
old
=
{
.
dpy
=
eglGetCurrentDisplay
(),
.
ctx
=
EGL_NO_CONTEXT
,
.
read
=
EGL_NO_SURFACE
,
.
draw
=
EGL_NO_SURFACE
,
};
// Do we have a valid display?
if
(
old
.
dpy
!=
EGL_NO_DISPLAY
)
{
old
.
ctx
=
eglGetCurrentContext
();
old
.
read
=
eglGetCurrentSurface
(
EGL_READ
);
old
.
draw
=
eglGetCurrentSurface
(
EGL_DRAW
);
}
return
old
;
}
static
inline
void
old_restore
(
struct
old_helper
*
old
,
EGLDisplay
current_dpy
)
{
if
(
old
->
dpy
==
EGL_NO_DISPLAY
)
{
// There were no display, just unbind the context.
if
(
eglMakeCurrent
(
current_dpy
,
EGL_NO_CONTEXT
,
EGL_NO_SURFACE
,
EGL_NO_SURFACE
))
{
return
;
}
}
else
{
if
(
eglMakeCurrent
(
old
->
dpy
,
old
->
draw
,
old
->
read
,
old
->
ctx
))
{
return
;
}
}
EGL_ERROR
(
"Failed to make old EGL context current! (%p, %p, %p, %p)"
,
old
->
dpy
,
old
->
draw
,
old
->
read
,
old
->
ctx
);
}
/*
*
* EGL compositor subclass.
*
*/
/*!
/*!
* EGL based compositor.
* EGL based compositor.
*/
*/
...
@@ -127,57 +198,6 @@ ensure_native_fence_is_loaded(EGLDisplay dpy, PFNEGLGETPROCADDRESSPROC get_gl_pr
...
@@ -127,57 +198,6 @@ ensure_native_fence_is_loaded(EGLDisplay dpy, PFNEGLGETPROCADDRESSPROC get_gl_pr
}
}
/*
*
* Old helper.
*
*/
struct
old_helper
{
EGLDisplay
dpy
;
EGLContext
ctx
;
EGLSurface
read
,
draw
;
};
static
inline
struct
old_helper
old_save
(
void
)
{
struct
old_helper
old
=
{
.
dpy
=
eglGetCurrentDisplay
(),
.
ctx
=
EGL_NO_CONTEXT
,
.
read
=
EGL_NO_SURFACE
,
.
draw
=
EGL_NO_SURFACE
,
};
// Do we have a valid display?
if
(
old
.
dpy
!=
EGL_NO_DISPLAY
)
{
old
.
ctx
=
eglGetCurrentContext
();
old
.
read
=
eglGetCurrentSurface
(
EGL_READ
);
old
.
draw
=
eglGetCurrentSurface
(
EGL_DRAW
);
}
return
old
;
}
static
inline
void
old_restore
(
struct
old_helper
*
old
,
EGLDisplay
current_dpy
)
{
if
(
old
->
dpy
==
EGL_NO_DISPLAY
)
{
// There were no display, just unbind the context.
if
(
eglMakeCurrent
(
current_dpy
,
EGL_NO_CONTEXT
,
EGL_NO_SURFACE
,
EGL_NO_SURFACE
))
{
return
;
}
}
else
{
if
(
eglMakeCurrent
(
old
->
dpy
,
old
->
draw
,
old
->
read
,
old
->
ctx
))
{
return
;
}
}
EGL_ERROR
(
"Failed to make old EGL context current! (%p, %p, %p, %p)"
,
old
->
dpy
,
old
->
draw
,
old
->
read
,
old
->
ctx
);
}
/*
/*
*
*
* Functions.
* Functions.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment