13bfa90b6Smrg/* 23bfa90b6Smrg * Copyright 2006-2011 by VMware, Inc. 33bfa90b6Smrg * 43bfa90b6Smrg * Permission is hereby granted, free of charge, to any person obtaining a 53bfa90b6Smrg * copy of this software and associated documentation files (the "Software"), 63bfa90b6Smrg * to deal in the Software without restriction, including without limitation 73bfa90b6Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 83bfa90b6Smrg * and/or sell copies of the Software, and to permit persons to whom the 93bfa90b6Smrg * Software is furnished to do so, subject to the following conditions: 103bfa90b6Smrg * 113bfa90b6Smrg * The above copyright notice and this permission notice shall be included in 123bfa90b6Smrg * all copies or substantial portions of the Software. 133bfa90b6Smrg * 143bfa90b6Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 153bfa90b6Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 163bfa90b6Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 173bfa90b6Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 183bfa90b6Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 193bfa90b6Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 203bfa90b6Smrg * OTHER DEALINGS IN THE SOFTWARE. 213bfa90b6Smrg * 223bfa90b6Smrg * Except as contained in this notice, the name of the copyright holder(s) 233bfa90b6Smrg * and author(s) shall not be used in advertising or otherwise to promote 243bfa90b6Smrg * the sale, use or other dealings in this Software without prior written 253bfa90b6Smrg * authorization from the copyright holder(s) and author(s). 263bfa90b6Smrg */ 273bfa90b6Smrg 283bfa90b6Smrg/* 293bfa90b6Smrg * vmwarectrl.c -- 303bfa90b6Smrg * 313bfa90b6Smrg * The implementation of the VMWARE_CTRL protocol extension that 323bfa90b6Smrg * allows X clients to communicate with the driver. 333bfa90b6Smrg */ 3434a0776dSmrg#ifdef HAVE_CONFIG_H 3534a0776dSmrg#include "config.h" 3634a0776dSmrg#endif 373bfa90b6Smrg 383bfa90b6Smrg#include <xorg-server.h> 393bfa90b6Smrg#include "dixstruct.h" 403bfa90b6Smrg#include "extnsionst.h" 413bfa90b6Smrg#include <X11/X.h> 423bfa90b6Smrg#include <X11/extensions/panoramiXproto.h> 433bfa90b6Smrg 443bfa90b6Smrg#include "vmwarectrlproto.h" 453bfa90b6Smrg#include "vmwgfx_driver.h" 463bfa90b6Smrg#include "vmwgfx_drmi.h" 473bfa90b6Smrg 483bfa90b6Smrg/* 493bfa90b6Smrg *---------------------------------------------------------------------------- 503bfa90b6Smrg * 513bfa90b6Smrg * VMwareCtrlQueryVersion -- 523bfa90b6Smrg * 533bfa90b6Smrg * Implementation of QueryVersion command handler. Initialises and 543bfa90b6Smrg * sends a reply. 553bfa90b6Smrg * 563bfa90b6Smrg * Results: 573bfa90b6Smrg * Standard response codes. 583bfa90b6Smrg * 593bfa90b6Smrg * Side effects: 603bfa90b6Smrg * Writes reply to client 613bfa90b6Smrg * 623bfa90b6Smrg *---------------------------------------------------------------------------- 633bfa90b6Smrg */ 643bfa90b6Smrg 653bfa90b6Smrgstatic int 663bfa90b6SmrgVMwareCtrlQueryVersion(ClientPtr client) 673bfa90b6Smrg{ 683bfa90b6Smrg xVMwareCtrlQueryVersionReply rep = { 0, }; 693bfa90b6Smrg register int n; 703bfa90b6Smrg 713bfa90b6Smrg REQUEST_SIZE_MATCH(xVMwareCtrlQueryVersionReq); 723bfa90b6Smrg 733bfa90b6Smrg rep.type = X_Reply; 743bfa90b6Smrg rep.length = 0; 753bfa90b6Smrg rep.sequenceNumber = client->sequence; 763bfa90b6Smrg rep.majorVersion = VMWARE_CTRL_MAJOR_VERSION; 773bfa90b6Smrg rep.minorVersion = VMWARE_CTRL_MINOR_VERSION; 783bfa90b6Smrg if (client->swapped) { 793bfa90b6Smrg _swaps(&rep.sequenceNumber, n); 803bfa90b6Smrg _swapl(&rep.length, n); 813bfa90b6Smrg _swapl(&rep.majorVersion, n); 823bfa90b6Smrg _swapl(&rep.minorVersion, n); 833bfa90b6Smrg } 843bfa90b6Smrg WriteToClient(client, sizeof(xVMwareCtrlQueryVersionReply), (char *)&rep); 853bfa90b6Smrg 863bfa90b6Smrg return client->noClientException; 873bfa90b6Smrg} 883bfa90b6Smrg 893bfa90b6Smrg 903bfa90b6Smrg/* 913bfa90b6Smrg *---------------------------------------------------------------------------- 923bfa90b6Smrg * 933bfa90b6Smrg * VMwareCtrlDoSetRes -- 943bfa90b6Smrg * 953bfa90b6Smrg * Set the custom resolution into the mode list. 963bfa90b6Smrg * 973bfa90b6Smrg * This is done by alternately updating one of two dynamic modes. It is 983bfa90b6Smrg * done this way because the server gets upset if you try to switch 993bfa90b6Smrg * to a new resolution that has the same index as the current one. 1003bfa90b6Smrg * 1013bfa90b6Smrg * Results: 1023bfa90b6Smrg * TRUE on success, FALSE otherwise. 1033bfa90b6Smrg * 1043bfa90b6Smrg * Side effects: 1053bfa90b6Smrg * One dynamic mode will be updated if successful. 1063bfa90b6Smrg * 1073bfa90b6Smrg *---------------------------------------------------------------------------- 1083bfa90b6Smrg */ 1093bfa90b6Smrg 1103bfa90b6Smrgstatic Bool 1113bfa90b6SmrgVMwareCtrlDoSetRes(ScrnInfoPtr pScrn, 1123bfa90b6Smrg CARD32 x, 1133bfa90b6Smrg CARD32 y) 1143bfa90b6Smrg{ 1153bfa90b6Smrg modesettingPtr ms = modesettingPTR(pScrn); 1163bfa90b6Smrg struct drm_vmw_rect rect; 1173bfa90b6Smrg int ret; 1183bfa90b6Smrg 1193bfa90b6Smrg rect.x = 0; 1203bfa90b6Smrg rect.y = 0; 1213bfa90b6Smrg rect.w = x; 1223bfa90b6Smrg rect.h = y; 1233bfa90b6Smrg 12434a0776dSmrg ms->autoLayout = FALSE; 1253bfa90b6Smrg ret = vmwgfx_update_gui_layout(ms->fd, 1, &rect); 1263bfa90b6Smrg return (ret == 0); 1273bfa90b6Smrg} 1283bfa90b6Smrg 1293bfa90b6Smrg 1303bfa90b6Smrg/* 1313bfa90b6Smrg *---------------------------------------------------------------------------- 1323bfa90b6Smrg * 1333bfa90b6Smrg * VMwareCtrlSetRes -- 1343bfa90b6Smrg * 1353bfa90b6Smrg * Implementation of SetRes command handler. Initialises and sends a 1363bfa90b6Smrg * reply. 1373bfa90b6Smrg * 1383bfa90b6Smrg * Results: 1393bfa90b6Smrg * Standard response codes. 1403bfa90b6Smrg * 1413bfa90b6Smrg * Side effects: 1423bfa90b6Smrg * Writes reply to client 1433bfa90b6Smrg * 1443bfa90b6Smrg *---------------------------------------------------------------------------- 1453bfa90b6Smrg */ 1463bfa90b6Smrg 1473bfa90b6Smrgstatic int 1483bfa90b6SmrgVMwareCtrlSetRes(ClientPtr client) 1493bfa90b6Smrg{ 1503bfa90b6Smrg REQUEST(xVMwareCtrlSetResReq); 1513bfa90b6Smrg xVMwareCtrlSetResReply rep = { 0, }; 1523bfa90b6Smrg ScrnInfoPtr pScrn; 1533bfa90b6Smrg ExtensionEntry *ext; 1543bfa90b6Smrg register int n; 1553bfa90b6Smrg 1563bfa90b6Smrg REQUEST_SIZE_MATCH(xVMwareCtrlSetResReq); 1573bfa90b6Smrg 1583bfa90b6Smrg if (!(ext = CheckExtension(VMWARE_CTRL_PROTOCOL_NAME))) { 1593bfa90b6Smrg return BadMatch; 1603bfa90b6Smrg } 1613bfa90b6Smrg 1623bfa90b6Smrg pScrn = ext->extPrivate; 1633bfa90b6Smrg if (pScrn->scrnIndex != stuff->screen) { 1643bfa90b6Smrg return BadMatch; 1653bfa90b6Smrg } 1663bfa90b6Smrg 1673bfa90b6Smrg if (!VMwareCtrlDoSetRes(pScrn, stuff->x, stuff->y)) { 1683bfa90b6Smrg return BadValue; 1693bfa90b6Smrg } 1703bfa90b6Smrg 1713bfa90b6Smrg rep.type = X_Reply; 1723bfa90b6Smrg rep.length = (sizeof(xVMwareCtrlSetResReply) - sizeof(xGenericReply)) >> 2; 1733bfa90b6Smrg rep.sequenceNumber = client->sequence; 1743bfa90b6Smrg rep.screen = stuff->screen; 1753bfa90b6Smrg rep.x = stuff->x; 1763bfa90b6Smrg rep.y = stuff->y; 1773bfa90b6Smrg if (client->swapped) { 1783bfa90b6Smrg _swaps(&rep.sequenceNumber, n); 1793bfa90b6Smrg _swapl(&rep.length, n); 1803bfa90b6Smrg _swapl(&rep.screen, n); 1813bfa90b6Smrg _swapl(&rep.x, n); 1823bfa90b6Smrg _swapl(&rep.y, n); 1833bfa90b6Smrg } 1843bfa90b6Smrg WriteToClient(client, sizeof(xVMwareCtrlSetResReply), (char *)&rep); 1853bfa90b6Smrg 1863bfa90b6Smrg return client->noClientException; 1873bfa90b6Smrg} 1883bfa90b6Smrg 1893bfa90b6Smrg 1903bfa90b6Smrg/* 1913bfa90b6Smrg *---------------------------------------------------------------------------- 1923bfa90b6Smrg * 1933bfa90b6Smrg * VMwareCtrlDoSetTopology -- 1943bfa90b6Smrg * 1953bfa90b6Smrg * Set the custom topology and set a dynamic mode to the bounding box 1963bfa90b6Smrg * of the passed topology. If a topology is already pending, then do 1973bfa90b6Smrg * nothing but do not return failure. 1983bfa90b6Smrg * 1993bfa90b6Smrg * Results: 2003bfa90b6Smrg * TRUE on success, FALSE otherwise. 2013bfa90b6Smrg * 2023bfa90b6Smrg * Side effects: 2033bfa90b6Smrg * One dynamic mode and the pending xinerama state will be updated if 2043bfa90b6Smrg * successful. 2053bfa90b6Smrg * 2063bfa90b6Smrg *---------------------------------------------------------------------------- 2073bfa90b6Smrg */ 2083bfa90b6Smrg 2093bfa90b6Smrgstatic Bool 2103bfa90b6SmrgVMwareCtrlDoSetTopology(ScrnInfoPtr pScrn, 2113bfa90b6Smrg xXineramaScreenInfo *extents, 2123bfa90b6Smrg unsigned long number) 2133bfa90b6Smrg{ 2143bfa90b6Smrg modesettingPtr ms = modesettingPTR(pScrn); 2153bfa90b6Smrg struct drm_vmw_rect *rects; 2163bfa90b6Smrg int i; 2173bfa90b6Smrg int ret; 2183bfa90b6Smrg 2193bfa90b6Smrg rects = calloc(number, sizeof(*rects)); 2203bfa90b6Smrg if (!rects) 2213bfa90b6Smrg return FALSE; 2223bfa90b6Smrg 2233bfa90b6Smrg for (i = 0; i < number; i++) { 2243bfa90b6Smrg rects[i].x = extents[i].x_org; 2253bfa90b6Smrg rects[i].y = extents[i].y_org; 2263bfa90b6Smrg rects[i].w = extents[i].width; 2273bfa90b6Smrg rects[i].h = extents[i].height; 2283bfa90b6Smrg } 2293bfa90b6Smrg 23034a0776dSmrg ms->autoLayout = FALSE; 2313bfa90b6Smrg ret = vmwgfx_update_gui_layout(ms->fd, number, rects); 2323bfa90b6Smrg 2333bfa90b6Smrg free(rects); 2343bfa90b6Smrg return (ret == 0); 2353bfa90b6Smrg} 2363bfa90b6Smrg 2373bfa90b6Smrg 2383bfa90b6Smrg/* 2393bfa90b6Smrg *---------------------------------------------------------------------------- 2403bfa90b6Smrg * 2413bfa90b6Smrg * VMwareCtrlSetTopology -- 2423bfa90b6Smrg * 2433bfa90b6Smrg * Implementation of SetTopology command handler. Initialises and sends a 2443bfa90b6Smrg * reply. 2453bfa90b6Smrg * 2463bfa90b6Smrg * Results: 2473bfa90b6Smrg * Standard response codes. 2483bfa90b6Smrg * 2493bfa90b6Smrg * Side effects: 2503bfa90b6Smrg * Writes reply to client 2513bfa90b6Smrg * 2523bfa90b6Smrg *---------------------------------------------------------------------------- 2533bfa90b6Smrg */ 2543bfa90b6Smrg 2553bfa90b6Smrgstatic int 2563bfa90b6SmrgVMwareCtrlSetTopology(ClientPtr client) 2573bfa90b6Smrg{ 2583bfa90b6Smrg REQUEST(xVMwareCtrlSetTopologyReq); 2593bfa90b6Smrg xVMwareCtrlSetTopologyReply rep = { 0, }; 2603bfa90b6Smrg ScrnInfoPtr pScrn; 2613bfa90b6Smrg ExtensionEntry *ext; 2623bfa90b6Smrg register int n; 2633bfa90b6Smrg xXineramaScreenInfo *extents; 2643bfa90b6Smrg 2653bfa90b6Smrg REQUEST_AT_LEAST_SIZE(xVMwareCtrlSetTopologyReq); 2663bfa90b6Smrg 2673bfa90b6Smrg if (!(ext = CheckExtension(VMWARE_CTRL_PROTOCOL_NAME))) { 2683bfa90b6Smrg return BadMatch; 2693bfa90b6Smrg } 2703bfa90b6Smrg 2713bfa90b6Smrg pScrn = ext->extPrivate; 2723bfa90b6Smrg if (pScrn->scrnIndex != stuff->screen) { 2733bfa90b6Smrg return BadMatch; 2743bfa90b6Smrg } 2753bfa90b6Smrg 2763bfa90b6Smrg extents = (xXineramaScreenInfo *)(stuff + 1); 2773bfa90b6Smrg if (!VMwareCtrlDoSetTopology(pScrn, extents, stuff->number)) { 2783bfa90b6Smrg return BadValue; 2793bfa90b6Smrg } 2803bfa90b6Smrg 2813bfa90b6Smrg rep.type = X_Reply; 2823bfa90b6Smrg rep.length = (sizeof(xVMwareCtrlSetTopologyReply) - sizeof(xGenericReply)) >> 2; 2833bfa90b6Smrg rep.sequenceNumber = client->sequence; 2843bfa90b6Smrg rep.screen = stuff->screen; 2853bfa90b6Smrg if (client->swapped) { 2863bfa90b6Smrg _swaps(&rep.sequenceNumber, n); 2873bfa90b6Smrg _swapl(&rep.length, n); 2883bfa90b6Smrg _swapl(&rep.screen, n); 2893bfa90b6Smrg } 2903bfa90b6Smrg WriteToClient(client, sizeof(xVMwareCtrlSetTopologyReply), (char *)&rep); 2913bfa90b6Smrg 2923bfa90b6Smrg return client->noClientException; 2933bfa90b6Smrg} 2943bfa90b6Smrg 2953bfa90b6Smrg 2963bfa90b6Smrg/* 2973bfa90b6Smrg *---------------------------------------------------------------------------- 2983bfa90b6Smrg * 2993bfa90b6Smrg * VMwareCtrlDispatch -- 3003bfa90b6Smrg * 3013bfa90b6Smrg * Dispatcher for VMWARE_CTRL commands. Calls the correct handler for 3023bfa90b6Smrg * each command type. 3033bfa90b6Smrg * 3043bfa90b6Smrg * Results: 3053bfa90b6Smrg * Standard response codes. 3063bfa90b6Smrg * 3073bfa90b6Smrg * Side effects: 3083bfa90b6Smrg * Side effects of individual command handlers. 3093bfa90b6Smrg * 3103bfa90b6Smrg *---------------------------------------------------------------------------- 3113bfa90b6Smrg */ 3123bfa90b6Smrg 3133bfa90b6Smrgstatic int 3143bfa90b6SmrgVMwareCtrlDispatch(ClientPtr client) 3153bfa90b6Smrg{ 3163bfa90b6Smrg REQUEST(xReq); 3173bfa90b6Smrg 3183bfa90b6Smrg switch(stuff->data) { 3193bfa90b6Smrg case X_VMwareCtrlQueryVersion: 3203bfa90b6Smrg return VMwareCtrlQueryVersion(client); 3213bfa90b6Smrg case X_VMwareCtrlSetRes: 3223bfa90b6Smrg return VMwareCtrlSetRes(client); 3233bfa90b6Smrg case X_VMwareCtrlSetTopology: 3243bfa90b6Smrg return VMwareCtrlSetTopology(client); 3253bfa90b6Smrg } 3263bfa90b6Smrg return BadRequest; 3273bfa90b6Smrg} 3283bfa90b6Smrg 3293bfa90b6Smrg 3303bfa90b6Smrg/* 3313bfa90b6Smrg *---------------------------------------------------------------------------- 3323bfa90b6Smrg * 3333bfa90b6Smrg * SVMwareCtrlQueryVersion -- 3343bfa90b6Smrg * 3353bfa90b6Smrg * Wrapper for QueryVersion handler that handles input from other-endian 3363bfa90b6Smrg * clients. 3373bfa90b6Smrg * 3383bfa90b6Smrg * Results: 3393bfa90b6Smrg * Standard response codes. 3403bfa90b6Smrg * 3413bfa90b6Smrg * Side effects: 3423bfa90b6Smrg * Side effects of unswapped implementation. 3433bfa90b6Smrg * 3443bfa90b6Smrg *---------------------------------------------------------------------------- 3453bfa90b6Smrg */ 3463bfa90b6Smrg 3473bfa90b6Smrgstatic int 3483bfa90b6SmrgSVMwareCtrlQueryVersion(ClientPtr client) 3493bfa90b6Smrg{ 3503bfa90b6Smrg register int n; 3513bfa90b6Smrg 3523bfa90b6Smrg REQUEST(xVMwareCtrlQueryVersionReq); 3533bfa90b6Smrg REQUEST_SIZE_MATCH(xVMwareCtrlQueryVersionReq); 3543bfa90b6Smrg 3553bfa90b6Smrg _swaps(&stuff->length, n); 3563bfa90b6Smrg 3573bfa90b6Smrg return VMwareCtrlQueryVersion(client); 3583bfa90b6Smrg} 3593bfa90b6Smrg 3603bfa90b6Smrg 3613bfa90b6Smrg/* 3623bfa90b6Smrg *---------------------------------------------------------------------------- 3633bfa90b6Smrg * 3643bfa90b6Smrg * SVMwareCtrlSetRes -- 3653bfa90b6Smrg * 3663bfa90b6Smrg * Wrapper for SetRes handler that handles input from other-endian 3673bfa90b6Smrg * clients. 3683bfa90b6Smrg * 3693bfa90b6Smrg * Results: 3703bfa90b6Smrg * Standard response codes. 3713bfa90b6Smrg * 3723bfa90b6Smrg * Side effects: 3733bfa90b6Smrg * Side effects of unswapped implementation. 3743bfa90b6Smrg * 3753bfa90b6Smrg *---------------------------------------------------------------------------- 3763bfa90b6Smrg */ 3773bfa90b6Smrg 3783bfa90b6Smrgstatic int 3793bfa90b6SmrgSVMwareCtrlSetRes(ClientPtr client) 3803bfa90b6Smrg{ 3813bfa90b6Smrg register int n; 3823bfa90b6Smrg 3833bfa90b6Smrg REQUEST(xVMwareCtrlSetResReq); 3843bfa90b6Smrg REQUEST_SIZE_MATCH(xVMwareCtrlSetResReq); 3853bfa90b6Smrg 3863bfa90b6Smrg _swaps(&stuff->length, n); 3873bfa90b6Smrg _swapl(&stuff->screen, n); 3883bfa90b6Smrg _swapl(&stuff->x, n); 3893bfa90b6Smrg _swapl(&stuff->y, n); 3903bfa90b6Smrg 3913bfa90b6Smrg return VMwareCtrlSetRes(client); 3923bfa90b6Smrg} 3933bfa90b6Smrg 3943bfa90b6Smrg 3953bfa90b6Smrg/* 3963bfa90b6Smrg *---------------------------------------------------------------------------- 3973bfa90b6Smrg * 3983bfa90b6Smrg * SVMwareCtrlSetTopology -- 3993bfa90b6Smrg * 4003bfa90b6Smrg * Wrapper for SetTopology handler that handles input from other-endian 4013bfa90b6Smrg * clients. 4023bfa90b6Smrg * 4033bfa90b6Smrg * Results: 4043bfa90b6Smrg * Standard response codes. 4053bfa90b6Smrg * 4063bfa90b6Smrg * Side effects: 4073bfa90b6Smrg * Side effects of unswapped implementation. 4083bfa90b6Smrg * 4093bfa90b6Smrg *---------------------------------------------------------------------------- 4103bfa90b6Smrg */ 4113bfa90b6Smrg 4123bfa90b6Smrgstatic int 4133bfa90b6SmrgSVMwareCtrlSetTopology(ClientPtr client) 4143bfa90b6Smrg{ 4153bfa90b6Smrg register int n; 4163bfa90b6Smrg 4173bfa90b6Smrg REQUEST(xVMwareCtrlSetTopologyReq); 4183bfa90b6Smrg REQUEST_SIZE_MATCH(xVMwareCtrlSetTopologyReq); 4193bfa90b6Smrg 4203bfa90b6Smrg _swaps(&stuff->length, n); 4213bfa90b6Smrg _swapl(&stuff->screen, n); 4223bfa90b6Smrg _swapl(&stuff->number, n); 4233bfa90b6Smrg /* Each extent is a struct of shorts. */ 4243bfa90b6Smrg SwapRestS(stuff); 4253bfa90b6Smrg 4263bfa90b6Smrg return VMwareCtrlSetTopology(client); 4273bfa90b6Smrg} 4283bfa90b6Smrg 4293bfa90b6Smrg 4303bfa90b6Smrg/* 4313bfa90b6Smrg *---------------------------------------------------------------------------- 4323bfa90b6Smrg * 4333bfa90b6Smrg * SVMwareCtrlDispatch -- 4343bfa90b6Smrg * 4353bfa90b6Smrg * Wrapper for dispatcher that handles input from other-endian clients. 4363bfa90b6Smrg * 4373bfa90b6Smrg * Results: 4383bfa90b6Smrg * Standard response codes. 4393bfa90b6Smrg * 4403bfa90b6Smrg * Side effects: 4413bfa90b6Smrg * Side effects of individual command handlers. 4423bfa90b6Smrg * 4433bfa90b6Smrg *---------------------------------------------------------------------------- 4443bfa90b6Smrg */ 4453bfa90b6Smrg 4463bfa90b6Smrgstatic int 4473bfa90b6SmrgSVMwareCtrlDispatch(ClientPtr client) 4483bfa90b6Smrg{ 4493bfa90b6Smrg REQUEST(xReq); 4503bfa90b6Smrg 4513bfa90b6Smrg switch(stuff->data) { 4523bfa90b6Smrg case X_VMwareCtrlQueryVersion: 4533bfa90b6Smrg return SVMwareCtrlQueryVersion(client); 4543bfa90b6Smrg case X_VMwareCtrlSetRes: 4553bfa90b6Smrg return SVMwareCtrlSetRes(client); 4563bfa90b6Smrg case X_VMwareCtrlSetTopology: 4573bfa90b6Smrg return SVMwareCtrlSetTopology(client); 4583bfa90b6Smrg } 4593bfa90b6Smrg return BadRequest; 4603bfa90b6Smrg} 4613bfa90b6Smrg 4623bfa90b6Smrg 4633bfa90b6Smrg/* 4643bfa90b6Smrg *---------------------------------------------------------------------------- 4653bfa90b6Smrg * 4663bfa90b6Smrg * VMwareCtrlResetProc -- 4673bfa90b6Smrg * 4683bfa90b6Smrg * Cleanup handler called when the extension is removed. 4693bfa90b6Smrg * 4703bfa90b6Smrg * Results: 4713bfa90b6Smrg * None 4723bfa90b6Smrg * 4733bfa90b6Smrg * Side effects: 4743bfa90b6Smrg * None 4753bfa90b6Smrg * 4763bfa90b6Smrg *---------------------------------------------------------------------------- 4773bfa90b6Smrg */ 4783bfa90b6Smrg 4793bfa90b6Smrgstatic void 4803bfa90b6SmrgVMwareCtrlResetProc(ExtensionEntry* extEntry) 4813bfa90b6Smrg{ 4823bfa90b6Smrg /* Currently, no cleanup is necessary. */ 4833bfa90b6Smrg} 4843bfa90b6Smrg 4853bfa90b6Smrg 4863bfa90b6Smrg/* 4873bfa90b6Smrg *---------------------------------------------------------------------------- 4883bfa90b6Smrg * 4893bfa90b6Smrg * VMwareCtrl_ExitInit -- 4903bfa90b6Smrg * 4913bfa90b6Smrg * Initialiser for the VMWARE_CTRL protocol extension. 4923bfa90b6Smrg * 4933bfa90b6Smrg * Results: 4943bfa90b6Smrg * None. 4953bfa90b6Smrg * 4963bfa90b6Smrg * Side effects: 4973bfa90b6Smrg * Protocol extension will be registered if successful. 4983bfa90b6Smrg * 4993bfa90b6Smrg *---------------------------------------------------------------------------- 5003bfa90b6Smrg */ 5013bfa90b6Smrg 5023bfa90b6Smrgvoid 5033bfa90b6Smrgvmw_ctrl_ext_init(ScrnInfoPtr pScrn) 5043bfa90b6Smrg{ 5053bfa90b6Smrg ExtensionEntry *myext; 5063bfa90b6Smrg 5073bfa90b6Smrg if (!(myext = CheckExtension(VMWARE_CTRL_PROTOCOL_NAME))) { 5083bfa90b6Smrg if (!(myext = AddExtension(VMWARE_CTRL_PROTOCOL_NAME, 0, 0, 5093bfa90b6Smrg VMwareCtrlDispatch, 5103bfa90b6Smrg SVMwareCtrlDispatch, 5113bfa90b6Smrg VMwareCtrlResetProc, 5123bfa90b6Smrg StandardMinorOpcode))) { 5133bfa90b6Smrg xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 5143bfa90b6Smrg "Failed to add VMWARE_CTRL extension\n"); 5153bfa90b6Smrg return; 5163bfa90b6Smrg } 5173bfa90b6Smrg 5183bfa90b6Smrg /* 5193bfa90b6Smrg * For now, only support one screen as that's all the virtual 5203bfa90b6Smrg * hardware supports. 5213bfa90b6Smrg */ 5223bfa90b6Smrg myext->extPrivate = pScrn; 5233bfa90b6Smrg 5243bfa90b6Smrg xf86DrvMsg(pScrn->scrnIndex, X_INFO, 5253bfa90b6Smrg "Initialized VMWARE_CTRL extension version %d.%d\n", 5263bfa90b6Smrg VMWARE_CTRL_MAJOR_VERSION, VMWARE_CTRL_MINOR_VERSION); 5273bfa90b6Smrg } 5283bfa90b6Smrg} 529