[Spice-commits] 2 commits - xddm/display xddm/miniport
Sandy Stutsman
sstuts at kemper.freedesktop.org
Mon Sep 21 10:56:58 PDT 2015
xddm/display/quic.c | 2 --
xddm/display/utils.h | 4 +---
xddm/miniport/qxl.c | 15 +++++++++++----
3 files changed, 12 insertions(+), 9 deletions(-)
New commits:
commit 7ee27e89c7c1602f51cfd3761cc8b9b87aa5b50d
Author: Sandy Stutsman <sstutsma at redhat.com>
Date: Thu Sep 17 17:12:50 2015 -0400
Do not allow duplicate IDs in video mode info buffer.
Modes are returned in a buffer from qemu with IDs in increasing but not
necessarily consecutive order. (Some modes may be omitted if they don't fit
into the framebuffer.) Two custom modes are appended to the local buffer to
support arbitrary resolutions. The first custom id must be set to +1 of the
last id in the mode buffer, not to the last index +1 of the buffer.
E.G. these are the last entries in the mode buffer returned from QEMU:
Index Mode id (unfortunately named ModeIndex in the struct)
...
124 128
125 130
126 132
127 134 (last mode returned from QEMU)
Custom Modes:
128 135 (Not 128!)
129 136
If the first custom mode id is set to 128 (the number of modes returned
from QEMU), it will duplicate the id for the mode at index 124. That could
cause the FindMode function which searches the mode list by mode id
to return the wrong mode information.
The custom mode id's are now set to be greater than the last mode id
returned from QEMU.
The last argument in the FillVidModeInfo is replaced with the actual mode
id rather than the index. This does nothing more than replace the mode id
with itself.
This addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1202424
---
Updated the comments
---
diff --git a/xddm/miniport/qxl.c b/xddm/miniport/qxl.c
index e0fb87f..22537e2 100644
--- a/xddm/miniport/qxl.c
+++ b/xddm/miniport/qxl.c
@@ -596,6 +596,7 @@ VP_STATUS InitModes(QXLExtension *dev)
ULONG n_modes;
ULONG i;
VP_STATUS error;
+ ULONG custom_mode_id = 0;
PAGED_CODE();
DEBUG_PRINT((dev, 0, "%s\n", __FUNCTION__));
@@ -632,6 +633,11 @@ VP_STATUS InitModes(QXLExtension *dev)
return error;
}
}
+ /* Mode ids are increasing in the buffer but may not be consecutive,
+ * so set the first custom id to be 1 larger than the last id in the buffer.
+ * (ModeIndex isn't really an index, it is an ID).
+ */
+ custom_mode_id = modes->modes[modes->n_modes-1].id + 1;
/* 2 dummy modes for custom display resolution */
/* This is necessary to bypass Windows mode index check, that
@@ -640,7 +646,7 @@ VP_STATUS InitModes(QXLExtension *dev)
for (i = dev->custom_mode; i <= dev->custom_mode + 1; ++i) {
memcpy(&modes_info[i], &modes_info[0], sizeof(VIDEO_MODE_INFORMATION));
- modes_info[i].ModeIndex = i;
+ modes_info[i].ModeIndex = custom_mode_id++;
}
dev->n_modes = n_modes;
@@ -1002,6 +1008,7 @@ static VP_STATUS SetCustomDisplay(QXLExtension *dev_ext, QXLEscapeSetCustomDispl
uint32_t xres = custom_display->xres;
uint32_t yres = custom_display->yres;
uint32_t bpp = custom_display->bpp;
+ PVIDEO_MODE_INFORMATION pMode;
/* alternate custom mode index */
if (dev_ext->custom_mode == (dev_ext->n_modes - 1))
@@ -1014,11 +1021,11 @@ static VP_STATUS SetCustomDisplay(QXLExtension *dev_ext, QXLEscapeSetCustomDispl
__FUNCTION__, xres, yres, bpp, dev_ext->rom->surface0_area_size));
return ERROR_NOT_ENOUGH_MEMORY;
}
-
- ret = FillVidModeInfo(&dev_ext->modes[dev_ext->custom_mode],
+ pMode = &dev_ext->modes[dev_ext->custom_mode];
+ ret = FillVidModeInfo(pMode,
custom_display->xres, custom_display->yres,
custom_display->bpp,
- dev_ext->custom_mode);
+ pMode->ModeIndex);
DEBUG_PRINT((dev_ext, 0, "%s: Returning %d\n", __FUNCTION__, ret));
return ret;
}
commit 31a59216065709e0fdf8713e5b2a3ce0496b950a
Author: Sandy Stutsman <sstutsma at redhat.com>
Date: Wed Sep 16 13:06:02 2015 -0400
Remove redundant macro definitions.
A change to spice-procotol adds spice/macros.h to the qxl build. This
causes a few macros to be redefined, resulting in warnings that break the
build.
Explicitly including the spice/macros.h file in place of the
redundant macros fixes the warnings.
diff --git a/xddm/display/quic.c b/xddm/display/quic.c
index ee12fab..504c719 100644
--- a/xddm/display/quic.c
+++ b/xddm/display/quic.c
@@ -60,8 +60,6 @@
#define QUIC_VERSION_MINOR 1U
#define QUIC_VERSION ((QUIC_VERSION_MAJOR << 16) | (QUIC_VERSION_MAJOR & 0xffff))
-#define ABS(a) ((a) >= 0 ? (a) : -(a))
-
#ifdef ASSERT
#undef ASSERT
#endif
diff --git a/xddm/display/utils.h b/xddm/display/utils.h
index a8d0de6..d5283c5 100644
--- a/xddm/display/utils.h
+++ b/xddm/display/utils.h
@@ -21,9 +21,7 @@
#ifndef _H_UTILS
#define _H_UTILS
-
-#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
-#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
+#include <spice/macros.h>
#define ALIGN(a, b) (((a) + ((b) - 1)) & ~((b) - 1))
More information about the Spice-commits
mailing list