log.debug("Found VMWare SVGA device using ports 0x" + NumberUtils.hex(indexPort) +
" and 0x" + NumberUtils.hex(valuePort));
try {
// Allocate IO register space
final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
ports = claimPorts(rm, device, basePort, SVGA_NUM_PORTS * 4);
// Detect deviceID
deviceId = getVMWareID();
if (deviceId == SVGA_ID_0 || deviceId == SVGA_ID_INVALID) {
dumpState();
throw new DriverException("No supported VMWare SVGA found, found id 0x" +
NumberUtils.hex(deviceId));
} else {
log.debug("VMWare SVGA ID: 0x" + NumberUtils.hex(deviceId));
}
// Initialize and start FIFO
fifoMem = initFifo(device, rm);
// Read info
this.capabilities = getReg32(SVGA_REG_CAPABILITIES);
this.fifoCapabilities = hasCapability(SVGA_CAP_EXTENDED_FIFO) ? getFIFO(SVGA_FIFO_CAPABILITIES) : 0;
this.videoRamSize = getReg32(SVGA_REG_FB_MAX_SIZE);
this.maxWidth = getReg32(SVGA_REG_MAX_WIDTH);
this.maxHeight = getReg32(SVGA_REG_MAX_HEIGHT);
final int bitsPerPixel = getReg32(SVGA_REG_BITS_PER_PIXEL);
this.bytesPerLine = getReg32(SVGA_REG_BYTES_PER_LINE);
// Allocate framebuffer memory
final Address videoRamAddr;
if (device.getConfig().getDeviceID() == PCI_DEVICE_ID_VMWARE_SVGA2) {
videoRamAddr =
Address.fromLong(device.getConfig().asHeaderType0().getBaseAddresses()[1].getMemoryBase());
} else {
videoRamAddr = Address.fromIntZeroExtend(SVGA_REG_FB_START);
}
this.videoRam = rm.claimMemoryResource(device, videoRamAddr, videoRamSize, ResourceManager.MEMMODE_NORMAL);
this.bitsPerPixel = bitsPerPixel;
switch (bitsPerPixel) {
case 8:
bitmapGraphics =
BitmapGraphics.create8bppInstance(videoRam, width, height,