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 namespace mozilla {
14 namespace widget {
15 
16 class GfxInfo : public GfxInfoBase {
~GfxInfo()17   ~GfxInfo() {}
18 
19  public:
20   GfxInfo();
21 
22   // We only declare the subset of nsIGfxInfo that we actually implement. The
23   // rest is brought forward from GfxInfoBase.
24   NS_IMETHOD GetD2DEnabled(bool* aD2DEnabled) override;
25   NS_IMETHOD GetDWriteEnabled(bool* aDWriteEnabled) override;
26   NS_IMETHOD GetDWriteVersion(nsAString& aDwriteVersion) override;
27   NS_IMETHOD GetCleartypeParameters(nsAString& aCleartypeParams) override;
28   NS_IMETHOD GetAdapterDescription(nsAString& aAdapterDescription) override;
29   NS_IMETHOD GetAdapterDriver(nsAString& aAdapterDriver) override;
30   NS_IMETHOD GetAdapterVendorID(nsAString& aAdapterVendorID) override;
31   NS_IMETHOD GetAdapterDeviceID(nsAString& aAdapterDeviceID) override;
32   NS_IMETHOD GetAdapterSubsysID(nsAString& aAdapterSubsysID) override;
33   NS_IMETHOD GetAdapterRAM(nsAString& aAdapterRAM) override;
34   NS_IMETHOD GetAdapterDriverVersion(nsAString& aAdapterDriverVersion) override;
35   NS_IMETHOD GetAdapterDriverDate(nsAString& aAdapterDriverDate) override;
36   NS_IMETHOD GetAdapterDescription2(nsAString& aAdapterDescription) override;
37   NS_IMETHOD GetAdapterDriver2(nsAString& aAdapterDriver) override;
38   NS_IMETHOD GetAdapterVendorID2(nsAString& aAdapterVendorID) override;
39   NS_IMETHOD GetAdapterDeviceID2(nsAString& aAdapterDeviceID) override;
40   NS_IMETHOD GetAdapterSubsysID2(nsAString& aAdapterSubsysID) override;
41   NS_IMETHOD GetAdapterRAM2(nsAString& aAdapterRAM) override;
42   NS_IMETHOD GetAdapterDriverVersion2(
43       nsAString& aAdapterDriverVersion) override;
44   NS_IMETHOD GetAdapterDriverDate2(nsAString& aAdapterDriverDate) override;
45   NS_IMETHOD GetIsGPU2Active(bool* aIsGPU2Active) override;
46   using GfxInfoBase::GetFeatureStatus;
47   using GfxInfoBase::GetFeatureSuggestedDriverVersion;
48 
49   virtual nsresult Init() override;
50 
OperatingSystemVersion()51   virtual uint32_t OperatingSystemVersion() override { return mWindowsVersion; }
52 
53   nsresult FindMonitors(JSContext* cx, JS::HandleObject array) override;
54 
55 #ifdef DEBUG
56   NS_DECL_ISUPPORTS_INHERITED
57   NS_DECL_NSIGFXINFODEBUG
58 #endif
59 
60  protected:
61   virtual nsresult GetFeatureStatusImpl(
62       int32_t aFeature, int32_t* aStatus, nsAString& aSuggestedDriverVersion,
63       const nsTArray<GfxDriverInfo>& aDriverInfo, nsACString& aFailureId,
64       OperatingSystem* aOS = nullptr) override;
65   virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo() override;
66 
67   void DescribeFeatures(JSContext* cx, JS::Handle<JSObject*> aOut) override;
68 
69  private:
70   void AddCrashReportAnnotations();
71 
72   nsString mDeviceString[2];
73   nsString mDeviceID[2];
74   nsString mDriverVersion[2];
75   nsString mDriverDate[2];
76   nsString mDeviceKey[2];
77   nsString mDeviceKeyDebug;
78   nsString mAdapterVendorID[2];
79   nsString mAdapterDeviceID[2];
80   nsString mAdapterSubsysID[2];
81   uint32_t mWindowsVersion;
82   uint32_t mActiveGPUIndex;  // This must be 0 or 1
83   bool mHasDualGPU;
84   bool mHasDriverVersionMismatch;
85 };
86 
87 }  // namespace widget
88 }  // namespace mozilla
89 
90 #endif /* __mozilla_widget_GfxInfo_h__ */
91