summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-10-15 20:24:05 +0200
committerHans de Goede <hdegoede@redhat.com>2010-10-15 20:24:30 +0200
commit9bc132a575b824f34136aeacc24444dba66615a4 (patch)
treeeee9b7df20e8bd1998a88794e803afad4032bde7
parentb161637c5c842aa2559cbb38676f5afc98747de2 (diff)
Don't access the qxl device when our vt is not focussed
Trying to do so causes the X-server to segfault as it has dropped iopl permission, which is, erm, undesirable :)
-rw-r--r--src/qxl.h10
-rw-r--r--src/qxl_cursor.c2
-rw-r--r--src/qxl_driver.c21
-rw-r--r--src/qxl_surface.c8
4 files changed, 8 insertions, 33 deletions
diff --git a/src/qxl.h b/src/qxl.h
index 7ac8ec4..20094c6 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -699,16 +699,6 @@ struct _qxl_screen_t
} u;
};
-static inline Bool
-in_vga_mode (qxl_screen_t *qxl)
-{
- /* FIXME: The ability to detect whether we are in VGA
- * mode has been remvoed in newer devices.
- */
-
- return FALSE;
-}
-
static uint64_t
physical_address (qxl_screen_t *qxl, void *virtual, uint8_t slot_id)
{
diff --git a/src/qxl_cursor.c b/src/qxl_cursor.c
index 475796e..9e0bea8 100644
--- a/src/qxl_cursor.c
+++ b/src/qxl_cursor.c
@@ -30,7 +30,7 @@ push_cursor (qxl_screen_t *qxl, struct qxl_cursor_cmd *cursor)
struct qxl_command cmd;
/* See comment on push_command() in qxl_driver.c */
- if (!in_vga_mode (qxl))
+ if (qxl->pScrn->vtSema)
{
cmd.type = QXL_CMD_CURSOR;
cmd.data = physical_address (qxl, cursor, qxl->main_mem_slot);
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 853d552..1f6ae57 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -480,7 +480,7 @@ push_drawable (qxl_screen_t *qxl, struct qxl_drawable *drawable)
* the next time a mode set set, an assertion in the
* device will take down the entire virtual machine.
*/
- if (!in_vga_mode (qxl))
+ if (qxl->pScrn->vtSema)
{
cmd.type = QXL_CMD_DRAW;
cmd.data = physical_address (qxl, drawable, qxl->main_mem_slot);
@@ -622,25 +622,6 @@ paint_shadow (qxl_screen_t *qxl)
submit_copy (qxl, &qrect);
}
-static void
-qxl_sanity_check (qxl_screen_t *qxl)
-{
- /* read the mode back from the rom */
- if (!qxl->rom || !qxl->pScrn)
- return;
-
- if (in_vga_mode (qxl))
- {
- ErrorF("QXL device jumped back to VGA mode - resetting mode\n");
- qxl_switch_mode(qxl->pScrn->scrnIndex, qxl->pScrn->currentMode, 0);
- }
-}
-
-static void
-qxl_wakeup_handler (pointer data, int i, pointer LastSelectMask)
-{
-}
-
static Bool
qxl_create_screen_resources(ScreenPtr pScreen)
{
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 65d259a..e797fbb 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -202,7 +202,7 @@ push_surface_cmd (qxl_screen_t *qxl, struct qxl_surface_cmd *cmd)
{
struct qxl_command command;
- if (!in_vga_mode (qxl))
+ if (qxl->pScrn->vtSema)
{
command.type = QXL_CMD_SURFACE;
command.data = physical_address (qxl, cmd, qxl->main_mem_slot);
@@ -281,7 +281,7 @@ push_drawable (qxl_screen_t *qxl, struct qxl_drawable *drawable)
* the next time a mode set set, an assertion in the
* device will take down the entire virtual machine.
*/
- if (!in_vga_mode (qxl))
+ if (qxl->pScrn->vtSema)
{
cmd.type = QXL_CMD_DRAW;
cmd.data = physical_address (qxl, drawable, qxl->main_mem_slot);
@@ -636,9 +636,13 @@ qxl_surface_prepare_access (qxl_surface_t *surface,
int n_boxes;
BoxPtr boxes;
ScreenPtr pScreen = pixmap->drawable.pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
RegionRec new;
int stride, height;
+ if (!pScrn->vtSema)
+ return FALSE;
+
REGION_INIT (NULL, &new, (BoxPtr)NULL, 0);
REGION_SUBTRACT (NULL, &new, region, &surface->access_region);