Added Eric Petit's VMware graphics driver - thanks!
Made the following changes from the version I got from Eric: * made BppForSpace() in DriverInterface.h inline to remove some warnings * renamed driver source files to lower case. * removed Be Inc. copyright from kernel driver as I couldn't see anything coming from Be Inc. there - correct me if I was wrong, Eric. * Minor other changes like added missing header guards. * The README provided in the main directory is only included in the accelerant directory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19793 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright 1999, Be Incorporated.
|
||||
* Copyright 2007, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Be Incorporated
|
||||
* Eric Petit <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef DRIVERINTERFACE_H
|
||||
#define DRIVERINTERFACE_H
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Accelerant.h>
|
||||
#include <Drivers.h>
|
||||
#include <PCI.h>
|
||||
#include <OS.h>
|
||||
|
||||
#include "vm_device_version.h"
|
||||
#include "svga_reg.h"
|
||||
|
||||
#define MAX_SAMPLE_DEVICE_NAME_LENGTH 32
|
||||
#define CURSOR_ID 1
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Benaphores */
|
||||
|
||||
typedef struct {
|
||||
sem_id sem;
|
||||
int32 ben;
|
||||
} Benaphore;
|
||||
#define INIT_BEN(x) x.sem = create_sem(0, "VMware "#x); x.ben = 0;
|
||||
#define ACQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
|
||||
#define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
|
||||
#define DELETE_BEN(x) delete_sem(x.sem);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Utils */
|
||||
|
||||
#define ROUND_TO_PAGE_SIZE(x) (((x)+(B_PAGE_SIZE)-1)&~((B_PAGE_SIZE)-1))
|
||||
|
||||
static inline int
|
||||
BppForSpace(int space)
|
||||
{
|
||||
switch (space) {
|
||||
case B_RGB32:
|
||||
return 32;
|
||||
case B_RGB24:
|
||||
return 24;
|
||||
case B_RGB16:
|
||||
return 16;
|
||||
case B_RGB15:
|
||||
return 15;
|
||||
case B_CMAP8:
|
||||
return 8;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Request codes for ioctl() */
|
||||
|
||||
enum {
|
||||
VMWARE_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1,
|
||||
VMWARE_FIFO_START,
|
||||
VMWARE_FIFO_STOP,
|
||||
VMWARE_FIFO_SYNC,
|
||||
VMWARE_SET_MODE,
|
||||
VMWARE_SHOW_CURSOR,
|
||||
VMWARE_MOVE_CURSOR,
|
||||
};
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Structure shared between the kernel driver and the accelerant */
|
||||
|
||||
typedef struct {
|
||||
/* Device info and capabilities */
|
||||
uint16 vendorId;
|
||||
uint16 deviceId;
|
||||
uint8 revision;
|
||||
uint32 maxWidth;
|
||||
uint32 maxHeight;
|
||||
void *fbDma;
|
||||
uint32 fbSize;
|
||||
void *fifoDma;
|
||||
uint32 fifoSize;
|
||||
uint32 fifoMin;
|
||||
uint32 capabilities;
|
||||
uint32 fifoCapabilities;
|
||||
uint32 fifoFlags;
|
||||
|
||||
/* For registers access */
|
||||
uint16 indexPort;
|
||||
uint16 valuePort;
|
||||
|
||||
/* Mapped areas */
|
||||
area_id fbArea;
|
||||
void *fb;
|
||||
area_id fifoArea;
|
||||
void *fifo;
|
||||
|
||||
/* This changes when we switch to another mode */
|
||||
uint32 fbOffset;
|
||||
uint32 bytesPerRow;
|
||||
|
||||
/* Current display mode */
|
||||
display_mode dm;
|
||||
|
||||
Benaphore engineLock;
|
||||
Benaphore fifoLock;
|
||||
uint32 fifoNext;
|
||||
} SharedInfo;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user