diff options
Diffstat (limited to 'src/dev/arm/hdlcd.cc')
-rw-r--r-- | src/dev/arm/hdlcd.cc | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/dev/arm/hdlcd.cc b/src/dev/arm/hdlcd.cc index a92ae4627..081fec2ff 100644 --- a/src/dev/arm/hdlcd.cc +++ b/src/dev/arm/hdlcd.cc @@ -65,6 +65,7 @@ HDLcd::HDLcd(const HDLcdParams *p) addrRanges{RangeSize(pioAddr, pioSize)}, enableCapture(p->enable_capture), pixelBufferSize(p->pixel_buffer_size), + virtRefreshRate(p->virt_refresh_rate), // Registers version(VERSION_RESETV), @@ -82,6 +83,7 @@ HDLcd::HDLcd(const HDLcdParams *p) pixel_format(0), red_select(0), green_select(0), blue_select(0), + virtRefreshEvent(this), // Other bmp(&pixelPump.fb), pic(NULL), conv(PixelConverter::rgba8888_le), pixelPump(*this, *p->pxl_clk, p->pixel_chunk) @@ -201,13 +203,19 @@ HDLcd::drainResume() { AmbaDmaDevice::drainResume(); - // We restored from an old checkpoint without a pixel pump, start - // an new refresh. This typically happens when restoring from old - // checkpoints. - if (enabled() && !pixelPump.active()) { - // Update timing parameter before rendering frames - pixelPump.updateTimings(displayTimings()); - pixelPump.start(); + if (enabled()) { + if (sys->bypassCaches()) { + // We restart the HDLCD if we are in KVM mode. This + // ensures that we always use the fast refresh logic if we + // resume in KVM mode. + cmdDisable(); + cmdEnable(); + } else if (!pixelPump.active()) { + // We restored from an old checkpoint without a pixel + // pump, start an new refresh. This typically happens when + // restoring from old checkpoints. + cmdEnable(); + } } // We restored from a checkpoint and need to update the VNC server @@ -215,6 +223,13 @@ HDLcd::drainResume() vnc->setDirty(); } +void +HDLcd::virtRefresh() +{ + pixelPump.renderFrame(); + schedule(virtRefreshEvent, (curTick() + virtRefreshRate)); +} + // read registers and frame buffer Tick HDLcd::read(PacketPtr pkt) @@ -482,13 +497,23 @@ HDLcd::cmdEnable() // Update timing parameter before rendering frames pixelPump.updateTimings(displayTimings()); - pixelPump.start(); + + if (sys->bypassCaches()) { + schedule(virtRefreshEvent, clockEdge()); + } else { + pixelPump.start(); + } } void HDLcd::cmdDisable() { pixelPump.stop(); + // Disable the virtual refresh event + if (virtRefreshEvent.scheduled()) { + assert(sys->bypassCaches()); + deschedule(virtRefreshEvent); + } dmaEngine->abortFrame(); } |