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

Side by Side Diff: media/gpu/dxva_video_decode_accelerator_win.h

Issue 2859723002: Copy NV12 picture buffers on demand on the main thread. (Closed)
Patch Set: change comment Created 3 years, 7 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') | media/gpu/dxva_video_decode_accelerator_win.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ 5 #ifndef MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
6 #define MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ 6 #define MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
7 7
8 #include <d3d11_1.h> 8 #include <d3d11_1.h>
9 #include <d3d9.h> 9 #include <d3d9.h>
10 #include <initguid.h> 10 #include <initguid.h>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles( 138 static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles(
139 const gpu::GpuPreferences& gpu_preferences, 139 const gpu::GpuPreferences& gpu_preferences,
140 const gpu::GpuDriverBugWorkarounds& workarounds); 140 const gpu::GpuDriverBugWorkarounds& workarounds);
141 141
142 // Preload dlls required for decoding. 142 // Preload dlls required for decoding.
143 static void PreSandboxInitialization(); 143 static void PreSandboxInitialization();
144 144
145 private: 145 private:
146 friend class DXVAPictureBuffer; 146 friend class DXVAPictureBuffer;
147 friend class EGLStreamDelayedCopyPictureBuffer;
147 friend class EGLStreamCopyPictureBuffer; 148 friend class EGLStreamCopyPictureBuffer;
148 friend class EGLStreamPictureBuffer; 149 friend class EGLStreamPictureBuffer;
149 friend class PbufferPictureBuffer; 150 friend class PbufferPictureBuffer;
150 typedef void* EGLConfig; 151 typedef void* EGLConfig;
151 typedef void* EGLSurface; 152 typedef void* EGLSurface;
152 typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs; 153 typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs;
153 154
155 enum class PictureBufferMechanism {
156 // Copy to either a BGRA8 or FP16 texture using the video processor.
157 COPY_TO_RGB,
158
159 // Copy to another NV12 texture that can be used in ANGLE.
160 COPY_TO_NV12,
161
162 // Bind the resulting GLImage to the NV12 texture. If the texture's used
163 // in a an overlay than use it directly, otherwise copy it to another NV12
164 // texture when necessary.
165 DELAYED_COPY_TO_NV12,
166
167 // Bind the NV12 decoder texture directly to the texture used in ANGLE.
168 BIND
169 };
170
154 // Returns the minimum resolution for the |profile| passed in. 171 // Returns the minimum resolution for the |profile| passed in.
155 static std::pair<int, int> GetMinResolution(const VideoCodecProfile profile); 172 static std::pair<int, int> GetMinResolution(const VideoCodecProfile profile);
156 173
157 // Returns the maximum resolution for the |profile| passed in. 174 // Returns the maximum resolution for the |profile| passed in.
158 static std::pair<int, int> GetMaxResolution(const VideoCodecProfile profile); 175 static std::pair<int, int> GetMaxResolution(const VideoCodecProfile profile);
159 176
160 // Returns the maximum resolution for H264 video. 177 // Returns the maximum resolution for H264 video.
161 static std::pair<int, int> GetMaxH264Resolution(); 178 static std::pair<int, int> GetMaxH264Resolution();
162 179
163 // Certain AMD GPU drivers like R600, R700, Evergreen and Cayman and 180 // Certain AMD GPU drivers like R600, R700, Evergreen and Cayman and
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // The |config_changed| parameter is set to true if we detect a change in the 385 // The |config_changed| parameter is set to true if we detect a change in the
369 // stream. 386 // stream.
370 HRESULT CheckConfigChanged(IMFSample* sample, bool* config_changed); 387 HRESULT CheckConfigChanged(IMFSample* sample, bool* config_changed);
371 388
372 // Called when we detect a stream configuration change. We reinitialize the 389 // Called when we detect a stream configuration change. We reinitialize the
373 // decoder here. 390 // decoder here.
374 void ConfigChanged(const Config& config); 391 void ConfigChanged(const Config& config);
375 392
376 uint32_t GetTextureTarget() const; 393 uint32_t GetTextureTarget() const;
377 394
395 PictureBufferMechanism GetPictureBufferMechanism() const;
396 bool ShouldUseANGLEDevice() const;
378 ID3D11Device* D3D11Device() const; 397 ID3D11Device* D3D11Device() const;
379 398
380 // To expose client callbacks from VideoDecodeAccelerator. 399 // To expose client callbacks from VideoDecodeAccelerator.
381 VideoDecodeAccelerator::Client* client_; 400 VideoDecodeAccelerator::Client* client_;
382 401
383 base::win::ScopedComPtr<IMFTransform> decoder_; 402 base::win::ScopedComPtr<IMFTransform> decoder_;
384 403
385 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_; 404 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_;
386 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_; 405 base::win::ScopedComPtr<IDirect3DDevice9Ex> d3d9_device_ex_;
387 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; 406 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // attain a WeakPtr. 529 // attain a WeakPtr.
511 base::WeakPtr<DXVAVideoDecodeAccelerator> weak_ptr_; 530 base::WeakPtr<DXVAVideoDecodeAccelerator> weak_ptr_;
512 531
513 // Set to true if we are in the context of a Flush operation. Used to prevent 532 // Set to true if we are in the context of a Flush operation. Used to prevent
514 // multiple flush done notifications being sent out. 533 // multiple flush done notifications being sent out.
515 bool pending_flush_; 534 bool pending_flush_;
516 535
517 // Use CODECAPI_AVLowLatencyMode. 536 // Use CODECAPI_AVLowLatencyMode.
518 bool enable_low_latency_; 537 bool enable_low_latency_;
519 538
520 bool share_nv12_textures_; 539 // Supports sharing the decoded NV12 textures with ANGLE
540 bool support_share_nv12_textures_;
521 541
522 // Copy NV12 texture to another NV12 texture. 542 // Supports copying the NV12 texture to another NV12 texture to use in
523 bool copy_nv12_textures_; 543 // ANGLE.
544 bool support_copy_nv12_textures_;
524 545
525 // Copy video to FP16 scRGB textures. 546 // Copy video to FP16 scRGB textures.
526 bool use_fp16_ = false; 547 bool use_fp16_ = false;
527 548
528 // When converting YUV to RGB, make sure we tell the blitter about the input 549 // When converting YUV to RGB, make sure we tell the blitter about the input
529 // color space so that it can convert it correctly. 550 // color space so that it can convert it correctly.
530 bool use_color_info_ = true; 551 bool use_color_info_ = true;
531 552
532 // Defaults to false. Indicates if we should use D3D or DX11 interfaces for 553 // Defaults to false. Indicates if we should use D3D or DX11 interfaces for
533 // H/W decoding. 554 // H/W decoding.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 588
568 // Function pointer for the MFCreateDXGIDeviceManager API. 589 // Function pointer for the MFCreateDXGIDeviceManager API.
569 static CreateDXGIDeviceManager create_dxgi_device_manager_; 590 static CreateDXGIDeviceManager create_dxgi_device_manager_;
570 591
571 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); 592 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator);
572 }; 593 };
573 594
574 } // namespace media 595 } // namespace media
575 596
576 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_ 597 #endif // MEDIA_GPU_DXVA_VIDEO_DECODE_ACCELERATOR_WIN_H_
OLDNEW
« no previous file with comments | « media/gpu/dxva_picture_buffer_win.cc ('k') | media/gpu/dxva_video_decode_accelerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698