Bug 1849470 - Update in-tree zlib to version 1.3. r=aosmond
[gecko.git] / gfx / layers / LayersTypes.cpp
blob8d0ddb9d319dd850f8606296f3d4dd928f8c6806
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 } // namespace layers
84 } // namespace mozilla