+void intel_display_init(DisplayState *ds);
#endif
diff --git a/dom0_driver.c b/dom0_driver.c
-index d98a458..22501ed 100644
+index 0988c6f..1aa5952 100644
--- a/dom0_driver.c
+++ b/dom0_driver.c
@@ -43,6 +43,7 @@
static void dom0_driver_state_change(const char *path, void *opaque);
static void dom0_driver_command(const char *path, void *opaque);
-@@ -682,6 +683,11 @@ void dom0_driver_init(const char *position)
+@@ -692,6 +693,11 @@ void dom0_driver_init(const char *position)
driver.enter = intel_enter;
driver.leave = intel_leave;
}
vga_update_display(s);
diff --git a/intel.c b/intel.c
new file mode 100644
-index 0000000..4ad22a8
+index 0000000..85968cb
--- /dev/null
+++ b/intel.c
-@@ -0,0 +1,489 @@
+@@ -0,0 +1,508 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <pci/pci.h>
+
+#include "qemu-common.h"
++#include "qemu-timer.h"
+#include "console.h"
+#include "sysemu.h"
+
+static uint32_t intel_fb_base, intel_mmio_base;
+static uint32_t map_s, map_d, map_size;
+static int refresh;
++static QEMUTimer *check_linear_timer = NULL;
+
+static void set_data_pointer(DisplaySurface *surf);
+static void intel_resize(DisplayState *ds);
+ return intel_get_reg(REG_DR_DSPBSURF);
+}
+
-+static inline int is_linear(void)
-+{
-+ unsigned int *dspacntr = (unsigned int *)(intel_mmio + REG_DR_DSPACNTR);
-+ if (((*dspacntr) & (1 << 10)) == 0)
-+ return 1;
-+ else
-+ return 0;
-+}
-+
+static inline void intel_get_res(unsigned int *x,
+ unsigned int *y,
+ unsigned int *pitch)
+ return intel_have_focus;
+}
+
++static inline int is_linear(void)
++{
++ if (surfaenabled())
++ return (intel_get_reg(REG_DR_DSPACNTR) & (1 << 10)) == 0;
++ else
++ return (intel_get_reg(REG_DR_DSPBCNTR) & (1 << 10)) == 0;
++}
++
++static void intel_check_linear(void)
++{
++ if (!check_linear_timer)
++ check_linear_timer = qemu_new_timer(rt_clock, intel_check_linear, NULL);
++
++ if (!is_linear())
++ {
++ intel_force_linear(0);
++ vga_hw_invalidate();
++ vga_hw_update();
++ }
++
++ if (intel_have_focus)
++ qemu_mod_timer(check_linear_timer,
++ qemu_get_clock(rt_clock) + 4000);
++}
++
+static void intel_focus(int focus)
+{
+ if (intel_have_focus == focus)
+ }
+ vga_hw_invalidate();
+ vga_hw_update();
++ intel_check_linear();
+
+ INTEL_DEBUG("intel_focus %d, x=%d, y=%d, stride=%d\n",
+ focus, IntelX, IntelY, IntelPitch);