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

Side by Side Diff: ui/ozone/platform/dri/dri_surface.cc

Issue 399213005: [Ozone-DRI] Adding ScanoutBuffer interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use RefCounted as base Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/dri/dri_surface.h ('k') | ui/ozone/platform/dri/gbm_surface.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/dri/dri_surface.h" 5 #include "ui/ozone/platform/dri/dri_surface.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/mman.h> 8 #include <sys/mman.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <xf86drm.h> 10 #include <xf86drm.h>
(...skipping 13 matching lines...) Expand all
24 bitmaps_(), 24 bitmaps_(),
25 front_buffer_(0), 25 front_buffer_(0),
26 size_(size) { 26 size_(size) {
27 } 27 }
28 28
29 DriSurface::~DriSurface() { 29 DriSurface::~DriSurface() {
30 } 30 }
31 31
32 bool DriSurface::Initialize() { 32 bool DriSurface::Initialize() {
33 for (size_t i = 0; i < arraysize(bitmaps_); ++i) { 33 for (size_t i = 0; i < arraysize(bitmaps_); ++i) {
34 bitmaps_[i].reset(new DriBuffer(dri_)); 34 bitmaps_[i] = new DriBuffer(dri_);
35 // TODO(dnicoara) Should select the configuration based on what the 35 // TODO(dnicoara) Should select the configuration based on what the
36 // underlying system supports. 36 // underlying system supports.
37 SkImageInfo info = SkImageInfo::MakeN32Premul(size_.width(), 37 SkImageInfo info = SkImageInfo::MakeN32Premul(size_.width(),
38 size_.height()); 38 size_.height());
39 if (!bitmaps_[i]->Initialize(info)) { 39 if (!bitmaps_[i]->Initialize(info)) {
40 return false; 40 return false;
41 } 41 }
42 } 42 }
43 43
44 return true; 44 return true;
45 } 45 }
46 46
47 uint32_t DriSurface::GetFramebufferId() const { 47 uint32_t DriSurface::GetFramebufferId() const {
48 CHECK(backbuffer()); 48 CHECK(backbuffer());
49 return backbuffer()->framebuffer(); 49 return backbuffer()->GetFramebufferId();
50 } 50 }
51 51
52 uint32_t DriSurface::GetHandle() const { 52 uint32_t DriSurface::GetHandle() const {
53 CHECK(backbuffer()); 53 CHECK(backbuffer());
54 return backbuffer()->handle(); 54 return backbuffer()->GetHandle();
55 } 55 }
56 56
57 void DriSurface::PreSwapBuffers() { 57 void DriSurface::PreSwapBuffers() {
58 } 58 }
59 59
60 // This call is made after the hardware just started displaying our back buffer. 60 // This call is made after the hardware just started displaying our back buffer.
61 // We need to update our pointer reference and synchronize the two buffers. 61 // We need to update our pointer reference and synchronize the two buffers.
62 void DriSurface::SwapBuffers() { 62 void DriSurface::SwapBuffers() {
63 CHECK(frontbuffer()); 63 CHECK(frontbuffer());
64 CHECK(backbuffer()); 64 CHECK(backbuffer());
65 65
66 // Update our front buffer pointer. 66 // Update our front buffer pointer.
67 front_buffer_ ^= 1; 67 front_buffer_ ^= 1;
68 } 68 }
69 69
70 gfx::Size DriSurface::Size() const { 70 gfx::Size DriSurface::Size() const {
71 return size_; 71 return size_;
72 } 72 }
73 73
74 SkCanvas* DriSurface::GetDrawableForWidget() { 74 SkCanvas* DriSurface::GetDrawableForWidget() {
75 CHECK(backbuffer()); 75 CHECK(backbuffer());
76 return backbuffer()->canvas(); 76 return backbuffer()->GetCanvas();
77 } 77 }
78 78
79 } // namespace ui 79 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_surface.h ('k') | ui/ozone/platform/dri/gbm_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698