1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "LayersTypes.h"
10 #include "nsPrintfCString.h"
11 #include "mozilla/gfx/gfxVars.h"
14 # include "gfxConfig.h"
15 # include "mozilla/StaticPrefs_gfx.h"
21 const char* kCompositionPayloadTypeNames
[kCompositionPayloadTypeCount
] = {
26 "MouseUpFollowedByClick",
29 const char* GetLayersBackendName(LayersBackend aBackend
) {
31 case LayersBackend::LAYERS_NONE
:
33 case LayersBackend::LAYERS_WR
:
34 if (gfx::gfxVars::UseSoftwareWebRender()) {
36 if (gfx::gfxVars::AllowSoftwareWebRenderD3D11() &&
37 gfx::gfxConfig::IsEnabled(gfx::Feature::D3D11_COMPOSITING
)) {
38 return "webrender_software_d3d11";
41 return "webrender_software";
45 MOZ_ASSERT_UNREACHABLE("unknown layers backend");
50 std::ostream
& operator<<(std::ostream
& aStream
, const LayersId
& aId
) {
51 return aStream
<< nsPrintfCString("0x%" PRIx64
, aId
.mId
).get();
55 CompositableHandle
CompositableHandle::GetNext() {
56 static std::atomic
<uint64_t> sCounter
= 0;
57 return CompositableHandle
{++sCounter
};
61 RemoteTextureId
RemoteTextureId::GetNext() {
62 static std::atomic
<uint64_t> sCounter
= 0;
63 return RemoteTextureId
{++sCounter
};
67 RemoteTextureOwnerId
RemoteTextureOwnerId::GetNext() {
68 static std::atomic
<uint64_t> sCounter
= 0;
69 return RemoteTextureOwnerId
{++sCounter
};
73 GpuProcessTextureId
GpuProcessTextureId::GetNext() {
74 if (!XRE_IsGPUProcess()) {
75 MOZ_ASSERT_UNREACHABLE("unexpected to be called");
76 return GpuProcessTextureId
{};
79 static std::atomic
<uint64_t> sCounter
= 0;
80 return GpuProcessTextureId
{++sCounter
};
84 GpuProcessQueryId
GpuProcessQueryId::GetNext() {
85 if (!XRE_IsGPUProcess()) {
86 MOZ_ASSERT_UNREACHABLE("unexpected to be called");
87 return GpuProcessQueryId
{};
90 static std::atomic
<uint64_t> sCounter
= 0;
91 return GpuProcessQueryId
{++sCounter
};
95 } // namespace mozilla