// put paramater array into the cmd buffer void setParams(byte[] p) { for (int i = 0; i < p.length; i++) { mem.setShort(i + 8, p[i]); } }
/** * Open the given configuration * * @param config */ final RadeonSurface open(RadeonConfiguration config) throws ResourceNotFreeException { // Get the best matching config config = fbinfo.getBestConfiguration(config); log.debug("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().toInt()) + ", size 0x" + NumberUtils.hex(screen.getSize().toInt())); // 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().toInt()); if (fbinfo.hasCRTC2) { vgaIO.setReg32(CRTC2_OFFSET, (int) screen.getOffset().toInt()); } // 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, accel); } finally { // Turn the screen back on setDpms(dpmsState); } }
/** @see org.jnode.driver.video.vgahw.VgaIO#setSEQ(int, int) */ public void setSEQ(int index, int val) { mmio.setShort(NV16_SEQIND, (short) ((index & 0xFF) | ((val & 0xFF) << 8))); }
/** * Gets an 16-bit MMIO value * * @param index */ final void setReg16(int index, int value) { mmio.setShort(index, (short) value); }
/** @see org.jnode.driver.video.vgahw.VgaIO#setGRAF(int, int) */ public void setGRAF(int index, int val) { mmio.setShort(NV16_GRPHIND, (short) ((index & 0xFF) | ((val & 0xFF) << 8))); }