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

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

Issue 1483633002: ozone: support gfx::BufferFormat::RGBX_8888 as a native pixmap format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve Created 5 years 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/common/drm_util.cc ('k') | no next file » | 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_base.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h"
6 6
7 #include <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/ozone/platform/drm/gpu/drm_device.h" 10 #include "ui/ozone/platform/drm/gpu/drm_device.h"
11 11
12 namespace ui { 12 namespace ui {
13 13
14 GbmBufferBase::GbmBufferBase(const scoped_refptr<DrmDevice>& drm, 14 GbmBufferBase::GbmBufferBase(const scoped_refptr<DrmDevice>& drm,
15 gbm_bo* bo, 15 gbm_bo* bo,
16 bool scanout) 16 bool scanout)
17 : drm_(drm), bo_(bo) { 17 : drm_(drm), bo_(bo) {
18 fb_pixel_format_ = gbm_bo_get_format(bo);
dshwang 2015/11/27 17:59:54 fb_pixel_format_ is used in GetBufferFormat() even
reveman 2015/11/27 20:09:33 can you move this into the initialization list?
kalyank 2015/11/27 21:15:20 Here storage format can be different to pixel form
18 if (scanout) { 19 if (scanout) {
19 fb_pixel_format_ = gbm_bo_get_format(bo);
20 if (fb_pixel_format_ == GBM_FORMAT_ARGB8888)
21 fb_pixel_format_ = GBM_FORMAT_XRGB8888;
dshwang 2015/11/27 17:59:54 This hack was introduced by https://codereview.chr
22
23 // For now, we only support XRGB and UYVY format.
24 DCHECK(fb_pixel_format_ == GBM_FORMAT_XRGB8888 ||
25 fb_pixel_format_ == GBM_FORMAT_UYVY);
26
27 uint32_t handles[4] = {0}; 20 uint32_t handles[4] = {0};
28 handles[0] = gbm_bo_get_handle(bo).u32; 21 handles[0] = gbm_bo_get_handle(bo).u32;
29 uint32_t strides[4] = {0}; 22 uint32_t strides[4] = {0};
30 strides[0] = gbm_bo_get_stride(bo); 23 strides[0] = gbm_bo_get_stride(bo);
31 uint32_t offsets[4] = {0}; 24 uint32_t offsets[4] = {0};
32 25
33 if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo), 26 if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo),
34 fb_pixel_format_, handles, strides, offsets, 27 fb_pixel_format_, handles, strides, offsets,
35 &framebuffer_, 0)) { 28 &framebuffer_, 0)) {
36 PLOG(ERROR) << "Failed to register buffer"; 29 PLOG(ERROR) << "Failed to register buffer";
(...skipping 21 matching lines...) Expand all
58 51
59 uint32_t GbmBufferBase::GetFramebufferPixelFormat() const { 52 uint32_t GbmBufferBase::GetFramebufferPixelFormat() const {
60 return fb_pixel_format_; 53 return fb_pixel_format_;
61 } 54 }
62 55
63 bool GbmBufferBase::RequiresGlFinish() const { 56 bool GbmBufferBase::RequiresGlFinish() const {
64 return !drm_->is_primary_device(); 57 return !drm_->is_primary_device();
65 } 58 }
66 59
67 } // namespace ui 60 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/common/drm_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698