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

Side by Side Diff: gpu/ipc/service/direct_composition_surface_win.cc

Issue 2870263002: Rename ScopedComPtr::Receive to ScopedComPtr::GetAddressOf (Closed)
Patch Set: Rebase to 2a6f440 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
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 "gpu/ipc/service/direct_composition_surface_win.h" 5 #include "gpu/ipc/service/direct_composition_surface_win.h"
6 6
7 #include <d3d11_1.h> 7 #include <d3d11_1.h>
8 #include <dcomptypes.h> 8 #include <dcomptypes.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 base::win::ScopedComPtr<ID3D11Device> d3d11_device = 124 base::win::ScopedComPtr<ID3D11Device> d3d11_device =
125 gl::QueryD3D11DeviceObjectFromANGLE(); 125 gl::QueryD3D11DeviceObjectFromANGLE();
126 if (!d3d11_device) { 126 if (!d3d11_device) {
127 DLOG(ERROR) << "Failing to create overlay swapchain because couldn't " 127 DLOG(ERROR) << "Failing to create overlay swapchain because couldn't "
128 "retrieve D3D11 device from ANGLE."; 128 "retrieve D3D11 device from ANGLE.";
129 return false; 129 return false;
130 } 130 }
131 131
132 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; 132 base::win::ScopedComPtr<IDXGIDevice> dxgi_device;
133 d3d11_device.CopyTo(dxgi_device.Receive()); 133 d3d11_device.CopyTo(dxgi_device.GetAddressOf());
134 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; 134 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter;
135 dxgi_device->GetAdapter(dxgi_adapter.Receive()); 135 dxgi_device->GetAdapter(dxgi_adapter.GetAddressOf());
136 136
137 unsigned int i = 0; 137 unsigned int i = 0;
138 while (true) { 138 while (true) {
139 base::win::ScopedComPtr<IDXGIOutput> output; 139 base::win::ScopedComPtr<IDXGIOutput> output;
140 if (FAILED(dxgi_adapter->EnumOutputs(i++, output.Receive()))) 140 if (FAILED(dxgi_adapter->EnumOutputs(i++, output.GetAddressOf())))
141 break; 141 break;
142 base::win::ScopedComPtr<IDXGIOutput3> output3; 142 base::win::ScopedComPtr<IDXGIOutput3> output3;
143 if (FAILED(output.CopyTo(output3.Receive()))) 143 if (FAILED(output.CopyTo(output3.GetAddressOf())))
144 continue; 144 continue;
145 145
146 UINT flags = 0; 146 UINT flags = 0;
147 if (FAILED(output3->CheckOverlaySupport(DXGI_FORMAT_YUY2, 147 if (FAILED(output3->CheckOverlaySupport(DXGI_FORMAT_YUY2,
148 d3d11_device.Get(), &flags))) 148 d3d11_device.Get(), &flags)))
149 continue; 149 continue;
150 150
151 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.OverlaySupportFlags", 151 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.OverlaySupportFlags",
152 flags); 152 flags);
153 153
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 video_processor_enumerator_; 306 video_processor_enumerator_;
307 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_; 307 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_;
308 base::win::ScopedComPtr<ID3D11VideoContext> video_context_; 308 base::win::ScopedComPtr<ID3D11VideoContext> video_context_;
309 309
310 base::win::ScopedHandle swap_chain_handle_; 310 base::win::ScopedHandle swap_chain_handle_;
311 311
312 DISALLOW_COPY_AND_ASSIGN(SwapChainPresenter); 312 DISALLOW_COPY_AND_ASSIGN(SwapChainPresenter);
313 }; 313 };
314 314
315 bool DCLayerTree::Initialize(HWND window) { 315 bool DCLayerTree::Initialize(HWND window) {
316 d3d11_device_.CopyTo(video_device_.Receive()); 316 d3d11_device_.CopyTo(video_device_.GetAddressOf());
317 base::win::ScopedComPtr<ID3D11DeviceContext> context; 317 base::win::ScopedComPtr<ID3D11DeviceContext> context;
318 d3d11_device_->GetImmediateContext(context.Receive()); 318 d3d11_device_->GetImmediateContext(context.GetAddressOf());
319 context.CopyTo(video_context_.Receive()); 319 context.CopyTo(video_context_.GetAddressOf());
320 320
321 base::win::ScopedComPtr<IDCompositionDesktopDevice> desktop_device; 321 base::win::ScopedComPtr<IDCompositionDesktopDevice> desktop_device;
322 dcomp_device_.CopyTo(desktop_device.Receive()); 322 dcomp_device_.CopyTo(desktop_device.GetAddressOf());
323 323
324 HRESULT hr = desktop_device->CreateTargetForHwnd(window, TRUE, 324 HRESULT hr = desktop_device->CreateTargetForHwnd(
325 dcomp_target_.Receive()); 325 window, TRUE, dcomp_target_.GetAddressOf());
326 if (FAILED(hr)) 326 if (FAILED(hr))
327 return false; 327 return false;
328 328
329 hr = dcomp_device_->CreateVisual(root_visual_.Receive()); 329 hr = dcomp_device_->CreateVisual(root_visual_.GetAddressOf());
330 if (FAILED(hr)) 330 if (FAILED(hr))
331 return false; 331 return false;
332 332
333 dcomp_target_->SetRoot(root_visual_.Get()); 333 dcomp_target_->SetRoot(root_visual_.Get());
334 return true; 334 return true;
335 } 335 }
336 336
337 void DCLayerTree::InitializeVideoProcessor(const gfx::Size& input_size, 337 void DCLayerTree::InitializeVideoProcessor(const gfx::Size& input_size,
338 const gfx::Size& output_size) { 338 const gfx::Size& output_size) {
339 if (SizeContains(video_input_size_, input_size) && 339 if (SizeContains(video_input_size_, input_size) &&
340 SizeContains(video_output_size_, output_size)) 340 SizeContains(video_output_size_, output_size))
341 return; 341 return;
342 video_input_size_ = input_size; 342 video_input_size_ = input_size;
343 video_output_size_ = output_size; 343 video_output_size_ = output_size;
344 344
345 video_processor_.Reset(); 345 video_processor_.Reset();
346 video_processor_enumerator_.Reset(); 346 video_processor_enumerator_.Reset();
347 D3D11_VIDEO_PROCESSOR_CONTENT_DESC desc = {}; 347 D3D11_VIDEO_PROCESSOR_CONTENT_DESC desc = {};
348 desc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE; 348 desc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
349 desc.InputFrameRate.Numerator = 60; 349 desc.InputFrameRate.Numerator = 60;
350 desc.InputFrameRate.Denominator = 1; 350 desc.InputFrameRate.Denominator = 1;
351 desc.InputWidth = input_size.width(); 351 desc.InputWidth = input_size.width();
352 desc.InputHeight = input_size.height(); 352 desc.InputHeight = input_size.height();
353 desc.OutputFrameRate.Numerator = 60; 353 desc.OutputFrameRate.Numerator = 60;
354 desc.OutputFrameRate.Denominator = 1; 354 desc.OutputFrameRate.Denominator = 1;
355 desc.OutputWidth = output_size.width(); 355 desc.OutputWidth = output_size.width();
356 desc.OutputHeight = output_size.height(); 356 desc.OutputHeight = output_size.height();
357 desc.Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL; 357 desc.Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL;
358 HRESULT hr = video_device_->CreateVideoProcessorEnumerator( 358 HRESULT hr = video_device_->CreateVideoProcessorEnumerator(
359 &desc, video_processor_enumerator_.Receive()); 359 &desc, video_processor_enumerator_.GetAddressOf());
360 CHECK(SUCCEEDED(hr)); 360 CHECK(SUCCEEDED(hr));
361 361
362 hr = video_device_->CreateVideoProcessor(video_processor_enumerator_.Get(), 0, 362 hr = video_device_->CreateVideoProcessor(video_processor_enumerator_.Get(), 0,
363 video_processor_.Receive()); 363 video_processor_.GetAddressOf());
364 CHECK(SUCCEEDED(hr)); 364 CHECK(SUCCEEDED(hr));
365 } 365 }
366 366
367 base::win::ScopedComPtr<IDXGISwapChain1> 367 base::win::ScopedComPtr<IDXGISwapChain1>
368 DCLayerTree::GetLayerSwapChainForTesting(size_t index) const { 368 DCLayerTree::GetLayerSwapChainForTesting(size_t index) const {
369 if (index >= visual_info_.size()) 369 if (index >= visual_info_.size())
370 return base::win::ScopedComPtr<IDXGISwapChain1>(); 370 return base::win::ScopedComPtr<IDXGISwapChain1>();
371 return visual_info_[index].swap_chain; 371 return visual_info_[index].swap_chain;
372 } 372 }
373 373
374 DCLayerTree::SwapChainPresenter::SwapChainPresenter( 374 DCLayerTree::SwapChainPresenter::SwapChainPresenter(
375 DCLayerTree* surface, 375 DCLayerTree* surface,
376 base::win::ScopedComPtr<ID3D11Device> d3d11_device) 376 base::win::ScopedComPtr<ID3D11Device> d3d11_device)
377 : surface_(surface), d3d11_device_(d3d11_device) { 377 : surface_(surface), d3d11_device_(d3d11_device) {
378 d3d11_device_.CopyTo(video_device_.Receive()); 378 d3d11_device_.CopyTo(video_device_.GetAddressOf());
379 base::win::ScopedComPtr<ID3D11DeviceContext> context; 379 base::win::ScopedComPtr<ID3D11DeviceContext> context;
380 d3d11_device_->GetImmediateContext(context.Receive()); 380 d3d11_device_->GetImmediateContext(context.GetAddressOf());
381 context.CopyTo(video_context_.Receive()); 381 context.CopyTo(video_context_.GetAddressOf());
382 HMODULE dcomp = ::GetModuleHandleA("dcomp.dll"); 382 HMODULE dcomp = ::GetModuleHandleA("dcomp.dll");
383 CHECK(dcomp); 383 CHECK(dcomp);
384 create_surface_handle_function_ = 384 create_surface_handle_function_ =
385 reinterpret_cast<PFN_DCOMPOSITION_CREATE_SURFACE_HANDLE>( 385 reinterpret_cast<PFN_DCOMPOSITION_CREATE_SURFACE_HANDLE>(
386 GetProcAddress(dcomp, "DCompositionCreateSurfaceHandle")); 386 GetProcAddress(dcomp, "DCompositionCreateSurfaceHandle"));
387 CHECK(create_surface_handle_function_); 387 CHECK(create_surface_handle_function_);
388 } 388 }
389 389
390 DCLayerTree::SwapChainPresenter::~SwapChainPresenter() {} 390 DCLayerTree::SwapChainPresenter::~SwapChainPresenter() {}
391 391
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 desc.Usage = D3D11_USAGE_DYNAMIC; 432 desc.Usage = D3D11_USAGE_DYNAMIC;
433 433
434 // This isn't actually bound to a decoder, but dynamic textures need 434 // This isn't actually bound to a decoder, but dynamic textures need
435 // BindFlags to be nonzero and D3D11_BIND_DECODER also works when creating 435 // BindFlags to be nonzero and D3D11_BIND_DECODER also works when creating
436 // a VideoProcessorInputView. 436 // a VideoProcessorInputView.
437 desc.BindFlags = D3D11_BIND_DECODER; 437 desc.BindFlags = D3D11_BIND_DECODER;
438 desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 438 desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
439 desc.MiscFlags = 0; 439 desc.MiscFlags = 0;
440 desc.SampleDesc.Count = 1; 440 desc.SampleDesc.Count = 1;
441 base::win::ScopedComPtr<ID3D11Texture2D> texture; 441 base::win::ScopedComPtr<ID3D11Texture2D> texture;
442 HRESULT hr = d3d11_device_->CreateTexture2D(&desc, nullptr, 442 HRESULT hr = d3d11_device_->CreateTexture2D(
443 staging_texture_.Receive()); 443 &desc, nullptr, staging_texture_.GetAddressOf());
444 CHECK(SUCCEEDED(hr)) << "Creating D3D11 video upload texture failed: " 444 CHECK(SUCCEEDED(hr)) << "Creating D3D11 video upload texture failed: "
445 << std::hex << hr; 445 << std::hex << hr;
446 staging_texture_size_ = texture_size; 446 staging_texture_size_ = texture_size;
447 } 447 }
448 base::win::ScopedComPtr<ID3D11DeviceContext> context; 448 base::win::ScopedComPtr<ID3D11DeviceContext> context;
449 d3d11_device_->GetImmediateContext(context.Receive()); 449 d3d11_device_->GetImmediateContext(context.GetAddressOf());
450 D3D11_MAPPED_SUBRESOURCE mapped_resource; 450 D3D11_MAPPED_SUBRESOURCE mapped_resource;
451 HRESULT hr = context->Map(staging_texture_.Get(), 0, D3D11_MAP_WRITE_DISCARD, 451 HRESULT hr = context->Map(staging_texture_.Get(), 0, D3D11_MAP_WRITE_DISCARD,
452 0, &mapped_resource); 452 0, &mapped_resource);
453 CHECK(SUCCEEDED(hr)) << "Mapping D3D11 video upload texture failed: " 453 CHECK(SUCCEEDED(hr)) << "Mapping D3D11 video upload texture failed: "
454 << std::hex << hr; 454 << std::hex << hr;
455 455
456 size_t dest_stride = mapped_resource.RowPitch; 456 size_t dest_stride = mapped_resource.RowPitch;
457 for (int y = 0; y < texture_size.height(); y++) { 457 for (int y = 0; y < texture_size.height(); y++) {
458 const uint8_t* y_source = 458 const uint8_t* y_source =
459 y_image_memory->memory() + y * y_image_memory->stride(); 459 y_image_memory->memory() + y * y_image_memory->stride();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 DCHECK(uv_image_memory); 537 DCHECK(uv_image_memory);
538 if (!UploadVideoImages(y_image_memory, uv_image_memory)) 538 if (!UploadVideoImages(y_image_memory, uv_image_memory))
539 return; 539 return;
540 DCHECK(staging_texture_); 540 DCHECK(staging_texture_);
541 input_texture = staging_texture_; 541 input_texture = staging_texture_;
542 input_level = 0; 542 input_level = 0;
543 } 543 }
544 544
545 if (!out_view_) { 545 if (!out_view_) {
546 base::win::ScopedComPtr<ID3D11Texture2D> texture; 546 base::win::ScopedComPtr<ID3D11Texture2D> texture;
547 swap_chain_->GetBuffer(0, IID_PPV_ARGS(texture.Receive())); 547 swap_chain_->GetBuffer(0, IID_PPV_ARGS(texture.GetAddressOf()));
548 D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC out_desc = {}; 548 D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC out_desc = {};
549 out_desc.ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D; 549 out_desc.ViewDimension = D3D11_VPOV_DIMENSION_TEXTURE2D;
550 out_desc.Texture2D.MipSlice = 0; 550 out_desc.Texture2D.MipSlice = 0;
551 HRESULT hr = video_device_->CreateVideoProcessorOutputView( 551 HRESULT hr = video_device_->CreateVideoProcessorOutputView(
552 texture.Get(), video_processor_enumerator_.Get(), &out_desc, 552 texture.Get(), video_processor_enumerator_.Get(), &out_desc,
553 out_view_.Receive()); 553 out_view_.GetAddressOf());
554 CHECK(SUCCEEDED(hr)); 554 CHECK(SUCCEEDED(hr));
555 } 555 }
556 556
557 // TODO(jbauman): Use correct colorspace. 557 // TODO(jbauman): Use correct colorspace.
558 gfx::ColorSpace src_color_space = gfx::ColorSpace::CreateREC709(); 558 gfx::ColorSpace src_color_space = gfx::ColorSpace::CreateREC709();
559 base::win::ScopedComPtr<ID3D11VideoContext1> context1; 559 base::win::ScopedComPtr<ID3D11VideoContext1> context1;
560 if (SUCCEEDED(video_context_.CopyTo(context1.Receive()))) { 560 if (SUCCEEDED(video_context_.CopyTo(context1.GetAddressOf()))) {
561 context1->VideoProcessorSetStreamColorSpace1( 561 context1->VideoProcessorSetStreamColorSpace1(
562 video_processor_.Get(), 0, 562 video_processor_.Get(), 0,
563 gfx::ColorSpaceWin::GetDXGIColorSpace(src_color_space)); 563 gfx::ColorSpaceWin::GetDXGIColorSpace(src_color_space));
564 } else { 564 } else {
565 // This can't handle as many different types of color spaces, so use it 565 // This can't handle as many different types of color spaces, so use it
566 // only if ID3D11VideoContext1 isn't available. 566 // only if ID3D11VideoContext1 isn't available.
567 D3D11_VIDEO_PROCESSOR_COLOR_SPACE color_space = 567 D3D11_VIDEO_PROCESSOR_COLOR_SPACE color_space =
568 gfx::ColorSpaceWin::GetD3D11ColorSpace(src_color_space); 568 gfx::ColorSpaceWin::GetD3D11ColorSpace(src_color_space);
569 video_context_->VideoProcessorSetStreamColorSpace(video_processor_.Get(), 0, 569 video_context_->VideoProcessorSetStreamColorSpace(video_processor_.Get(), 0,
570 &color_space); 570 &color_space);
571 } 571 }
572 572
573 gfx::ColorSpace output_color_space = 573 gfx::ColorSpace output_color_space =
574 is_yuy2_swapchain_ ? src_color_space : gfx::ColorSpace::CreateSRGB(); 574 is_yuy2_swapchain_ ? src_color_space : gfx::ColorSpace::CreateSRGB();
575 if (base::FeatureList::IsEnabled(kFallbackBT709VideoToBT601) && 575 if (base::FeatureList::IsEnabled(kFallbackBT709VideoToBT601) &&
576 (output_color_space == gfx::ColorSpace::CreateREC709())) { 576 (output_color_space == gfx::ColorSpace::CreateREC709())) {
577 output_color_space = gfx::ColorSpace::CreateREC601(); 577 output_color_space = gfx::ColorSpace::CreateREC601();
578 } 578 }
579 579
580 base::win::ScopedComPtr<IDXGISwapChain3> swap_chain3; 580 base::win::ScopedComPtr<IDXGISwapChain3> swap_chain3;
581 if (SUCCEEDED(swap_chain_.CopyTo(swap_chain3.Receive()))) { 581 if (SUCCEEDED(swap_chain_.CopyTo(swap_chain3.GetAddressOf()))) {
582 DXGI_COLOR_SPACE_TYPE color_space = 582 DXGI_COLOR_SPACE_TYPE color_space =
583 gfx::ColorSpaceWin::GetDXGIColorSpace(output_color_space); 583 gfx::ColorSpaceWin::GetDXGIColorSpace(output_color_space);
584 HRESULT hr = swap_chain3->SetColorSpace1(color_space); 584 HRESULT hr = swap_chain3->SetColorSpace1(color_space);
585 CHECK(SUCCEEDED(hr)); 585 CHECK(SUCCEEDED(hr));
586 if (context1) { 586 if (context1) {
587 context1->VideoProcessorSetOutputColorSpace1(video_processor_.Get(), 587 context1->VideoProcessorSetOutputColorSpace1(video_processor_.Get(),
588 color_space); 588 color_space);
589 } else { 589 } else {
590 D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space = 590 D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space =
591 gfx::ColorSpaceWin::GetD3D11ColorSpace(output_color_space); 591 gfx::ColorSpaceWin::GetD3D11ColorSpace(output_color_space);
592 video_context_->VideoProcessorSetOutputColorSpace(video_processor_.Get(), 592 video_context_->VideoProcessorSetOutputColorSpace(video_processor_.Get(),
593 &d3d11_color_space); 593 &d3d11_color_space);
594 } 594 }
595 } 595 }
596 596
597 { 597 {
598 D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC in_desc = {}; 598 D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC in_desc = {};
599 in_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D; 599 in_desc.ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D;
600 in_desc.Texture2D.ArraySlice = input_level; 600 in_desc.Texture2D.ArraySlice = input_level;
601 base::win::ScopedComPtr<ID3D11VideoProcessorInputView> in_view; 601 base::win::ScopedComPtr<ID3D11VideoProcessorInputView> in_view;
602 HRESULT hr = video_device_->CreateVideoProcessorInputView( 602 HRESULT hr = video_device_->CreateVideoProcessorInputView(
603 input_texture.Get(), video_processor_enumerator_.Get(), &in_desc, 603 input_texture.Get(), video_processor_enumerator_.Get(), &in_desc,
604 in_view.Receive()); 604 in_view.GetAddressOf());
605 CHECK(SUCCEEDED(hr)); 605 CHECK(SUCCEEDED(hr));
606 606
607 D3D11_VIDEO_PROCESSOR_STREAM stream = {}; 607 D3D11_VIDEO_PROCESSOR_STREAM stream = {};
608 stream.Enable = true; 608 stream.Enable = true;
609 stream.OutputIndex = 0; 609 stream.OutputIndex = 0;
610 stream.InputFrameOrField = 0; 610 stream.InputFrameOrField = 0;
611 stream.PastFrames = 0; 611 stream.PastFrames = 0;
612 stream.FutureFrames = 0; 612 stream.FutureFrames = 0;
613 stream.pInputSurface = in_view.Get(); 613 stream.pInputSurface = in_view.Get();
614 RECT dest_rect = gfx::Rect(swap_chain_size).ToRECT(); 614 RECT dest_rect = gfx::Rect(swap_chain_size).ToRECT();
(...skipping 20 matching lines...) Expand all
635 swap_chain_->Present(0, 0); 635 swap_chain_->Present(0, 0);
636 636
637 // DirectComposition can display black for a swapchain between the first 637 // DirectComposition can display black for a swapchain between the first
638 // and second time it's presented to - maybe the first Present can get 638 // and second time it's presented to - maybe the first Present can get
639 // lost somehow and it shows the wrong buffer. In that case copy the 639 // lost somehow and it shows the wrong buffer. In that case copy the
640 // buffers so both have the correct contents, which seems to help. The 640 // buffers so both have the correct contents, which seems to help. The
641 // first Present() after this needs to have SyncInterval > 0, or else the 641 // first Present() after this needs to have SyncInterval > 0, or else the
642 // workaround doesn't help. 642 // workaround doesn't help.
643 base::win::ScopedComPtr<ID3D11Texture2D> dest_texture; 643 base::win::ScopedComPtr<ID3D11Texture2D> dest_texture;
644 HRESULT hr = 644 HRESULT hr =
645 swap_chain_->GetBuffer(0, IID_PPV_ARGS(dest_texture.Receive())); 645 swap_chain_->GetBuffer(0, IID_PPV_ARGS(dest_texture.GetAddressOf()));
646 DCHECK(SUCCEEDED(hr)); 646 DCHECK(SUCCEEDED(hr));
647 base::win::ScopedComPtr<ID3D11Texture2D> src_texture; 647 base::win::ScopedComPtr<ID3D11Texture2D> src_texture;
648 hr = swap_chain_->GetBuffer(1, IID_PPV_ARGS(src_texture.Receive())); 648 hr = swap_chain_->GetBuffer(1, IID_PPV_ARGS(src_texture.GetAddressOf()));
649 DCHECK(SUCCEEDED(hr)); 649 DCHECK(SUCCEEDED(hr));
650 base::win::ScopedComPtr<ID3D11DeviceContext> context; 650 base::win::ScopedComPtr<ID3D11DeviceContext> context;
651 d3d11_device_->GetImmediateContext(context.Receive()); 651 d3d11_device_->GetImmediateContext(context.GetAddressOf());
652 context->CopyResource(dest_texture.Get(), src_texture.Get()); 652 context->CopyResource(dest_texture.Get(), src_texture.Get());
653 } 653 }
654 654
655 swap_chain_->Present(1, 0); 655 swap_chain_->Present(1, 0);
656 656
657 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.SwapchainFormat", 657 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.SwapchainFormat",
658 is_yuy2_swapchain_); 658 is_yuy2_swapchain_);
659 frames_since_color_space_change_++; 659 frames_since_color_space_change_++;
660 660
661 base::win::ScopedComPtr<IDXGISwapChainMedia> swap_chain_media; 661 base::win::ScopedComPtr<IDXGISwapChainMedia> swap_chain_media;
662 if (SUCCEEDED(swap_chain_.CopyTo(swap_chain_media.Receive()))) { 662 if (SUCCEEDED(swap_chain_.CopyTo(swap_chain_media.GetAddressOf()))) {
663 DXGI_FRAME_STATISTICS_MEDIA stats = {}; 663 DXGI_FRAME_STATISTICS_MEDIA stats = {};
664 if (SUCCEEDED(swap_chain_media->GetFrameStatisticsMedia(&stats))) { 664 if (SUCCEEDED(swap_chain_media->GetFrameStatisticsMedia(&stats))) {
665 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.CompositionMode", 665 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.CompositionMode",
666 stats.CompositionMode); 666 stats.CompositionMode);
667 presentation_history_.AddSample(stats.CompositionMode); 667 presentation_history_.AddSample(stats.CompositionMode);
668 } 668 }
669 } 669 }
670 } 670 }
671 671
672 bool DCLayerTree::SwapChainPresenter::InitializeVideoProcessor( 672 bool DCLayerTree::SwapChainPresenter::InitializeVideoProcessor(
(...skipping 12 matching lines...) Expand all
685 // recreated if the enumerator is. 685 // recreated if the enumerator is.
686 out_view_.Reset(); 686 out_view_.Reset();
687 return true; 687 return true;
688 } 688 }
689 689
690 void DCLayerTree::SwapChainPresenter::ReallocateSwapChain(bool yuy2) { 690 void DCLayerTree::SwapChainPresenter::ReallocateSwapChain(bool yuy2) {
691 TRACE_EVENT0("gpu", "DCLayerTree::SwapChainPresenter::ReallocateSwapChain"); 691 TRACE_EVENT0("gpu", "DCLayerTree::SwapChainPresenter::ReallocateSwapChain");
692 DCHECK(!swap_chain_); 692 DCHECK(!swap_chain_);
693 693
694 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; 694 base::win::ScopedComPtr<IDXGIDevice> dxgi_device;
695 d3d11_device_.CopyTo(dxgi_device.Receive()); 695 d3d11_device_.CopyTo(dxgi_device.GetAddressOf());
696 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; 696 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter;
697 dxgi_device->GetAdapter(dxgi_adapter.Receive()); 697 dxgi_device->GetAdapter(dxgi_adapter.GetAddressOf());
698 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory; 698 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory;
699 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.Receive())); 699 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.GetAddressOf()));
700 700
701 base::win::ScopedComPtr<IDXGIFactoryMedia> media_factory; 701 base::win::ScopedComPtr<IDXGIFactoryMedia> media_factory;
702 dxgi_factory.CopyTo(media_factory.Receive()); 702 dxgi_factory.CopyTo(media_factory.GetAddressOf());
703 DXGI_SWAP_CHAIN_DESC1 desc = {}; 703 DXGI_SWAP_CHAIN_DESC1 desc = {};
704 desc.Width = swap_chain_size_.width(); 704 desc.Width = swap_chain_size_.width();
705 desc.Height = swap_chain_size_.height(); 705 desc.Height = swap_chain_size_.height();
706 desc.Format = DXGI_FORMAT_YUY2; 706 desc.Format = DXGI_FORMAT_YUY2;
707 desc.Stereo = FALSE; 707 desc.Stereo = FALSE;
708 desc.SampleDesc.Count = 1; 708 desc.SampleDesc.Count = 1;
709 desc.BufferCount = 2; 709 desc.BufferCount = 2;
710 desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; 710 desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
711 desc.Scaling = DXGI_SCALING_STRETCH; 711 desc.Scaling = DXGI_SCALING_STRETCH;
712 desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; 712 desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
(...skipping 14 matching lines...) Expand all
727 727
728 frames_since_color_space_change_ = 0; 728 frames_since_color_space_change_ = 0;
729 729
730 is_yuy2_swapchain_ = false; 730 is_yuy2_swapchain_ = false;
731 // The composition surface handle isn't actually used, but 731 // The composition surface handle isn't actually used, but
732 // CreateSwapChainForComposition can't create YUY2 swapchains. 732 // CreateSwapChainForComposition can't create YUY2 swapchains.
733 HRESULT hr = E_FAIL; 733 HRESULT hr = E_FAIL;
734 if (yuy2) { 734 if (yuy2) {
735 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle( 735 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle(
736 d3d11_device_.Get(), swap_chain_handle_.Get(), &desc, nullptr, 736 d3d11_device_.Get(), swap_chain_handle_.Get(), &desc, nullptr,
737 swap_chain_.Receive()); 737 swap_chain_.GetAddressOf());
738 is_yuy2_swapchain_ = SUCCEEDED(hr); 738 is_yuy2_swapchain_ = SUCCEEDED(hr);
739 failed_to_create_yuy2_swapchain_ = !is_yuy2_swapchain_; 739 failed_to_create_yuy2_swapchain_ = !is_yuy2_swapchain_;
740 } 740 }
741 741
742 if (!is_yuy2_swapchain_) { 742 if (!is_yuy2_swapchain_) {
743 if (yuy2) { 743 if (yuy2) {
744 DLOG(ERROR) << "YUY2 creation failed with " << std::hex << hr 744 DLOG(ERROR) << "YUY2 creation failed with " << std::hex << hr
745 << ". Falling back to BGRA"; 745 << ". Falling back to BGRA";
746 } 746 }
747 desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; 747 desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
748 desc.Flags = 0; 748 desc.Flags = 0;
749 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle( 749 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle(
750 d3d11_device_.Get(), swap_chain_handle_.Get(), &desc, nullptr, 750 d3d11_device_.Get(), swap_chain_handle_.Get(), &desc, nullptr,
751 swap_chain_.Receive()); 751 swap_chain_.GetAddressOf());
752 CHECK(SUCCEEDED(hr)); 752 CHECK(SUCCEEDED(hr));
753 } 753 }
754 out_view_.Reset(); 754 out_view_.Reset();
755 } 755 }
756 756
757 void DCLayerTree::InitVisual(size_t i) { 757 void DCLayerTree::InitVisual(size_t i) {
758 DCHECK_GT(visual_info_.size(), i); 758 DCHECK_GT(visual_info_.size(), i);
759 VisualInfo* visual_info = &visual_info_[i]; 759 VisualInfo* visual_info = &visual_info_[i];
760 if (visual_info->content_visual) 760 if (visual_info->content_visual)
761 return; 761 return;
762 DCHECK(!visual_info->clip_visual); 762 DCHECK(!visual_info->clip_visual);
763 base::win::ScopedComPtr<IDCompositionVisual2> visual; 763 base::win::ScopedComPtr<IDCompositionVisual2> visual;
764 dcomp_device_->CreateVisual(visual_info->clip_visual.Receive()); 764 dcomp_device_->CreateVisual(visual_info->clip_visual.GetAddressOf());
765 dcomp_device_->CreateVisual(visual.Receive()); 765 dcomp_device_->CreateVisual(visual.GetAddressOf());
766 visual_info->content_visual = visual; 766 visual_info->content_visual = visual;
767 visual_info->clip_visual->AddVisual(visual.Get(), FALSE, nullptr); 767 visual_info->clip_visual->AddVisual(visual.Get(), FALSE, nullptr);
768 768
769 IDCompositionVisual2* last_visual = 769 IDCompositionVisual2* last_visual =
770 (i > 0) ? visual_info_[i - 1].clip_visual.Get() : nullptr; 770 (i > 0) ? visual_info_[i - 1].clip_visual.Get() : nullptr;
771 root_visual_->AddVisual(visual_info->clip_visual.Get(), TRUE, last_visual); 771 root_visual_->AddVisual(visual_info->clip_visual.Get(), TRUE, last_visual);
772 } 772 }
773 773
774 void DCLayerTree::UpdateVisualForVideo( 774 void DCLayerTree::UpdateVisualForVideo(
775 VisualInfo* visual_info, 775 VisualInfo* visual_info,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 gfx::Transform scale_transform; 807 gfx::Transform scale_transform;
808 scale_transform.Scale( 808 scale_transform.Scale(
809 visual_info->swap_chain_presenter->swap_chain_scale_x(), 809 visual_info->swap_chain_presenter->swap_chain_scale_x(),
810 visual_info->swap_chain_presenter->swap_chain_scale_y()); 810 visual_info->swap_chain_presenter->swap_chain_scale_y());
811 final_transform.PreconcatTransform(scale_transform); 811 final_transform.PreconcatTransform(scale_transform);
812 final_transform.Transpose(); 812 final_transform.Transpose();
813 813
814 dc_visual->SetOffsetX(bounds_rect.x()); 814 dc_visual->SetOffsetX(bounds_rect.x());
815 dc_visual->SetOffsetY(bounds_rect.y()); 815 dc_visual->SetOffsetY(bounds_rect.y());
816 base::win::ScopedComPtr<IDCompositionMatrixTransform> dcomp_transform; 816 base::win::ScopedComPtr<IDCompositionMatrixTransform> dcomp_transform;
817 dcomp_device_->CreateMatrixTransform(dcomp_transform.Receive()); 817 dcomp_device_->CreateMatrixTransform(dcomp_transform.GetAddressOf());
818 D2D_MATRIX_3X2_F d2d_matrix = {{{final_transform.matrix().get(0, 0), 818 D2D_MATRIX_3X2_F d2d_matrix = {{{final_transform.matrix().get(0, 0),
819 final_transform.matrix().get(0, 1), 819 final_transform.matrix().get(0, 1),
820 final_transform.matrix().get(1, 0), 820 final_transform.matrix().get(1, 0),
821 final_transform.matrix().get(1, 1), 821 final_transform.matrix().get(1, 1),
822 final_transform.matrix().get(3, 0), 822 final_transform.matrix().get(3, 0),
823 final_transform.matrix().get(3, 1)}}}; 823 final_transform.matrix().get(3, 1)}}};
824 dcomp_transform->SetMatrix(d2d_matrix); 824 dcomp_transform->SetMatrix(d2d_matrix);
825 dc_visual->SetTransform(dcomp_transform.Get()); 825 dc_visual->SetTransform(dcomp_transform.Get());
826 } 826 }
827 } 827 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 const ui::DCRendererLayerParams& params) { 861 const ui::DCRendererLayerParams& params) {
862 if (params.is_clipped != visual_info->is_clipped || 862 if (params.is_clipped != visual_info->is_clipped ||
863 params.clip_rect != visual_info->clip_rect) { 863 params.clip_rect != visual_info->clip_rect) {
864 // DirectComposition clips happen in the pre-transform visual 864 // DirectComposition clips happen in the pre-transform visual
865 // space, while cc/ clips happen post-transform. So the clip needs 865 // space, while cc/ clips happen post-transform. So the clip needs
866 // to go on a separate parent visual that's untransformed. 866 // to go on a separate parent visual that's untransformed.
867 visual_info->is_clipped = params.is_clipped; 867 visual_info->is_clipped = params.is_clipped;
868 visual_info->clip_rect = params.clip_rect; 868 visual_info->clip_rect = params.clip_rect;
869 if (params.is_clipped) { 869 if (params.is_clipped) {
870 base::win::ScopedComPtr<IDCompositionRectangleClip> clip; 870 base::win::ScopedComPtr<IDCompositionRectangleClip> clip;
871 dcomp_device_->CreateRectangleClip(clip.Receive()); 871 dcomp_device_->CreateRectangleClip(clip.GetAddressOf());
872 gfx::Rect offset_clip = params.clip_rect; 872 gfx::Rect offset_clip = params.clip_rect;
873 clip->SetLeft(offset_clip.x()); 873 clip->SetLeft(offset_clip.x());
874 clip->SetRight(offset_clip.right()); 874 clip->SetRight(offset_clip.right());
875 clip->SetBottom(offset_clip.bottom()); 875 clip->SetBottom(offset_clip.bottom());
876 clip->SetTop(offset_clip.y()); 876 clip->SetTop(offset_clip.y());
877 visual_info->clip_visual->SetClip(clip.Get()); 877 visual_info->clip_visual->SetClip(clip.Get());
878 } else { 878 } else {
879 visual_info->clip_visual->SetClip(nullptr); 879 visual_info->clip_visual->SetClip(nullptr);
880 } 880 }
881 } 881 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 DCHECK(!swap_chain_); 1017 DCHECK(!swap_chain_);
1018 DXGI_FORMAT output_format = 1018 DXGI_FORMAT output_format =
1019 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableHDR) 1019 base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableHDR)
1020 ? DXGI_FORMAT_R16G16B16A16_FLOAT 1020 ? DXGI_FORMAT_R16G16B16A16_FLOAT
1021 : DXGI_FORMAT_B8G8R8A8_UNORM; 1021 : DXGI_FORMAT_B8G8R8A8_UNORM;
1022 if (enable_dc_layers_) { 1022 if (enable_dc_layers_) {
1023 // Always treat as premultiplied, because an underlay could cause it to 1023 // Always treat as premultiplied, because an underlay could cause it to
1024 // become transparent. 1024 // become transparent.
1025 HRESULT hr = dcomp_device_->CreateSurface( 1025 HRESULT hr = dcomp_device_->CreateSurface(
1026 size_.width(), size_.height(), output_format, 1026 size_.width(), size_.height(), output_format,
1027 DXGI_ALPHA_MODE_PREMULTIPLIED, dcomp_surface_.Receive()); 1027 DXGI_ALPHA_MODE_PREMULTIPLIED, dcomp_surface_.GetAddressOf());
1028 has_been_rendered_to_ = false; 1028 has_been_rendered_to_ = false;
1029 CHECK(SUCCEEDED(hr)); 1029 CHECK(SUCCEEDED(hr));
1030 } else { 1030 } else {
1031 DXGI_ALPHA_MODE alpha_mode = 1031 DXGI_ALPHA_MODE alpha_mode =
1032 has_alpha_ ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE; 1032 has_alpha_ ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE;
1033 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; 1033 base::win::ScopedComPtr<IDXGIDevice> dxgi_device;
1034 d3d11_device_.CopyTo(dxgi_device.Receive()); 1034 d3d11_device_.CopyTo(dxgi_device.GetAddressOf());
1035 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; 1035 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter;
1036 dxgi_device->GetAdapter(dxgi_adapter.Receive()); 1036 dxgi_device->GetAdapter(dxgi_adapter.GetAddressOf());
1037 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory; 1037 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory;
1038 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.Receive())); 1038 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.GetAddressOf()));
1039 1039
1040 DXGI_SWAP_CHAIN_DESC1 desc = {}; 1040 DXGI_SWAP_CHAIN_DESC1 desc = {};
1041 desc.Width = size_.width(); 1041 desc.Width = size_.width();
1042 desc.Height = size_.height(); 1042 desc.Height = size_.height();
1043 desc.Format = output_format; 1043 desc.Format = output_format;
1044 desc.Stereo = FALSE; 1044 desc.Stereo = FALSE;
1045 desc.SampleDesc.Count = 1; 1045 desc.SampleDesc.Count = 1;
1046 desc.BufferCount = 2; 1046 desc.BufferCount = 2;
1047 desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; 1047 desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
1048 desc.Scaling = DXGI_SCALING_STRETCH; 1048 desc.Scaling = DXGI_SCALING_STRETCH;
1049 desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; 1049 desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
1050 desc.AlphaMode = alpha_mode; 1050 desc.AlphaMode = alpha_mode;
1051 desc.Flags = 0; 1051 desc.Flags = 0;
1052 HRESULT hr = dxgi_factory->CreateSwapChainForComposition( 1052 HRESULT hr = dxgi_factory->CreateSwapChainForComposition(
1053 d3d11_device_.Get(), &desc, nullptr, swap_chain_.Receive()); 1053 d3d11_device_.Get(), &desc, nullptr, swap_chain_.GetAddressOf());
1054 has_been_rendered_to_ = false; 1054 has_been_rendered_to_ = false;
1055 first_swap_ = true; 1055 first_swap_ = true;
1056 CHECK(SUCCEEDED(hr)); 1056 CHECK(SUCCEEDED(hr));
1057 } 1057 }
1058 } 1058 }
1059 1059
1060 void DirectCompositionSurfaceWin::ReleaseDrawTexture(bool will_discard) { 1060 void DirectCompositionSurfaceWin::ReleaseDrawTexture(bool will_discard) {
1061 if (real_surface_) { 1061 if (real_surface_) {
1062 eglDestroySurface(GetDisplay(), real_surface_); 1062 eglDestroySurface(GetDisplay(), real_surface_);
1063 real_surface_ = nullptr; 1063 real_surface_ = nullptr;
1064 } 1064 }
1065 if (draw_texture_) { 1065 if (draw_texture_) {
1066 draw_texture_.Reset(); 1066 draw_texture_.Reset();
1067 if (dcomp_surface_) { 1067 if (dcomp_surface_) {
1068 HRESULT hr = dcomp_surface_->EndDraw(); 1068 HRESULT hr = dcomp_surface_->EndDraw();
1069 CHECK(SUCCEEDED(hr)); 1069 CHECK(SUCCEEDED(hr));
1070 } else if (!will_discard) { 1070 } else if (!will_discard) {
1071 DXGI_PRESENT_PARAMETERS params = {}; 1071 DXGI_PRESENT_PARAMETERS params = {};
1072 RECT dirty_rect = swap_rect_.ToRECT(); 1072 RECT dirty_rect = swap_rect_.ToRECT();
1073 params.DirtyRectsCount = 1; 1073 params.DirtyRectsCount = 1;
1074 params.pDirtyRects = &dirty_rect; 1074 params.pDirtyRects = &dirty_rect;
1075 swap_chain_->Present1(first_swap_ ? 0 : 1, 0, &params); 1075 swap_chain_->Present1(first_swap_ ? 0 : 1, 0, &params);
1076 if (first_swap_) { 1076 if (first_swap_) {
1077 // Wait for the GPU to finish executing its commands before 1077 // Wait for the GPU to finish executing its commands before
1078 // committing the DirectComposition tree, or else the swapchain 1078 // committing the DirectComposition tree, or else the swapchain
1079 // may flicker black when it's first presented. 1079 // may flicker black when it's first presented.
1080 base::win::ScopedComPtr<IDXGIDevice2> dxgi_device2; 1080 base::win::ScopedComPtr<IDXGIDevice2> dxgi_device2;
1081 HRESULT hr = d3d11_device_.CopyTo(dxgi_device2.Receive()); 1081 HRESULT hr = d3d11_device_.CopyTo(dxgi_device2.GetAddressOf());
1082 DCHECK(SUCCEEDED(hr)); 1082 DCHECK(SUCCEEDED(hr));
1083 base::WaitableEvent event( 1083 base::WaitableEvent event(
1084 base::WaitableEvent::ResetPolicy::AUTOMATIC, 1084 base::WaitableEvent::ResetPolicy::AUTOMATIC,
1085 base::WaitableEvent::InitialState::NOT_SIGNALED); 1085 base::WaitableEvent::InitialState::NOT_SIGNALED);
1086 dxgi_device2->EnqueueSetEvent(event.handle()); 1086 dxgi_device2->EnqueueSetEvent(event.handle());
1087 event.Wait(); 1087 event.Wait();
1088 first_swap_ = false; 1088 first_swap_ = false;
1089 } 1089 }
1090 } 1090 }
1091 } 1091 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 DLOG(ERROR) << "First draw to surface must draw to everything"; 1233 DLOG(ERROR) << "First draw to surface must draw to everything";
1234 return false; 1234 return false;
1235 } 1235 }
1236 1236
1237 CHECK(!g_current_surface); 1237 CHECK(!g_current_surface);
1238 1238
1239 RECT rect = rectangle.ToRECT(); 1239 RECT rect = rectangle.ToRECT();
1240 if (dcomp_surface_) { 1240 if (dcomp_surface_) {
1241 POINT update_offset; 1241 POINT update_offset;
1242 HRESULT hr = dcomp_surface_->BeginDraw( 1242 HRESULT hr = dcomp_surface_->BeginDraw(
1243 &rect, IID_PPV_ARGS(draw_texture_.Receive()), &update_offset); 1243 &rect, IID_PPV_ARGS(draw_texture_.GetAddressOf()), &update_offset);
1244 draw_offset_ = gfx::Point(update_offset) - gfx::Rect(rect).origin(); 1244 draw_offset_ = gfx::Point(update_offset) - gfx::Rect(rect).origin();
1245 CHECK(SUCCEEDED(hr)); 1245 CHECK(SUCCEEDED(hr));
1246 } else { 1246 } else {
1247 HRESULT hr = 1247 HRESULT hr =
1248 swap_chain_->GetBuffer(0, IID_PPV_ARGS(draw_texture_.Receive())); 1248 swap_chain_->GetBuffer(0, IID_PPV_ARGS(draw_texture_.GetAddressOf()));
1249 swap_rect_ = rectangle; 1249 swap_rect_ = rectangle;
1250 draw_offset_ = gfx::Vector2d(); 1250 draw_offset_ = gfx::Vector2d();
1251 CHECK(SUCCEEDED(hr)); 1251 CHECK(SUCCEEDED(hr));
1252 } 1252 }
1253 has_been_rendered_to_ = true; 1253 has_been_rendered_to_ = true;
1254 1254
1255 g_current_surface = dcomp_surface_.Get(); 1255 g_current_surface = dcomp_surface_.Get();
1256 1256
1257 std::vector<EGLint> pbuffer_attribs{ 1257 std::vector<EGLint> pbuffer_attribs{
1258 EGL_WIDTH, 1258 EGL_WIDTH,
(...skipping 21 matching lines...) Expand all
1280 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { 1280 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() {
1281 return child_window_.GetTaskRunnerForTesting(); 1281 return child_window_.GetTaskRunnerForTesting();
1282 } 1282 }
1283 1283
1284 base::win::ScopedComPtr<IDXGISwapChain1> 1284 base::win::ScopedComPtr<IDXGISwapChain1>
1285 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { 1285 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const {
1286 return layer_tree_->GetLayerSwapChainForTesting(index); 1286 return layer_tree_->GetLayerSwapChainForTesting(index);
1287 } 1287 }
1288 1288
1289 } // namespace gpu 1289 } // namespace gpu
OLDNEW
« no previous file with comments | « device/sensors/data_fetcher_shared_memory_win.cc ('k') | gpu/ipc/service/direct_composition_surface_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698