| OLD | NEW |
| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 return supported_format.drm_format == format; | 529 return supported_format.drm_format == format; |
| 530 }); | 530 }); |
| 531 if (supported_format == | 531 if (supported_format == |
| 532 (drm_supported_formats + arraysize(drm_supported_formats))) { | 532 (drm_supported_formats + arraysize(drm_supported_formats))) { |
| 533 wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_FORMAT, | 533 wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_FORMAT, |
| 534 "invalid format 0x%x", format); | 534 "invalid format 0x%x", format); |
| 535 return; | 535 return; |
| 536 } | 536 } |
| 537 | 537 |
| 538 std::vector<gfx::NativePixmapPlane> planes; | 538 std::vector<gfx::NativePixmapPlane> planes; |
| 539 planes.emplace_back(stride0, offset0, 0, 0); | 539 planes.emplace_back(stride0, offset0, 0); |
| 540 planes.emplace_back(stride1, offset1, 0, 0); | 540 planes.emplace_back(stride1, offset1, 0); |
| 541 planes.emplace_back(stride2, offset2, 0, 0); | 541 planes.emplace_back(stride2, offset2, 0); |
| 542 std::vector<base::ScopedFD> fds; | 542 std::vector<base::ScopedFD> fds; |
| 543 | 543 |
| 544 size_t num_planes = | 544 size_t num_planes = |
| 545 gfx::NumberOfPlanesForBufferFormat(supported_format->buffer_format); | 545 gfx::NumberOfPlanesForBufferFormat(supported_format->buffer_format); |
| 546 planes.resize(num_planes); | 546 planes.resize(num_planes); |
| 547 fds.push_back(base::ScopedFD(name)); | 547 fds.push_back(base::ScopedFD(name)); |
| 548 | 548 |
| 549 std::unique_ptr<Buffer> buffer = | 549 std::unique_ptr<Buffer> buffer = |
| 550 GetUserDataAs<Display>(resource)->CreateLinuxDMABufBuffer( | 550 GetUserDataAs<Display>(resource)->CreateLinuxDMABufBuffer( |
| 551 gfx::Size(width, height), supported_format->buffer_format, planes, | 551 gfx::Size(width, height), supported_format->buffer_format, planes, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 687 |
| 688 for (uint32_t i = 0; i < num_planes; ++i) { | 688 for (uint32_t i = 0; i < num_planes; ++i) { |
| 689 auto plane_it = linux_buffer_params->planes.find(i); | 689 auto plane_it = linux_buffer_params->planes.find(i); |
| 690 if (plane_it == linux_buffer_params->planes.end()) { | 690 if (plane_it == linux_buffer_params->planes.end()) { |
| 691 wl_resource_post_error(resource, | 691 wl_resource_post_error(resource, |
| 692 ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE, | 692 ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE, |
| 693 "missing a plane"); | 693 "missing a plane"); |
| 694 return; | 694 return; |
| 695 } | 695 } |
| 696 LinuxBufferParams::Plane& plane = plane_it->second; | 696 LinuxBufferParams::Plane& plane = plane_it->second; |
| 697 planes.emplace_back(plane.stride, plane.offset, 0, 0); | 697 planes.emplace_back(plane.stride, plane.offset, 0); |
| 698 if (plane.fd.is_valid()) | 698 if (plane.fd.is_valid()) |
| 699 fds.push_back(std::move(plane.fd)); | 699 fds.push_back(std::move(plane.fd)); |
| 700 } | 700 } |
| 701 | 701 |
| 702 std::unique_ptr<Buffer> buffer = | 702 std::unique_ptr<Buffer> buffer = |
| 703 linux_buffer_params->display->CreateLinuxDMABufBuffer( | 703 linux_buffer_params->display->CreateLinuxDMABufBuffer( |
| 704 gfx::Size(width, height), supported_format->buffer_format, planes, | 704 gfx::Size(width, height), supported_format->buffer_format, planes, |
| 705 std::move(fds)); | 705 std::move(fds)); |
| 706 if (!buffer) { | 706 if (!buffer) { |
| 707 zwp_linux_buffer_params_v1_send_failed(resource); | 707 zwp_linux_buffer_params_v1_send_failed(resource); |
| (...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3128 DCHECK(event_loop); | 3128 DCHECK(event_loop); |
| 3129 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3129 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3130 } | 3130 } |
| 3131 | 3131 |
| 3132 void Server::Flush() { | 3132 void Server::Flush() { |
| 3133 wl_display_flush_clients(wl_display_.get()); | 3133 wl_display_flush_clients(wl_display_.get()); |
| 3134 } | 3134 } |
| 3135 | 3135 |
| 3136 } // namespace wayland | 3136 } // namespace wayland |
| 3137 } // namespace exo | 3137 } // namespace exo |
| OLD | NEW |