summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-07-06 08:02:21 -0400
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-07-15 19:24:30 +0200
commit6ee541636b6ed6846074afeb1c32d9e8e6a9bdda (patch)
treee97bd93fd3c9e0ac31fd8b17a9ab397b37118cc3 /src
parent7f8d3ed05cbe8914910e49b49ec44df15562bd16 (diff)
Add check_crtc() helper, to catch crtc/monitor config errors
Diffstat (limited to 'src')
-rw-r--r--src/qxl_driver.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index e621501..5b70c96 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -58,10 +58,13 @@
extern void compat_init_scrn(ScrnInfoPtr);
-#if 0
+#ifdef WITH_CHECK_POINT
#define CHECK_POINT() ErrorF("%s: %d (%s)\n", __FILE__, __LINE__, __FUNCTION__);
-#endif
+#else
#define CHECK_POINT()
+#endif
+
+#define BREAKPOINT() do{ __asm__ __volatile__ ("int $03"); } while(0)
const OptionInfoRec DefaultOptions[] = {
{ OPTION_ENABLE_IMAGE_CACHE,
@@ -930,6 +933,30 @@ enum ROPDescriptor {
ROPD_INVERS_RES = (1 <<10),
};
+static int
+check_crtc(qxl_screen_t *qxl)
+{
+ int i, count = 0;
+ xf86CrtcPtr crtc;
+
+ for (i = 0 ; i < qxl->num_heads; ++i) {
+ crtc = qxl->crtcs[i];
+ if (!crtc->enabled || crtc->mode.CrtcHDisplay == 0 ||
+ crtc->mode.CrtcVDisplay == 0)
+ continue;
+ count++;
+ }
+
+#if 0
+ if (count == 0) {
+ ErrorF("check crtc failed, count == 0!!\n");
+ BREAKPOINT();
+ }
+#endif
+
+ return count;
+}
+
static void
qxl_update_monitors_config(qxl_screen_t *qxl)
{
@@ -938,6 +965,8 @@ qxl_update_monitors_config(qxl_screen_t *qxl)
xf86CrtcPtr crtc;
QXLRam *ram = get_ram_header(qxl);
+ check_crtc(qxl);
+
qxl->monitors_config->count = 0;
qxl->monitors_config->max_allowed = qxl->num_heads;
for (i = 0 ; i < qxl->num_heads; ++i) {
@@ -1914,6 +1943,8 @@ qxl_init_randr(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
pScrn->display->virtualY = qxl->virtual_y;
xf86InitialConfiguration(pScrn, TRUE);
+ /* all crtcs are enabled here, but their mode is 0,
+ resulting monitor config empty atm */
}
static void