Rename SharedContexMutex into ContexMutex

Follow up after:
    Replace (Single/Shared)ContextMutex classed with ContextMutex

Renamed build option:
    angle_enable_shared_context_mutex -> angle_enable_context_mutex

Renamed because there is no more SharedContexMutex class and
ContextMutex is now used for both Shared and not Shared Contexts.

Bug: angleproject:8226
Change-Id: I68eea84aa59441d9c5b19870910b2bb499311e08
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4650350
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
This commit is contained in:
Igor Nazarov
2023-06-27 18:08:27 +03:00
committed by Angle LUCI CQ
parent ca4dc52e95
commit 4b724130cb
11 changed files with 26 additions and 26 deletions

View File

@@ -81,7 +81,7 @@ declare_args() {
angle_enable_global_mutex_load_time_allocate =
is_android && !build_with_chromium
angle_enable_shared_context_mutex = true
angle_enable_context_mutex = true
}
declare_args() {
@@ -187,9 +187,9 @@ config("internal_config") {
defines += [ "ANGLE_ENABLE_GLOBAL_MUTEX_LOAD_TIME_ALLOCATE=1" ]
}
if (angle_enable_shared_context_mutex && angle_enable_share_context_lock &&
if (angle_enable_context_mutex && angle_enable_share_context_lock &&
!angle_force_context_check_every_call) {
defines += [ "ANGLE_ENABLE_SHARED_CONTEXT_MUTEX=1" ]
defines += [ "ANGLE_ENABLE_CONTEXT_MUTEX=1" ]
}
if (angle_enable_context_mutex_recursion) {

View File

@@ -6,7 +6,7 @@
"scripts/entry_point_packed_gl_enums.json":
"1c6b036918aabb9822a638fbf33f87f4",
"scripts/generate_entry_points.py":
"64ef644064c7fcbbf89458dc53ca5c94",
"ee19e5c267b0d86d725ddb37578a1214",
"scripts/gl_angle_ext.xml":
"3d6d9529c6d0da797652c366ddaa9087",
"scripts/registry_xml.py":

View File

@@ -3022,7 +3022,7 @@ def get_egl_entry_point_labeled_object(ep_to_object, cmd_stripped, params, packe
def get_context_lock(api, cmd_name):
# EGLImage related commands need to access EGLImage and Display which should
# be protected with global lock
# Also handles ContexMutex marging when SharedContextMutex is enabled.
# Also handles ContextMutex merging when "angle_enable_context_mutex" is true.
if api == apis.GLES and cmd_name.startswith("glEGLImage"):
return "SCOPED_EGL_IMAGE_SHARE_CONTEXT_LOCK(context, imagePacked);"

View File

@@ -173,7 +173,7 @@ egl::ContextMutex *AllocateOrUseContextMutex(egl::ContextMutex *sharedContextMut
{
if (sharedContextMutex != nullptr)
{
ASSERT(egl::kIsSharedContextMutexEnabled);
ASSERT(egl::kIsContextMutexEnabled);
ASSERT(sharedContextMutex->isReferenced());
return sharedContextMutex;
}

View File

@@ -3,9 +3,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SharedContextMutex.cpp: Classes for protecting Shared Context access and EGLImage siblings.
// ContextMutex.cpp: Classes for protecting Context access and EGLImage siblings.
#include "libANGLE/SharedContextMutex.h"
#include "libANGLE/ContextMutex.h"
#include "common/system_utils.h"
#include "libANGLE/Context.h"

View File

@@ -3,10 +3,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SharedContextMutex.h: Classes for protecting Shared Context access and EGLImage siblings.
// ContextMutex.h: Classes for protecting Context access and EGLImage siblings.
#ifndef LIBANGLE_SHARED_CONTEXT_MUTEX_H_
#define LIBANGLE_SHARED_CONTEXT_MUTEX_H_
#ifndef LIBANGLE_CONTEXT_MUTEX_H_
#define LIBANGLE_CONTEXT_MUTEX_H_
#include <atomic>
@@ -19,10 +19,10 @@ class Context;
namespace egl
{
#if defined(ANGLE_ENABLE_SHARED_CONTEXT_MUTEX)
constexpr bool kIsSharedContextMutexEnabled = true;
#if defined(ANGLE_ENABLE_CONTEXT_MUTEX)
constexpr bool kIsContextMutexEnabled = true;
#else
constexpr bool kIsSharedContextMutexEnabled = false;
constexpr bool kIsContextMutexEnabled = false;
#endif
// Use standard mutex for now
@@ -211,4 +211,4 @@ class [[nodiscard]] ScopedContextMutexLock final
} // namespace egl
#endif // LIBANGLE_SHARED_CONTEXT_MUTEX_H_
#endif // LIBANGLE_CONTEXT_MUTEX_H_

View File

@@ -1123,7 +1123,7 @@ Error Display::initialize()
mSingleThreadPool = angle::WorkerThreadPool::Create(1, ANGLEPlatformCurrent());
mMultiThreadPool = angle::WorkerThreadPool::Create(0, ANGLEPlatformCurrent());
if (kIsSharedContextMutexEnabled)
if (kIsContextMutexEnabled)
{
ASSERT(mManagersMutex == nullptr);
mManagersMutex = new ContextMutex();
@@ -1563,7 +1563,7 @@ Error Display::createContext(const Config *configuration,
ScopedContextMutexLock mutexLock;
ContextMutex *sharedContextMutex = nullptr;
if (kIsSharedContextMutexEnabled)
if (kIsContextMutexEnabled)
{
ASSERT(mManagersMutex != nullptr);
if (shareContext != nullptr)

View File

@@ -316,7 +316,7 @@ Image::Image(rx::EGLImplFactory *factory,
ASSERT(mImplementation != nullptr);
ASSERT(buffer != nullptr);
if (kIsSharedContextMutexEnabled)
if (kIsContextMutexEnabled)
{
if (context != nullptr)
{

View File

@@ -15,6 +15,7 @@
#include "common/Color.h"
#include "common/angleutils.h"
#include "common/bitset_utils.h"
#include "libANGLE/ContextMutex.h"
#include "libANGLE/Debug.h"
#include "libANGLE/GLES1State.h"
#include "libANGLE/Overlay.h"
@@ -24,7 +25,6 @@
#include "libANGLE/RefCountObject.h"
#include "libANGLE/Renderbuffer.h"
#include "libANGLE/Sampler.h"
#include "libANGLE/SharedContextMutex.h"
#include "libANGLE/Texture.h"
#include "libANGLE/TransformFeedback.h"
#include "libANGLE/Version.h"

View File

@@ -301,7 +301,7 @@ libangle_headers = [
"src/libANGLE/Semaphore.h",
"src/libANGLE/Shader.h",
"src/libANGLE/ShareGroup.h",
"src/libANGLE/SharedContextMutex.h",
"src/libANGLE/ContextMutex.h",
"src/libANGLE/SizedMRUCache.h",
"src/libANGLE/State.h",
"src/libANGLE/Stream.h",
@@ -400,6 +400,7 @@ libangle_sources = [
"src/libANGLE/Compiler.cpp",
"src/libANGLE/Config.cpp",
"src/libANGLE/Context.cpp",
"src/libANGLE/ContextMutex.cpp",
"src/libANGLE/Context_gles_1_0.cpp",
"src/libANGLE/Debug.cpp",
"src/libANGLE/Device.cpp",
@@ -438,7 +439,6 @@ libangle_sources = [
"src/libANGLE/Semaphore.cpp",
"src/libANGLE/Shader.cpp",
"src/libANGLE/ShareGroup.cpp",
"src/libANGLE/SharedContextMutex.cpp",
"src/libANGLE/State.cpp",
"src/libANGLE/Stream.cpp",
"src/libANGLE/Surface.cpp",

View File

@@ -54,7 +54,7 @@ class [[nodiscard]] ScopedSyncCurrentContextFromThread
// Tries to lock "ContextMutex" of the Context current to the "thread".
ANGLE_INLINE ScopedContextMutexLock TryLockCurrentContext(Thread *thread)
{
ASSERT(kIsSharedContextMutexEnabled);
ASSERT(kIsContextMutexEnabled);
gl::Context *context = thread->getContext();
return context != nullptr ? ScopedContextMutexLock(context->getContextMutex())
: ScopedContextMutexLock();
@@ -63,7 +63,7 @@ ANGLE_INLINE ScopedContextMutexLock TryLockCurrentContext(Thread *thread)
// Tries to lock "ContextMutex" of the Context with "contextID" if it is valid.
ANGLE_INLINE ScopedContextMutexLock TryLockContext(Display *display, gl::ContextID contextID)
{
ASSERT(kIsSharedContextMutexEnabled);
ASSERT(kIsContextMutexEnabled);
gl::Context *context = GetContextIfValid(display, contextID);
return context != nullptr ? ScopedContextMutexLock(context->getContextMutex())
: ScopedContextMutexLock();
@@ -74,7 +74,7 @@ ANGLE_INLINE ScopedContextMutexLock TryLockContext(Display *display, gl::Context
ANGLE_INLINE ScopedContextMutexLock LockAndTryMergeContextMutexes(gl::Context *context,
ImageID imageID)
{
ASSERT(kIsSharedContextMutexEnabled);
ASSERT(kIsContextMutexEnabled);
ASSERT(context->getDisplay() != nullptr);
ScopedContextMutexLock lock(context->getContextMutex());
const Image *image = context->getDisplay()->getImage(imageID);
@@ -89,7 +89,7 @@ ANGLE_INLINE ScopedContextMutexLock LockAndTryMergeContextMutexes(gl::Context *c
return lock;
}
#if !defined(ANGLE_ENABLE_SHARED_CONTEXT_MUTEX)
#if !defined(ANGLE_ENABLE_CONTEXT_MUTEX)
# define ANGLE_EGL_SCOPED_CONTEXT_LOCK(EP, THREAD, ...)
#else
# define ANGLE_EGL_SCOPED_CONTEXT_LOCK(EP, THREAD, ...) \
@@ -158,7 +158,7 @@ static ANGLE_INLINE void DirtyContextIfNeeded(Context *context)
DirtyContextIfNeeded(context)
# define SCOPED_EGL_IMAGE_SHARE_CONTEXT_LOCK(context, imageID) \
SCOPED_SHARE_CONTEXT_LOCK(context)
# elif !defined(ANGLE_ENABLE_SHARED_CONTEXT_MUTEX)
# elif !defined(ANGLE_ENABLE_CONTEXT_MUTEX)
# define SCOPED_SHARE_CONTEXT_LOCK(context) \
egl::ScopedOptionalGlobalMutexLock shareContextLock(context->isShared())
# define SCOPED_EGL_IMAGE_SHARE_CONTEXT_LOCK(context, imageID) ANGLE_SCOPED_GLOBAL_LOCK()