[carnelian] Do SetDebugClientInfo on Mold's Allocator

Sysmem will soon require this call because it helps identify the client
if it causes an error or OOM.

Change-Id: If826f266b6ff9e3a3893448cb59ccd4e1c34a16f
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/475942
Reviewed-by: Rob Tsuk <robtsuk@google.com>
Commit-Queue: John Bauman <jbauman@google.com>
diff --git a/src/lib/ui/carnelian/src/render/generic/mold/context.rs b/src/lib/ui/carnelian/src/render/generic/mold/context.rs
index 141a818..e4e1aa5 100644
--- a/src/lib/ui/carnelian/src/render/generic/mold/context.rs
+++ b/src/lib/ui/carnelian/src/render/generic/mold/context.rs
@@ -18,7 +18,7 @@
     FORMAT_MODIFIER_LINEAR,
 };
 use fuchsia_component::client::connect_to_service;
-use fuchsia_framebuffer::PixelFormat;
+use fuchsia_framebuffer::{sysmem::set_allocator_name, PixelFormat};
 use fuchsia_trace::duration;
 use fuchsia_zircon as zx;
 use fuchsia_zircon_sys as sys;
@@ -159,6 +159,7 @@
         display_rotation: DisplayRotation,
     ) -> Self {
         let sysmem = connect_to_service::<AllocatorMarker>().expect("failed to connect to sysmem");
+        set_allocator_name(&sysmem).unwrap_or_else(|e| eprintln!("set_allocator_name: {:?}", e));
         let (collection_client, collection_request) =
             zx::Channel::create().expect("failed to create Zircon channel");
         sysmem
diff --git a/src/lib/ui/fuchsia-framebuffer/src/sysmem.rs b/src/lib/ui/fuchsia-framebuffer/src/sysmem.rs
index 5710bb2..c5e36b2 100644
--- a/src/lib/ui/fuchsia-framebuffer/src/sysmem.rs
+++ b/src/lib/ui/fuchsia-framebuffer/src/sysmem.rs
@@ -154,7 +154,9 @@
     collection_client: Option<fidl_fuchsia_sysmem::BufferCollectionProxy>,
 }
 
-fn set_allocator_name(sysmem_client: &fidl_fuchsia_sysmem::AllocatorProxy) -> Result<(), Error> {
+pub fn set_allocator_name(
+    sysmem_client: &fidl_fuchsia_sysmem::AllocatorProxy,
+) -> Result<(), Error> {
     let name = fuchsia_runtime::process_self().get_name()?;
     let koid = fuchsia_runtime::process_self().get_koid()?;
     Ok(sysmem_client.set_debug_client_info(name.to_str()?, koid.raw_koid())?)