From: Jean Guyader Date: Wed, 9 Sep 2009 02:00:31 +0000 (+0100) Subject: Intel: when have focus check if the screen is still linear every 4 secondes. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d994987d9d83580715f49618bad190b62fb1849c;p=xenclient%2Fioemu-pq.git Intel: when have focus check if the screen is still linear every 4 secondes. --- diff --git a/master/intel b/master/intel index 4ccb27c..a8c462d 100644 --- a/master/intel +++ b/master/intel @@ -33,7 +33,7 @@ index 97214c0..8c9b09b 100644 +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 @@ @@ -44,7 +44,7 @@ index d98a458..22501ed 100644 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; } @@ -215,10 +215,10 @@ index 90bd544..a2b8744 100644 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 +#include +#include @@ -231,6 +231,7 @@ index 0000000..4ad22a8 +#include + +#include "qemu-common.h" ++#include "qemu-timer.h" +#include "console.h" +#include "sysemu.h" + @@ -271,6 +272,7 @@ index 0000000..4ad22a8 +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); @@ -293,15 +295,6 @@ index 0000000..4ad22a8 + 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) @@ -593,6 +586,31 @@ index 0000000..4ad22a8 + 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) @@ -609,6 +627,7 @@ index 0000000..4ad22a8 + } + 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);