Chromium Code Reviews| Index: components/exo/wayland/server.cc |
| diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc |
| index 61c0c6baa3b3e71871f28b4228b67140a1ba345b..a4486041c0e74f5cbf9c3f70d443dc515eec9e0f 100644 |
| --- a/components/exo/wayland/server.cc |
| +++ b/components/exo/wayland/server.cc |
| @@ -55,6 +55,8 @@ |
| #include "ui/display/display_observer.h" |
| #include "ui/display/screen.h" |
| #include "ui/events/keycodes/dom/keycode_converter.h" |
| +#include "ui/gfx/buffer_format_util.h" |
| +#include "ui/gfx/buffer_types.h" |
| #include "ui/views/widget/widget.h" |
| #include "ui/views/widget/widget_observer.h" |
| #include "ui/wm/public/activation_change_observer.h" |
| @@ -435,6 +437,7 @@ const struct drm_supported_format { |
| uint32_t drm_format; |
| gfx::BufferFormat buffer_format; |
| } drm_supported_formats[] = { |
| + {WL_DRM_FORMAT_YUV420, gfx::BufferFormat::YUV_420}, |
| {WL_DRM_FORMAT_RGB565, gfx::BufferFormat::BGR_565}, |
| {WL_DRM_FORMAT_XBGR8888, gfx::BufferFormat::RGBX_8888}, |
| {WL_DRM_FORMAT_ABGR8888, gfx::BufferFormat::RGBA_8888}, |
| @@ -500,10 +503,17 @@ void drm_create_prime_buffer(wl_client* client, |
| return; |
| } |
| + std::vector<int> strides{stride0, stride1, stride2}; |
| + std::vector<int> offsets{offset0, offset1, offset2}; |
| + |
| + int planes = |
| + gfx::NumberOfPlanesForBufferFormat(supported_format->buffer_format); |
| + strides.resize(planes); |
| + offsets.resize(planes); |
| std::unique_ptr<Buffer> buffer = |
| GetUserDataAs<Display>(resource)->CreateLinuxDMABufBuffer( |
| base::ScopedFD(name), gfx::Size(width, height), |
| - supported_format->buffer_format, stride0); |
| + supported_format->buffer_format, strides, offsets); |
| if (!buffer) { |
| wl_resource_post_no_memory(resource); |
| return; |
| @@ -544,6 +554,7 @@ const struct dmabuf_supported_format { |
| uint32_t dmabuf_format; |
| gfx::BufferFormat buffer_format; |
| } dmabuf_supported_formats[] = { |
| + // TODO(dcastagna): Add support for YUV_420. |
|
reveman
2016/06/06 21:24:08
Please add this format here as well. The interface
Daniele Castagna
2016/06/09 21:09:17
Done. Added also the support for multiple planes i
|
| {DRM_FORMAT_RGB565, gfx::BufferFormat::BGR_565}, |
| {DRM_FORMAT_XBGR8888, gfx::BufferFormat::RGBX_8888}, |
| {DRM_FORMAT_ABGR8888, gfx::BufferFormat::RGBA_8888}, |
| @@ -636,7 +647,7 @@ void linux_buffer_params_create(wl_client* client, |
| std::unique_ptr<Buffer> buffer = |
| linux_buffer_params->display->CreateLinuxDMABufBuffer( |
| std::move(linux_buffer_params->fd), gfx::Size(width, height), |
| - supported_format->buffer_format, linux_buffer_params->stride); |
| + supported_format->buffer_format, {linux_buffer_params->stride}, {0}); |
| if (!buffer) { |
| zwp_linux_buffer_params_v1_send_failed(resource); |
| return; |