diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /gfx/layers/d3d11/ReadbackManagerD3D11.h | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/layers/d3d11/ReadbackManagerD3D11.h')
-rw-r--r-- | gfx/layers/d3d11/ReadbackManagerD3D11.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/gfx/layers/d3d11/ReadbackManagerD3D11.h b/gfx/layers/d3d11/ReadbackManagerD3D11.h new file mode 100644 index 000000000..d15346fd8 --- /dev/null +++ b/gfx/layers/d3d11/ReadbackManagerD3D11.h @@ -0,0 +1,65 @@ +/* -*- 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_READBACKMANAGERD3D11_H +#define GFX_READBACKMANAGERD3D11_H + +#include <windows.h> +#include <d3d10_1.h> + +#include "nsTArray.h" +#include "nsAutoPtr.h" + +namespace mozilla { +namespace layers { + +class TextureReadbackSink; +struct ReadbackTask; + +class ReadbackManagerD3D11 final +{ + NS_INLINE_DECL_REFCOUNTING(ReadbackManagerD3D11) +public: + ReadbackManagerD3D11(); + + /** + * Tell the readback manager to post a readback task. + * + * @param aTexture D3D10_USAGE_STAGING texture that will contain the data that + * was readback. + * @param aSink TextureReadbackSink that the resulting DataSourceSurface + * should be dispatched to. + */ + void PostTask(ID3D10Texture2D* aTexture, TextureReadbackSink* aSink); + +private: + ~ReadbackManagerD3D11(); + + static DWORD WINAPI StartTaskThread(void *aManager); + + void ProcessTasks(); + + // The invariant maintained by |mTaskSemaphore| is that the readback thread + // will awaken from WaitForMultipleObjects() at least once per readback + // task enqueued by the main thread. Since the readback thread processes + // exactly one task per wakeup (with one exception), no tasks are lost. The + // exception is when the readback thread is shut down, which orphans the + // remaining tasks, on purpose. + HANDLE mTaskSemaphore; + // Event signaled when the task thread should shutdown + HANDLE mShutdownEvent; + // Handle to the task thread + HANDLE mTaskThread; + + // FiFo list of readback tasks that are to be executed. Access is synchronized + // by mTaskMutex. + CRITICAL_SECTION mTaskMutex; + nsTArray<nsAutoPtr<ReadbackTask>> mPendingReadbackTasks; +}; + +} +} + +#endif /* GFX_READBACKMANAGERD3D11_H */ |