Bug 144685 - [EGL] Move EGLDisplay handling to PlatformDisplay and remove PlatformDisplay definition from GLDefs.h
Summary: [EGL] Move EGLDisplay handling to PlatformDisplay and remove PlatformDisplay ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks: 144521
  Show dependency treegraph
 
Reported: 2015-05-06 06:36 PDT by Carlos Garcia Campos
Modified: 2015-05-06 09:08 PDT (History)
4 users (show)

See Also:


Attachments
Patch (18.39 KB, patch)
2015-05-06 06:44 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Try to fix EFL build (24.76 KB, patch)
2015-05-06 07:00 PDT, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff
Patch for landing (25.54 KB, patch)
2015-05-06 08:32 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch for landing (25.92 KB, patch)
2015-05-06 08:35 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch for landing (26.78 KB, patch)
2015-05-06 08:39 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2015-05-06 06:36:23 PDT
And remove the PlatformDisplay definition from platform/graphics/opengl/GLDefs.h. The EGL display is also initialized in multiple places, and could be unified in PlatformDisplay.
Comment 1 Carlos Garcia Campos 2015-05-06 06:44:11 PDT
Created attachment 252469 [details]
Patch
Comment 2 Carlos Garcia Campos 2015-05-06 07:00:33 PDT
Created attachment 252470 [details]
Try to fix EFL build
Comment 3 Martin Robinson 2015-05-06 07:54:48 PDT
Comment on attachment 252470 [details]
Try to fix EFL build

View in context: https://bugs.webkit.org/attachment.cgi?id=252470&action=review

> Source/WebCore/platform/graphics/PlatformDisplay.cpp:139
> +#if USE(OPENGL_ES_2)
> +    static const EGLenum eglAPIVersion = EGL_OPENGL_ES_API;
> +#else
> +    static const EGLenum eglAPIVersion = EGL_OPENGL_API;
> +#endif
> +    if (eglBindAPI(eglAPIVersion) == EGL_FALSE) {
> +        LOG_ERROR("Failed to set EGL API(%d).", eglGetError());
> +        terminateEGLDisplay();
> +        return;
> +    }

This needs to be called once per program, not once per display. Perhaps you could surround this with std::once.

> Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp:153
> -    m_glxPixmap = glXCreateGLXPixmap(m_sharedDisplay, visualInfo.get(), m_pixmap);
> +    m_glxPixmap = glXCreateGLXPixmap(X11Helper::nativeDisplay(), visualInfo.get(), m_pixmap);

This is GLX-related, so perhaps you could update the bug title and ChangeLog slightly?
Comment 4 Carlos Garcia Campos 2015-05-06 08:25:28 PDT
(In reply to comment #3)
> Comment on attachment 252470 [details]
> Try to fix EFL build
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=252470&action=review
> 
> > Source/WebCore/platform/graphics/PlatformDisplay.cpp:139
> > +#if USE(OPENGL_ES_2)
> > +    static const EGLenum eglAPIVersion = EGL_OPENGL_ES_API;
> > +#else
> > +    static const EGLenum eglAPIVersion = EGL_OPENGL_API;
> > +#endif
> > +    if (eglBindAPI(eglAPIVersion) == EGL_FALSE) {
> > +        LOG_ERROR("Failed to set EGL API(%d).", eglGetError());
> > +        terminateEGLDisplay();
> > +        return;
> > +    }
> 
> This needs to be called once per program, not once per display. Perhaps you
> could surround this with std::once.

Display is already a single instance, so this will be called only once per display, per process.

> > Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp:153
> > -    m_glxPixmap = glXCreateGLXPixmap(m_sharedDisplay, visualInfo.get(), m_pixmap);
> > +    m_glxPixmap = glXCreateGLXPixmap(X11Helper::nativeDisplay(), visualInfo.get(), m_pixmap);
> 
> This is GLX-related, so perhaps you could update the bug title and ChangeLog
> slightly?

But nothing has actually changed here, I can add and remove PlatformDisplay from GLDefs.h
Comment 5 Martin Robinson 2015-05-06 08:31:21 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > Comment on attachment 252470 [details]
> > Try to fix EFL build
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=252470&action=review
> > 
> > > Source/WebCore/platform/graphics/PlatformDisplay.cpp:139
> > > +#if USE(OPENGL_ES_2)
> > > +    static const EGLenum eglAPIVersion = EGL_OPENGL_ES_API;
> > > +#else
> > > +    static const EGLenum eglAPIVersion = EGL_OPENGL_API;
> > > +#endif
> > > +    if (eglBindAPI(eglAPIVersion) == EGL_FALSE) {
> > > +        LOG_ERROR("Failed to set EGL API(%d).", eglGetError());
> > > +        terminateEGLDisplay();
> > > +        return;
> > > +    }
> > 
> > This needs to be called once per program, not once per display. Perhaps you
> > could surround this with std::once.
> 
> Display is already a single instance, so this will be called only once per
> display, per process.

eglBindAPI isn't supposed to be called once per-display. I supposed to be called once.

> 
> > > Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp:153
> > > -    m_glxPixmap = glXCreateGLXPixmap(m_sharedDisplay, visualInfo.get(), m_pixmap);
> > > +    m_glxPixmap = glXCreateGLXPixmap(X11Helper::nativeDisplay(), visualInfo.get(), m_pixmap);
> > 
> > This is GLX-related, so perhaps you could update the bug title and ChangeLog
> > slightly?
> 
> But nothing has actually changed here, I can add and remove PlatformDisplay
> from GLDefs.h

I'm not sure I understand what you mean, but the change is so small that you can probably skip mentioning GLX in the ChangeLog if you don't think it matters.
Comment 6 Carlos Garcia Campos 2015-05-06 08:32:02 PDT
Created attachment 252475 [details]
Patch for landing
Comment 7 Carlos Garcia Campos 2015-05-06 08:35:26 PDT
Created attachment 252476 [details]
Patch for landing
Comment 8 Carlos Garcia Campos 2015-05-06 08:39:28 PDT
Created attachment 252478 [details]
Patch for landing
Comment 9 Carlos Garcia Campos 2015-05-06 08:46:51 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Comment on attachment 252470 [details]
> > > Try to fix EFL build
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=252470&action=review
> > > 
> > > > Source/WebCore/platform/graphics/PlatformDisplay.cpp:139
> > > > +#if USE(OPENGL_ES_2)
> > > > +    static const EGLenum eglAPIVersion = EGL_OPENGL_ES_API;
> > > > +#else
> > > > +    static const EGLenum eglAPIVersion = EGL_OPENGL_API;
> > > > +#endif
> > > > +    if (eglBindAPI(eglAPIVersion) == EGL_FALSE) {
> > > > +        LOG_ERROR("Failed to set EGL API(%d).", eglGetError());
> > > > +        terminateEGLDisplay();
> > > > +        return;
> > > > +    }
> > > 
> > > This needs to be called once per program, not once per display. Perhaps you
> > > could surround this with std::once.
> > 
> > Display is already a single instance, so this will be called only once per
> > display, per process.
> 
> eglBindAPI isn't supposed to be called once per-display. I supposed to be
> called once.

There's only one display, so it will be called once. Anyway, I've moved the egl initializations repeated in several places here, so if it was wrong it can be fixed in a follow up patch, this patch shouldn't change any behaviour. But I insist, this is called only once per process.
Comment 10 Martin Robinson 2015-05-06 08:47:52 PDT
(In reply to comment #9)

> There's only one display, so it will be called once. Anyway, I've moved the
> egl initializations repeated in several places here, so if it was wrong it
> can be fixed in a follow up patch, this patch shouldn't change any
> behaviour. But I insist, this is called only once per process.

Okay. I misunderstood what you wrote earlier. Sorry about that. This sounds fine.
Comment 11 Carlos Garcia Campos 2015-05-06 09:08:01 PDT
Committed r183868: <http://trac.webkit.org/changeset/183868>