Hash :
22fc9523
Author :
Date :
2021-02-03T15:32:48
EGL: implement EGL_EXT_buffer_age Add extension flag. Add Validation check to surface query. Enable extension for vulkan. Modify AcquireNextImage to ++frame count and tag images with frame number. Buffer age is the difference between current frame count and the tagged frame number on the buffer. getBuffeAge may need to trigger AcquireNextImage to be current. Pass through egl extension and query. Add EGLBufferAgeTest Test: angle_end2end_test --gtest_filter=EGLBufferAgeTest Test: angle_deqp_egl_tests --deqp-case=dEQP-EGL.functional.buffer_age.* Bug: angleproject:3529 Change-Id: I0cb94be1c3e85d6f33e82a6a1ccdc9731b6a7f23 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2684724 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// WindowSurfaceEGL.h: EGL implementation of egl::Surface for windows
#include "libANGLE/renderer/gl/egl/WindowSurfaceEGL.h"
#include "libANGLE/Surface.h"
#include "libANGLE/renderer/gl/egl/egl_utils.h"
namespace rx
{
WindowSurfaceEGL::WindowSurfaceEGL(const egl::SurfaceState &state,
const FunctionsEGL *egl,
EGLConfig config,
EGLNativeWindowType window)
: SurfaceEGL(state, egl, config), mWindow(window)
{}
WindowSurfaceEGL::~WindowSurfaceEGL() {}
egl::Error WindowSurfaceEGL::initialize(const egl::Display *display)
{
constexpr EGLint kForwardedWindowSurfaceAttributes[] = {
EGL_RENDER_BUFFER, EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_GL_COLORSPACE,
EGL_COLOR_COMPONENT_TYPE_EXT};
native_egl::AttributeVector nativeAttribs =
native_egl::TrimAttributeMap(mState.attributes, kForwardedWindowSurfaceAttributes);
native_egl::FinalizeAttributeVector(&nativeAttribs);
mSurface = mEGL->createWindowSurface(mConfig, mWindow, nativeAttribs.data());
if (mSurface == EGL_NO_SURFACE)
{
return egl::Error(mEGL->getError(), "eglCreateWindowSurface failed");
}
return egl::NoError();
}
egl::Error WindowSurfaceEGL::getBufferAge(const gl::Context *context, EGLint *age)
{
ANGLE_UNUSED_VARIABLE(context);
EGLBoolean result = mEGL->querySurface(mSurface, EGL_BUFFER_AGE_EXT, age);
if (result == EGL_FALSE)
{
return egl::Error(mEGL->getError(), "eglQuerySurface for EGL_BUFFER_AGE_EXT failed");
}
return egl::NoError();
}
} // namespace rx