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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_surface.cc

Issue 1166463004: Revert of Adding status to swap complete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « ui/ozone/platform/drm/gpu/crtc_controller.cc ('k') | ui/ozone/platform/drm/gpu/drm_window.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/ozone/platform/drm/gpu/drm_surface.h" 5 #include "ui/ozone/platform/drm/gpu/drm_surface.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkSurface.h" 11 #include "third_party/skia/include/core/SkSurface.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/skia_util.h" 13 #include "ui/gfx/skia_util.h"
14 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" 14 #include "ui/ozone/platform/drm/gpu/drm_buffer.h"
15 #include "ui/ozone/platform/drm/gpu/drm_device.h" 15 #include "ui/ozone/platform/drm/gpu/drm_device.h"
16 #include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h" 16 #include "ui/ozone/platform/drm/gpu/drm_vsync_provider.h"
17 #include "ui/ozone/platform/drm/gpu/drm_window.h" 17 #include "ui/ozone/platform/drm/gpu/drm_window.h"
18 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" 18 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h"
19 19
20 namespace ui { 20 namespace ui {
21 21
22 namespace { 22 namespace {
23 void EmptyPageFlipCallback(gfx::SwapResult result) {
24 }
25 23
26 scoped_refptr<DrmBuffer> AllocateBuffer(const scoped_refptr<DrmDevice>& drm, 24 scoped_refptr<DrmBuffer> AllocateBuffer(const scoped_refptr<DrmDevice>& drm,
27 const gfx::Size& size) { 25 const gfx::Size& size) {
28 scoped_refptr<DrmBuffer> buffer(new DrmBuffer(drm)); 26 scoped_refptr<DrmBuffer> buffer(new DrmBuffer(drm));
29 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); 27 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height());
30 28
31 bool initialized = 29 bool initialized =
32 buffer->Initialize(info, true /* should_register_framebuffer */); 30 buffer->Initialize(info, true /* should_register_framebuffer */);
33 DCHECK(initialized) << "Failed to create drm buffer."; 31 DCHECK(initialized) << "Failed to create drm buffer.";
34 32
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 64
67 void DrmSurface::PresentCanvas(const gfx::Rect& damage) { 65 void DrmSurface::PresentCanvas(const gfx::Rect& damage) {
68 DCHECK(base::MessageLoopForUI::IsCurrent()); 66 DCHECK(base::MessageLoopForUI::IsCurrent());
69 67
70 DCHECK(buffers_[front_buffer_ ^ 1].get()); 68 DCHECK(buffers_[front_buffer_ ^ 1].get());
71 window_delegate_->QueueOverlayPlane( 69 window_delegate_->QueueOverlayPlane(
72 OverlayPlane(buffers_[front_buffer_ ^ 1])); 70 OverlayPlane(buffers_[front_buffer_ ^ 1]));
73 71
74 UpdateNativeSurface(damage); 72 UpdateNativeSurface(damage);
75 window_delegate_->SchedulePageFlip(true /* is_sync */, 73 window_delegate_->SchedulePageFlip(true /* is_sync */,
76 base::Bind(&EmptyPageFlipCallback)); 74 base::Bind(&base::DoNothing));
77 75
78 // Update our front buffer pointer. 76 // Update our front buffer pointer.
79 front_buffer_ ^= 1; 77 front_buffer_ ^= 1;
80 } 78 }
81 79
82 scoped_ptr<gfx::VSyncProvider> DrmSurface::CreateVSyncProvider() { 80 scoped_ptr<gfx::VSyncProvider> DrmSurface::CreateVSyncProvider() {
83 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_)); 81 return make_scoped_ptr(new DrmVSyncProvider(window_delegate_));
84 } 82 }
85 83
86 void DrmSurface::UpdateNativeSurface(const gfx::Rect& damage) { 84 void DrmSurface::UpdateNativeSurface(const gfx::Rect& damage) {
87 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas(); 85 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas();
88 86
89 // The DrmSurface is double buffered, so the current back buffer is 87 // The DrmSurface is double buffered, so the current back buffer is
90 // missing the previous update. Expand damage region. 88 // missing the previous update. Expand damage region.
91 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); 89 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_));
92 90
93 // Copy damage region. 91 // Copy damage region.
94 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); 92 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot());
95 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL); 93 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL);
96 94
97 last_damage_ = damage; 95 last_damage_ = damage;
98 } 96 }
99 97
100 } // namespace ui 98 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/crtc_controller.cc ('k') | ui/ozone/platform/drm/gpu/drm_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698