Backed out changeset 5c7de47bcacb (bug 1927094) for causing Bug 1928689. a=backout
[gecko.git] / widget / gtk / GfxInfo.h
blob26b4554b4a9226735fd6ed2b981e1a1dba40ea26
1 /* vim: se cin sw=2 ts=2 et : */
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef WIDGET_GTK_GFXINFO_h__
9 #define WIDGET_GTK_GFXINFO_h__
11 #include "GfxInfoBase.h"
12 #include "nsString.h"
14 namespace mozilla {
15 namespace widget {
17 class GfxInfo final : public GfxInfoBase {
18 public:
19 // We only declare the subset of nsIGfxInfo that we actually implement. The
20 // rest is brought forward from GfxInfoBase.
21 NS_IMETHOD GetD2DEnabled(bool* aD2DEnabled) override;
22 NS_IMETHOD GetDWriteEnabled(bool* aDWriteEnabled) override;
23 NS_IMETHOD GetDWriteVersion(nsAString& aDwriteVersion) override;
24 NS_IMETHOD GetEmbeddedInFirefoxReality(
25 bool* aEmbeddedInFirefoxReality) override;
26 NS_IMETHOD GetHasBattery(bool* aHasBattery) override;
27 NS_IMETHOD GetCleartypeParameters(nsAString& aCleartypeParams) override;
28 NS_IMETHOD GetWindowProtocol(nsAString& aWindowProtocol) override;
29 NS_IMETHOD GetTestType(nsAString& aTestType) override;
30 NS_IMETHOD GetAdapterDescription(nsAString& aAdapterDescription) override;
31 NS_IMETHOD GetAdapterDriver(nsAString& aAdapterDriver) override;
32 NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
33 NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
34 NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
35 NS_IMETHOD GetAdapterRAM(uint32_t* aAdapterRAM) override;
36 NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
37 NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
38 NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
39 NS_IMETHOD GetAdapterDescription2(nsAString& aAdapterDescription) override;
40 NS_IMETHOD GetAdapterDriver2(nsAString& aAdapterDriver) override;
41 NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
42 NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
43 NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
44 NS_IMETHOD GetAdapterRAM2(uint32_t* aAdapterRAM) override;
45 NS_IMETHOD GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) override;
46 NS_IMETHOD GetAdapterDriverVersion2(
47 nsAString& aAdapterDriverVersion) override;
48 NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;
49 NS_IMETHOD GetIsGPU2Active(bool* aIsGPU2Active) override;
50 NS_IMETHOD GetDrmRenderDevice(nsACString& aDrmRenderDevice) override;
51 using GfxInfoBase::GetFeatureStatus;
52 using GfxInfoBase::GetFeatureSuggestedDriverVersion;
54 virtual nsresult Init() override;
56 NS_IMETHOD_(void) GetData() override;
58 static bool FireGLXTestProcess();
60 #ifdef DEBUG
61 NS_DECL_ISUPPORTS_INHERITED
62 NS_DECL_NSIGFXINFODEBUG
63 #endif
65 protected:
66 ~GfxInfo() = default;
68 OperatingSystem GetOperatingSystem() override {
69 return OperatingSystem::Linux;
71 virtual nsresult GetFeatureStatusImpl(
72 int32_t aFeature, int32_t* aStatus, nsAString& aSuggestedDriverVersion,
73 const nsTArray<GfxDriverInfo>& aDriverInfo, nsACString& aFailureId,
74 OperatingSystem* aOS = nullptr) override;
75 virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo() override;
77 virtual bool DoesWindowProtocolMatch(
78 const nsAString& aBlocklistWindowProtocol,
79 const nsAString& aWindowProtocol) override;
81 virtual bool DoesDriverVendorMatch(const nsAString& aBlocklistVendor,
82 const nsAString& aDriverVendor) override;
83 static int FireTestProcess(const nsAString& aBinaryFile, int* aOutPipe,
84 const char** aStringArgs);
86 private:
87 bool mInitialized = false;
88 nsCString mVendorId;
89 nsCString mDeviceId;
90 nsCString mDriverVendor;
91 nsCString mDriverVersion;
92 nsCString mAdapterDescription;
93 uint32_t mAdapterRAM;
94 nsCString mOS;
95 nsCString mOSRelease;
96 nsCString mTestType;
98 nsCString mSecondaryVendorId;
99 nsCString mSecondaryDeviceId;
101 nsCString mDrmRenderDevice;
103 nsTArray<nsCString> mDdxDrivers;
105 struct ScreenInfo {
106 uint32_t mWidth;
107 uint32_t mHeight;
108 bool mIsDefault;
111 nsTArray<ScreenInfo> mScreenInfo;
112 bool mHasTextureFromPixmap;
113 unsigned int mGLMajorVersion, mGLMinorVersion;
114 bool mIsMesa;
115 bool mIsAccelerated;
116 bool mIsWayland;
117 bool mIsXWayland;
118 bool mHasMultipleGPUs;
119 bool mGlxTestError;
120 mozilla::Maybe<bool> mIsVAAPISupported;
121 int mVAAPISupportedCodecs = 0;
122 mozilla::Maybe<bool> mIsV4L2Supported;
123 int mV4L2SupportedCodecs = 0;
125 static int sGLXTestPipe;
126 static pid_t sGLXTestPID;
128 void GetDataVAAPI();
129 void GetDataV4L2();
130 void V4L2ProbeDevice(nsCString& dev);
131 void AddCrashReportAnnotations();
134 } // namespace widget
135 } // namespace mozilla
137 #endif /* WIDGET_GTK_GFXINFO_h__ */