mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 06:40:08 +01:00
xorg/vmwgfx: Kill this target. It's not used anymore.
This fixes a build error introduced with commit "winsys/svga: Update to vmwgfx kernel module 2.1" if both the svga driver and the xorg state tracker was enabled at the same time. If needed we can re-add a minimal target for basic functionality. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
This commit is contained in:
parent
e4394fb19f
commit
d742a64909
14 changed files with 1 additions and 2784 deletions
|
|
@ -1798,7 +1798,7 @@ if test "x$with_gallium_drivers" != x; then
|
|||
case "x$driver" in
|
||||
xsvga)
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
|
||||
gallium_check_st "svga/drm" "dri-vmwgfx" "xorg-vmwgfx" "xa-vmwgfx"
|
||||
gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
|
||||
;;
|
||||
xi915)
|
||||
PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ if not env['embedded']:
|
|||
#'targets/xorg-i965/SConscript',
|
||||
#'targets/xorg-nouveau/SConscript',
|
||||
#'targets/xorg-radeon/SConscript',
|
||||
'targets/xorg-vmwgfx/SConscript',
|
||||
])
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
LIBNAME = vmwgfx_drv.so
|
||||
|
||||
C_SOURCES = \
|
||||
vmw_xorg.c \
|
||||
vmw_video.c \
|
||||
vmw_ioctl.c \
|
||||
vmw_ctrl.c \
|
||||
vmw_target.c \
|
||||
vmw_screen.c
|
||||
|
||||
DRIVER_INCLUDES = \
|
||||
-I$(TOP)/src/gallium
|
||||
|
||||
DRIVER_DEFINES = \
|
||||
-std=gnu99 \
|
||||
-DGALLIUM_RBUG \
|
||||
-DGALLIUM_TRACE \
|
||||
-DHAVE_CONFIG_H
|
||||
|
||||
DRIVER_PIPES = \
|
||||
$(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
|
||||
$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
|
||||
$(TOP)/src/gallium/drivers/svga/libsvga.a \
|
||||
$(TOP)/src/gallium/drivers/trace/libtrace.a \
|
||||
$(TOP)/src/gallium/drivers/rbug/librbug.a
|
||||
|
||||
DRIVER_LINKS = \
|
||||
$(shell pkg-config --libs libdrm libkms)
|
||||
|
||||
include ../Makefile.xorg
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
import os.path
|
||||
|
||||
Import('*')
|
||||
|
||||
env = env.Clone()
|
||||
|
||||
env.PkgUseModules(['DRM', 'XORG'])
|
||||
|
||||
if env['kms']:
|
||||
env.PkgUseModules(['KMS'])
|
||||
|
||||
env.Prepend(CPPPATH = [
|
||||
'#/include',
|
||||
'#/src/gallium',
|
||||
'#/src/mesa',
|
||||
'#/src/gallium/drivers/svga',
|
||||
'#/src/gallium/drivers/svga/include',
|
||||
])
|
||||
|
||||
env.Append(CPPDEFINES = [
|
||||
])
|
||||
|
||||
if env['gcc']:
|
||||
env.Append(CPPDEFINES = [
|
||||
'HAVE_STDINT_H',
|
||||
'HAVE_SYS_TYPES_H',
|
||||
])
|
||||
|
||||
env.Append(CFLAGS = [
|
||||
'-std=gnu99',
|
||||
'-D_FILE_OFFSET_BITS=64',
|
||||
])
|
||||
|
||||
env.Prepend(LIBPATH = [
|
||||
])
|
||||
|
||||
env.Prepend(LIBS = [
|
||||
trace,
|
||||
rbug,
|
||||
st_xorg,
|
||||
svgadrm,
|
||||
svga,
|
||||
gallium,
|
||||
])
|
||||
|
||||
sources = [
|
||||
'vmw_ioctl.c',
|
||||
'vmw_ctrl.c',
|
||||
'vmw_screen.c',
|
||||
'vmw_target.c',
|
||||
'vmw_video.c',
|
||||
'vmw_xorg.c',
|
||||
]
|
||||
|
||||
# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
|
||||
module = env.LoadableModule(
|
||||
target ='vmwgfx_drv.so',
|
||||
source = sources,
|
||||
LIBS = env['LIBS'],
|
||||
SHLIBPREFIX = '',
|
||||
)
|
||||
|
||||
env.Alias('xorg-vmwgfx', module)
|
||||
|
|
@ -1,524 +0,0 @@
|
|||
/*
|
||||
* Copyright 2006 by VMware, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the copyright holder(s)
|
||||
* and author(s) shall not be used in advertising or otherwise to promote
|
||||
* the sale, use or other dealings in this Software without prior written
|
||||
* authorization from the copyright holder(s) and author(s).
|
||||
*/
|
||||
|
||||
/*
|
||||
* vmwarectrl.c --
|
||||
*
|
||||
* The implementation of the VMWARE_CTRL protocol extension that
|
||||
* allows X clients to communicate with the driver.
|
||||
*/
|
||||
|
||||
#include <xorg-server.h>
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include <X11/X.h>
|
||||
#include <X11/extensions/panoramiXproto.h>
|
||||
|
||||
#include "vmw_driver.h"
|
||||
#include "vmwarectrlproto.h"
|
||||
|
||||
#include "xf86drm.h"
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrlQueryVersion --
|
||||
*
|
||||
* Implementation of QueryVersion command handler. Initialises and
|
||||
* sends a reply.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Writes reply to client
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
VMwareCtrlQueryVersion(ClientPtr client)
|
||||
{
|
||||
xVMwareCtrlQueryVersionReply rep = { 0, };
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xVMwareCtrlQueryVersionReq);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = VMWARE_CTRL_MAJOR_VERSION;
|
||||
rep.minorVersion = VMWARE_CTRL_MINOR_VERSION;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.majorVersion, n);
|
||||
swapl(&rep.minorVersion, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xVMwareCtrlQueryVersionReply), (char *)&rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrlDoSetRes --
|
||||
*
|
||||
* Set the custom resolution into the mode list.
|
||||
*
|
||||
* This is done by alternately updating one of two dynamic modes. It is
|
||||
* done this way because the server gets upset if you try to switch
|
||||
* to a new resolution that has the same index as the current one.
|
||||
*
|
||||
* Results:
|
||||
* TRUE on success, FALSE otherwise.
|
||||
*
|
||||
* Side effects:
|
||||
* One dynamic mode will be updated if successful.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Bool
|
||||
VMwareCtrlDoSetRes(ScrnInfoPtr pScrn,
|
||||
CARD32 x,
|
||||
CARD32 y)
|
||||
{
|
||||
struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
|
||||
struct vmw_rect rect;
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.w = x;
|
||||
rect.h = y;
|
||||
|
||||
vmw_ioctl_update_layout(vmw, 1, &rect);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrlSetRes --
|
||||
*
|
||||
* Implementation of SetRes command handler. Initialises and sends a
|
||||
* reply.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Writes reply to client
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
VMwareCtrlSetRes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xVMwareCtrlSetResReq);
|
||||
xVMwareCtrlSetResReply rep = { 0, };
|
||||
ScrnInfoPtr pScrn;
|
||||
ExtensionEntry *ext;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xVMwareCtrlSetResReq);
|
||||
|
||||
if (!(ext = CheckExtension(VMWARE_CTRL_PROTOCOL_NAME))) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
pScrn = ext->extPrivate;
|
||||
if (pScrn->scrnIndex != stuff->screen) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if (!VMwareCtrlDoSetRes(pScrn, stuff->x, stuff->y)) {
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = (sizeof(xVMwareCtrlSetResReply) - sizeof(xGenericReply)) >> 2;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.screen = stuff->screen;
|
||||
rep.x = stuff->x;
|
||||
rep.y = stuff->y;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.screen, n);
|
||||
swapl(&rep.x, n);
|
||||
swapl(&rep.y, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xVMwareCtrlSetResReply), (char *)&rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrlDoSetTopology --
|
||||
*
|
||||
* Set the custom topology and set a dynamic mode to the bounding box
|
||||
* of the passed topology. If a topology is already pending, then do
|
||||
* nothing but do not return failure.
|
||||
*
|
||||
* Results:
|
||||
* TRUE on success, FALSE otherwise.
|
||||
*
|
||||
* Side effects:
|
||||
* One dynamic mode and the pending xinerama state will be updated if
|
||||
* successful.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Bool
|
||||
VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn,
|
||||
xXineramaScreenInfo *extents,
|
||||
unsigned long number)
|
||||
{
|
||||
struct vmw_rect *rects;
|
||||
struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
|
||||
int i;
|
||||
|
||||
rects = calloc(number, sizeof(*rects));
|
||||
if (!rects)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < number; i++) {
|
||||
rects[i].x = extents[i].x_org;
|
||||
rects[i].y = extents[i].y_org;
|
||||
rects[i].w = extents[i].width;
|
||||
rects[i].h = extents[i].height;
|
||||
}
|
||||
|
||||
vmw_ioctl_update_layout(vmw, number, rects);
|
||||
|
||||
free(rects);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrlSetTopology --
|
||||
*
|
||||
* Implementation of SetTopology command handler. Initialises and sends a
|
||||
* reply.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Writes reply to client
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
VMwareCtrlSetTopology(ClientPtr client)
|
||||
{
|
||||
REQUEST(xVMwareCtrlSetTopologyReq);
|
||||
xVMwareCtrlSetTopologyReply rep = { 0, };
|
||||
ScrnInfoPtr pScrn;
|
||||
ExtensionEntry *ext;
|
||||
register int n;
|
||||
xXineramaScreenInfo *extents;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xVMwareCtrlSetTopologyReq);
|
||||
|
||||
if (!(ext = CheckExtension(VMWARE_CTRL_PROTOCOL_NAME))) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
pScrn = ext->extPrivate;
|
||||
if (pScrn->scrnIndex != stuff->screen) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
extents = (xXineramaScreenInfo *)(stuff + 1);
|
||||
if (!VMwareCtrlDoSetTopology(pScrn, extents, stuff->number)) {
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = (sizeof(xVMwareCtrlSetTopologyReply) - sizeof(xGenericReply)) >> 2;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.screen = stuff->screen;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.screen, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xVMwareCtrlSetTopologyReply), (char *)&rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrlDispatch --
|
||||
*
|
||||
* Dispatcher for VMWARE_CTRL commands. Calls the correct handler for
|
||||
* each command type.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Side effects of individual command handlers.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
VMwareCtrlDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch(stuff->data) {
|
||||
case X_VMwareCtrlQueryVersion:
|
||||
return VMwareCtrlQueryVersion(client);
|
||||
case X_VMwareCtrlSetRes:
|
||||
return VMwareCtrlSetRes(client);
|
||||
case X_VMwareCtrlSetTopology:
|
||||
return VMwareCtrlSetTopology(client);
|
||||
}
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* SVMwareCtrlQueryVersion --
|
||||
*
|
||||
* Wrapper for QueryVersion handler that handles input from other-endian
|
||||
* clients.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Side effects of unswapped implementation.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
SVMwareCtrlQueryVersion(ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xVMwareCtrlQueryVersionReq);
|
||||
REQUEST_SIZE_MATCH(xVMwareCtrlQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
|
||||
return VMwareCtrlQueryVersion(client);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* SVMwareCtrlSetRes --
|
||||
*
|
||||
* Wrapper for SetRes handler that handles input from other-endian
|
||||
* clients.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Side effects of unswapped implementation.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
SVMwareCtrlSetRes(ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xVMwareCtrlSetResReq);
|
||||
REQUEST_SIZE_MATCH(xVMwareCtrlSetResReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->screen, n);
|
||||
swapl(&stuff->x, n);
|
||||
swapl(&stuff->y, n);
|
||||
|
||||
return VMwareCtrlSetRes(client);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* SVMwareCtrlSetTopology --
|
||||
*
|
||||
* Wrapper for SetTopology handler that handles input from other-endian
|
||||
* clients.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Side effects of unswapped implementation.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
SVMwareCtrlSetTopology(ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xVMwareCtrlSetTopologyReq);
|
||||
REQUEST_SIZE_MATCH(xVMwareCtrlSetTopologyReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->screen, n);
|
||||
swapl(&stuff->number, n);
|
||||
/* Each extent is a struct of shorts. */
|
||||
SwapRestS(stuff);
|
||||
|
||||
return VMwareCtrlSetTopology(client);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* SVMwareCtrlDispatch --
|
||||
*
|
||||
* Wrapper for dispatcher that handles input from other-endian clients.
|
||||
*
|
||||
* Results:
|
||||
* Standard response codes.
|
||||
*
|
||||
* Side effects:
|
||||
* Side effects of individual command handlers.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
SVMwareCtrlDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch(stuff->data) {
|
||||
case X_VMwareCtrlQueryVersion:
|
||||
return SVMwareCtrlQueryVersion(client);
|
||||
case X_VMwareCtrlSetRes:
|
||||
return SVMwareCtrlSetRes(client);
|
||||
case X_VMwareCtrlSetTopology:
|
||||
return SVMwareCtrlSetTopology(client);
|
||||
}
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrlResetProc --
|
||||
*
|
||||
* Cleanup handler called when the extension is removed.
|
||||
*
|
||||
* Results:
|
||||
* None
|
||||
*
|
||||
* Side effects:
|
||||
* None
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void
|
||||
VMwareCtrlResetProc(ExtensionEntry* extEntry)
|
||||
{
|
||||
/* Currently, no cleanup is necessary. */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------------
|
||||
*
|
||||
* VMwareCtrl_ExitInit --
|
||||
*
|
||||
* Initialiser for the VMWARE_CTRL protocol extension.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* Protocol extension will be registered if successful.
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
vmw_ctrl_ext_init(struct vmw_customizer *vmw)
|
||||
{
|
||||
ExtensionEntry *myext;
|
||||
ScrnInfoPtr pScrn = vmw->pScrn;
|
||||
|
||||
if (!(myext = CheckExtension(VMWARE_CTRL_PROTOCOL_NAME))) {
|
||||
if (!(myext = AddExtension(VMWARE_CTRL_PROTOCOL_NAME, 0, 0,
|
||||
VMwareCtrlDispatch,
|
||||
SVMwareCtrlDispatch,
|
||||
VMwareCtrlResetProc,
|
||||
StandardMinorOpcode))) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Failed to add VMWARE_CTRL extension\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* For now, only support one screen as that's all the virtual
|
||||
* hardware supports.
|
||||
*/
|
||||
myext->extPrivate = pScrn;
|
||||
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"Initialized VMWARE_CTRL extension version %d.%d\n",
|
||||
VMWARE_CTRL_MAJOR_VERSION, VMWARE_CTRL_MINOR_VERSION);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright 2006 by VMware, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the copyright holder(s)
|
||||
* and author(s) shall not be used in advertising or otherwise to promote
|
||||
* the sale, use or other dealings in this Software without prior written
|
||||
* authorization from the copyright holder(s) and author(s).
|
||||
*/
|
||||
|
||||
/*
|
||||
* vmw_ctrl.h --
|
||||
*
|
||||
* The definitions used by the VMWARE_CTRL protocol extension that
|
||||
* allows X clients to communicate with the driver.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _VMW_CTRL_H_
|
||||
#define _VMW_CTRL_H_
|
||||
|
||||
#define VMWARE_CTRL_PROTOCOL_NAME "VMWARE_CTRL"
|
||||
|
||||
#define VMWARE_CTRL_MAJOR_VERSION 0
|
||||
#define VMWARE_CTRL_MINOR_VERSION 2
|
||||
|
||||
#define X_VMwareCtrlQueryVersion 0
|
||||
#define X_VMwareCtrlSetRes 1
|
||||
#define X_VMwareCtrlSetTopology 2
|
||||
|
||||
#endif /* _VMW_CTRL_H_ */
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
/**********************************************************
|
||||
* Copyright 2009 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains the shared resources for VMware Xorg driver
|
||||
* that sits ontop of the Xorg State Traker.
|
||||
*
|
||||
* It is initialized in vmw_screen.c.
|
||||
*
|
||||
* @author Jakob Bornecrantz <jakob@vmware.com>
|
||||
*/
|
||||
|
||||
#ifndef VMW_DRIVER_H_
|
||||
#define VMW_DRIVER_H_
|
||||
|
||||
#include "state_trackers/xorg/xorg_tracker.h"
|
||||
|
||||
struct vmw_dma_buffer;
|
||||
|
||||
struct vmw_rect
|
||||
{
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
uint32_t w;
|
||||
uint32_t h;
|
||||
};
|
||||
|
||||
struct vmw_customizer
|
||||
{
|
||||
CustomizerRec base;
|
||||
ScrnInfoPtr pScrn;
|
||||
|
||||
int fd;
|
||||
|
||||
void *cursor_priv;
|
||||
|
||||
/* vmw_video.c */
|
||||
void *video_priv;
|
||||
uint64_t max_fb_size;
|
||||
};
|
||||
|
||||
static INLINE struct vmw_customizer *
|
||||
vmw_customizer(CustomizerPtr cust)
|
||||
{
|
||||
return cust ? (struct vmw_customizer *) cust : NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* vmw_ctrl.c
|
||||
*/
|
||||
|
||||
void vmw_ctrl_ext_init(struct vmw_customizer *vmw);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* vmw_video.c
|
||||
*/
|
||||
|
||||
Bool vmw_video_init(struct vmw_customizer *vmw);
|
||||
|
||||
Bool vmw_video_close(struct vmw_customizer *vmw);
|
||||
|
||||
void vmw_video_stop_all(struct vmw_customizer *vmw);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* vmw_ioctl.c
|
||||
*/
|
||||
|
||||
int vmw_ioctl_cursor_bypass(struct vmw_customizer *vmw, int xhot, int yhot);
|
||||
|
||||
struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_customizer *vmw,
|
||||
uint32_t size,
|
||||
unsigned *handle);
|
||||
|
||||
void * vmw_ioctl_buffer_map(struct vmw_customizer *vmw,
|
||||
struct vmw_dma_buffer *buf);
|
||||
|
||||
void vmw_ioctl_buffer_unmap(struct vmw_customizer *vmw,
|
||||
struct vmw_dma_buffer *buf);
|
||||
|
||||
void vmw_ioctl_buffer_destroy(struct vmw_customizer *vmw,
|
||||
struct vmw_dma_buffer *buf);
|
||||
|
||||
int vmw_ioctl_supports_streams(struct vmw_customizer *vmw);
|
||||
|
||||
int vmw_ioctl_num_streams(struct vmw_customizer *vmw,
|
||||
uint32_t *ntot, uint32_t *nfree);
|
||||
|
||||
int vmw_ioctl_unref_stream(struct vmw_customizer *vmw, uint32_t stream_id);
|
||||
|
||||
int vmw_ioctl_claim_stream(struct vmw_customizer *vmw, uint32_t *out);
|
||||
|
||||
int vmw_ioctl_update_layout(struct vmw_customizer *vmw, uint32_t num, struct vmw_rect *rects);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/**********************************************************
|
||||
* Copyright 2009 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
#ifndef VMW_HOOK_H_
|
||||
#define VMW_HOOK_H_
|
||||
|
||||
#include "state_trackers/xorg/xorg_winsys.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* vmw_screen.c
|
||||
*/
|
||||
|
||||
void vmw_screen_set_functions(ScrnInfoPtr pScrn);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,260 +0,0 @@
|
|||
/**********************************************************
|
||||
* Copyright 2009 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains the functions for creating dma buffers by calling
|
||||
* the kernel via driver specific ioctls.
|
||||
*
|
||||
* @author Jakob Bornecrantz <jakob@vmware.com>
|
||||
*/
|
||||
|
||||
#ifndef HAVE_STDINT_H
|
||||
#define HAVE_STDINT_H 1
|
||||
#endif
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include "xf86drm.h"
|
||||
#include "../../winsys/svga/drm/vmwgfx_drm.h"
|
||||
|
||||
#include "vmw_driver.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
struct vmw_dma_buffer
|
||||
{
|
||||
void *data;
|
||||
unsigned handle;
|
||||
uint64_t map_handle;
|
||||
unsigned map_count;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
static int
|
||||
vmw_ioctl_get_param(struct vmw_customizer *vmw, uint32_t param, uint64_t *out)
|
||||
{
|
||||
struct drm_vmw_getparam_arg gp_arg;
|
||||
int ret;
|
||||
|
||||
memset(&gp_arg, 0, sizeof(gp_arg));
|
||||
gp_arg.param = param;
|
||||
ret = drmCommandWriteRead(vmw->fd, DRM_VMW_GET_PARAM,
|
||||
&gp_arg, sizeof(gp_arg));
|
||||
|
||||
if (ret == 0) {
|
||||
*out = gp_arg.value;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
vmw_ioctl_supports_streams(struct vmw_customizer *vmw)
|
||||
{
|
||||
uint64_t value;
|
||||
int ret;
|
||||
|
||||
ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_STREAMS, &value);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return value ? 0 : -ENOSYS;
|
||||
}
|
||||
|
||||
int
|
||||
vmw_ioctl_num_streams(struct vmw_customizer *vmw,
|
||||
uint32_t *ntot, uint32_t *nfree)
|
||||
{
|
||||
uint64_t v1, v2;
|
||||
int ret;
|
||||
|
||||
ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_STREAMS, &v1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_FREE_STREAMS, &v2);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
*ntot = (uint32_t)v1;
|
||||
*nfree = (uint32_t)v2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
vmw_ioctl_claim_stream(struct vmw_customizer *vmw, uint32_t *out)
|
||||
{
|
||||
struct drm_vmw_stream_arg s_arg;
|
||||
int ret;
|
||||
|
||||
ret = drmCommandRead(vmw->fd, DRM_VMW_CLAIM_STREAM,
|
||||
&s_arg, sizeof(s_arg));
|
||||
|
||||
if (ret)
|
||||
return -1;
|
||||
|
||||
*out = s_arg.stream_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
vmw_ioctl_unref_stream(struct vmw_customizer *vmw, uint32_t stream_id)
|
||||
{
|
||||
struct drm_vmw_stream_arg s_arg;
|
||||
int ret;
|
||||
|
||||
memset(&s_arg, 0, sizeof(s_arg));
|
||||
s_arg.stream_id = stream_id;
|
||||
|
||||
ret = drmCommandRead(vmw->fd, DRM_VMW_CLAIM_STREAM,
|
||||
&s_arg, sizeof(s_arg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
vmw_ioctl_cursor_bypass(struct vmw_customizer *vmw, int xhot, int yhot)
|
||||
{
|
||||
struct drm_vmw_cursor_bypass_arg arg;
|
||||
int ret;
|
||||
|
||||
memset(&arg, 0, sizeof(arg));
|
||||
arg.flags = DRM_VMW_CURSOR_BYPASS_ALL;
|
||||
arg.xhot = xhot;
|
||||
arg.yhot = yhot;
|
||||
|
||||
ret = drmCommandWrite(vmw->fd, DRM_VMW_CURSOR_BYPASS,
|
||||
&arg, sizeof(arg));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct vmw_dma_buffer *
|
||||
vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *handle)
|
||||
{
|
||||
struct vmw_dma_buffer *buf;
|
||||
union drm_vmw_alloc_dmabuf_arg arg;
|
||||
struct drm_vmw_alloc_dmabuf_req *req = &arg.req;
|
||||
struct drm_vmw_dmabuf_rep *rep = &arg.rep;
|
||||
int ret;
|
||||
|
||||
buf = calloc(1, sizeof(*buf));
|
||||
if (!buf)
|
||||
goto err;
|
||||
|
||||
memset(&arg, 0, sizeof(arg));
|
||||
req->size = size;
|
||||
do {
|
||||
ret = drmCommandWriteRead(vmw->fd, DRM_VMW_ALLOC_DMABUF, &arg, sizeof(arg));
|
||||
} while (ret == -ERESTART);
|
||||
|
||||
if (ret) {
|
||||
debug_printf("IOCTL failed %d: %s\n", ret, strerror(-ret));
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
|
||||
buf->data = NULL;
|
||||
buf->handle = rep->handle;
|
||||
buf->map_handle = rep->map_handle;
|
||||
buf->map_count = 0;
|
||||
buf->size = size;
|
||||
|
||||
*handle = rep->handle;
|
||||
|
||||
return buf;
|
||||
|
||||
err_free:
|
||||
free(buf);
|
||||
err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
vmw_ioctl_buffer_destroy(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
|
||||
{
|
||||
struct drm_vmw_unref_dmabuf_arg arg;
|
||||
|
||||
if (buf->data) {
|
||||
munmap(buf->data, buf->size);
|
||||
buf->data = NULL;
|
||||
}
|
||||
|
||||
memset(&arg, 0, sizeof(arg));
|
||||
arg.handle = buf->handle;
|
||||
drmCommandWrite(vmw->fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg));
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void *
|
||||
vmw_ioctl_buffer_map(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
|
||||
{
|
||||
void *map;
|
||||
|
||||
if (buf->data == NULL) {
|
||||
map = mmap(NULL, buf->size, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
vmw->fd, buf->map_handle);
|
||||
if (map == MAP_FAILED) {
|
||||
debug_printf("%s: Map failed.\n", __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf->data = map;
|
||||
}
|
||||
|
||||
++buf->map_count;
|
||||
|
||||
return buf->data;
|
||||
}
|
||||
|
||||
void
|
||||
vmw_ioctl_buffer_unmap(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
|
||||
{
|
||||
--buf->map_count;
|
||||
}
|
||||
|
||||
int
|
||||
vmw_ioctl_update_layout(struct vmw_customizer *vmw, uint32_t num, struct vmw_rect *rects)
|
||||
{
|
||||
struct drm_vmw_update_layout_arg ul_arg;
|
||||
int ret;
|
||||
|
||||
assert(sizeof(struct vmw_rect) == sizeof(struct drm_vmw_rect));
|
||||
|
||||
memset(&ul_arg, 0, sizeof(ul_arg));
|
||||
ul_arg.num_outputs = num;
|
||||
ul_arg.rects = (uint64_t)(uintptr_t)rects;
|
||||
|
||||
ret = drmCommandWriteRead(vmw->fd, DRM_VMW_UPDATE_LAYOUT,
|
||||
&ul_arg, sizeof(ul_arg));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,267 +0,0 @@
|
|||
/**********************************************************
|
||||
* Copyright 2009 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains the init code for the VMware Xorg driver.
|
||||
*
|
||||
* @author Jakob Bornecrantz <jakob@vmware.com>
|
||||
*/
|
||||
|
||||
#include "vmw_hook.h"
|
||||
#include "vmw_driver.h"
|
||||
#include "pipe/p_context.h"
|
||||
|
||||
#include "cursorstr.h"
|
||||
#include "../../winsys/svga/drm/vmwgfx_drm.h"
|
||||
|
||||
void vmw_winsys_screen_set_throttling(struct pipe_screen *screen,
|
||||
uint32_t throttle_us);
|
||||
|
||||
|
||||
/* modified version of crtc functions */
|
||||
xf86CrtcFuncsRec vmw_screen_crtc_funcs;
|
||||
|
||||
static void
|
||||
vmw_screen_cursor_load_argb(xf86CrtcPtr crtc, CARD32 *image)
|
||||
{
|
||||
struct vmw_customizer *vmw =
|
||||
vmw_customizer(xorg_customizer(crtc->scrn));
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
|
||||
xf86CrtcFuncsPtr funcs = vmw->cursor_priv;
|
||||
CursorPtr c = config->cursor;
|
||||
|
||||
/* Run the ioctl before uploading the image */
|
||||
vmw_ioctl_cursor_bypass(vmw, c->bits->xhot, c->bits->yhot);
|
||||
|
||||
funcs->load_cursor_argb(crtc, image);
|
||||
}
|
||||
|
||||
static void
|
||||
vmw_screen_cursor_init(struct vmw_customizer *vmw)
|
||||
{
|
||||
ScrnInfoPtr pScrn = vmw->pScrn;
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
int i;
|
||||
|
||||
/* XXX assume that all crtc's have the same function struct */
|
||||
|
||||
/* Save old struct need to call the old functions as well */
|
||||
vmw->cursor_priv = (void*)(config->crtc[0]->funcs);
|
||||
memcpy(&vmw_screen_crtc_funcs, vmw->cursor_priv, sizeof(xf86CrtcFuncsRec));
|
||||
vmw_screen_crtc_funcs.load_cursor_argb = vmw_screen_cursor_load_argb;
|
||||
|
||||
for (i = 0; i < config->num_crtc; i++)
|
||||
config->crtc[i]->funcs = &vmw_screen_crtc_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
vmw_screen_cursor_close(struct vmw_customizer *vmw)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(vmw->pScrn);
|
||||
int i;
|
||||
|
||||
vmw_ioctl_cursor_bypass(vmw, 0, 0);
|
||||
|
||||
for (i = 0; i < config->num_crtc; i++)
|
||||
config->crtc[i]->funcs = vmw->cursor_priv;
|
||||
}
|
||||
|
||||
static void
|
||||
vmw_context_throttle(CustomizerPtr cust,
|
||||
struct pipe_context *pipe,
|
||||
enum xorg_throttling_reason reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case THROTTLE_RENDER:
|
||||
vmw_winsys_screen_set_throttling(pipe->screen, 20000);
|
||||
break;
|
||||
default:
|
||||
vmw_winsys_screen_set_throttling(pipe->screen, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vmw_context_no_throttle(CustomizerPtr cust,
|
||||
struct pipe_context *pipe,
|
||||
enum xorg_throttling_reason reason)
|
||||
{
|
||||
vmw_winsys_screen_set_throttling(pipe->screen, 0);
|
||||
}
|
||||
|
||||
static Bool
|
||||
vmw_check_fb_size(CustomizerPtr cust,
|
||||
unsigned long pitch,
|
||||
unsigned long height)
|
||||
{
|
||||
struct vmw_customizer *vmw = vmw_customizer(cust);
|
||||
|
||||
/**
|
||||
* 1) Is there a pitch alignment?
|
||||
* 2) The 1024 byte pad is an arbitrary value to be on
|
||||
*/
|
||||
|
||||
return ((uint64_t) pitch * height + 1024ULL < vmw->max_fb_size);
|
||||
}
|
||||
|
||||
static Bool
|
||||
vmw_pre_init(CustomizerPtr cust, int fd)
|
||||
{
|
||||
struct vmw_customizer *vmw = vmw_customizer(cust);
|
||||
drmVersionPtr ver;
|
||||
|
||||
vmw->fd = fd;
|
||||
|
||||
ver = drmGetVersion(vmw->fd);
|
||||
if (ver == NULL ||
|
||||
(ver->version_major == 1 && ver->version_minor < 1)) {
|
||||
cust->swap_throttling = TRUE;
|
||||
cust->dirty_throttling = TRUE;
|
||||
cust->winsys_context_throttle = vmw_context_no_throttle;
|
||||
} else {
|
||||
cust->swap_throttling = TRUE;
|
||||
cust->dirty_throttling = FALSE;
|
||||
cust->winsys_context_throttle = vmw_context_throttle;
|
||||
debug_printf("%s: Enabling kernel throttling.\n", __func__);
|
||||
|
||||
if (ver->version_major > 1 ||
|
||||
(ver->version_major == 1 && ver->version_minor >= 3)) {
|
||||
struct drm_vmw_getparam_arg arg;
|
||||
int ret;
|
||||
|
||||
arg.param = DRM_VMW_PARAM_MAX_FB_SIZE;
|
||||
ret = drmCommandWriteRead(fd, DRM_VMW_GET_PARAM, &arg,
|
||||
sizeof(arg));
|
||||
if (!ret) {
|
||||
vmw->max_fb_size = arg.value;
|
||||
cust->winsys_check_fb_size = vmw_check_fb_size;
|
||||
debug_printf("%s: Enabling fb size check.\n", __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ver)
|
||||
drmFreeVersion(ver);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
vmw_screen_init(CustomizerPtr cust)
|
||||
{
|
||||
struct vmw_customizer *vmw = vmw_customizer(cust);
|
||||
|
||||
vmw_screen_cursor_init(vmw);
|
||||
|
||||
vmw_ctrl_ext_init(vmw);
|
||||
|
||||
/* if gallium is used then we don't need to do anything more. */
|
||||
if (xorg_has_gallium(vmw->pScrn))
|
||||
return TRUE;
|
||||
|
||||
vmw_video_init(vmw);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
vmw_screen_close(CustomizerPtr cust)
|
||||
{
|
||||
struct vmw_customizer *vmw = vmw_customizer(cust);
|
||||
|
||||
if (!vmw)
|
||||
return TRUE;
|
||||
|
||||
vmw_screen_cursor_close(vmw);
|
||||
|
||||
vmw_video_close(vmw);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
vmw_screen_enter_vt(CustomizerPtr cust)
|
||||
{
|
||||
debug_printf("%s: enter\n", __func__);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
vmw_screen_leave_vt(CustomizerPtr cust)
|
||||
{
|
||||
struct vmw_customizer *vmw = vmw_customizer(cust);
|
||||
|
||||
debug_printf("%s: enter\n", __func__);
|
||||
|
||||
vmw_video_stop_all(vmw);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions for setting up hooks into the xorg state tracker
|
||||
*/
|
||||
|
||||
static Bool (*vmw_screen_pre_init_saved)(ScrnInfoPtr pScrn, int flags) = NULL;
|
||||
|
||||
static Bool
|
||||
vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
|
||||
{
|
||||
struct vmw_customizer *vmw;
|
||||
CustomizerPtr cust;
|
||||
|
||||
vmw = xnfcalloc(1, sizeof(*vmw));
|
||||
if (!vmw)
|
||||
return FALSE;
|
||||
|
||||
cust = &vmw->base;
|
||||
|
||||
cust->winsys_pre_init = vmw_pre_init;
|
||||
cust->winsys_screen_init = vmw_screen_init;
|
||||
cust->winsys_screen_close = vmw_screen_close;
|
||||
cust->winsys_enter_vt = vmw_screen_enter_vt;
|
||||
cust->winsys_leave_vt = vmw_screen_leave_vt;
|
||||
cust->no_3d = TRUE;
|
||||
cust->unhidden_hw_cursor_update = TRUE;
|
||||
vmw->pScrn = pScrn;
|
||||
|
||||
pScrn->driverPrivate = cust;
|
||||
|
||||
pScrn->PreInit = vmw_screen_pre_init_saved;
|
||||
if (!pScrn->PreInit(pScrn, flags))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
vmw_screen_set_functions(ScrnInfoPtr pScrn)
|
||||
{
|
||||
assert(!vmw_screen_pre_init_saved);
|
||||
|
||||
vmw_screen_pre_init_saved = pScrn->PreInit;
|
||||
pScrn->PreInit = vmw_screen_pre_init;
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "state_tracker/drm_driver.h"
|
||||
#include "svga/drm/svga_drm_public.h"
|
||||
#include "svga/svga_public.h"
|
||||
|
||||
static struct pipe_screen *
|
||||
create_screen(int fd)
|
||||
{
|
||||
struct svga_winsys_screen *sws;
|
||||
struct pipe_screen *screen;
|
||||
|
||||
sws = svga_drm_winsys_screen_create(fd);
|
||||
if (!sws)
|
||||
return NULL;
|
||||
|
||||
screen = svga_screen_create(sws);
|
||||
if (!screen)
|
||||
return NULL;
|
||||
|
||||
screen = debug_screen_wrap(screen);
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen)
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,191 +0,0 @@
|
|||
/**********************************************************
|
||||
* Copyright 2008-2009 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Glue file for Xorg State Tracker.
|
||||
*
|
||||
* @author Alan Hourihane <alanh@tungstengraphics.com>
|
||||
* @author Jakob Bornecrantz <wallbraker@gmail.com>
|
||||
*/
|
||||
|
||||
#include "vmw_hook.h"
|
||||
|
||||
|
||||
/*
|
||||
* Defines and modinfo
|
||||
*/
|
||||
|
||||
#define VMWGFX_DRIVER_NAME "vmwgfx"
|
||||
|
||||
#define VMW_STRING_INNER(s) #s
|
||||
#define VMW_STRING(str) VMW_STRING_INNER(str)
|
||||
|
||||
#define VMWGFX_VERSION_MAJOR 11
|
||||
#define VMWGFX_VERSION_MINOR 0
|
||||
#define VMWGFX_VERSION_PATCH 0
|
||||
#define VMWGFX_VERSION_STRING_MAJOR VMW_STRING(VMWGFX_VERSION_MAJOR)
|
||||
#define VMWGFX_VERSION_STRING_MINOR VMW_STRING(VMWGFX_VERSION_MINOR)
|
||||
#define VMWGFX_VERSION_STRING_PATCH VMW_STRING(VMWGFX_VERSION_PATCH)
|
||||
|
||||
#define VMWGFX_DRIVER_VERSION \
|
||||
(VMWGFX_VERSION_MAJOR * 65536 + VMWGFX_VERSION_MINOR * 256 + VMWGFX_VERSION_PATCH)
|
||||
#define VMWGFX_DRIVER_VERSION_STRING \
|
||||
VMWGFX_VERSION_STRING_MAJOR "." VMWGFX_VERSION_STRING_MINOR \
|
||||
"." VMWGFX_VERSION_STRING_PATCH
|
||||
|
||||
/*
|
||||
* Standard four digit version string expected by VMware Tools installer.
|
||||
* As the driver's version is only {major, minor, patchlevel}, simply append an
|
||||
* extra zero for the fourth digit.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
_X_EXPORT const char vmwgfx_drv_modinfo[] __attribute__((section(".modinfo"),unused)) =
|
||||
"version=" VMWGFX_DRIVER_VERSION_STRING ".0";
|
||||
#endif
|
||||
|
||||
static void vmw_xorg_identify(int flags);
|
||||
_X_EXPORT Bool vmw_xorg_pci_probe(DriverPtr driver,
|
||||
int entity_num,
|
||||
struct pci_device *device,
|
||||
intptr_t match_data);
|
||||
|
||||
|
||||
/*
|
||||
* Tables
|
||||
*/
|
||||
|
||||
static const struct pci_id_match vmw_xorg_device_match[] = {
|
||||
{0x15ad, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static SymTabRec vmw_xorg_chipsets[] = {
|
||||
{PCI_MATCH_ANY, "VMware SVGA Device"},
|
||||
{-1, NULL}
|
||||
};
|
||||
|
||||
static PciChipsets vmw_xorg_pci_devices[] = {
|
||||
{PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
|
||||
{-1, -1, NULL}
|
||||
};
|
||||
|
||||
static XF86ModuleVersionInfo vmw_xorg_version = {
|
||||
VMWGFX_DRIVER_NAME,
|
||||
MODULEVENDORSTRING,
|
||||
MODINFOSTRING1,
|
||||
MODINFOSTRING2,
|
||||
XORG_VERSION_CURRENT,
|
||||
VMWGFX_VERSION_MAJOR, VMWGFX_VERSION_MINOR, VMWGFX_VERSION_PATCH,
|
||||
ABI_CLASS_VIDEODRV,
|
||||
ABI_VIDEODRV_VERSION,
|
||||
MOD_CLASS_VIDEODRV,
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Xorg driver exported structures
|
||||
*/
|
||||
|
||||
_X_EXPORT DriverRec vmwgfx = {
|
||||
1,
|
||||
VMWGFX_DRIVER_NAME,
|
||||
vmw_xorg_identify,
|
||||
NULL,
|
||||
xorg_tracker_available_options,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
vmw_xorg_device_match,
|
||||
vmw_xorg_pci_probe
|
||||
};
|
||||
|
||||
static MODULESETUPPROTO(vmw_xorg_setup);
|
||||
|
||||
_X_EXPORT XF86ModuleData vmwgfxModuleData = {
|
||||
&vmw_xorg_version,
|
||||
vmw_xorg_setup,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Xorg driver functions
|
||||
*/
|
||||
|
||||
static pointer
|
||||
vmw_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||
{
|
||||
static Bool setupDone = 0;
|
||||
|
||||
/* This module should be loaded only once, but check to be sure.
|
||||
*/
|
||||
if (!setupDone) {
|
||||
setupDone = 1;
|
||||
xf86AddDriver(&vmwgfx, module, HaveDriverFuncs);
|
||||
|
||||
/*
|
||||
* The return value must be non-NULL on success even though there
|
||||
* is no TearDownProc.
|
||||
*/
|
||||
return (pointer) 1;
|
||||
} else {
|
||||
if (errmaj)
|
||||
*errmaj = LDR_ONCEONLY;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vmw_xorg_identify(int flags)
|
||||
{
|
||||
xf86PrintChipsets("vmwgfx", "Driver for VMware SVGA device",
|
||||
vmw_xorg_chipsets);
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
vmw_xorg_pci_probe(DriverPtr driver,
|
||||
int entity_num, struct pci_device *device, intptr_t match_data)
|
||||
{
|
||||
ScrnInfoPtr scrn = NULL;
|
||||
EntityInfoPtr entity;
|
||||
|
||||
scrn = xf86ConfigPciEntity(scrn, 0, entity_num, vmw_xorg_pci_devices,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
if (scrn != NULL) {
|
||||
scrn->driverVersion = 1;
|
||||
scrn->driverName = "vmwgfx";
|
||||
scrn->name = "vmwgfx";
|
||||
scrn->Probe = NULL;
|
||||
|
||||
entity = xf86GetEntityInfo(entity_num);
|
||||
|
||||
/* Use all the functions from the xorg tracker */
|
||||
xorg_tracker_set_functions(scrn);
|
||||
|
||||
vmw_screen_set_functions(scrn);
|
||||
}
|
||||
return scrn != NULL;
|
||||
}
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright 2006 by VMware, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of the copyright holder(s)
|
||||
* and author(s) shall not be used in advertising or otherwise to promote
|
||||
* the sale, use or other dealings in this Software without prior written
|
||||
* authorization from the copyright holder(s) and author(s).
|
||||
*/
|
||||
|
||||
/*
|
||||
* vmwarectrlproto.h --
|
||||
*
|
||||
* The description of the VMWARE_CTRL protocol extension that
|
||||
* allows X clients to communicate with the driver.
|
||||
*/
|
||||
|
||||
#ifndef _VMWARE_CTRL_PROTO_H_
|
||||
#define _VMWARE_CTRL_PROTO_H_
|
||||
|
||||
|
||||
#include <X11/X.h>
|
||||
#include "vmw_ctrl.h"
|
||||
|
||||
|
||||
/*
|
||||
* Requests and Replies
|
||||
*/
|
||||
|
||||
/* Version 0.1 definitions. */
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType; /* always X_VMwareCtrlReqCode */
|
||||
CARD8 VMwareCtrlReqType; /* always X_VMwareCtrlQueryVersion */
|
||||
CARD16 length B16;
|
||||
CARD32 majorVersion B32;
|
||||
CARD32 minorVersion B32;
|
||||
} xVMwareCtrlQueryVersionReq;
|
||||
#define sz_xVMwareCtrlQueryVersionReq 12
|
||||
|
||||
typedef struct {
|
||||
BYTE type; /* X_Reply */
|
||||
BYTE pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 majorVersion B32;
|
||||
CARD32 minorVersion B32;
|
||||
CARD32 pad2 B32;
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
} xVMwareCtrlQueryVersionReply;
|
||||
#define sz_xVMwareCtrlQueryVersionReply 32
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType; /* always X_VMwareCtrlReqCode */
|
||||
CARD8 VMwareCtrlReqType; /* always X_VMwareCtrlSetRes */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 x B32;
|
||||
CARD32 y B32;
|
||||
} xVMwareCtrlSetResReq;
|
||||
#define sz_xVMwareCtrlSetResReq 16
|
||||
|
||||
typedef struct {
|
||||
BYTE type; /* X_Reply */
|
||||
BYTE pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 screen B32;
|
||||
CARD32 x B32;
|
||||
CARD32 y B32;
|
||||
CARD32 pad2 B32;
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
} xVMwareCtrlSetResReply;
|
||||
#define sz_xVMwareCtrlSetResReply 32
|
||||
|
||||
/* Version 0.2 definitions. */
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType; /* always X_VMwareCtrlReqCode */
|
||||
CARD8 VMwareCtrlReqType; /* always X_VMwareCtrlSetTopology */
|
||||
CARD16 length B16;
|
||||
CARD32 screen B32;
|
||||
CARD32 number B32;
|
||||
CARD32 pad1 B32;
|
||||
} xVMwareCtrlSetTopologyReq;
|
||||
#define sz_xVMwareCtrlSetTopologyReq 16
|
||||
|
||||
typedef struct {
|
||||
BYTE type; /* X_Reply */
|
||||
BYTE pad1;
|
||||
CARD16 sequenceNumber B16;
|
||||
CARD32 length B32;
|
||||
CARD32 screen B32;
|
||||
CARD32 pad2 B32;
|
||||
CARD32 pad3 B32;
|
||||
CARD32 pad4 B32;
|
||||
CARD32 pad5 B32;
|
||||
CARD32 pad6 B32;
|
||||
} xVMwareCtrlSetTopologyReply;
|
||||
#define sz_xVMwareCtrlSetTopologyReply 32
|
||||
|
||||
#endif /* _VMWARE_CTRL_PROTO_H_ */
|
||||
Loading…
Add table
Reference in a new issue