]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Original Description:
authorVMware, Inc <>
Mon, 28 Sep 2009 20:21:55 +0000 (13:21 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 28 Sep 2009 20:21:55 +0000 (13:21 -0700)
Add RPC to support enabling and disabling 3D in guest.

Add an RPC that allows the UI to reset Aero -> essentially net
stop/start uxsms. Programatically done by DCE Win32 APIs. See
http://msdn.microsoft.com/en-us/library/aa969538%28VS.85%29.aspx.
This is basically a fix for 467709 until a better solution becomes
available (one that requires methods that are not supported
right now, like PCI hotplug).

The fix is a bit ugly, we need to refactor a bit in the code that
spawns resolution set.

Furthermore, we need to broadcast this to all user sessions, not
just the active one. A loop that iterates all guest sessions will
come later.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/guestCaps.h
open-vm-tools/services/plugins/resolutionSet/resolutionInt.h
open-vm-tools/services/plugins/resolutionSet/resolutionSet.c

index 7a90b45d6b8f76d4f89da4299b15a1b153ed4c86..3efa28331626985230938ce106b999c27758801d 100644 (file)
@@ -67,6 +67,7 @@ typedef enum {
    GHI_CAP_SET_FOCUSED_WINDOW           = 20, // supports ghi.guest.setFocusedWindow
    GHI_CAP_GET_EXEC_INFO_HASH           = 21, // supports ghi.guest.getExecInfoHash
    UNITY_CAP_STICKY_WINDOWS             = 22, // supports unity.window.{un,}stick
+   CAP_CHANGE_HOST_3D_AVAILABILITY_HINT = 23, // supports sending 3D support hint to guest
 } GuestCapabilities;
 
 typedef struct {
@@ -131,6 +132,7 @@ static GuestCapElem guestCapTable[] = {
    { GHI_CAP_SET_FOCUSED_WINDOW,           GHI_CAP_VMDB_PATH,   "setFocusedWindow"},
    { GHI_CAP_GET_EXEC_INFO_HASH,           GHI_CAP_VMDB_PATH,   "getExecInfoHash"},
    { UNITY_CAP_STICKY_WINDOWS,             UNITY_CAP_VMDB_PATH, "sticky"},
+   { CAP_CHANGE_HOST_3D_AVAILABILITY_HINT, CAP_VMDB_PATH, "changeHost3DAvailabilityHint" },
 };
 
 #endif // VM_NEED_VMDB_GUEST_CAP_MAPPING
index a6a8475f8adaea7c3f5b325f5c9189e331b1c631..7934452111410d610c56fa14ab5c30636b593237 100644 (file)
@@ -76,6 +76,7 @@ InitHandle ResolutionToolkitInit(void);
 void ResolutionBackendCleanup(void);
 Bool ResolutionSetResolution(uint32 width, uint32 height);
 #if defined(RESOLUTION_WIN32)
+Bool ResolutionChangeHost3DAvailabilityHint(Bool enable);
 void ResolutionSetSessionChange(DWORD code, DWORD sessionID);
 #endif
 Bool ResolutionSetTopology(unsigned int ndisplays, DisplayTopologyInfo displays[]);
index a95dcef80dacc5303e5bebf1b19a4c6af16f382c..6d4d18d3f5bedd03d4427fa3c2e35b04ea157e24 100644 (file)
@@ -57,6 +57,7 @@ static Bool ResolutionDisplayTopologySetCB(RpcInData *data);
 
 #if defined(RESOLUTION_WIN32)
 static Bool ResolutionDisplayTopologyModesSetCB(RpcInData *data);
+static Bool ResolutionChangeHost3DAvailabilityHintCB(RpcInData *data);
 void ResolutionSetSessionChangeCB(gpointer src, ToolsAppCtx *ctx, DWORD code, DWORD sessionID);
 #endif
 
@@ -181,6 +182,41 @@ invalid_arguments:
 
 
 #if defined(RESOLUTION_WIN32)
+/**
+ *
+ * Handler for TCLO 'ChangeHost3DAvailabilityHint'.
+ *
+ * Routine unmarshals RPC arguments and passes over to back-end for handling.
+ *
+ * @param[in] data RPC data
+ * @return TRUE if we can reply, FALSE otherwise.
+ */
+
+static Bool
+ResolutionChangeHost3DAvailabilityHintCB(RpcInData *data)
+{
+   unsigned int set;
+   Bool success = FALSE;
+   unsigned int index = 0;
+
+   Debug("%s: enter\n", __FUNCTION__);
+
+   if (!StrUtil_GetNextUintToken(&set, &index, data->args, " ")) {
+      Debug("%s: invalid arguments\n", __FUNCTION__);
+      return RPCIN_SETRETVALS(data,
+                              "Invalid arguments. Expected \"set\"",
+                              FALSE);
+   }
+
+   success = ResolutionChangeHost3DAvailabilityHint(set?TRUE:FALSE);
+
+   RPCIN_SETRETVALS(data, success ? "" : "ResolutionChangeHost3DAvailabilityHint failed", success);
+
+   Debug("%s: leave\n", __FUNCTION__);
+   return success;
+}
+
+
 /**
  *
  * Handler for TCLO 'DisplayTopologyModes_Set'.
@@ -429,14 +465,16 @@ ResolutionSetCapabilities(gpointer src,
       RES_SET_IDX              = 0,
       DPY_TOPO_SET_IDX         = 1,
       DPY_GLOBAL_OFFSET_IDX    = 2,
-      DPY_TOPO_MODES_SET_IDX   = 3
+      DPY_TOPO_MODES_SET_IDX   = 3,
+      CHANGE_3D_HINT_IDX       = 4
    };
 
    ToolsAppCapability caps[] = {
       { TOOLS_CAP_OLD, "resolution_set", 0, 0 },
       { TOOLS_CAP_OLD, "display_topology_set", 0, 0 },
       { TOOLS_CAP_OLD, "display_global_offset", 0, 0 },
-      { TOOLS_CAP_NEW, NULL, CAP_SET_TOPO_MODES, 0 }
+      { TOOLS_CAP_NEW, NULL, CAP_SET_TOPO_MODES, 0 },
+      { TOOLS_CAP_NEW, NULL, CAP_CHANGE_HOST_3D_AVAILABILITY_HINT, 0},
    };
 
    ResolutionInfoType *resInfo = &resolutionInfo;
@@ -464,6 +502,9 @@ Debug("%s: setting DPY_TOPO_MODES_SET_IDX to 1\n", __FUNCTION__);
       }
    }
 
+#if defined(RESOLUTION_WIN32)
+   caps[CHANGE_3D_HINT_IDX].value = 1;
+#endif
    ResolutionServerCapReg(ctx, resServerCap);
 
    return VMTools_WrapArray(caps, sizeof *caps, ARRAYSIZE(caps));
@@ -517,7 +558,7 @@ ToolsOnLoad(ToolsAppCtx *ctx)
     */
    if (resInfo->canSetResolution || resInfo->canSetTopology) {
       int index = 0;
-      RpcChannelCallback rpcs[3];
+      RpcChannelCallback rpcs[4];
 
       memset(rpcs, '\0', sizeof rpcs);
 
@@ -535,6 +576,9 @@ ToolsOnLoad(ToolsAppCtx *ctx)
          rpcs[index].name = "DisplayTopologyModes_Set";
          rpcs[index].callback = ResolutionDisplayTopologyModesSetCB;
          index++;
+         rpcs[index].name = "ChangeHost3DAvailabilityHint";
+         rpcs[index].callback = ResolutionChangeHost3DAvailabilityHintCB;
+         index++;
 #endif
       }