OLD | NEW |
---|---|
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), fb_pixel_format_(gbm_bo_get_format(bo)) { |
kalyank
2015/12/11 04:57:41
Unless its a scanout buffer and the buffer is regi
dshwang
2015/12/11 07:17:32
Ok, agree.
To clarify, rename it to framebuffer_pi
| |
18 if (scanout) { | 18 if (scanout) { |
19 fb_pixel_format_ = gbm_bo_get_format(bo); | 19 // Currently, drm supports 24 bitcolordepth for hardware overlay. |
20 if (fb_pixel_format_ == GBM_FORMAT_ARGB8888) | 20 if (fb_pixel_format_ == GBM_FORMAT_ARGB8888 || |
21 fb_pixel_format_ == GBM_FORMAT_ABGR8888) | |
kalyank
2015/12/11 04:57:41
ABGR, is this format going to be used ?
dshwang
2015/12/11 07:17:32
ABGR is not used by chrome. However, ozone gbm sup
kalyank
2015/12/11 19:07:12
Only BGRA and RGBA are advertised. In BGRA case, f
dshwang
2015/12/13 05:34:43
Got it. New CL supports both BGRX8888 and RGBX8888
| |
21 fb_pixel_format_ = GBM_FORMAT_XRGB8888; | 22 fb_pixel_format_ = GBM_FORMAT_XRGB8888; |
22 | 23 |
23 // For now, we only support XRGB and UYVY format. | 24 // For now, we only support XRGB and UYVY format. |
24 DCHECK(fb_pixel_format_ == GBM_FORMAT_XRGB8888 || | 25 DCHECK(fb_pixel_format_ == GBM_FORMAT_XRGB8888 || |
25 fb_pixel_format_ == GBM_FORMAT_UYVY); | 26 fb_pixel_format_ == GBM_FORMAT_UYVY); |
26 | 27 |
27 uint32_t handles[4] = {0}; | 28 uint32_t handles[4] = {0}; |
28 handles[0] = gbm_bo_get_handle(bo).u32; | 29 handles[0] = gbm_bo_get_handle(bo).u32; |
29 uint32_t strides[4] = {0}; | 30 uint32_t strides[4] = {0}; |
30 strides[0] = gbm_bo_get_stride(bo); | 31 strides[0] = gbm_bo_get_stride(bo); |
(...skipping 27 matching lines...) Expand all Loading... | |
58 | 59 |
59 uint32_t GbmBufferBase::GetFramebufferPixelFormat() const { | 60 uint32_t GbmBufferBase::GetFramebufferPixelFormat() const { |
60 return fb_pixel_format_; | 61 return fb_pixel_format_; |
61 } | 62 } |
62 | 63 |
63 bool GbmBufferBase::RequiresGlFinish() const { | 64 bool GbmBufferBase::RequiresGlFinish() const { |
64 return !drm_->is_primary_device(); | 65 return !drm_->is_primary_device(); |
65 } | 66 } |
66 | 67 |
67 } // namespace ui | 68 } // namespace ui |
OLD | NEW |