xserver: Branch 'master' - 4 commits

Adam Jackson ajax at kemper.freedesktop.org
Thu Dec 13 12:44:02 PST 2007


 hw/xfree86/common/xf86Mode.c |   48 +----------------------------
 hw/xfree86/common/xf86str.h  |    1 
 hw/xfree86/modes/xf86Modes.c |   69 +++++++++++++++++++++++++++++--------------
 hw/xfree86/modes/xf86Modes.h |    5 +++
 4 files changed, 56 insertions(+), 67 deletions(-)

New commits:
commit efcdc0d7010f4e6ec833842cb010a07068edf7ab
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Dec 13 15:38:41 2007 -0500

    Correct the documentation comments in xf86Modes.c
    
    Most of those functions do not, in fact, work with circular mode lists,
    and by this point the API isn't really "proposed" anymore.

diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 3febd37..3d222cc 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -339,12 +339,10 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
 /**
  * Marks as bad any modes with unsupported flags.
  *
- * \param modeList doubly-linked or circular list of modes.
+ * \param modeList doubly-linked list of modes.
  * \param flags flags supported by the driver.
  *
  * \bug only V_INTERLACE and V_DBLSCAN are supported.  Is that enough?
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
  */
 _X_EXPORT void
 xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -363,9 +361,7 @@ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 /**
  * Marks as bad any modes extending beyond the given max X, Y, or pitch.
  *
- * \param modeList doubly-linked or circular list of modes.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
+ * \param modeList doubly-linked list of modes.
  */
 _X_EXPORT void
 xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -392,9 +388,7 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
  * Marks as bad any modes that aren't supported by the given monitor's
  * hsync and vrefresh ranges.
  *
- * \param modeList doubly-linked or circular list of modes.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
+ * \param modeList doubly-linked list of modes.
  */
 _X_EXPORT void
 xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -436,12 +430,10 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 /**
  * Marks as bad any modes extending beyond outside of the given clock ranges.
  *
- * \param modeList doubly-linked or circular list of modes.
+ * \param modeList doubly-linked list of modes.
  * \param min pointer to minimums of clock ranges
  * \param max pointer to maximums of clock ranges
  * \param n_ranges number of ranges.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
  */
 _X_EXPORT void
 xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
@@ -474,9 +466,7 @@ xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
  *
  * MODE_BAD is used as the rejection flag, for lack of a better flag.
  *
- * \param modeList doubly-linked or circular list of modes.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
+ * \param modeList doubly-linked list of modes.
  */
 _X_EXPORT void
 xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
@@ -506,7 +496,7 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
 /**
  * Marks as bad any modes exceeding the given bandwidth.
  *
- * \param modeList doubly-linked or circular list of modes.
+ * \param modeList doubly-linked list of modes.
  * \param bandwidth bandwidth in MHz.
  * \param depth color depth.
  */
@@ -528,8 +518,6 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
  * \param modeList pointer to a doubly-linked or circular list of modes.
  * \param verbose determines whether the reason for mode invalidation is
  *	  printed.
- *
- * This is not in xf86Modes.c, but would be part of the proposed new API.
  */
 _X_EXPORT void
 xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
commit 1768af38c737f4c14d32f587b51a8ec3d3d6ed5f
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Dec 13 15:06:18 2007 -0500

    Add infrastructure for validating modes by memory bandwidth.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 544276b..782f08b 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -183,6 +183,8 @@ xf86ModeStatusToString(ModeStatus status)
         return "all modes must have the same resolution";
     case MODE_NO_REDUCED:
         return "monitor doesn't support reduced blanking";
+    case MODE_BANDWIDTH:
+	return "mode requires too much memory bandwidth";
     case MODE_BAD:
 	return "unknown reason";
     case MODE_ERROR:
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index af98b4f..2e02135 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -125,6 +125,7 @@ typedef enum {
     MODE_ONE_HEIGHT,    /* only one height is supported */
     MODE_ONE_SIZE,      /* only one resolution is supported */
     MODE_NO_REDUCED,    /* monitor doesn't accept reduced blanking */
+    MODE_BANDWIDTH,	/* mode requires too much memory bandwidth */
     MODE_BAD = -2,	/* unspecified reason */
     MODE_ERROR	= -1	/* error condition */
 } ModeStatus;
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 12ee6e0..3febd37 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -118,6 +118,24 @@ xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
     }
 }
 
+/** Calculates the memory bandwidth (in MiB/sec) of a mode. */
+_X_EXPORT unsigned int
+xf86ModeBandwidth(DisplayModePtr mode, int depth)
+{
+    float a_active, a_total, active_percent, pixels_per_second;
+    int bytes_per_pixel = (depth + 7) / 8;
+
+    if (!mode->HTotal || !mode->VTotal || !mode->Clock)
+	return 0;
+
+    a_active = mode->HDisplay * mode->VDisplay;
+    a_total = mode->HTotal * mode->VTotal;
+    active_percent = a_active / a_total;
+    pixels_per_second = active_percent * mode->Clock * 1000.0;
+
+    return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024));
+}
+
 /** Sets a default mode name of <width>x<height> on a mode. */
 _X_EXPORT void
 xf86SetModeDefaultName(DisplayModePtr mode)
@@ -486,6 +504,25 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
 
 
 /**
+ * Marks as bad any modes exceeding the given bandwidth.
+ *
+ * \param modeList doubly-linked or circular list of modes.
+ * \param bandwidth bandwidth in MHz.
+ * \param depth color depth.
+ */
+_X_EXPORT void
+xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+			   unsigned int bandwidth, int depth)
+{
+    DisplayModePtr mode;
+
+    for (mode = modeList; mode != NULL; mode = mode->next) {
+	if (xf86ModeBandwidth(mode, depth) > bandwidth)
+	    mode->status = MODE_BANDWIDTH;
+    }
+}
+
+/**
  * Frees any modes from the list with a status other than MODE_OK.
  *
  * \param modeList pointer to a doubly-linked or circular list of modes.
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index 3722d25..9ad5ee6 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -42,6 +42,7 @@
 
 double xf86ModeHSync(DisplayModePtr mode);
 double xf86ModeVRefresh(DisplayModePtr mode);
+unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
 
 int
 xf86ModeWidth (DisplayModePtr mode, Rotation rotation);
@@ -79,6 +80,10 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 		      MonPtr mon);
 
 void
+xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+			   unsigned int bandwidth, int depth);
+
+void
 xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
 		      Bool verbose);
 
commit 4359193aaa522599c502d012b9c163e993c01d79
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Dec 13 10:59:48 2007 -0500

    Explain a confusing #ifdef.

diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 3879b91..12ee6e0 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -38,12 +38,14 @@
 
 extern XF86ConfigPtr xf86configptr;
 
-/**
- * @file this file contains symbols from xf86Mode.c and friends that are static
- * there but we still want to use.  We need to come up with better API here.
+/*
+ * This is the version number where we epoched.  These files get copied
+ * into drivers that want to use this setup infrastructure on pre-1.3
+ * servers, so when that happens they need to define these symbols
+ * themselves.  However, _in_ the server, we basically always define them now.
  */
-
 #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
+
 /**
  * Calculates the horizontal sync rate of a mode.
  *
commit 8cedbb0a53d47b12f03edb726db9d5879c8a63a4
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Dec 13 10:57:35 2007 -0500

    Clean up some #if 0.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 7fcce10..544276b 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -368,52 +368,6 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
     return MODE_OK;
 }
 
-#if 0
-/** Calculates the horizontal sync rate of a mode */
-_X_EXPORT double
-xf86ModeHSync(DisplayModePtr mode)
-{
-    double hsync = 0.0;
-    
-    if (mode->HSync > 0.0)
-	    hsync = mode->HSync;
-    else if (mode->HTotal > 0)
-	    hsync = (float)mode->Clock / (float)mode->HTotal;
-
-    return hsync;
-}
-
-/** Calculates the vertical refresh rate of a mode */
-_X_EXPORT double
-xf86ModeVRefresh(DisplayModePtr mode)
-{
-    double refresh = 0.0;
-
-    if (mode->VRefresh > 0.0)
-	refresh = mode->VRefresh;
-    else if (mode->HTotal > 0 && mode->VTotal > 0) {
-	refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
-	if (mode->Flags & V_INTERLACE)
-	    refresh *= 2.0;
-	if (mode->Flags & V_DBLSCAN)
-	    refresh /= 2.0;
-	if (mode->VScan > 1)
-	    refresh /= (float)(mode->VScan);
-    }
-    return refresh;
-}
-
-/** Sets a default mode name of <width>x<height> on a mode. */
-_X_EXPORT void
-xf86SetModeDefaultName(DisplayModePtr mode)
-{
-    if (mode->name != NULL)
-	xfree(mode->name);
-
-    mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
-}
-#endif
-
 /*
  * xf86LookupMode
  *


More information about the xorg-commit mailing list