1 /* vim: se cin sw=2 ts=2 et : */
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3  *
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/. */
7 
8 #ifndef __mozilla_widget_GfxInfo_h__
9 #define __mozilla_widget_GfxInfo_h__
10 
11 #include "GfxInfoBase.h"
12 
13 #include "nsString.h"
14 
15 namespace mozilla {
16 namespace widget {
17 
18 class GfxInfo : public GfxInfoBase {
19  public:
20   GfxInfo();
21   // We only declare the subset of nsIGfxInfo that we actually implement. The
22   // rest is brought forward from GfxInfoBase.
23   NS_IMETHOD GetD2DEnabled(bool* aD2DEnabled) override;
24   NS_IMETHOD GetDWriteEnabled(bool* aDWriteEnabled) override;
25   NS_IMETHOD GetDWriteVersion(nsAString& aDwriteVersion) override;
26   NS_IMETHOD GetEmbeddedInFirefoxReality(
27       bool* aEmbeddedInFirefoxReality) override;
28   NS_IMETHOD GetHasBattery(bool* aHasBattery) override;
29   NS_IMETHOD GetWindowProtocol(nsAString& aWindowProtocol) override;
30   NS_IMETHOD GetDesktopEnvironment(nsAString& aDesktopEnvironment) override;
31   NS_IMETHOD GetTestType(nsAString& aTestType) override;
32   NS_IMETHOD GetCleartypeParameters(nsAString& aCleartypeParams) override;
33   NS_IMETHOD GetAdapterDescription(nsAString& aAdapterDescription) override;
34   NS_IMETHOD GetAdapterDriver(nsAString& aAdapterDriver) override;
35   NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
36   NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
37   NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
38   NS_IMETHOD GetAdapterRAM(uint32_t* aAdapterRAM) override;
39   NS_IMETHOD GetAdapterDriverVendor(nsAString& aAdapterDriverVendor) override;
40   NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
41   NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
42   NS_IMETHOD GetAdapterDescription2(nsAString& aAdapterDescription) override;
43   NS_IMETHOD GetAdapterDriver2(nsAString& aAdapterDriver) override;
44   NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
45   NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
46   NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
47   NS_IMETHOD GetAdapterRAM2(uint32_t* aAdapterRAM) override;
48   NS_IMETHOD GetAdapterDriverVendor2(nsAString& aAdapterDriverVendor) override;
49   NS_IMETHOD GetAdapterDriverVersion2(
50       nsAString& aAdapterDriverVersion) override;
51   NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;
52   NS_IMETHOD GetIsGPU2Active(bool* aIsGPU2Active) override;
53   NS_IMETHOD GetDisplayInfo(nsTArray<nsString>& aDisplayInfo) override;
54   NS_IMETHOD GetDisplayWidth(nsTArray<uint32_t>& aDisplayWidth) override;
55   NS_IMETHOD GetDisplayHeight(nsTArray<uint32_t>& aDisplayHeight) override;
56   NS_IMETHOD GetDrmRenderDevice(nsACString& aDrmRenderDevice) override;
57 
58   using GfxInfoBase::GetFeatureStatus;
59   using GfxInfoBase::GetFeatureSuggestedDriverVersion;
60 
61   virtual nsresult Init() override;
62 
63 #ifdef DEBUG
64   NS_DECL_ISUPPORTS_INHERITED
65   NS_DECL_NSIGFXINFODEBUG
66 #endif
67 
OperatingSystemVersion()68   virtual uint32_t OperatingSystemVersion() override { return mOSXVersion; }
69 
70   nsresult FindMonitors(JSContext* cx, JS::HandleObject array) override;
71 
72  protected:
~GfxInfo()73   virtual ~GfxInfo() {}
74 
75   virtual nsresult GetFeatureStatusImpl(
76       int32_t aFeature, int32_t* aStatus, nsAString& aSuggestedDriverVersion,
77       const nsTArray<GfxDriverInfo>& aDriverInfo, nsACString& aFailureId,
78       OperatingSystem* aOS = nullptr) override;
79   virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo() override;
80 
81  private:
82   void GetDeviceInfo();
83   void GetSelectedCityInfo();
84   void AddCrashReportAnnotations();
85 
86   uint32_t mNumGPUsDetected;
87 
88   uint32_t mAdapterRAM[2];
89   nsString mDeviceID[2];
90   nsString mDriverVersion[2];
91   nsString mDriverDate[2];
92   nsString mDeviceKey[2];
93 
94   nsString mAdapterVendorID[2];
95   nsString mAdapterDeviceID[2];
96 
97   uint32_t mOSXVersion;
98 };
99 
100 }  // namespace widget
101 }  // namespace mozilla
102 
103 #endif /* __mozilla_widget_GfxInfo_h__ */
104