Commit 718ae508 by Ian Elliott Committed by Commit Bot

Vulkan: Always query EGL_WIDTH and EGL_HEIGHT

This fixes the failures of the dEQP EGL resize tests on Android. Those tests don't actually resize the window (which would allow the tests to pass), but do change internal Android Surface values that vkGetPhysicalDeviceSurfaceCapabilitiesKHR queries. Therefore, by freshly querying these values the test passes. Bug: b/153329980 Change-Id: Ie966f221bfaa14988c1503c7f5503f0b21476bcb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2165639Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 448b14bb
......@@ -457,6 +457,32 @@ EGLint Surface::getHeight() const
return mFixedSize ? static_cast<EGLint>(mFixedHeight) : mImplementation->getHeight();
}
egl::Error Surface::getUserWidth(const egl::Display *display, EGLint *value) const
{
if (mFixedSize)
{
*value = static_cast<EGLint>(mFixedWidth);
return NoError();
}
else
{
return mImplementation->getUserWidth(display, value);
}
}
egl::Error Surface::getUserHeight(const egl::Display *display, EGLint *value) const
{
if (mFixedSize)
{
*value = static_cast<EGLint>(mFixedHeight);
return NoError();
}
else
{
return mImplementation->getUserHeight(display, value);
}
}
Error Surface::bindTexImage(gl::Context *context, gl::Texture *texture, EGLint buffer)
{
ASSERT(!mTexture);
......
......@@ -107,6 +107,15 @@ class Surface : public LabeledObject, public gl::FramebufferAttachmentObject
// width and height can change with client window resizing
EGLint getWidth() const;
EGLint getHeight() const;
// Note: windows cannot be resized on Android. The approach requires
// calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR. However, that is
// expensive; and there are troublesome timing issues for other parts of
// ANGLE (which cause test failures and crashes). Therefore, a
// special-Android-only path is created just for the querying of EGL_WIDTH
// and EGL_HEIGHT.
// https://issuetracker.google.com/issues/153329980
egl::Error getUserWidth(const egl::Display *display, EGLint *value) const;
egl::Error getUserHeight(const egl::Display *display, EGLint *value) const;
EGLint getPixelAspectRatio() const;
EGLenum getRenderBuffer() const;
EGLenum getSwapBehavior() const;
......
......@@ -3964,7 +3964,10 @@ void QueryContextAttrib(const gl::Context *context, EGLint attribute, EGLint *va
}
}
void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value)
egl::Error QuerySurfaceAttrib(const Display *display,
const Surface *surface,
EGLint attribute,
EGLint *value)
{
switch (attribute)
{
......@@ -3981,7 +3984,7 @@ void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value)
*value = surface->getConfig()->configID;
break;
case EGL_HEIGHT:
*value = surface->getHeight();
ANGLE_TRY(surface->getUserHeight(display, value));
break;
case EGL_HORIZONTAL_RESOLUTION:
*value = surface->getHorizontalResolution();
......@@ -4037,7 +4040,7 @@ void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value)
*value = surface->getVerticalResolution();
break;
case EGL_WIDTH:
*value = surface->getWidth();
ANGLE_TRY(surface->getUserWidth(display, value));
break;
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
*value = surface->isPostSubBufferSupported();
......@@ -4064,6 +4067,7 @@ void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value)
UNREACHABLE();
break;
}
return NoError();
}
void SetSurfaceAttrib(Surface *surface, EGLint attribute, EGLint value)
......
......@@ -274,7 +274,10 @@ void QueryConfigAttrib(const Config *config, EGLint attribute, EGLint *value);
void QueryContextAttrib(const gl::Context *context, EGLint attribute, EGLint *value);
void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value);
egl::Error QuerySurfaceAttrib(const Display *display,
const Surface *surface,
EGLint attribute,
EGLint *value);
void SetSurfaceAttrib(Surface *surface, EGLint attribute, EGLint value);
Error GetSyncAttrib(Display *display, Sync *sync, EGLint attribute, EGLint *value);
......
......@@ -99,4 +99,16 @@ egl::Error SurfaceImpl::swapWithFrameToken(const gl::Context *context,
UNREACHABLE();
return egl::EglBadDisplay();
}
egl::Error SurfaceImpl::getUserWidth(const egl::Display *display, EGLint *value) const
{
*value = getWidth();
return egl::NoError();
}
egl::Error SurfaceImpl::getUserHeight(const egl::Display *display, EGLint *value) const
{
*value = getHeight();
return egl::NoError();
}
} // namespace rx
......@@ -79,6 +79,15 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl
// width and height can change with client window resizing
virtual EGLint getWidth() const = 0;
virtual EGLint getHeight() const = 0;
// Note: windows cannot be resized on Android. The approach requires
// calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR. However, that is
// expensive; and there are troublesome timing issues for other parts of
// ANGLE (which cause test failures and crashes). Therefore, a
// special-Android-only path is created just for the querying of EGL_WIDTH
// and EGL_HEIGHT.
// https://issuetracker.google.com/issues/153329980
virtual egl::Error getUserWidth(const egl::Display *display, EGLint *value) const;
virtual egl::Error getUserHeight(const egl::Display *display, EGLint *value) const;
virtual EGLint isPostSubBufferSupported() const = 0;
virtual EGLint getSwapBehavior() const = 0;
......
......@@ -1441,6 +1441,45 @@ EGLint WindowSurfaceVk::getHeight() const
return static_cast<EGLint>(mColorRenderTarget.getExtents().height);
}
egl::Error WindowSurfaceVk::getUserWidth(const egl::Display *display, EGLint *value) const
{
DisplayVk *displayVk = vk::GetImpl(display);
VkSurfaceCapabilitiesKHR surfaceCaps;
angle::Result result = getUserExtentsImpl(displayVk, &surfaceCaps);
if (result == angle::Result::Continue)
{
// The EGL spec states that value is not written if there is an error
*value = static_cast<EGLint>(surfaceCaps.currentExtent.width);
}
return angle::ToEGL(result, displayVk, EGL_BAD_SURFACE);
}
egl::Error WindowSurfaceVk::getUserHeight(const egl::Display *display, EGLint *value) const
{
DisplayVk *displayVk = vk::GetImpl(display);
VkSurfaceCapabilitiesKHR surfaceCaps;
angle::Result result = getUserExtentsImpl(displayVk, &surfaceCaps);
if (result == angle::Result::Continue)
{
// The EGL spec states that value is not written if there is an error
*value = static_cast<EGLint>(surfaceCaps.currentExtent.height);
}
return angle::ToEGL(result, displayVk, EGL_BAD_SURFACE);
}
angle::Result WindowSurfaceVk::getUserExtentsImpl(DisplayVk *displayVk,
VkSurfaceCapabilitiesKHR *surfaceCaps) const
{
const VkPhysicalDevice &physicalDevice = displayVk->getRenderer()->getPhysicalDevice();
ANGLE_VK_TRY(displayVk,
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, mSurface, surfaceCaps));
return angle::Result::Continue;
}
EGLint WindowSurfaceVk::isPostSubBufferSupported() const
{
// TODO(jmadill)
......
......@@ -214,6 +214,17 @@ class WindowSurfaceVk : public SurfaceVk
// width and height can change with client window resizing
EGLint getWidth() const override;
EGLint getHeight() const override;
// Note: windows cannot be resized on Android. The approach requires
// calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR. However, that is
// expensive; and there are troublesome timing issues for other parts of
// ANGLE (which cause test failures and crashes). Therefore, a
// special-Android-only path is created just for the querying of EGL_WIDTH
// and EGL_HEIGHT.
// https://issuetracker.google.com/issues/153329980
egl::Error getUserWidth(const egl::Display *display, EGLint *value) const override;
egl::Error getUserHeight(const egl::Display *display, EGLint *value) const override;
angle::Result getUserExtentsImpl(DisplayVk *displayVk,
VkSurfaceCapabilitiesKHR *surfaceCaps) const;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
......
......@@ -353,7 +353,8 @@ EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
ANGLE_EGL_TRY_RETURN(thread, ValidateQuerySurface(display, eglSurface, attribute, value),
"eglQuerySurface", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
QuerySurfaceAttrib(eglSurface, attribute, value);
ANGLE_EGL_TRY_RETURN(thread, QuerySurfaceAttrib(display, eglSurface, attribute, value),
"eglQuerySurface", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
......
......@@ -113,7 +113,6 @@
1340 WIN : dEQP-EGL.functional.resize.pixel_density.* = SKIP
// Windows OpenGL failures
2546 WIN : dEQP-EGL.functional.resize.surface_size.shrink = SKIP
2546 WIN : dEQP-EGL.functional.query_surface.simple.pbuffer.rgba8888_depth_stencil = FAIL
2546 WIN : dEQP-EGL.functional.thread_cleanup.* = SKIP
......@@ -129,9 +128,6 @@
2715 WIN VULKAN : dEQP-EGL.functional.query_surface.simple.pbuffer.rgb888_no_depth_no_stencil = FAIL
2715 WIN VULKAN : dEQP-EGL.functional.query_surface.simple.pbuffer.rgba8888_depth_no_stencil = FAIL
2715 WIN VULKAN : dEQP-EGL.functional.query_surface.simple.pbuffer.rgba8888_no_depth_no_stencil = FAIL
2635 WIN VULKAN : dEQP-EGL.functional.resize.surface_size.grow = FAIL
2635 WIN VULKAN : dEQP-EGL.functional.resize.surface_size.stretch_height = FAIL
2635 WIN VULKAN : dEQP-EGL.functional.resize.surface_size.stretch_width = FAIL
2716 WIN VULKAN : dEQP-EGL.functional.preserve_swap.no_preserve.* = FAIL
// Linux failures
......@@ -252,4 +248,4 @@
2546 NEXUS5X : dEQP-EGL.functional.query_context.query_context.* = SKIP
// SwANGLE bots
4495 WIN SWIFTSHADER : dEQP-EGL.functional.sharing.gles2.multithread.random_egl_server_sync.shaders.compile.9 = SKIP
\ No newline at end of file
4495 WIN SWIFTSHADER : dEQP-EGL.functional.sharing.gles2.multithread.random_egl_server_sync.shaders.compile.9 = SKIP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment