xf86-video-ati: Branch 'master' - 3 commits

Alex Deucher agd5f at kemper.freedesktop.org
Thu Feb 25 18:17:25 PST 2010


 man/radeon.man        |    8 ++++----
 src/drmmode_display.c |   20 +++++++++++++-------
 src/drmmode_display.h |    2 +-
 src/radeon.h          |    3 +--
 src/radeon_driver.c   |   39 ++++++++++++---------------------------
 src/radeon_kms.c      |   18 +-----------------
 src/radeon_probe.c    |    8 ++------
 7 files changed, 34 insertions(+), 64 deletions(-)

New commits:
commit b499eee7506f7478649e0000e9f8fcd00ac9d88d
Author: James Le Cuirot <chewi at aura-online.co.uk>
Date:   Thu Feb 25 21:13:18 2010 -0500

    clean up kms zaphod handling
    
    Taken from James patch on bug 24523
    
    agd5f: adapt to the current code

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ed3d927..7fd5725 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -899,9 +899,16 @@ 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 ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) {
-		if (!RADEONZaphodStringMatches(pScrn, s, name))
-		    goto out_free_encoders;
+	if (xf86IsEntityShared(pScrn->entityList[0])) {
+		if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) {
+			if (!RADEONZaphodStringMatches(pScrn, s, name))
+				goto out_free_encoders;
+		} else {
+			if (info->IsPrimary && (num != 0))
+				goto out_free_encoders;
+			else if (info->IsSecondary && (num != 1))
+				goto out_free_encoders;
+		}
 	}
 
 	output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name);
@@ -1143,7 +1150,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);
@@ -1178,12 +1185,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 & 0xf) & (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 >> 4) & 0xf) & (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 b4e1759..427004e 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -367,10 +367,8 @@ 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 };
-    const char *s;
 
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
 		   "RADEONPreInit_KMS\n");
@@ -427,20 +425,6 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
     if (!radeon_alloc_dri(pScrn))
 	return FALSE;
 
-    /* crtc low bits - output high bits */
-    zaphod_mask = 0xff;
-    if (info->IsPrimary) {
-	if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS)))
-	    zaphod_mask = 0xfd;
-	else
-	    zaphod_mask = 0xdd;
-    }
-    if (info->IsSecondary) {
-	if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS)))
-	    zaphod_mask = 0xf2;
-	else
-	    zaphod_mask = 0x22;
-    }
     info->allowColorTiling = xf86ReturnOptValBool(info->Options,
                                         OPTION_COLOR_TILING, FALSE);
     if (info->ChipFamily >= CHIP_FAMILY_R600) {
@@ -451,7 +435,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;
commit 433c8617341f5768255826435a2b09afba684f02
Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Thu Feb 25 21:03:13 2010 -0500

    update ZaphodHeads option
    
    Now that the screen section mapping is fixed,
    Make the option per-instance and allow multiple
    outputs to be specified; e.g., DVI-0 and HDMI-0
    associated with instance 0 and LVDS and VGA-0
    associated with instance 1.

diff --git a/man/radeon.man b/man/radeon.man
index ca8ce60..05b7d16 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -616,14 +616,14 @@ The default is
 .B on with > 32MB VRAM, off with < 32MB.
 .TP
 .BI "Option \*qZaphodHeads\*q \*q" string \*q
-Specify the randr outputs to use with zaphod mode. If you do not specify
-an outputs, the driver will pick them automatically.
+Specify the randr output(s) to use with zaphod mode for a particular driver
+instance.  If you use this option you most use this option for all instances
+of the driver.
 .br
 For example:
 .B
 Option \*qZaphodHeads\*q \*qLVDS,VGA-0\*q
-will assign xrandr output LVDS to the first instance of the driver and
-VGA-0 to the second instance.
+will assign xrandr outputs LVDS and VGA-0 to this instance of the driver.
 
 .SH TEXTURED VIDEO ATTRIBUTES
 The driver supports the following X11 Xv attributes for Textured Video.
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index bb219cf..ed3d927 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -900,7 +900,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
 	}
 
 	if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) {
-		if (!RADEONZaphodStringMatches(pScrn, info->IsPrimary, s, name))
+		if (!RADEONZaphodStringMatches(pScrn, s, name))
 		    goto out_free_encoders;
 	}
 
diff --git a/src/radeon.h b/src/radeon.h
index c0b5d7a..56695f9 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -1231,8 +1231,7 @@ extern void RADEONInitMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
 extern void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn,
 					 RADEONSavePtr restore);
 extern Bool
-RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary,
-			  const char *s, char *output_name);
+RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name);
 
 Bool RADEONGetRec(ScrnInfoPtr pScrn);
 void RADEONFreeRec(ScrnInfoPtr pScrn);
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 9a4cb9a..e11c5e9 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2788,18 +2788,18 @@ RADEONPreInitBIOS(ScrnInfoPtr pScrn, xf86Int10InfoPtr  pInt10)
 }
 
 Bool
-RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary,
-			  const char *s, char *output_name)
+RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)
 {
-    int i = 0, second = 0;
-    char s1[20], s2[20];
+    int i = 0;
+    char s1[20];
 
     do {
 	switch(*s) {
 	case ',':
 	    s1[i] = '\0';
 	    i = 0;
-	    second = 1;
+	    if (strcmp(s1, output_name) == 0)
+		return TRUE;
 	    break;
 	case ' ':
 	case '\t':
@@ -2807,23 +2807,15 @@ RADEONZaphodStringMatches(ScrnInfoPtr pScrn, Bool is_primary,
 	case '\r':
 	    break;
 	default:
-	    if (second)
-		s2[i] = *s;
-	    else
-		s1[i] = *s;
+	    s1[i] = *s;
 	    i++;
 	    break;
 	}
     } while(*s++);
-    s2[i] = '\0';
 
-    if (is_primary) {
-	if (strcmp(s1, output_name) == 0)
-	    return TRUE;
-    } else {
-	if (strcmp(s2, output_name) == 0)
-	    return TRUE;
-    }
+    s1[i] = '\0';
+    if (strcmp(s1, output_name) == 0)
+	return TRUE;
 
     return FALSE;
 }
@@ -2832,20 +2824,13 @@ static void RADEONFixZaphodOutputs(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info = RADEONPTR(pScrn);
     xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
-    xf86OutputPtr output;
     int o;
     char *s;
 
     if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) {
-	for (o = 0; o < config->num_output; o++) {
-	    if (RADEONZaphodStringMatches(pScrn, info->IsPrimary, s, config->output[o]->name))
-		output = config->output[o];
-	}
-	while (config->num_output > 1) {
-	    if (config->output[0] != output)
-		xf86OutputDestroy(config->output[0]);
-	    else if (config->output[1] != output)
-		xf86OutputDestroy(config->output[1]);
+	for (o = config->num_output; o > 0; o--) {
+	    if (!RADEONZaphodStringMatches(pScrn, s, config->output[o - 1]->name))
+		xf86OutputDestroy(config->output[o - 1]);
 	}
     } else {
 	if (info->IsPrimary) {
commit f3e20b01c77f02bdf3483ceee27a1f00d240c33d
Author: James Le Cuirot <chewi at aura-online.co.uk>
Date:   Thu Feb 25 19:10:19 2010 -0500

    zaphod: Fix entity instance assignment.
    
    Each screen needs to have a pointer back to its
    device's entity instance, Currently Screen1 is
    pointing to Screen0's instance so when it comes
    to match up the screen sections with the detected
    screens, Screen0 gets chosen in both cases.
    
    See bug 24523

diff --git a/src/radeon_probe.c b/src/radeon_probe.c
index 42e7259..1429835 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;


More information about the xorg-commit mailing list