Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: ui/gl/gl_image_dxgi.h

Issue 2981713002: Revert of Allow presenting DXGI share handles as overlays. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/gpu/dxva_picture_buffer_win.cc ('k') | ui/gl/gl_image_dxgi.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <d3d11.h> 5 #include <d3d11.h>
6 6
7 #include "base/win/scoped_comptr.h" 7 #include "base/win/scoped_comptr.h"
8 #include "base/win/scoped_handle.h"
9 #include "ui/gl/gl_export.h" 8 #include "ui/gl/gl_export.h"
10 #include "ui/gl/gl_image.h" 9 #include "ui/gl/gl_image.h"
11 10
12 typedef void* EGLStreamKHR; 11 typedef void* EGLStreamKHR;
13 12
14 namespace gl { 13 namespace gl {
15 14
16 class GL_EXPORT GLImageDXGIBase : public GLImage { 15 class GL_EXPORT GLImageDXGI : public GLImage {
17 public: 16 public:
18 GLImageDXGIBase(const gfx::Size& size); 17 GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream);
19 18
20 // Safe downcast. Returns nullptr on failure. 19 // Safe downcast. Returns nullptr on failure.
21 static GLImageDXGIBase* FromGLImage(GLImage* image); 20 static GLImageDXGI* FromGLImage(GLImage* image);
22 21
23 // GLImage implementation. 22 // GLImage implementation.
24 gfx::Size GetSize() override; 23 gfx::Size GetSize() override;
25 unsigned GetInternalFormat() override; 24 unsigned GetInternalFormat() override;
26 bool BindTexImage(unsigned target) override; 25 bool BindTexImage(unsigned target) override;
27 void ReleaseTexImage(unsigned target) override; 26 void ReleaseTexImage(unsigned target) override;
28 bool CopyTexImage(unsigned target) override; 27 bool CopyTexImage(unsigned target) override;
29 bool CopyTexSubImage(unsigned target, 28 bool CopyTexSubImage(unsigned target,
30 const gfx::Point& offset, 29 const gfx::Point& offset,
31 const gfx::Rect& rect) override; 30 const gfx::Rect& rect) override;
32 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 31 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
33 int z_order, 32 int z_order,
34 gfx::OverlayTransform transform, 33 gfx::OverlayTransform transform,
35 const gfx::Rect& bounds_rect, 34 const gfx::Rect& bounds_rect,
36 const gfx::RectF& crop_rect) override; 35 const gfx::RectF& crop_rect) override;
37 void Flush() override; 36 void Flush() override;
38 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, 37 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
39 uint64_t process_tracing_id, 38 uint64_t process_tracing_id,
40 const std::string& dump_name) override; 39 const std::string& dump_name) override;
41 Type GetType() const override; 40 Type GetType() const override;
42 41
42 void SetTexture(const base::win::ScopedComPtr<ID3D11Texture2D>& texture,
43 size_t level);
44
43 base::win::ScopedComPtr<ID3D11Texture2D> texture() { return texture_; } 45 base::win::ScopedComPtr<ID3D11Texture2D> texture() { return texture_; }
44 size_t level() const { return level_; } 46 size_t level() const { return level_; }
45 47
46 protected: 48 protected:
47 ~GLImageDXGIBase() override; 49 ~GLImageDXGI() override;
48 50
49 gfx::Size size_; 51 gfx::Size size_;
50 52
53 EGLStreamKHR stream_;
54
51 base::win::ScopedComPtr<ID3D11Texture2D> texture_; 55 base::win::ScopedComPtr<ID3D11Texture2D> texture_;
52 size_t level_ = 0; 56 size_t level_ = 0;
53 }; 57 };
54 58
55 class GL_EXPORT GLImageDXGI : public GLImageDXGIBase {
56 public:
57 GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream);
58
59 // GLImage implementation.
60 bool BindTexImage(unsigned target) override;
61
62 void SetTexture(const base::win::ScopedComPtr<ID3D11Texture2D>& texture,
63 size_t level);
64
65 protected:
66 ~GLImageDXGI() override;
67
68 EGLStreamKHR stream_;
69 };
70
71 // This copies to a new texture on bind. 59 // This copies to a new texture on bind.
72 class GL_EXPORT CopyingGLImageDXGI : public GLImageDXGI { 60 class GL_EXPORT CopyingGLImageDXGI : public GLImageDXGI {
73 public: 61 public:
74 CopyingGLImageDXGI(const base::win::ScopedComPtr<ID3D11Device>& d3d11_device, 62 CopyingGLImageDXGI(const base::win::ScopedComPtr<ID3D11Device>& d3d11_device,
75 const gfx::Size& size, 63 const gfx::Size& size,
76 EGLStreamKHR stream); 64 EGLStreamKHR stream);
77 65
78 bool Initialize(); 66 bool Initialize();
79 bool InitializeVideoProcessor( 67 bool InitializeVideoProcessor(
80 const base::win::ScopedComPtr<ID3D11VideoProcessor>& video_processor, 68 const base::win::ScopedComPtr<ID3D11VideoProcessor>& video_processor,
(...skipping 10 matching lines...) Expand all
91 bool copied_ = false; 79 bool copied_ = false;
92 80
93 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_; 81 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_;
94 base::win::ScopedComPtr<ID3D11VideoContext> video_context_; 82 base::win::ScopedComPtr<ID3D11VideoContext> video_context_;
95 base::win::ScopedComPtr<ID3D11VideoProcessor> d3d11_processor_; 83 base::win::ScopedComPtr<ID3D11VideoProcessor> d3d11_processor_;
96 base::win::ScopedComPtr<ID3D11VideoProcessorEnumerator> enumerator_; 84 base::win::ScopedComPtr<ID3D11VideoProcessorEnumerator> enumerator_;
97 base::win::ScopedComPtr<ID3D11Device> d3d11_device_; 85 base::win::ScopedComPtr<ID3D11Device> d3d11_device_;
98 base::win::ScopedComPtr<ID3D11Texture2D> decoder_copy_texture_; 86 base::win::ScopedComPtr<ID3D11Texture2D> decoder_copy_texture_;
99 base::win::ScopedComPtr<ID3D11VideoProcessorOutputView> output_view_; 87 base::win::ScopedComPtr<ID3D11VideoProcessorOutputView> output_view_;
100 }; 88 };
101
102 class GL_EXPORT GLImageDXGIHandle : public GLImageDXGIBase {
103 public:
104 GLImageDXGIHandle(const gfx::Size& size,
105 base::win::ScopedHandle handle,
106 uint32_t level);
107
108 bool Initialize();
109
110 protected:
111 ~GLImageDXGIHandle() override;
112
113 base::win::ScopedHandle handle_;
114 };
115 } 89 }
OLDNEW
« no previous file with comments | « media/gpu/dxva_picture_buffer_win.cc ('k') | ui/gl/gl_image_dxgi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698