0001-adjust-buffer-format-order.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 44a44adecbc97242371cf67f8bbd5553c95fa123 Mon Sep 17 00:00:00 2001
  2. From: Yaowei Zhou <yaowei.zhou@intel.com>
  3. Date: Wed, 18 Jan 2023 17:00:50 +0800
  4. Subject: [PATCH] Adjust the order of wayland drm and zwp dma buf in WaylandBufferFactory
  5. Adjust the order as buffer format implementation of zwp dma buffer from
  6. Mutter, which will cause inconsistent with gbm support format list of
  7. GPU process.
  8. Bug: N/A
  9. Change-Id: Ice63c52fbd6eff0a099c35c0943e24c1fd1a1d70
  10. ---
  11. diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc b/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc
  12. index 2376d77..7d6c032e 100644
  13. --- a/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc
  14. +++ b/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc
  15. @@ -25,13 +25,13 @@
  16. uint32_t planes_count,
  17. wl::OnRequestBufferCallback callback) const {
  18. DCHECK(SupportsDmabuf());
  19. - if (wayland_zwp_dmabuf_) {
  20. + if (wayland_drm_) {
  21. + wayland_drm_->CreateBuffer(fd, size, strides, offsets, modifiers, format,
  22. + planes_count, std::move(callback));
  23. + } else if (wayland_zwp_dmabuf_) {
  24. wayland_zwp_dmabuf_->CreateBuffer(fd, size, strides, offsets, modifiers,
  25. format, planes_count,
  26. std::move(callback));
  27. - } else if (wayland_drm_) {
  28. - wayland_drm_->CreateBuffer(fd, size, strides, offsets, modifiers, format,
  29. - planes_count, std::move(callback));
  30. } else {
  31. // This method must never be called if neither zwp_linux_dmabuf or wl_drm
  32. // are supported.
  33. @@ -52,10 +52,11 @@
  34. wl::BufferFormatsWithModifiersMap
  35. WaylandBufferFactory::GetSupportedBufferFormats() const {
  36. #if defined(WAYLAND_GBM)
  37. - if (wayland_zwp_dmabuf_)
  38. - return wayland_zwp_dmabuf_->supported_buffer_formats();
  39. - else if (wayland_drm_)
  40. + if (wayland_drm_) {
  41. return wayland_drm_->supported_buffer_formats();
  42. + } else if (wayland_zwp_dmabuf_) {
  43. + return wayland_zwp_dmabuf_->supported_buffer_formats();
  44. + }
  45. #endif
  46. return {};
  47. }
  48. @@ -71,10 +72,11 @@
  49. bool WaylandBufferFactory::CanCreateDmabufImmed() const {
  50. #if defined(WAYLAND_GBM)
  51. - if (wayland_zwp_dmabuf_)
  52. - return wayland_zwp_dmabuf_->CanCreateBufferImmed();
  53. - else if (wayland_drm_)
  54. + if (wayland_drm_) {
  55. return wayland_drm_->CanCreateBufferImmed();
  56. + } else if (wayland_zwp_dmabuf_) {
  57. + return wayland_zwp_dmabuf_->CanCreateBufferImmed();
  58. + }
  59. #endif
  60. return false;
  61. }