summaryrefslogtreecommitdiff
path: root/gfx/layers
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-05-04 20:49:56 +0000
committerMoonchild <moonchild@palemoon.org>2020-05-04 20:49:56 +0000
commit6980b807916490eff6ee7a6791129ef5d76a118e (patch)
treecbf3ec27d288cdcfff16237fdbc783ab6f04a92b /gfx/layers
parentca826767f07eb3b463f660b94f9416ecb5065611 (diff)
downloaduxp-6980b807916490eff6ee7a6791129ef5d76a118e.tar.gz
Issue #1450 - Remove NVidia 3D-Vision utils
Legacy, unmaintained and untested D3D9 stereo output behind a hidden pref that nobody ever uses... :P 'nuf said. Resolves #1450
Diffstat (limited to 'gfx/layers')
-rw-r--r--gfx/layers/d3d9/CompositorD3D9.cpp39
-rw-r--r--gfx/layers/d3d9/DeviceManagerD3D9.cpp24
-rw-r--r--gfx/layers/d3d9/DeviceManagerD3D9.h9
-rw-r--r--gfx/layers/d3d9/Nv3DVUtils.cpp148
-rw-r--r--gfx/layers/d3d9/Nv3DVUtils.h86
-rw-r--r--gfx/layers/moz.build1
6 files changed, 0 insertions, 307 deletions
diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp
index 85c19139f3..6f01e7d152 100644
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -11,7 +11,6 @@
#include "mozilla/layers/ContentHost.h"
#include "mozilla/layers/Effects.h"
#include "nsWindowsHelpers.h"
-#include "Nv3DVUtils.h"
#include "gfxFailure.h"
#include "mozilla/layers/LayerManagerComposite.h"
#include "gfxPrefs.h"
@@ -426,44 +425,6 @@ CompositorD3D9::DrawQuad(const gfx::Rect &aRect,
MOZ_ASSERT(sourceCb->GetD3D9Texture());
MOZ_ASSERT(sourceCr->GetD3D9Texture());
- /*
- * Send 3d control data and metadata
- */
- if (mDeviceManager->GetNv3DVUtils()) {
- Nv_Stereo_Mode mode;
- switch (source->AsSourceD3D9()->GetStereoMode()) {
- case StereoMode::LEFT_RIGHT:
- mode = NV_STEREO_MODE_LEFT_RIGHT;
- break;
- case StereoMode::RIGHT_LEFT:
- mode = NV_STEREO_MODE_RIGHT_LEFT;
- break;
- case StereoMode::BOTTOM_TOP:
- mode = NV_STEREO_MODE_BOTTOM_TOP;
- break;
- case StereoMode::TOP_BOTTOM:
- mode = NV_STEREO_MODE_TOP_BOTTOM;
- break;
- case StereoMode::MONO:
- mode = NV_STEREO_MODE_MONO;
- break;
- }
-
- // Send control data even in mono case so driver knows to leave stereo mode.
- mDeviceManager->GetNv3DVUtils()->SendNv3DVControl(mode, true, FIREFOX_3DV_APP_HANDLE);
-
- if (source->AsSourceD3D9()->GetStereoMode() != StereoMode::MONO) {
- mDeviceManager->GetNv3DVUtils()->SendNv3DVControl(mode, true, FIREFOX_3DV_APP_HANDLE);
-
- RefPtr<IDirect3DSurface9> renderTarget;
- d3d9Device->GetRenderTarget(0, getter_AddRefs(renderTarget));
- mDeviceManager->GetNv3DVUtils()->SendNv3DVMetaData((unsigned int)aRect.width,
- (unsigned int)aRect.height,
- (HANDLE)(sourceY->GetD3D9Texture()),
- (HANDLE)(renderTarget));
- }
- }
-
// Linear scaling is default here, adhering to mFilter is difficult since
// presumably even with point filtering we'll still want chroma upsampling
// to be linear. In the current approach we can't.
diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.cpp b/gfx/layers/d3d9/DeviceManagerD3D9.cpp
index 09778bc9c1..5aa0e9825e 100644
--- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp
+++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp
@@ -8,7 +8,6 @@
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsPrintfCString.h"
-#include "Nv3DVUtils.h"
#include "plstr.h"
#include <algorithm>
#include "gfx2DGlue.h"
@@ -263,21 +262,6 @@ DeviceManagerD3D9::Initialize()
return false;
}
- if (gfxPrefs::StereoVideoEnabled()) {
- /* Create an Nv3DVUtils instance */
- if (!mNv3DVUtils) {
- mNv3DVUtils = new Nv3DVUtils();
- if (!mNv3DVUtils) {
- NS_WARNING("Could not create a new instance of Nv3DVUtils.");
- }
- }
-
- /* Initialize the Nv3DVUtils object */
- if (mNv3DVUtils) {
- mNv3DVUtils->Initialize();
- }
- }
-
HMODULE d3d9 = LoadLibraryW(L"d3d9.dll");
decltype(Direct3DCreate9)* d3d9Create = (decltype(Direct3DCreate9)*)
GetProcAddress(d3d9, "Direct3DCreate9");
@@ -385,14 +369,6 @@ DeviceManagerD3D9::Initialize()
/*
* Do some post device creation setup
*/
- if (mNv3DVUtils) {
- IUnknown* devUnknown = nullptr;
- if (mDevice) {
- mDevice->QueryInterface(IID_IUnknown, (void **)&devUnknown);
- }
- mNv3DVUtils->SetDeviceInfo(devUnknown);
- }
-
auto failCreateShaderMsg = "[D3D9] failed to create a critical resource (shader) code";
hr = mDevice->CreateVertexShader((DWORD*)LayerQuadVS,
diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.h b/gfx/layers/d3d9/DeviceManagerD3D9.h
index d27b679ab0..394f84d9cd 100644
--- a/gfx/layers/d3d9/DeviceManagerD3D9.h
+++ b/gfx/layers/d3d9/DeviceManagerD3D9.h
@@ -18,7 +18,6 @@ namespace mozilla {
namespace layers {
class DeviceManagerD3D9;
-class Nv3DVUtils;
class Layer;
class TextureSourceD3D9;
@@ -179,11 +178,6 @@ public:
// returns the register to be used for the mask texture, if appropriate
uint32_t SetShaderMode(ShaderMode aMode, MaskType aMaskType);
- /**
- * Return pointer to the Nv3DVUtils instance
- */
- Nv3DVUtils *GetNv3DVUtils() { return mNv3DVUtils; }
-
/**
* Returns true if this device was removed.
*/
@@ -338,9 +332,6 @@ private:
/* If this device was removed */
bool mDeviceWasRemoved;
- /* Nv3DVUtils instance */
- nsAutoPtr<Nv3DVUtils> mNv3DVUtils;
-
/**
* Verifies all required device capabilities are present.
*/
diff --git a/gfx/layers/d3d9/Nv3DVUtils.cpp b/gfx/layers/d3d9/Nv3DVUtils.cpp
deleted file mode 100644
index 72638228f2..0000000000
--- a/gfx/layers/d3d9/Nv3DVUtils.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/DebugOnly.h"
-
-#include "nsIServiceManager.h"
-#include "nsIConsoleService.h"
-#include <initguid.h>
-#include "Nv3DVUtils.h"
-
-DEFINE_GUID(CLSID_NV3DVStreaming,
-0xf7747266, 0x777d, 0x4f61, 0xa1, 0x75, 0xdd, 0x5a, 0xdf, 0x1e, 0x37, 0xdf);
-
-DEFINE_GUID(IID_INV3DVStreaming,
-0xf98f9bb2, 0xb914, 0x4d44, 0x98, 0xfa, 0x6e, 0x37, 0x85, 0x16, 0x98, 0x55);
-
-namespace mozilla {
-namespace layers {
-
-/**
- * Constructor and Destructor
- */
-Nv3DVUtils::Nv3DVUtils()
- : m3DVStreaming (nullptr)
-{
-}
-
-Nv3DVUtils::~Nv3DVUtils()
-{
- UnInitialize();
-}
-
-
-// Silence spurious warnings!
-#if defined(WARNING) || defined WARN_IF_FALSE
-#error We shouldn't be redefining these!
-#endif
-// Uncomment these to enable spurious warnings.
-//#define WARNING(str) NS_WARNING(str)
-//#define WARN_IF_FALSE(b, str) NS_WARNING_ASSERTION(b, str)
-#define WARNING(str)
-#define WARN_IF_FALSE(b, str)
-
-/**
- * Initializes the Nv3DVUtils object.
- */
-void
-Nv3DVUtils::Initialize()
-{
- /*
- * Detect if 3D Streaming object is already loaded. Do nothing in that case.
- */
- if (m3DVStreaming) {
- WARNING("Nv3DVStreaming COM object already instantiated.\n");
- return;
- }
-
- /*
- * Create the COM object. If we fail at any stage, just return
- */
- HRESULT hr = CoCreateInstance(CLSID_NV3DVStreaming, nullptr, CLSCTX_INPROC_SERVER, IID_INV3DVStreaming, (void**)(getter_AddRefs(m3DVStreaming)));
- if (FAILED(hr) || !m3DVStreaming) {
- WARNING("Nv3DVStreaming CoCreateInstance failed (disabled).");
- return;
- }
-
- /*
- * Initialize the object. Note that m3DVStreaming cannot be nullptr at this point.
- */
- bool bRetVal = m3DVStreaming->Nv3DVInitialize();
-
- if (!bRetVal) {
- WARNING("Nv3DVStreaming Nv3DVInitialize failed!");
- return;
- }
-}
-
-/**
- * Release resources used by the COM Object, and then release
- * the COM Object (nsRefPtr gets released by setting to nullptr)
- *
- */
-void
-Nv3DVUtils::UnInitialize()
-{
- if (m3DVStreaming) {
- m3DVStreaming->Nv3DVRelease();
- }
-}
-
-/**
- * Sets the device info, along with any other initialization that is needed after device creation
- * Pass the D3D9 device pointer is an IUnknown input argument.
- */
-void
-Nv3DVUtils::SetDeviceInfo(IUnknown *devUnknown)
-{
- if (!devUnknown) {
- WARNING("D3D Device Pointer (IUnknown) is nullptr.\n");
- return;
- }
-
- if (!m3DVStreaming) {
- return;
- }
-
- bool rv = m3DVStreaming->Nv3DVSetDevice(devUnknown);
- if (!rv) {
- WARNING("Nv3DVStreaming Nv3DVControl failed!");
- return;
- }
-
- rv = m3DVStreaming->Nv3DVControl(NV_STEREO_MODE_RIGHT_LEFT, true, FIREFOX_3DV_APP_HANDLE);
- WARN_IF_FALSE(rv, "Nv3DVStreaming Nv3DVControl failed!");
-}
-
-/*
- * Send Stereo Control Information. Used mainly to re-route
- * calls from ImageLayerD3D9 to the 3DV COM object
- */
-void
-Nv3DVUtils::SendNv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle)
-{
- if (!m3DVStreaming)
- return;
-
- DebugOnly<bool> rv = m3DVStreaming->Nv3DVControl(eStereoMode, bEnableStereo, dw3DVAppHandle);
- WARN_IF_FALSE(rv, "Nv3DVStreaming Nv3DVControl failed!");
-}
-
-/*
- * Send Stereo Metadata. Used mainly to re-route calls
- * from ImageLayerD3D9 to the 3DV COM object
- */
-void
-Nv3DVUtils::SendNv3DVMetaData(unsigned int dwWidth, unsigned int dwHeight, HANDLE hSrcLuma, HANDLE hDst)
-{
- if (!m3DVStreaming)
- return;
-
- DebugOnly<bool> rv = m3DVStreaming->Nv3DVMetaData((DWORD)dwWidth, (DWORD)dwHeight, hSrcLuma, hDst);
- WARN_IF_FALSE(rv, "Nv3DVStreaming Nv3DVMetaData failed!");
-}
-
-} /* namespace layers */
-} /* namespace mozilla */
diff --git a/gfx/layers/d3d9/Nv3DVUtils.h b/gfx/layers/d3d9/Nv3DVUtils.h
deleted file mode 100644
index 0712dd8882..0000000000
--- a/gfx/layers/d3d9/Nv3DVUtils.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef GFX_NV3DVUTILS_H
-#define GFX_NV3DVUTILS_H
-
-#include "Layers.h"
-#include <windows.h>
-#include <d3d9.h>
-
-namespace mozilla {
-namespace layers {
-
-#define FIREFOX_3DV_APP_HANDLE 0xECB992B6
-
-enum Nv_Stereo_Mode {
- NV_STEREO_MODE_LEFT_RIGHT = 0,
- NV_STEREO_MODE_RIGHT_LEFT = 1,
- NV_STEREO_MODE_TOP_BOTTOM = 2,
- NV_STEREO_MODE_BOTTOM_TOP = 3,
- NV_STEREO_MODE_MONO = 4,
- NV_STEREO_MODE_LAST = 5
-};
-
-class INv3DVStreaming : public IUnknown {
-
-public:
- virtual bool Nv3DVInitialize() = 0;
- virtual bool Nv3DVRelease() = 0;
- virtual bool Nv3DVSetDevice(IUnknown* pDevice) = 0;
- virtual bool Nv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle) = 0;
- virtual bool Nv3DVMetaData(DWORD dwWidth, DWORD dwHeight, HANDLE hSrcLuma, HANDLE hDst) = 0;
-};
-
-/*
- * Nv3DVUtils class
- */
-class Nv3DVUtils {
-
-public:
- Nv3DVUtils();
- ~Nv3DVUtils();
-
- /*
- * Initializes the Nv3DVUtils object.
- */
- void Initialize();
-
- /*
- * Release any resources if needed
- *
- */
- void UnInitialize();
-
- /*
- * Sets the device info, along with any other initialization that is needed after device creation
- * Pass the D3D9 device pointer is an IUnknown input argument
- */
- void SetDeviceInfo(IUnknown *devUnknown);
-
- /*
- * Send Stereo Control Information. Used mainly to re-route
- * calls from ImageLayerD3D9 to the 3DV COM object
- */
- void SendNv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle);
-
- /*
- * Send Stereo Metadata. Used mainly to re-route calls
- * from ImageLayerD3D9 to the 3DV COM object
- */
- void SendNv3DVMetaData(unsigned int dwWidth, unsigned int dwHeight, HANDLE hSrcLuma, HANDLE hDst);
-
-private:
-
- /* Nv3DVStreaming interface pointer */
- RefPtr<INv3DVStreaming> m3DVStreaming;
-
-};
-
-
-} // namespace layers
-} // namespace mozilla
-
-#endif /* GFX_NV3DVUTILS_H */
diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build
index 2a2fa11692..164f043505 100644
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -72,7 +72,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
SOURCES += [
'd3d9/CompositorD3D9.cpp',
'd3d9/DeviceManagerD3D9.cpp',
- 'd3d9/Nv3DVUtils.cpp',
]
if CONFIG['MOZ_ENABLE_D3D10_LAYER']:
EXPORTS.mozilla.layers += [