From: VMware, Inc <> Date: Mon, 28 Sep 2009 20:21:55 +0000 (-0700) Subject: Original Description: X-Git-Tag: p4-sync-929606~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bffe39b97cedd97b383ff57786dbbbd519d8eacc;p=thirdparty%2Fopen-vm-tools.git Original Description: 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 --- diff --git a/open-vm-tools/lib/include/guestCaps.h b/open-vm-tools/lib/include/guestCaps.h index 7a90b45d6..3efa28331 100644 --- a/open-vm-tools/lib/include/guestCaps.h +++ b/open-vm-tools/lib/include/guestCaps.h @@ -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 diff --git a/open-vm-tools/services/plugins/resolutionSet/resolutionInt.h b/open-vm-tools/services/plugins/resolutionSet/resolutionInt.h index a6a8475f8..793445211 100644 --- a/open-vm-tools/services/plugins/resolutionSet/resolutionInt.h +++ b/open-vm-tools/services/plugins/resolutionSet/resolutionInt.h @@ -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[]); diff --git a/open-vm-tools/services/plugins/resolutionSet/resolutionSet.c b/open-vm-tools/services/plugins/resolutionSet/resolutionSet.c index a95dcef80..6d4d18d3f 100644 --- a/open-vm-tools/services/plugins/resolutionSet/resolutionSet.c +++ b/open-vm-tools/services/plugins/resolutionSet/resolutionSet.c @@ -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 }