From 7f600569e70efd623266b573c70b12ecdd8da992 Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <ryan.pavlik@collabora.com>
Date: Tue, 17 May 2022 15:28:37 -0500
Subject: [PATCH] ipc: Word choice/clarity

---
 .../src/main/java/org/freedesktop/monado/ipc/Client.java    | 6 +++---
 src/xrt/ipc/client/ipc_client_compositor.c                  | 6 +++---
 src/xrt/ipc/server/ipc_server_handler.c                     | 3 +--
 src/xrt/ipc/server/ipc_server_process.c                     | 5 ++---
 src/xrt/ipc/shared/ipc_protocol.h                           | 2 +-
 5 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/xrt/ipc/android/src/main/java/org/freedesktop/monado/ipc/Client.java b/src/xrt/ipc/android/src/main/java/org/freedesktop/monado/ipc/Client.java
index ca4c1e3d9..94b90ac0c 100644
--- a/src/xrt/ipc/android/src/main/java/org/freedesktop/monado/ipc/Client.java
+++ b/src/xrt/ipc/android/src/main/java/org/freedesktop/monado/ipc/Client.java
@@ -293,7 +293,7 @@ public class Client implements ServiceConnection {
     /**
      * Handle the asynchronous connection of the binder IPC.
      *
-     * @param name    should match the intent above, but not used.
+     * @param name    should match the preceding intent, but not used.
      * @param service the associated service, which we cast in this function.
      */
     @Override
@@ -309,13 +309,13 @@ public class Client implements ServiceConnection {
     /**
      * Handle asynchronous disconnect.
      *
-     * @param name should match the intent above, but not used.
+     * @param name should match the preceding intent, but not used.
      */
     @Override
     public void onServiceDisconnected(ComponentName name) {
         Log.i(TAG, "onServiceDisconnected");
         shutdown();
-        //! @todo tell native that the world is crumbling, then close the fd here.
+        //! @todo tell C/C++ that the world is crumbling, then close the fd here.
     }
 
     /*
diff --git a/src/xrt/ipc/client/ipc_client_compositor.c b/src/xrt/ipc/client/ipc_client_compositor.c
index 4d02244fc..766bc7f8b 100644
--- a/src/xrt/ipc/client/ipc_client_compositor.c
+++ b/src/xrt/ipc/client/ipc_client_compositor.c
@@ -528,7 +528,7 @@ ipc_compositor_wait_frame(struct xrt_compositor *xc,
 	// This is how much we should sleep.
 	uint64_t diff_ns = wake_up_time_ns - now_ns;
 
-	// A minor tweak that helps hit the time better.
+	// A minor tweak that helps achieve the timing better.
 	diff_ns -= measured_scheduler_latency_ns;
 
 	os_nanosleep(diff_ns);
@@ -886,7 +886,7 @@ ipc_compositor_images_allocate(struct xrt_image_native_allocator *xina,
 	if (image_count < in_image_count) {
 		for (uint32_t k = 0; k < image_count && k < in_image_count; k++) {
 			/*
-			 * Paranoia, we do know that any fd not touched by
+			 * Overly-broad condition: we know that any fd not touched by
 			 * ipc_call_swapchain_create will be -1.
 			 */
 			if (remote_fds[k] >= 0) {
@@ -908,7 +908,7 @@ ipc_compositor_images_allocate(struct xrt_image_native_allocator *xina,
 	// Close any fds we are not interested in.
 	for (; i < image_count; i++) {
 		/*
-		 * Paranoia, we do know that any fd not touched by
+		 * Overly-broad condition: we know that any fd not touched by
 		 * ipc_call_swapchain_create will be -1.
 		 */
 		if (remote_fds[i] >= 0) {
diff --git a/src/xrt/ipc/server/ipc_server_handler.c b/src/xrt/ipc/server/ipc_server_handler.c
index f6d62f4f3..5fdae9d76 100644
--- a/src/xrt/ipc/server/ipc_server_handler.c
+++ b/src/xrt/ipc/server/ipc_server_handler.c
@@ -788,11 +788,10 @@ ipc_handle_swapchain_create(volatile struct ipc_client_state *ics,
 	// return our result to the caller.
 	struct xrt_swapchain_native *xscn = (struct xrt_swapchain_native *)xsc;
 
-	// Sanity checking.
+	// Limit checking
 	assert(xsc->image_count <= IPC_MAX_SWAPCHAIN_HANDLES);
 	assert(xsc->image_count <= max_handle_capacity);
 
-	// Paranoia.
 	for (size_t i = 1; i < xsc->image_count; i++) {
 		assert(xscn->images[0].size == xscn->images[i].size);
 		assert(xscn->images[0].use_dedicated_allocation == xscn->images[i].use_dedicated_allocation);
diff --git a/src/xrt/ipc/server/ipc_server_process.c b/src/xrt/ipc/server/ipc_server_process.c
index c39e52d22..dbc45bc4c 100644
--- a/src/xrt/ipc/server/ipc_server_process.c
+++ b/src/xrt/ipc/server/ipc_server_process.c
@@ -233,8 +233,7 @@ init_shm(struct ipc_server *s)
 		return -1;
 	}
 
-	// we have a filehandle, we will pass this to
-	// our client rather than access via filesystem
+	// we have a filehandle, we will pass this to our client
 	s->ism_handle = handle;
 
 
@@ -256,7 +255,7 @@ init_shm(struct ipc_server *s)
 		}
 
 		// The position of the tracking origin matches that in the
-		// servers memory.
+		// server's memory.
 		assert(i < XRT_SYSTEM_MAX_DEVICES);
 
 		struct ipc_shared_tracking_origin *itrack = &ism->itracks[count++];
diff --git a/src/xrt/ipc/shared/ipc_protocol.h b/src/xrt/ipc/shared/ipc_protocol.h
index 6f3de6fab..fc573eb4a 100644
--- a/src/xrt/ipc/shared/ipc_protocol.h
+++ b/src/xrt/ipc/shared/ipc_protocol.h
@@ -27,7 +27,7 @@
 #define IPC_BUF_SIZE 512   // must be >= largest message length in bytes
 #define IPC_MAX_VIEWS 8    // max views we will return configs for
 #define IPC_MAX_FORMATS 32 // max formats our server-side compositor supports
-#define IPC_MAX_DEVICES 8  // max number of devices we will map via shared mem
+#define IPC_MAX_DEVICES 8  // max number of devices we will map using shared mem
 #define IPC_MAX_LAYERS 16
 #define IPC_MAX_SLOTS 128
 #define IPC_MAX_CLIENTS 8