[MG_Remote, MG_Impl, MG_State, Config] (P12): MOBILEGL_IPC_SURFACE=server - headless window surfaces (NULL accepted), one ServerOwned CreateWindowSurface and no SetWindowHandle, the server's geometry into the EGL state before the create returns, and every refusal named on the client

This commit is contained in:
2026-09-23 23:55:23 -04:00
parent 844b217661
commit d481393f8f
10 changed files with 627 additions and 3 deletions
+47
View File
@@ -1056,6 +1056,53 @@ namespace MobileGL {
return true;
}
#if MOBILEGL_BUILD_DISAGGREGATED
// P12 (on-screen server window). See Core.h. Split builds only (G1).
EGLContext::EGLSurfaceHandle EGLContext::CreateServerOwnedWindowSurface(EGLDisplayHandle display,
EGLConfigHandle config,
const void* nativeWindow,
EGLint width, EGLint height,
Bool platformWindow) {
const std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (!IsDisplayInitialized(display)) {
SetError(EGL_NOT_INITIALIZED);
return EGL_NO_SURFACE;
}
if (!ValidateConfigOnDisplay(display, config)) {
SetError(EGL_BAD_CONFIG);
return EGL_NO_SURFACE;
}
if (width < 0 || height < 0) {
SetError(EGL_BAD_ATTRIBUTE);
return EGL_NO_SURFACE;
}
// No EGL_BAD_NATIVE_WINDOW for a null window: the window is the server's.
const auto surface = EncodeHandle<EGLSurfaceHandle>(m_nextSurfaceHandle++);
m_surfaces[surface] = SurfaceObject{
.Display = display,
.Config = config,
.Type = platformWindow ? SurfaceType::PlatformWindow : SurfaceType::Window,
.NativeHandleKey = ToNativeKey(nativeWindow),
.ClientBuffer = nullptr,
.BufferType = EGL_NONE,
.Width = width,
.Height = height,
};
return surface;
}
Bool EGLContext::SetSurfaceExtent(EGLSurfaceHandle surface, EGLint width, EGLint height) {
const std::lock_guard<std::recursive_mutex> lock(m_mutex);
auto surfaceIt = m_surfaces.find(surface);
if (surfaceIt == m_surfaces.end() || width < 0 || height < 0) {
return false;
}
surfaceIt->second.Width = width;
surfaceIt->second.Height = height;
return true;
}
#endif
Bool EGLContext::QuerySurface(EGLDisplayHandle display, EGLSurfaceHandle surface, EGLint attribute,
EGLint* value) const {
const std::lock_guard<std::recursive_mutex> lock(m_mutex);
+16
View File
@@ -87,6 +87,22 @@ namespace MobileGL {
Bool ValidateSurface(EGLSurfaceHandle surface) const;
Bool ValidateSurfaceOnDisplay(EGLDisplayHandle display, EGLSurfaceHandle surface) const;
Bool SwapInterval(EGLDisplayHandle display, EGLint interval);
#if MOBILEGL_BUILD_DISAGGREGATED
// P12 (on-screen server window), MOBILEGL_IPC_SURFACE=server. A window surface whose
// window is the SERVER's: the client's native window may be NULL (a headless client
// has none), and the extent it asked for (EGL_WIDTH/EGL_HEIGHT; 0/0 = the server
// window's own) stands until the server's real one arrives through SetSurfaceExtent.
// `platformWindow` keeps eglCreatePlatformWindowSurface's surface type. Split builds
// only: the pull build's state class is unchanged (G1).
EGLSurfaceHandle CreateServerOwnedWindowSurface(EGLDisplayHandle display, EGLConfigHandle config,
const void* nativeWindow, EGLint width,
EGLint height, Bool platformWindow);
// P12: the server's REAL extent of a surface - a server-owned window's geometry, from
// the CreateWindowSurface reply and from every surface-changed event after it - so
// eglQuerySurface(EGL_WIDTH/EGL_HEIGHT) answers what the server renders at. Unlike
// ResizeSurface it needs no display (the event carries none) and keeps a 0 as 0.
Bool SetSurfaceExtent(EGLSurfaceHandle surface, EGLint width, EGLint height);
#endif
// Current
Bool MakeCurrent(EGLDisplayHandle display, EGLSurfaceHandle draw, EGLSurfaceHandle read,