diff options
-rw-r--r-- | src/i830_debug.c | 29 | ||||
-rw-r--r-- | src/i830_driver.c | 16 | ||||
-rw-r--r-- | src/i830_memory.c | 26 | ||||
-rw-r--r-- | src/i830_tv.c | 3 | ||||
-rw-r--r-- | src/scripts/clock-graph.5c | 36 |
5 files changed, 98 insertions, 12 deletions
diff --git a/src/i830_debug.c b/src/i830_debug.c index 8b4b76f4..54dff29f 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 diff --git a/src/i830_driver.c b/src/i830_driver.c index 90a35de8..afde3fce 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -3020,8 +3020,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 */ @@ -3059,8 +3059,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 */ @@ -3173,6 +3173,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 1f6b40e7..2dd21b71 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; diff --git a/src/i830_tv.c b/src/i830_tv.c index 940250e5..ee2538ad 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) + ret->prev = mode_ptr; ret = mode_ptr; } diff --git a/src/scripts/clock-graph.5c b/src/scripts/clock-graph.5c index 98500e1e..e39e559c 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); } |