From 568550e22ca0e011d9a926dbee3376290e6615f7 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 20 Feb 2010 13:08:55 +0000 Subject: [PATCH] radeon: reworked zaphod mode The previous zaphod mode implementation didn't work for me. This may have been due to the first entity instance being assigned to the second screen. This fixes that problem and makes zaphod mode work using the regular syntax instead of a special driver option. --- src/drmmode_display.c | 11 +++++++---- src/drmmode_display.h | 2 +- src/radeon_kms.c | 9 +-------- src/radeon_probe.c | 8 ++------ 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index b7a6218..4759d61 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -897,6 +897,10 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1); } + if (xf86IsEntityShared(pScrn->entityList[0]) && strcmp(name, pScrn->monitor->id)) { + goto out_free_encoders; + } + output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name); if (!output) { goto out_free_encoders; @@ -1136,7 +1140,7 @@ static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = { }; -Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, char *busId, char *driver_name, int cpp, int zaphod_mask) +Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, char *busId, char *driver_name, int cpp) { xf86CrtcConfigPtr xf86_config; RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); @@ -1171,12 +1175,11 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, char *busId, char xf86CrtcSetSizeRange(pScrn, 320, 200, drmmode->mode_res->max_width, drmmode->mode_res->max_height); for (i = 0; i < drmmode->mode_res->count_crtcs; i++) - if (zaphod_mask & (1 << i)) + if (!xf86IsEntityShared(pScrn->entityList[0]) || pScrn->confScreen->device->screen == i) drmmode_crtc_init(pScrn, drmmode, i); for (i = 0; i < drmmode->mode_res->count_connectors; i++) - if (zaphod_mask & (1 << i)) - drmmode_output_init(pScrn, drmmode, i); + drmmode_output_init(pScrn, drmmode, i); /* workout clones */ drmmode_clones_init(pScrn, drmmode); diff --git a/src/drmmode_display.h b/src/drmmode_display.h index 371ad18..1576d49 100644 --- a/src/drmmode_display.h +++ b/src/drmmode_display.h @@ -74,7 +74,7 @@ typedef struct { } drmmode_output_private_rec, *drmmode_output_private_ptr; -extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, char *busId, char *driver_name, int cpp, int zaphod_mask); +extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, char *busId, char *driver_name, int cpp); extern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr); extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, struct radeon_bo *bo); void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y, int flags); diff --git a/src/radeon_kms.c b/src/radeon_kms.c index e9e5b5d..93662c4 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -366,7 +366,6 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) RADEONInfoPtr info; RADEONEntPtr pRADEONEnt; DevUnion* pPriv; - int zaphod_mask = 0; char *bus_id; Gamma zeros = { 0.0, 0.0, 0.0 }; @@ -425,12 +424,6 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) if (!radeon_alloc_dri(pScrn)) return FALSE; - zaphod_mask = 0xf; - if (info->IsPrimary) - zaphod_mask = 0xd; - if (info->IsSecondary) - zaphod_mask = 0x2; - info->allowColorTiling = xf86ReturnOptValBool(info->Options, OPTION_COLOR_TILING, FALSE); if (info->ChipFamily >= CHIP_FAMILY_R600) { @@ -441,7 +434,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) "KMS Color Tiling: %sabled\n", info->allowColorTiling ? "en" : "dis"); bus_id = DRICreatePCIBusID(info->PciInfo); - if (drmmode_pre_init(pScrn, &info->drmmode, bus_id, "radeon", pScrn->bitsPerPixel / 8, zaphod_mask) == FALSE) { + if (drmmode_pre_init(pScrn, &info->drmmode, bus_id, "radeon", pScrn->bitsPerPixel / 8) == FALSE) { xfree(bus_id); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Kernel modesetting setup failed\n"); goto fail; diff --git a/src/radeon_probe.c b/src/radeon_probe.c index 42e7259..c8350f5 100644 --- a/src/radeon_probe.c +++ b/src/radeon_probe.c @@ -183,13 +183,9 @@ radeon_get_scrninfo(int entity_num, void *pci_dev) pPriv = xf86GetEntityPrivate(pEnt->index, gRADEONEntityIndex); - if (!pPriv->ptr) { - int j; - int instance = xf86GetNumEntityInstances(pEnt->index); - - for (j = 0; j < instance; j++) - xf86SetEntityInstanceForScreen(pScrn, pEnt->index, j); + xf86SetEntityInstanceForScreen(pScrn, pEnt->index, xf86GetNumEntityInstances(pEnt->index) - 1); + if (!pPriv->ptr) { pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1); pRADEONEnt = pPriv->ptr; pRADEONEnt->HasSecondary = FALSE; -- 1.6.6.1