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

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

Issue 1128113011: ozone: Introduce ClientPixmap and ClientPixmapFactory for non-GPU processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix extensions_unittests Created 5 years, 4 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/gbm.gypi ('k') | ui/ozone/platform/drm/gpu/gbm_surface_factory.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/gbm_buffer.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <gbm.h> 9 #include <gbm.h>
10 #include <xf86drm.h> 10 #include <xf86drm.h>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // static 47 // static
48 scoped_refptr<GbmBuffer> GbmBuffer::CreateBuffer( 48 scoped_refptr<GbmBuffer> GbmBuffer::CreateBuffer(
49 const scoped_refptr<GbmDevice>& gbm, 49 const scoped_refptr<GbmDevice>& gbm,
50 gfx::BufferFormat format, 50 gfx::BufferFormat format,
51 const gfx::Size& size, 51 const gfx::Size& size,
52 gfx::BufferUsage usage) { 52 gfx::BufferUsage usage) {
53 TRACE_EVENT2("drm", "GbmBuffer::CreateBuffer", "device", 53 TRACE_EVENT2("drm", "GbmBuffer::CreateBuffer", "device",
54 gbm->device_path().value(), "size", size.ToString()); 54 gbm->device_path().value(), "size", size.ToString());
55 bool use_scanout = (usage == gfx::BufferUsage::SCANOUT); 55 bool use_scanout = (usage == gfx::BufferUsage::SCANOUT);
56 unsigned flags = GBM_BO_USE_RENDERING; 56 unsigned flags = GBM_BO_USE_RENDERING;
57 // GBM_BO_USE_SCANOUT is the hint of x-tiling.
57 if (use_scanout) 58 if (use_scanout)
58 flags |= GBM_BO_USE_SCANOUT; 59 flags |= GBM_BO_USE_SCANOUT;
59 gbm_bo* bo = gbm_bo_create(gbm->device(), size.width(), size.height(), 60 gbm_bo* bo = gbm_bo_create(gbm->device(), size.width(), size.height(),
60 GetGbmFormatFromBufferFormat(format), flags); 61 GetGbmFormatFromBufferFormat(format), flags);
61 if (!bo) 62 if (!bo)
62 return NULL; 63 return NULL;
63 64
64 scoped_refptr<GbmBuffer> buffer(new GbmBuffer(gbm, bo, use_scanout)); 65 scoped_refptr<GbmBuffer> buffer(new GbmBuffer(gbm, bo, use_scanout));
65 if (use_scanout && !buffer->GetFramebufferId()) 66 if (use_scanout && !buffer->GetFramebufferId())
66 return NULL; 67 return NULL;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 gfx::Size pixmap_size = buffer_->GetSize(); 144 gfx::Size pixmap_size = buffer_->GetSize();
144 // If the required size is not integer-sized, round it to the next integer. 145 // If the required size is not integer-sized, round it to the next integer.
145 *required_size = gfx::ToCeiledSize( 146 *required_size = gfx::ToCeiledSize(
146 gfx::SizeF(display_bounds.width() / crop_rect.width(), 147 gfx::SizeF(display_bounds.width() / crop_rect.width(),
147 display_bounds.height() / crop_rect.height())); 148 display_bounds.height() / crop_rect.height()));
148 return pixmap_size != *required_size; 149 return pixmap_size != *required_size;
149 } 150 }
150 151
151 } // namespace ui 152 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gbm.gypi ('k') | ui/ozone/platform/drm/gpu/gbm_surface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698