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

Side by Side Diff: components/exo/wayland/server.cc

Issue 2543633005: exo: NV12 support for linux-buffer-params interface. (Closed)
Patch Set: Created 4 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 | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/wayland/server.h" 5 #include "components/exo/wayland/server.h"
6 6
7 #include <grp.h> 7 #include <grp.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 588
589 const struct dmabuf_supported_format { 589 const struct dmabuf_supported_format {
590 uint32_t dmabuf_format; 590 uint32_t dmabuf_format;
591 gfx::BufferFormat buffer_format; 591 gfx::BufferFormat buffer_format;
592 } dmabuf_supported_formats[] = { 592 } dmabuf_supported_formats[] = {
593 {DRM_FORMAT_RGB565, gfx::BufferFormat::BGR_565}, 593 {DRM_FORMAT_RGB565, gfx::BufferFormat::BGR_565},
594 {DRM_FORMAT_XBGR8888, gfx::BufferFormat::RGBX_8888}, 594 {DRM_FORMAT_XBGR8888, gfx::BufferFormat::RGBX_8888},
595 {DRM_FORMAT_ABGR8888, gfx::BufferFormat::RGBA_8888}, 595 {DRM_FORMAT_ABGR8888, gfx::BufferFormat::RGBA_8888},
596 {DRM_FORMAT_XRGB8888, gfx::BufferFormat::BGRX_8888}, 596 {DRM_FORMAT_XRGB8888, gfx::BufferFormat::BGRX_8888},
597 {DRM_FORMAT_ARGB8888, gfx::BufferFormat::BGRA_8888}, 597 {DRM_FORMAT_ARGB8888, gfx::BufferFormat::BGRA_8888},
598 {DRM_FORMAT_NV12, gfx::BufferFormat::YUV_420_BIPLANAR},
598 {DRM_FORMAT_YVU420, gfx::BufferFormat::YVU_420}}; 599 {DRM_FORMAT_YVU420, gfx::BufferFormat::YVU_420}};
599 600
600 struct LinuxBufferParams { 601 struct LinuxBufferParams {
601 struct Plane { 602 struct Plane {
602 base::ScopedFD fd; 603 base::ScopedFD fd;
603 uint32_t stride; 604 uint32_t stride;
604 uint32_t offset; 605 uint32_t offset;
605 }; 606 };
606 607
607 explicit LinuxBufferParams(Display* display) : display(display) {} 608 explicit LinuxBufferParams(Display* display) : display(display) {}
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 for (uint32_t i = 0; i < num_planes; ++i) { 689 for (uint32_t i = 0; i < num_planes; ++i) {
689 auto plane_it = linux_buffer_params->planes.find(i); 690 auto plane_it = linux_buffer_params->planes.find(i);
690 if (plane_it == linux_buffer_params->planes.end()) { 691 if (plane_it == linux_buffer_params->planes.end()) {
691 wl_resource_post_error(resource, 692 wl_resource_post_error(resource,
692 ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE, 693 ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE,
693 "missing a plane"); 694 "missing a plane");
694 return; 695 return;
695 } 696 }
696 LinuxBufferParams::Plane& plane = plane_it->second; 697 LinuxBufferParams::Plane& plane = plane_it->second;
697 planes.emplace_back(plane.stride, plane.offset, 0, 0); 698 planes.emplace_back(plane.stride, plane.offset, 0, 0);
698 if (plane.fd.is_valid()) 699 // TODO(dcastagna): Support multiple fds.
700 if (!i) {
reveman 2016/11/30 22:59:49 can we post an error or have buffer creation fail
Daniele Castagna 2016/11/30 23:31:02 Done.
701 if (!plane.fd.is_valid()) {
702 wl_resource_post_error(resource,
703 ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE,
704 "file descriptor not valid");
705 return;
706 }
699 fds.push_back(std::move(plane.fd)); 707 fds.push_back(std::move(plane.fd));
708 }
700 } 709 }
701 710
702 std::unique_ptr<Buffer> buffer = 711 std::unique_ptr<Buffer> buffer =
703 linux_buffer_params->display->CreateLinuxDMABufBuffer( 712 linux_buffer_params->display->CreateLinuxDMABufBuffer(
704 gfx::Size(width, height), supported_format->buffer_format, planes, 713 gfx::Size(width, height), supported_format->buffer_format, planes,
705 std::move(fds)); 714 std::move(fds));
706 if (!buffer) { 715 if (!buffer) {
707 zwp_linux_buffer_params_v1_send_failed(resource); 716 zwp_linux_buffer_params_v1_send_failed(resource);
708 return; 717 return;
709 } 718 }
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 DCHECK(event_loop); 3080 DCHECK(event_loop);
3072 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 3081 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
3073 } 3082 }
3074 3083
3075 void Server::Flush() { 3084 void Server::Flush() {
3076 wl_display_flush_clients(wl_display_.get()); 3085 wl_display_flush_clients(wl_display_.get());
3077 } 3086 }
3078 3087
3079 } // namespace wayland 3088 } // namespace wayland
3080 } // namespace exo 3089 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698