summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2012-06-11 17:09:09 +0300
committerAlon Levy <alevy@redhat.com>2012-06-11 17:09:09 +0300
commit426b8209a3aa82740c40486c40892313b17f4913 (patch)
tree3d02fc2cef52c05a94fd6e11eb6c717f491b44bc
parent352d5508d6f04ef8f851326015354fba067d5e63 (diff)
wip - split
-rw-r--r--src/qxl_driver.c140
1 files changed, 90 insertions, 50 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index d18b8a6..926ad96 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -71,7 +71,7 @@ const OptionInfoRec DefaultOptions[] = {
{ OPTION_ENABLE_SURFACES,
"EnableSurfaces", OPTV_BOOLEAN, { 0 }, TRUE },
{ OPTION_NUM_HEADS,
- "NumHeads", OPTV_INTEGER, { 1 }, FALSE },
+ "NumHeads", OPTV_INTEGER, { 4 }, FALSE },
#ifdef XSPICE
{ OPTION_SPICE_PORT,
"SpicePort", OPTV_INTEGER, {5900}, FALSE },
@@ -644,8 +644,9 @@ qxl_reset_and_create_mem_slots (qxl_screen_t *qxl)
qxl->main_mem_slot = setup_slot(qxl, 0,
(unsigned long)qxl->ram_physical,
(unsigned long)qxl->ram_physical + (unsigned long)qxl->rom->num_pages * getpagesize(),
- (uint64_t)(uintptr_t)qxl->ram,
- (uint64_t)(uintptr_t)qxl->ram + (unsigned long)qxl->rom->num_pages * getpagesize()
+ (uint64_t)(uintptr_t)qxl->ram + qxl->surface0_size,
+ (uint64_t)(uintptr_t)qxl->ram + qxl->surface0_size +
+ (unsigned long)qxl->rom->num_pages * getpagesize()
);
qxl->vram_mem_slot = setup_slot(qxl, 1,
(unsigned long)qxl->vram_physical,
@@ -863,6 +864,57 @@ enum ROPDescriptor
ROPD_INVERS_RES = (1 <<10),
};
+static void
+qxl_update_monitors_config(qxl_screen_t *qxl)
+{
+ int i;
+ QXLHead *head;
+ xf86CrtcPtr crtc;
+ QXLRam *ram = get_ram_header(qxl);
+
+ qxl->monitors_config->count = qxl->num_heads;
+ for (i = 0 ; i < qxl->num_heads; ++i) {
+ head = &qxl->monitors_config->heads[i];
+ crtc = qxl->crtcs[i];
+ head->id = i;
+ head->surface_id = 0;
+ if (!crtc->enabled) {
+ head->width = head->height = head->x = head->y = 0;
+ head->height = 0;
+ } else {
+ head->width = crtc->mode.CrtcHDisplay;
+ head->height = crtc->mode.CrtcVDisplay;
+ head->x = crtc->x;
+ head->y = crtc->y;
+ }
+ }
+ /* initialize when actually used, memslots should be initialized by now */
+ if (ram->monitors_config == 0) {
+ ram->monitors_config = physical_address (qxl, qxl->monitors_config,
+ qxl->main_mem_slot);
+ }
+ qxl_io_monitors_config_async(qxl);
+}
+
+static Bool
+qxl_create_desired_modes(qxl_screen_t *qxl)
+{
+ int i;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(qxl->pScrn);
+
+ for (i = 0 ; i < config->num_crtc; ++i) {
+ xf86CrtcPtr crtc = config->crtc[i];
+ if (!crtc->enabled) {
+ continue;
+ }
+ if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation,
+ crtc->desiredX, crtc->desiredY))
+ return FALSE;
+ }
+ qxl_update_monitors_config(qxl);
+ return TRUE;
+}
+
static Bool
qxl_create_screen_resources(ScreenPtr pScreen)
{
@@ -887,7 +939,9 @@ qxl_create_screen_resources(ScreenPtr pScreen)
qxl_surface_kill (surf);
set_surface (pPixmap, qxl->primary);
-
+
+ qxl_create_desired_modes(qxl);
+
return TRUE;
}
@@ -1382,6 +1436,8 @@ qxl_enter_vt(int scrnIndex, int flags)
qxl->vt_surfaces = NULL;
}
+ qxl_create_desired_modes(qxl);
+
pScrn->EnableDisableFBAccess (scrnIndex, TRUE);
return TRUE;
@@ -1491,44 +1547,6 @@ qxl_check_device(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
}
#endif /* !XSPICE */
-static void
-qxl_update_monitors_config(qxl_screen_t *qxl)
-{
- int i;
- QXLHead *head;
- xf86CrtcPtr crtc;
-
- qxl->monitors_config->count = qxl->num_heads;
- for (i = 0 ; i < qxl->num_heads; ++i) {
- head = &qxl->monitors_config->heads[i];
- crtc = qxl->crtcs[i];
- head->id = i;
- head->surface_id = 0;
- if (!crtc->enabled) {
- head->width = head->height = head->x = head->y = 0;
- head->height = 0;
- } else {
- head->width = crtc->mode.CrtcHDisplay;
- head->height = crtc->mode.CrtcVDisplay;
- head->x = crtc->x;
- head->y = crtc->y;
- }
- }
-}
-
-static void
-qxl_send_monitors_config(qxl_screen_t *qxl)
-{
- QXLRam *ram = get_ram_header(qxl);
-
- /* initialize when actually used, memslots should be initialized by now */
- if (ram->monitors_config == NULL) {
- ram->monitors_config = physical_address (qxl, qxl->monitors_config,
- qxl->main_mem_slot);
- }
- qxl_io_monitors_config_async(qxl);
-}
-
static DisplayModePtr qxl_add_mode(qxl_screen_t *qxl, ScrnInfoPtr pScrn,
int width, int height, int type)
{
@@ -1634,10 +1652,13 @@ 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_update_monitors_config(qxl);
- qxl_send_monitors_config(qxl);
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,5,99,0,0)
+ crtc->transformPresent = FALSE;
+#endif
return TRUE;
}
@@ -1680,6 +1701,24 @@ qxl_crtc_destroy (xf86CrtcPtr crtc)
xf86DrvMsg(qxl->pScrn->scrnIndex, X_INFO, "%s\n", __func__);
}
+static Bool
+qxl_crtc_lock (xf86CrtcPtr crtc)
+{
+ qxl_screen_t *qxl = crtc->driver_private;
+
+ xf86DrvMsg(qxl->pScrn->scrnIndex, X_INFO, "%s\n", __func__);
+ return TRUE;
+}
+
+static void
+qxl_crtc_unlock (xf86CrtcPtr crtc)
+{
+ qxl_screen_t *qxl = crtc->driver_private;
+
+ xf86DrvMsg(qxl->pScrn->scrnIndex, X_INFO, "%s\n", __func__);
+ qxl_update_monitors_config(qxl);
+}
+
static const xf86CrtcFuncsRec qxl_crtc_funcs = {
.dpms = qxl_crtc_dpms,
.set_mode_major = qxl_crtc_set_mode_major,
@@ -1688,6 +1727,8 @@ static const xf86CrtcFuncsRec qxl_crtc_funcs = {
.show_cursor = qxl_crtc_show_cursor,
.hide_cursor = qxl_crtc_hide_cursor,
.load_cursor_argb = qxl_crtc_load_cursor_argb,
+ .lock = qxl_crtc_lock,
+ .unlock = qxl_crtc_unlock,
.gamma_set = qxl_crtc_gamma_set,
.destroy = qxl_crtc_destroy,
@@ -1763,14 +1804,13 @@ qxl_init_randr(ScrnInfoPtr pScrn, qxl_screen_t *qxl)
qxl_output->qxl = qxl;
}
- // TODO: resizable primary surface.
- qxl->virtual_x = maxWidth;
- qxl->virtual_y = maxHeight;
+ qxl->virtual_x = 1024;
+ qxl->virtual_y = 768;
pScrn->display->virtualX = qxl->virtual_x;
pScrn->display->virtualY = qxl->virtual_y;
- xf86InitialConfiguration(pScrn, FALSE /* no growing of virtualX/virtualY, TODO */);
+ xf86InitialConfiguration(pScrn, TRUE);
}
static void