summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2012-06-27 14:33:46 +0300
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-07-15 19:21:33 +0200
commite6bfdd035f3692b712496069b9361d010526802a (patch)
tree8e00a39799621fd48907d78abdb30c53a3e0a924 /src
parentf106ea65cde61c8f3cf5819d8c127fb7912ec067 (diff)
qxl_driver: introduce qxl_crtc, crtc private
Additionally prevents disabling of the primary crtc.
Diffstat (limited to 'src')
-rw-r--r--src/qxl.h6
-rw-r--r--src/qxl_driver.c25
2 files changed, 26 insertions, 5 deletions
diff --git a/src/qxl.h b/src/qxl.h
index 6c97f1f..44c9b47 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -266,6 +266,12 @@ typedef struct qxl_output_private {
int head;
} qxl_output_private;
+typedef struct qxl_crtc_private {
+ qxl_screen_t *qxl;
+ int head;
+ xf86OutputPtr output;
+} qxl_crtc_private;
+
static inline uint64_t
physical_address (qxl_screen_t *qxl, void *virtual, uint8_t slot_id)
{
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 280aa70..e1cd097 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1654,7 +1654,14 @@ static Bool
qxl_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
Rotation rotation, int x, int y)
{
- qxl_screen_t *qxl = crtc->driver_private;
+ qxl_crtc_private *crtc_private = crtc->driver_private;
+ qxl_screen_t *qxl = crtc_private->qxl;
+
+ if (crtc == qxl->crtcs[0] && mode == NULL) {
+ /* disallow disabling of monitor 0 mode */
+ ErrorF ("%s: not allowing crtc 0 disablement\n", __func__);
+ return FALSE;
+ }
crtc->mode = *mode;
crtc->x = x;
@@ -1701,7 +1708,8 @@ qxl_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
static void
qxl_crtc_destroy (xf86CrtcPtr crtc)
{
- qxl_screen_t *qxl = crtc->driver_private;
+ qxl_crtc_private *crtc_private = crtc->driver_private;
+ qxl_screen_t *qxl = crtc_private->qxl;
xf86DrvMsg(qxl->pScrn->scrnIndex, X_INFO, "%s\n", __func__);
}
@@ -1709,7 +1717,8 @@ qxl_crtc_destroy (xf86CrtcPtr crtc)
static Bool
qxl_crtc_lock (xf86CrtcPtr crtc)
{
- qxl_screen_t *qxl = crtc->driver_private;
+ qxl_crtc_private *crtc_private = crtc->driver_private;
+ qxl_screen_t *qxl = crtc_private->qxl;
xf86DrvMsg(qxl->pScrn->scrnIndex, X_INFO, "%s\n", __func__);
return TRUE;
@@ -1718,7 +1727,8 @@ qxl_crtc_lock (xf86CrtcPtr crtc)
static void
qxl_crtc_unlock (xf86CrtcPtr crtc)
{
- qxl_screen_t *qxl = crtc->driver_private;
+ qxl_crtc_private *crtc_private = crtc->driver_private;
+ qxl_screen_t *qxl = crtc_private->qxl;
xf86DrvMsg(qxl->pScrn->scrnIndex, X_INFO, "%s\n", __func__);
qxl_update_monitors_config(qxl);
@@ -1762,6 +1772,7 @@ qxl_init_randr(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
{
char name[32];
qxl_output_private *qxl_output;
+ qxl_crtc_private *qxl_crtc;
int i;
xf86OutputPtr output;
int maxWidth;
@@ -1795,7 +1806,10 @@ qxl_init_randr(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "failed to create Crtc %d",
i);
}
- qxl->crtcs[i]->driver_private = qxl;
+ qxl_crtc = xnfcalloc(sizeof(qxl_crtc_private), 1);
+ qxl->crtcs[i]->driver_private = qxl_crtc;
+ qxl_crtc->head = i;
+ qxl_crtc->qxl = qxl;
snprintf(name, sizeof(name), "qxl-%d", i);
qxl->outputs[i] = output = xf86OutputCreate(pScrn, &qxl_output_funcs, name);
if (!output) {
@@ -1808,6 +1822,7 @@ qxl_init_randr(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
output->driver_private = qxl_output;
qxl_output->head = i;
qxl_output->qxl = qxl;
+ qxl_crtc->output = output;
}
qxl->virtual_x = 1024;