Commit b6009f64 by Gert Wollny Committed by Angle LUCI CQ

Capture/Replay: Add feature for robust resource init

Query the feature when creating the display and the context, and pass the flag to the created context and also to durfaces. With that we create surfaces that will be marked "MayNeedInit" and are initialized if the resource is cleared or invalidated. Bug: angleproject:6041 Change-Id: I292f2e3f931736a18db93695441407e17d2265b6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2976656 Commit-Queue: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent 13ac4dfb
......@@ -76,6 +76,10 @@ struct FrontendFeatures : angle::FeatureSetBase
angle::Feature enableCompressingPipelineCacheInThreadPool = {
"enableCompressingPipelineCacheInThreadPool", angle::FeatureCategory::FrontendWorkarounds,
"Enable compressing pipeline cache in thread pool.", &members, "http://anglebug.com/4722"};
angle::Feature forceRobustResourceInit = {
"forceRobustResourceInit", angle::FeatureCategory::FrontendWorkarounds,
"Force-enable robust resource init", &members, "http://anglebug.com/6041"};
};
inline FrontendFeatures::FrontendFeatures() = default;
......
......@@ -211,9 +211,11 @@ bool GetClientArraysEnabled(const egl::AttributeMap &attribs)
return (attribs.get(EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE, EGL_TRUE) == EGL_TRUE);
}
bool GetRobustResourceInit(const egl::AttributeMap &attribs)
bool GetRobustResourceInit(egl::Display *display, const egl::AttributeMap &attribs)
{
return (attribs.get(EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE, EGL_FALSE) == EGL_TRUE);
const angle::FrontendFeatures &frontendFeatures = display->getFrontendFeatures();
return (frontendFeatures.forceRobustResourceInit.enabled ||
attribs.get(EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE, EGL_FALSE) == EGL_TRUE);
}
EGLenum GetContextPriority(const egl::AttributeMap &attribs)
......@@ -325,7 +327,7 @@ Context::Context(egl::Display *display,
GetDebug(attribs),
GetBindGeneratesResource(attribs),
GetClientArraysEnabled(attribs),
GetRobustResourceInit(attribs),
GetRobustResourceInit(display, attribs),
memoryProgramCache != nullptr,
GetContextPriority(attribs)),
mShared(shareContext != nullptr),
......
......@@ -1020,7 +1020,8 @@ Error Display::createWindowSurface(const Config *configuration,
ANGLE_TRY(restoreLostDevice());
}
SurfacePointer surface(new WindowSurface(mImplementation, configuration, window, attribs),
SurfacePointer surface(new WindowSurface(mImplementation, configuration, window, attribs,
mFrontendFeatures.forceRobustResourceInit.enabled),
this);
ANGLE_TRY(surface->initialize(this));
......@@ -1048,7 +1049,9 @@ Error Display::createPbufferSurface(const Config *configuration,
ANGLE_TRY(restoreLostDevice());
}
SurfacePointer surface(new PbufferSurface(mImplementation, configuration, attribs), this);
SurfacePointer surface(new PbufferSurface(mImplementation, configuration, attribs,
mFrontendFeatures.forceRobustResourceInit.enabled),
this);
ANGLE_TRY(surface->initialize(this));
ASSERT(outSurface != nullptr);
......@@ -1072,7 +1075,9 @@ Error Display::createPbufferFromClientBuffer(const Config *configuration,
}
SurfacePointer surface(
new PbufferSurface(mImplementation, configuration, buftype, clientBuffer, attribs), this);
new PbufferSurface(mImplementation, configuration, buftype, clientBuffer, attribs,
mFrontendFeatures.forceRobustResourceInit.enabled),
this);
ANGLE_TRY(surface->initialize(this));
ASSERT(outSurface != nullptr);
......@@ -1094,7 +1099,8 @@ Error Display::createPixmapSurface(const Config *configuration,
ANGLE_TRY(restoreLostDevice());
}
SurfacePointer surface(new PixmapSurface(mImplementation, configuration, nativePixmap, attribs),
SurfacePointer surface(new PixmapSurface(mImplementation, configuration, nativePixmap, attribs,
mFrontendFeatures.forceRobustResourceInit.enabled),
this);
ANGLE_TRY(surface->initialize(this));
......
......@@ -51,6 +51,7 @@ bool SurfaceState::isRobustResourceInitEnabled() const
Surface::Surface(EGLint surfaceType,
const egl::Config *config,
const AttributeMap &attributes,
bool forceRobustResourceInit,
EGLenum buftype)
: FramebufferAttachmentObject(),
mState(config, attributes),
......@@ -108,6 +109,7 @@ Surface::Surface(EGLint surfaceType,
mMipmapTexture = (attributes.get(EGL_MIPMAP_TEXTURE, EGL_FALSE) == EGL_TRUE);
mRobustResourceInitialization =
forceRobustResourceInit ||
(attributes.get(EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE, EGL_FALSE) == EGL_TRUE);
if (mRobustResourceInitialization)
{
......@@ -677,8 +679,9 @@ void Surface::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMess
WindowSurface::WindowSurface(rx::EGLImplFactory *implFactory,
const egl::Config *config,
EGLNativeWindowType window,
const AttributeMap &attribs)
: Surface(EGL_WINDOW_BIT, config, attribs)
const AttributeMap &attribs,
bool robustResourceInit)
: Surface(EGL_WINDOW_BIT, config, attribs, robustResourceInit)
{
mImplementation = implFactory->createWindowSurface(mState, window, attribs);
}
......@@ -687,8 +690,9 @@ WindowSurface::~WindowSurface() {}
PbufferSurface::PbufferSurface(rx::EGLImplFactory *implFactory,
const Config *config,
const AttributeMap &attribs)
: Surface(EGL_PBUFFER_BIT, config, attribs)
const AttributeMap &attribs,
bool robustResourceInit)
: Surface(EGL_PBUFFER_BIT, config, attribs, robustResourceInit)
{
mImplementation = implFactory->createPbufferSurface(mState, attribs);
}
......@@ -697,8 +701,9 @@ PbufferSurface::PbufferSurface(rx::EGLImplFactory *implFactory,
const Config *config,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const AttributeMap &attribs)
: Surface(EGL_PBUFFER_BIT, config, attribs, buftype)
const AttributeMap &attribs,
bool robustResourceInit)
: Surface(EGL_PBUFFER_BIT, config, attribs, robustResourceInit, buftype)
{
mImplementation =
implFactory->createPbufferFromClientBuffer(mState, buftype, clientBuffer, attribs);
......@@ -709,8 +714,9 @@ PbufferSurface::~PbufferSurface() {}
PixmapSurface::PixmapSurface(rx::EGLImplFactory *implFactory,
const Config *config,
NativePixmapType nativePixmap,
const AttributeMap &attribs)
: Surface(EGL_PIXMAP_BIT, config, attribs)
const AttributeMap &attribs,
bool robustResourceInit)
: Surface(EGL_PIXMAP_BIT, config, attribs, robustResourceInit)
{
mImplementation = implFactory->createPixmapSurface(mState, nativePixmap, attribs);
}
......
......@@ -192,6 +192,7 @@ class Surface : public LabeledObject, public gl::FramebufferAttachmentObject
Surface(EGLint surfaceType,
const egl::Config *config,
const AttributeMap &attributes,
bool forceRobustResourceInit,
EGLenum buftype = EGL_NONE);
~Surface() override;
rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override;
......@@ -266,7 +267,8 @@ class WindowSurface final : public Surface
WindowSurface(rx::EGLImplFactory *implFactory,
const Config *config,
EGLNativeWindowType window,
const AttributeMap &attribs);
const AttributeMap &attribs,
bool robustResourceInit);
~WindowSurface() override;
};
......@@ -275,12 +277,14 @@ class PbufferSurface final : public Surface
public:
PbufferSurface(rx::EGLImplFactory *implFactory,
const Config *config,
const AttributeMap &attribs);
const AttributeMap &attribs,
bool robustResourceInit);
PbufferSurface(rx::EGLImplFactory *implFactory,
const Config *config,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const AttributeMap &attribs);
const AttributeMap &attribs,
bool robustResourceInit);
protected:
~PbufferSurface() override;
......@@ -292,7 +296,8 @@ class PixmapSurface final : public Surface
PixmapSurface(rx::EGLImplFactory *implFactory,
const Config *config,
NativePixmapType nativePixmap,
const AttributeMap &attribs);
const AttributeMap &attribs,
bool robustResourceInit);
protected:
~PixmapSurface() override;
......
......@@ -66,7 +66,7 @@ TEST(SurfaceTest, DestructionDeletesImpl)
egl::Config config;
egl::Surface *surface = new egl::WindowSurface(
&factory, &config, static_cast<EGLNativeWindowType>(0), egl::AttributeMap());
&factory, &config, static_cast<EGLNativeWindowType>(0), egl::AttributeMap(), false);
EXPECT_CALL(*impl, destroy(_)).Times(1).RetiresOnSaturation();
EXPECT_CALL(*impl, destructor()).Times(1).RetiresOnSaturation();
......
......@@ -509,6 +509,7 @@ class TestBatch():
env = os.environ.copy()
env['ANGLE_CAPTURE_FRAME_END'] = '{}'.format(self.CAPTURE_FRAME_END)
env['ANGLE_CAPTURE_SERIALIZE_STATE'] = '1'
env['ANGLE_FEATURE_OVERRIDES_ENABLED'] = 'forceRobustResourceInit'
env['ANGLE_CAPTURE_ENABLED'] = '1'
info('Setting ANGLE_CAPTURE_OUT_DIR to %s' % self.trace_folder_path)
......
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