xf86-video-intel: Branch 'glucose' - 6 commits - src/i830_debug.c src/i830_driver.c src/i830_memory.c src/i830_tv.c src/scripts/clock-graph.5c

Alan Hourihane alanh at kemper.freedesktop.org
Thu Oct 25 02:54:46 PDT 2007


 src/i830_debug.c           |   29 +++++++++++++++++++++++++++++
 src/i830_driver.c          |   16 ++++++++++++----
 src/i830_memory.c          |   26 +++++++++++++++++++++++---
 src/i830_tv.c              |    3 +++
 src/scripts/clock-graph.5c |   36 +++++++++++++++++++++++++++++++-----
 5 files changed, 98 insertions(+), 12 deletions(-)

New commits:
commit a1bff8105f76daee7fdd74b76a9f46174ebfcf8c
Merge: 625b6f4... d2c78f8...
Author: Alan Hourihane <alanh at tungstengraphics.com>
Date:   Thu Oct 25 10:54:37 2007 +0100

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/driver/xf86-video-intel into glucose

commit d2c78f82c20f33fc9c22cab8a7ca161e57a34bf8
Author: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Date:   Wed Oct 24 19:34:12 2007 +0200

    Adapt to DRM Lockfree and setStatus changes.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 4407241..0ab7e8f 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3004,8 +3004,8 @@ I830LeaveVT(int scrnIndex, int flags)
     */
 #ifdef XF86DRI_MM
    if (pI830->directRenderingOpen) {
-      if (pI830->memory_manager != NULL) {
-	 drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT);
+      if (pI830->memory_manager != NULL && pScrn->vtSema) {
+	 drmMMLock(pI830->drmSubFD, DRM_BO_MEM_TT, 1, 0);
       }
    }
 #endif /* XF86DRI_MM */
@@ -3043,8 +3043,8 @@ I830EnterVT(int scrnIndex, int flags)
       /* Unlock the memory manager first of all so that we can pin our
        * buffer objects
        */
-      if (pI830->memory_manager != NULL) {
-	 drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT);
+      if (pI830->memory_manager != NULL && pScrn->vtSema) {
+	 drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1);
       }
    }
 #endif /* XF86DRI_MM */
@@ -3157,6 +3157,14 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
 
    if (pScrn->vtSema == TRUE) {
       I830LeaveVT(scrnIndex, 0);
+#ifdef XF86DRI_MM
+      if (pI830->directRenderingEnabled) {
+ 	 if (pI830->memory_manager != NULL) {
+	    drmMMUnlock(pI830->drmSubFD, DRM_BO_MEM_TT, 1);
+	 }
+      }
+#endif /* XF86DRI_MM */
+
    }
 
    if (pI830->devicesTimer)
diff --git a/src/i830_memory.c b/src/i830_memory.c
index bdfbba6..91d7beb 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -165,7 +165,17 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	I830Ptr pI830 = I830PTR(pScrn);
 	int ret;
 
-	ret = drmBOSetPin(pI830->drmSubFD, &mem->bo, 1);
+	ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo,
+			     DRM_BO_FLAG_MEM_VRAM |
+			     DRM_BO_FLAG_MEM_TT |
+			     DRM_BO_FLAG_READ |
+			     DRM_BO_FLAG_WRITE |
+			     DRM_BO_FLAG_NO_EVICT,
+			     DRM_BO_MASK_MEM |
+			     DRM_BO_FLAG_READ |
+			     DRM_BO_FLAG_WRITE |
+			     DRM_BO_FLAG_NO_EVICT,
+			     0, 0, 0);
 	if (ret != 0)
 	    return FALSE;
 
@@ -226,7 +236,10 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem)
 	I830Ptr pI830 = I830PTR(pScrn);
 	int ret;
 
-	ret = drmBOSetPin(pI830->drmSubFD, &mem->bo, 0);
+	ret = drmBOSetStatus(pI830->drmSubFD, &mem->bo,
+			     0, DRM_BO_FLAG_NO_EVICT,
+			     0, 0, 0);
+
 	if (ret == 0) {
 	    mem->bound = FALSE;
 	    /* Give buffer obviously wrong offset/end until it's re-pinned. */
@@ -739,8 +752,15 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
 	return NULL;
     }
 
+    /*
+     * Create buffers in local memory to avoid having the creation order
+     * determine the TT offset. Driver acceleration
+     * cannot handle changed front buffer TT offsets yet ,
+     * so let's keep our fingers crossed.
+     */
+
     mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE |
-	DRM_BO_FLAG_MEM_TT;
+	DRM_BO_FLAG_MEM_LOCAL;
     if (flags & ALLOW_SHARING)
 	mask |= DRM_BO_FLAG_SHAREABLE;
 
commit 78aaec0ffc711742bf8ad77757ed8c15cc3f7a9f
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Oct 24 11:50:54 2007 -0700

    Fix typo in my hand-application of rglowery's patch.

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 678d510..ee2538a 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1453,7 +1453,7 @@ i830_tv_get_modes(xf86OutputPtr output)
 	mode_ptr->next = ret;
 	mode_ptr->prev = NULL;
 	if (ret != NULL)
-	    reg->prev = mode_ptr;
+	    ret->prev = mode_ptr;
 	ret = mode_ptr;
     } 
 
commit 021265fbec9fd4ee31bdc9767c0c0453479ea22c
Author: Rob <rglowery at exemail.com.au>
Date:   Wed Oct 24 11:06:53 2007 -0700

    Fix a crash in TV mode handling by initializing the prev field of modes.

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 940250e..678d510 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1451,6 +1451,9 @@ i830_tv_get_modes(xf86OutputPtr output)
 	
 	mode_ptr->type = M_T_DRIVER;
 	mode_ptr->next = ret;
+	mode_ptr->prev = NULL;
+	if (ret != NULL)
+	    reg->prev = mode_ptr;
 	ret = mode_ptr;
     } 
 
commit 87345e820d20f1a98216c52e156c2e18c15ffa44
Author: Jesse Barnes <jesse.barnes at intel.com>
Date:   Mon Oct 22 14:22:37 2007 -0700

    intel_reg_dumper - dump VGA AR registers too
    
    Add a VGA AR dumping function so we can debug text mode problems too.

diff --git a/src/i830_debug.c b/src/i830_debug.c
index 8b4b76f..54dff29 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -560,6 +560,34 @@ static void i830DumpIndexed (ScrnInfoPtr pScrn, char *name, int id, int val, int
     }
 }
 
+static void i830DumpAR(ScrnInfoPtr pScrn)
+{
+    I830Ptr pI830 = I830PTR(pScrn);
+    int i;
+    uint16_t st01, palette_enable = 0;
+    unsigned char orig_arx, msr;
+
+    msr = INREG8(0x3cc);
+    if (msr & 1)
+	st01 = 0x3da;
+    else
+	st01 = 0x3ba;
+
+    INREG8(st01); /* make sure index/write register is in index mode */
+    orig_arx = INREG8(0x3c0);
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%19.19sX: 0x%02x\n",
+	       "AR", orig_arx);
+    
+    for (i = 0; i <= 0x14; i++) {
+	INREG8(st01);
+	OUTREG8(0x3c0, i);
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%18.18s%02x: 0x%02x\n",
+		   "AR", i, INREG8(0x3c1));
+    }
+    INREG8(st01);
+    OUTREG8(0x3c0, orig_arx);
+}
+
 void i830DumpRegs (ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
@@ -594,6 +622,7 @@ void i830DumpRegs (ScrnInfoPtr pScrn)
     xf86DrvMsg (pScrn->scrnIndex, X_INFO, "%20.20s: 0x%02x\n",
 		    "MSR", (unsigned int) msr);
 
+    i830DumpAR (pScrn);
     if (msr & 1)
 	crt = 0x3d0;
     else
commit 78e251db671e21bc859c9b505d391b70babee2dc
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Oct 19 15:04:10 2007 -0700

    In the clock graph, draw the VCO as erasures in the lines representing clocks.
    
    This shows one of the reasons for the gaps: with the other settings, the VCO
    is too low inside the gap.  However, it also points out another issue: we
    aren't using the high end of the VCO range due to some other limits being hit.

diff --git a/src/scripts/clock-graph.5c b/src/scripts/clock-graph.5c
index 98500e1..e39e559 100644
--- a/src/scripts/clock-graph.5c
+++ b/src/scripts/clock-graph.5c
@@ -4,12 +4,14 @@ library "examples/sort.5c";
 import Sort;
 
 int width = 1000, height = 200;
-
+int min_vco = 1400000000;
+int max_vco = 2800000000;
 int min = 0xffffffff;
 int max = 0;
 
 int max_clocks = 1000;
 int[4][max_clocks] clocks;
+int[4][max_clocks] vcos;
 int[4] clock_count = {0...};
 
 int[4] p2vals = {5,10,7,14};
@@ -49,8 +51,7 @@ void calc_p2(int p2i)
 						continue;
 					if (m2 > m1)
 						continue; /* won't happen */
-					if (vco < 1400000000 ||
-					    vco > 2800000000)
+					if (vco < min_vco || vco > max_vco)
 						continue;
 
 /*
@@ -61,6 +62,7 @@ void calc_p2(int p2i)
 */
 
 					clocks[p2i][clock_count[p2i]] = clock;
+					vcos[p2i][clock_count[p2i]] = vco;
 					clock_count[p2i]++;
 				}
 			}
@@ -88,6 +90,9 @@ real scale_x(real clock)
 for (p2i = 0; p2i < dim(p2vals); p2i++) {
 	int p2 = p2vals[p2i]; 
 	calc_p2(p2i);
+	real row_y1 = (p2i + 1) / (dim(p2vals) + 1) * height;
+	real row_y2 = p2i / (dim(p2vals) + 1) * height;
+
 	/*qsort(&p2vals[p2i], sort_p2);*/
 
 	switch (p2) {
@@ -104,6 +109,8 @@ for (p2i = 0; p2i < dim(p2vals); p2i++) {
 		set_source_rgb(cr, 0,0,0);
 		break;
 	}
+
+	/* draw the line for the clock */
 	for (int i = 0; i < clock_count[p2i]; i++) {
 		int clock = clocks[p2i][i];
 		real xpos;
@@ -112,8 +119,27 @@ for (p2i = 0; p2i < dim(p2vals); p2i++) {
 			continue;
 
 		xpos = scale_x(clock);
-		move_to(cr, xpos, p2i / (dim(p2vals) + 1) * height);
-		line_to(cr, xpos, (p2i + 1) / (dim(p2vals) + 1) * height);
+		move_to(cr, xpos, row_y1);
+		line_to(cr, xpos, row_y2);
+		stroke(cr);
+	}
+
+	set_source_rgb(cr, 1, 1, 1);
+	/* add a mark for the vco value of the clocks at each location */
+	for (int i = 0; i < clock_count[p2i]; i++) {
+		int clock = clocks[p2i][i];
+		int vco = vcos[p2i][i];
+		real mark_center;
+
+		if (clock < min_rate || clock > max_rate)
+			continue;
+
+		real xpos = scale_x(clock);
+		real vcofrac = (vco - min_vco) / (max_vco - min_vco);
+		real mark_height = (row_y1 + vcofrac * (row_y2 - row_y1));
+
+		move_to(cr, xpos, mark_height - 1);
+		line_to(cr, xpos, mark_height + 1);
 		stroke(cr);
 	}
 


More information about the xorg-commit mailing list