Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release
[gecko.git] / gfx / layers / LayersTypes.cpp
blob81ea1aa88f476d0fc3a4c2f581ed1d4d857af195
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"
9 #include <cinttypes>
10 #include "nsPrintfCString.h"
11 #include "mozilla/gfx/gfxVars.h"
13 #ifdef XP_WIN
14 # include "gfxConfig.h"
15 # include "mozilla/StaticPrefs_gfx.h"
16 #endif
18 namespace mozilla {
19 namespace layers {
21 const char* kCompositionPayloadTypeNames[kCompositionPayloadTypeCount] = {
22 "KeyPress",
23 "APZScroll",
24 "APZPinchZoom",
25 "ContentPaint",
26 "MouseUpFollowedByClick",
29 const char* GetLayersBackendName(LayersBackend aBackend) {
30 switch (aBackend) {
31 case LayersBackend::LAYERS_NONE:
32 return "none";
33 case LayersBackend::LAYERS_WR:
34 if (gfx::gfxVars::UseSoftwareWebRender()) {
35 #ifdef XP_WIN
36 if (gfx::gfxVars::AllowSoftwareWebRenderD3D11() &&
37 gfx::gfxConfig::IsEnabled(gfx::Feature::D3D11_COMPOSITING)) {
38 return "webrender_software_d3d11";
40 #endif
41 return "webrender_software";
43 return "webrender";
44 default:
45 MOZ_ASSERT_UNREACHABLE("unknown layers backend");
46 return "unknown";
50 std::ostream& operator<<(std::ostream& aStream, const LayersId& aId) {
51 return aStream << nsPrintfCString("0x%" PRIx64, aId.mId).get();
54 /* static */
55 CompositableHandle CompositableHandle::GetNext() {
56 static std::atomic<uint64_t> sCounter = 0;
57 return CompositableHandle{++sCounter};
60 /* static */
61 RemoteTextureId RemoteTextureId::GetNext() {
62 static std::atomic<uint64_t> sCounter = 0;
63 return RemoteTextureId{++sCounter};
66 /* static */
67 RemoteTextureOwnerId RemoteTextureOwnerId::GetNext() {
68 static std::atomic<uint64_t> sCounter = 0;
69 return RemoteTextureOwnerId{++sCounter};
72 /* static */
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};
83 /* static */
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};
94 } // namespace layers
95 } // namespace mozilla