log.info("BestConfig:" + config);
log.debug("BestConfig:" + config);
	final RadeonSurface open(RadeonConfiguration config)			throws ResourceNotFreeException {				// Get the best matching config		config = fbinfo.getBestConfiguration(config);		log.info("BestConfig:" + config);				// Calculate new configuration		final DisplayMode mode = config.getDisplayMode();		final int width = mode.getWidth();		final int height = mode.getHeight();		final int pixels = width * height;		final int bitsPerPixel = config.getBitsPerPixel();		final int bytesPerLine = config.getBytesPerLine();		final int bytesPerScreen = bytesPerLine * height;		log.debug("PLLInfo:" + fbinfo.getPllInfo());		currentState.calcForConfiguration(config, vgaIO, fbinfo);		// Disable video interrupts		vgaIO.disableIRQ();				// Allocate the screen memory		final MemoryResource screen = claimDeviceMemory(bytesPerScreen, 4 * 1024);		//final MemoryResource screen = deviceRam;		log.debug("Screen at 0x" + NumberUtils.hex(screen.getOffset())				+ ", size 0x" + NumberUtils.hex(screen.getSize()));		//if (true) { throw new ResourceNotFreeException("TEST"); }		// Save the current state		oldVgaState.saveFromVGA(vgaIO);		log.debug("oldState:" + oldVgaState);		// Turn off the screen		final DpmsState dpmsState = getDpms();		setDpms(DpmsState.OFF);		try {			// Set the new configuration			currentState.restoreToVGA(vgaIO);			log.debug("NewState: " + currentState);			vgaIO.setReg32(CRTC_OFFSET, (int) screen.getOffset());			if (fbinfo.hasCRTC2) {				vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset());			}			// Set the 8-bit palette			setPalette(1.0f);			// Create the graphics helper & clear the screen			final BitmapGraphics bitmapGraphics;			switch (bitsPerPixel) {			case 8:				bitmapGraphics = BitmapGraphics.create8bppInstance(screen,						width, height, bytesPerLine, 0);				screen.setByte(0, (byte) 0, pixels);				break;			case 16:				bitmapGraphics = BitmapGraphics.create16bppInstance(screen,						width, height, bytesPerLine, 0);				screen.setShort(0, (byte) 0, pixels);				break;			case 24:				bitmapGraphics = BitmapGraphics.create24bppInstance(screen,						width, height, bytesPerLine, 0);				screen.setInt24(0, 0, pixels);				break;			case 32:				bitmapGraphics = BitmapGraphics.create32bppInstance(screen,						width, height, bytesPerLine, 0);				screen.setInt(0, 0, pixels);				break;			default:				throw new IllegalArgumentException("Invalid bits per pixel "						+ bitsPerPixel);			}			return new RadeonSurface(this, config, bitmapGraphics, screen);		} finally {			// Turn the screen back on			setDpms(dpmsState);		}	}