示例#1
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#setATTIndex(int) */
 public void setATTIndex(int index) {
   getSTAT();
   mmio.setByte(NV8_ATTRINDW, (byte) (index | 0x20));
 }
示例#2
0
  /**
   * 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);
    }
  }
示例#3
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#getSEQ(int) */
 public int getSEQ(int index) {
   mmio.setByte(NV8_SEQIND, (byte) index);
   return mmio.getByte(NV8_SEQDAT) & 0xff;
 }
示例#4
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#setATT(int, int) */
 public void setATT(int index, int val) {
   getSTAT();
   mmio.setByte(NV8_ATTRINDW, (byte) (index | 0x20));
   mmio.setByte(NV8_ATTRDATW, (byte) val);
 }
示例#5
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#getGRAF(int) */
 public int getGRAF(int index) {
   mmio.setByte(NV8_GRPHIND, (byte) index);
   return mmio.getByte(NV8_GRPHDAT) & 0xff;
 }
示例#6
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#getCRT(int) */
 public int getCRT(int index) {
   mmio.setByte(NV8_CRTCIND, (byte) index);
   return mmio.getByte(NV8_CRTCDAT) & 0xff;
 }
示例#7
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#getATT(int) */
 public int getATT(int index) {
   getSTAT();
   mmio.setByte(NV8_ATTRINDW, (byte) (index | 0x20));
   return mmio.getByte(NV8_ATTRDATR) & 0xff;
 }
示例#8
0
 /**
  * Sets an 8-bit MMIO value
  *
  * @param index
  */
 final void setReg8(int index, int value) {
   mmio.setByte(index, (byte) value);
 }
示例#9
0
 /** @see org.jnode.driver.video.vgahw.VgaIO#setMISC(int) */
 public void setMISC(int val) {
   setSEQ(0, 1);
   mmio.setByte(NV8_MISCW, (byte) val);
   setSEQ(0, 3);
 }