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

Unified Diff: components/exo/wayland/server.cc

Issue 2404513002: exo: Implement zcr_linux_explicit_synchronization_v1
Patch Set: Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: components/exo/wayland/server.cc
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc
index 53b20f9432e12933ea581195d6beb1b66a0a4470..34c10d30c44b4accfb19281acb5e3acc53f58696 100644
--- a/components/exo/wayland/server.cc
+++ b/components/exo/wayland/server.cc
@@ -14,6 +14,7 @@
// Note: core wayland headers need to be included before protocol headers.
#include <alpha-compositing-unstable-v1-server-protocol.h> // NOLINT
+#include <explicit-fencing-unstable-v1-server-protocol.h> // NOLINT
#include <gaming-input-unstable-v1-server-protocol.h> // NOLINT
#include <remote-shell-unstable-v1-server-protocol.h> // NOLINT
#include <secure-output-unstable-v1-server-protocol.h> // NOLINT
@@ -60,8 +61,10 @@
#include "components/exo/touch.h"
#include "components/exo/touch_delegate.h"
#include "components/exo/wm_helper.h"
+#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "ipc/unix_domain_socket_util.h"
#include "third_party/skia/include/core/SkRegion.h"
+#include "ui/aura/env.h"
#include "ui/aura/window_property.h"
#include "ui/base/hit_test.h"
#include "ui/compositor/compositor_vsync_manager.h"
@@ -97,7 +100,7 @@ namespace {
const int kConfigureDelayAfterLayoutSwitchMs = 300;
// Default wayland socket name.
-const base::FilePath::CharType kSocketName[] = FILE_PATH_LITERAL("wayland-0");
+const base::FilePath::CharType kSocketName[] = FILE_PATH_LITERAL("exosphere-0");
reveman 2016/10/09 19:03:17 We'll have to do this in a separate CL. Maybe try
fooishbar 2016/10/12 15:41:56 Yeah, this really shouldn't be in here; was a loca
// Group used for wayland socket.
const char kWaylandSocketGroup[] = "wayland";
@@ -2966,6 +2969,76 @@ void bind_stylus(wl_client* client, void* data, uint32_t version, uint32_t id) {
nullptr);
}
+////////////////////////////////////////////////////////////////////////////////
+// per-surface explict-fencing interface:
reveman 2016/10/09 19:03:17 nit: for consistency "INTERFACENAME interface:"
fooishbar 2016/10/12 15:41:56 Done.
+
+void fenced_surface_destroy(wl_client* client, wl_resource* resource) {
+ wl_resource_destroy(resource);
+}
+
+void fenced_surface_set_acquire_fence(wl_client* client,
+ wl_resource* resource,
+ int fence_fd)
+{
+ Surface* surface = GetUserDataAs<Surface>(resource);
+ gfx::GpuFenceHandle handle;
+ std::unique_ptr<gfx::GpuFence> fence;
+
+ handle.fd.fd = fence_fd;
+
+ fence = aura::Env::GetInstance()
reveman 2016/10/09 19:03:17 How about we move this to exo::Display by adding a
fooishbar 2016/10/12 15:41:56 Done.
+ ->context_factory()
+ ->GetGpuMemoryBufferManager()
+ ->CreateGpuFenceFromHandle(handle);
+
+ if (!fence) {
+ DLOG(WARNING) << "failed to create GpuFence!";
+ return;
+ }
+
+ surface->FenceAcquire(std::move(fence));
+}
+
+const struct zcr_explicit_fenced_surface_v1_interface
+ fenced_surface_implementation = {
+ fenced_surface_destroy,
+ fenced_surface_set_acquire_fence};
+
+
+////////////////////////////////////////////////////////////////////////////////
+// explict-fencing interface:
+
+void fencing_destroy(wl_client* client, wl_resource* resource) {
+ wl_resource_destroy(resource);
+}
+
+void fencing_get_surface(wl_client* client, wl_resource* resource, uint32_t id,
reveman 2016/10/09 19:03:17 Can we make this consistent with the alpha_composi
fooishbar 2016/10/12 15:41:56 Yep, but let me do that in v3 so I can sort the re
fooishbar 2016/10/12 15:45:19 Done.
+ wl_resource* surface_resource) {
+ Surface* surface = GetUserDataAs<Surface>(surface_resource);
+ wl_resource* fenced_surface_resource =
+ wl_resource_create(client, &zcr_explicit_fenced_surface_v1_interface, 1,
+ id);
+
+ wl_resource_set_implementation(fenced_surface_resource,
+ &fenced_surface_implementation,
+ surface,
+ nullptr);
+}
+
+const struct zcr_linux_explicit_fencing_v1_interface
+ fencing_implementation = {
+ fencing_destroy,
+ fencing_get_surface};
+
+void bind_fencing(wl_client* client, void* data, uint32_t version,
+ uint32_t id) {
+ wl_resource* resource =
+ wl_resource_create(client, &zcr_linux_explicit_fencing_v1_interface, 1,
+ id);
+ wl_resource_set_implementation(resource, &fencing_implementation, data,
+ nullptr);
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -3008,6 +3081,9 @@ Server::Server(Display* display)
display_, bind_gaming_input);
wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_,
bind_stylus);
+ wl_global_create(wl_display_.get(),
reveman 2016/10/09 19:03:17 We currently don't make the assumption that all th
fooishbar 2016/10/12 15:41:56 Right, makes sense. Remembered that I'd only done
+ &zcr_linux_explicit_fencing_v1_interface, 1, display_,
+ bind_fencing);
}
Server::~Server() {}

Powered by Google App Engine
This is Rietveld 408576698