xf86-video-intel: Branch 'refs/remotes/origin/intel-batchbuffer' - 13 commits - configure.ac src/dri_bufmgr.c src/dri_bufmgr.h src/fix.5c src/i830_accel.c src/i830_debug.c src/i830_display.c src/i830_dri.c src/i830_driver.c src/i830_exa.c src/i830.h src/i830_memory.c src/i830_tv.c src/i965_render.c src/intel_batchbuffer.c src/intel_batchbuffer.h src/intel_bufmgr_ttm.c src/intel_bufmgr_ttm.h src/scripts/clock.5c src/scripts/clock-graph.5c src/scripts/fix.5c src/scripts/tv.5c src/tv.5c
Jesse Barnes
jbarnes at kemper.freedesktop.org
Thu Nov 1 12:06:30 PDT 2007
configure.ac | 2
src/dri_bufmgr.c | 41 +++++-----
src/dri_bufmgr.h | 66 ++++++++---------
src/fix.5c | 14 ---
src/i830.h | 8 +-
src/i830_accel.c | 4 -
src/i830_debug.c | 29 +++++++
src/i830_display.c | 12 ++-
src/i830_dri.c | 8 +-
src/i830_driver.c | 20 +++--
src/i830_exa.c | 14 +--
src/i830_memory.c | 33 +++++++-
src/i830_tv.c | 3
src/i965_render.c | 16 ++--
src/intel_batchbuffer.c | 50 ++++++------
src/intel_batchbuffer.h | 55 +++++++-------
src/intel_bufmgr_ttm.c | 116 +++++++++++++++---------------
src/intel_bufmgr_ttm.h | 6 -
src/scripts/clock-graph.5c | 174 +++++++++++++++++++++++++++++++++++++++++++++
src/scripts/clock.5c | 40 ++++++++++
src/scripts/fix.5c | 14 +++
src/scripts/tv.5c | 128 +++++++++++++++++++++++++++++++++
src/tv.5c | 128 ---------------------------------
23 files changed, 634 insertions(+), 347 deletions(-)
New commits:
commit 62281b1ed4adc90d7f8f893f50c166e16b39c68d
Author: Dave Airlie <airlied at redhat.com>
Date: Thu Nov 1 11:39:39 2007 +1100
intel: avoid symbol collisions with Mesa in AIGLX situations..
So re-using code from Mesa in the DDX as-is?? bad plan, Mesa tries
to use the DDX functions with the same names...
Maybe someday symbol visibility will save the world
diff --git a/src/dri_bufmgr.c b/src/dri_bufmgr.c
index 3c20789..b5da3b9 100644
--- a/src/dri_bufmgr.c
+++ b/src/dri_bufmgr.c
@@ -32,8 +32,8 @@
* Convenience functions for buffer management methods.
*/
-dri_bo *
-dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
+ddx_bo *
+ddx_bo_alloc(ddx_bufmgr *bufmgr, const char *name, unsigned long size,
unsigned int alignment, unsigned int location_mask)
{
assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT |
@@ -44,8 +44,8 @@ dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
return bufmgr->bo_alloc(bufmgr, name, size, alignment, location_mask);
}
-dri_bo *
-dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset,
+ddx_bo *
+ddx_bo_alloc_static(ddx_bufmgr *bufmgr, const char *name, unsigned long offset,
unsigned long size, void *virtual,
unsigned int location_mask)
{
@@ -60,13 +60,13 @@ dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset,
}
void
-dri_bo_reference(dri_bo *bo)
+ddx_bo_reference(ddx_bo *bo)
{
bo->bufmgr->bo_reference(bo);
}
void
-dri_bo_unreference(dri_bo *bo)
+ddx_bo_unreference(ddx_bo *bo)
{
if (bo == NULL)
return;
@@ -75,13 +75,13 @@ dri_bo_unreference(dri_bo *bo)
}
int
-dri_bo_map(dri_bo *buf, Bool write_enable)
+ddx_bo_map(ddx_bo *buf, Bool write_enable)
{
return buf->bufmgr->bo_map(buf, write_enable);
}
int
-dri_bo_unmap(dri_bo *buf)
+ddx_bo_unmap(ddx_bo *buf)
{
return buf->bufmgr->bo_unmap(buf);
}
@@ -108,47 +108,47 @@ dri_fence_unreference(dri_fence *fence)
}
void
-dri_bo_subdata(dri_bo *bo, unsigned long offset,
+ddx_bo_subdata(ddx_bo *bo, unsigned long offset,
unsigned long size, const void *data)
{
if (size == 0 || data == NULL)
return;
- dri_bo_map(bo, TRUE);
+ ddx_bo_map(bo, TRUE);
memcpy((unsigned char *)bo->virtual + offset, data, size);
- dri_bo_unmap(bo);
+ ddx_bo_unmap(bo);
}
void
-dri_bo_get_subdata(dri_bo *bo, unsigned long offset,
+ddx_bo_get_subdata(ddx_bo *bo, unsigned long offset,
unsigned long size, void *data)
{
if (size == 0 || data == NULL)
return;
- dri_bo_map(bo, FALSE);
+ ddx_bo_map(bo, FALSE);
memcpy(data, (unsigned char *)bo->virtual + offset, size);
- dri_bo_unmap(bo);
+ ddx_bo_unmap(bo);
}
void
-dri_bufmgr_destroy(dri_bufmgr *bufmgr)
+ddx_bufmgr_destroy(ddx_bufmgr *bufmgr)
{
bufmgr->destroy(bufmgr);
}
-void dri_emit_reloc(dri_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset, dri_bo *relocatee)
+void dri_emit_reloc(ddx_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset, ddx_bo *relocatee)
{
batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee);
}
-void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count)
+void *dri_process_relocs(ddx_bo *batch_buf, uint32_t *count)
{
return batch_buf->bufmgr->process_relocs(batch_buf, count);
}
-void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence)
+void dri_post_submit(ddx_bo *batch_buf, dri_fence **last_fence)
{
batch_buf->bufmgr->post_submit(batch_buf, last_fence);
}
diff --git a/src/dri_bufmgr.h b/src/dri_bufmgr.h
index cddafb6..57bc715 100644
--- a/src/dri_bufmgr.h
+++ b/src/dri_bufmgr.h
@@ -38,11 +38,11 @@
#include "xf86str.h"
-typedef struct _dri_bufmgr dri_bufmgr;
-typedef struct _dri_bo dri_bo;
+typedef struct _ddx_bufmgr ddx_bufmgr;
+typedef struct _ddx_bo ddx_bo;
typedef struct _dri_fence dri_fence;
-struct _dri_bo {
+struct _ddx_bo {
/** Size in bytes of the buffer object. */
unsigned long size;
/**
@@ -55,7 +55,7 @@ struct _dri_bo {
*/
void *virtual;
/** Buffer manager context associated with this buffer object */
- dri_bufmgr *bufmgr;
+ ddx_bufmgr *bufmgr;
};
struct _dri_fence {
@@ -67,7 +67,7 @@ struct _dri_fence {
*/
unsigned int type;
/** Buffer manager context associated with this fence */
- dri_bufmgr *bufmgr;
+ ddx_bufmgr *bufmgr;
};
/**
@@ -75,7 +75,7 @@ struct _dri_fence {
*
* Contains public methods followed by private storage for the buffer manager.
*/
-struct _dri_bufmgr {
+struct _ddx_bufmgr {
/**
* Allocate a buffer object.
*
@@ -84,7 +84,7 @@ struct _dri_bufmgr {
* bo_map() to be used by the CPU, and validated for use using bo_validate()
* to be used from the graphics device.
*/
- dri_bo *(*bo_alloc)(dri_bufmgr *bufmgr_ctx, const char *name,
+ ddx_bo *(*bo_alloc)(ddx_bufmgr *bufmgr_ctx, const char *name,
unsigned long size, unsigned int alignment,
unsigned int location_mask);
@@ -94,18 +94,18 @@ struct _dri_bufmgr {
* Static allocations are ones such as the front buffer that are offered by
* the X Server, which are never evicted and never moved.
*/
- dri_bo *(*bo_alloc_static)(dri_bufmgr *bufmgr_ctx, const char *name,
+ ddx_bo *(*bo_alloc_static)(ddx_bufmgr *bufmgr_ctx, const char *name,
unsigned long offset, unsigned long size,
void *virtual, unsigned int location_mask);
/** Takes a reference on a buffer object */
- void (*bo_reference)(dri_bo *bo);
+ void (*bo_reference)(ddx_bo *bo);
/**
* Releases a reference on a buffer object, freeing the data if
* rerefences remain.
*/
- void (*bo_unreference)(dri_bo *bo);
+ void (*bo_unreference)(ddx_bo *bo);
/**
* Maps the buffer into userspace.
@@ -113,10 +113,10 @@ struct _dri_bufmgr {
* This function will block waiting for any existing fence on the buffer to
* clear, first. The resulting mapping is available at buf->virtual.
\ */
- int (*bo_map)(dri_bo *buf, Bool write_enable);
+ int (*bo_map)(ddx_bo *buf, Bool write_enable);
/** Reduces the refcount on the userspace mapping of the buffer object. */
- int (*bo_unmap)(dri_bo *buf);
+ int (*bo_unmap)(ddx_bo *buf);
/** Takes a reference on a fence object */
void (*fence_reference)(dri_fence *fence);
@@ -135,52 +135,52 @@ struct _dri_bufmgr {
/**
* Tears down the buffer manager instance.
*/
- void (*destroy)(dri_bufmgr *bufmgr);
+ void (*destroy)(ddx_bufmgr *bufmgr);
/**
* Add relocation
*/
- void (*emit_reloc)(dri_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset, dri_bo *relocatee);
+ void (*emit_reloc)(ddx_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset, ddx_bo *relocatee);
- void *(*process_relocs)(dri_bo *batch_buf, uint32_t *count);
+ void *(*process_relocs)(ddx_bo *batch_buf, uint32_t *count);
- void (*post_submit)(dri_bo *batch_buf, dri_fence **fence);
+ void (*post_submit)(ddx_bo *batch_buf, dri_fence **fence);
};
-dri_bo *dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
+ddx_bo *ddx_bo_alloc(ddx_bufmgr *bufmgr, const char *name, unsigned long size,
unsigned int alignment, unsigned int location_mask);
-dri_bo *dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name,
+ddx_bo *ddx_bo_alloc_static(ddx_bufmgr *bufmgr, const char *name,
unsigned long offset, unsigned long size,
void *virtual, unsigned int location_mask);
-void dri_bo_reference(dri_bo *bo);
-void dri_bo_unreference(dri_bo *bo);
-int dri_bo_map(dri_bo *buf, Bool write_enable);
-int dri_bo_unmap(dri_bo *buf);
+void ddx_bo_reference(ddx_bo *bo);
+void ddx_bo_unreference(ddx_bo *bo);
+int ddx_bo_map(ddx_bo *buf, Bool write_enable);
+int ddx_bo_unmap(ddx_bo *buf);
void dri_fence_wait(dri_fence *fence);
void dri_fence_reference(dri_fence *fence);
void dri_fence_unreference(dri_fence *fence);
-void dri_bo_subdata(dri_bo *bo, unsigned long offset,
+void ddx_bo_subdata(ddx_bo *bo, unsigned long offset,
unsigned long size, const void *data);
-void dri_bo_get_subdata(dri_bo *bo, unsigned long offset,
+void ddx_bo_get_subdata(ddx_bo *bo, unsigned long offset,
unsigned long size, void *data);
-dri_bufmgr *dri_bufmgr_ttm_init(int fd, unsigned int fence_type,
+ddx_bufmgr *ddx_bufmgr_ttm_init(int fd, unsigned int fence_type,
unsigned int fence_type_flush);
-void dri_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr);
-dri_bufmgr *dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
+void ddx_bufmgr_fake_contended_lock_take(ddx_bufmgr *bufmgr);
+ddx_bufmgr *ddx_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
unsigned long size,
unsigned int (*fence_emit)(void *private),
int (*fence_wait)(void *private,
unsigned int cookie),
void *driver_priv);
-void dri_bufmgr_destroy(dri_bufmgr *bufmgr);
-dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
+void ddx_bufmgr_destroy(ddx_bufmgr *bufmgr);
+ddx_bo *dri_ttm_bo_create_from_handle(ddx_bufmgr *bufmgr, const char *name,
unsigned int handle);
-void dri_emit_reloc(dri_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset, dri_bo *relocatee);
-void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count);
-void dri_post_process_relocs(dri_bo *batch_buf);
-void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence);
+void dri_emit_reloc(ddx_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset, ddx_bo *relocatee);
+void *dri_process_relocs(ddx_bo *batch_buf, uint32_t *count);
+void dri_post_process_relocs(ddx_bo *batch_buf);
+void dri_post_submit(ddx_bo *batch_buf, dri_fence **last_fence);
#endif
diff --git a/src/i830.h b/src/i830.h
index 12b4e77..7784274 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -132,7 +132,7 @@ enum tile_format {
TILE_YMAJOR
};
-struct intel_batchbuffer;
+struct intelddx_batchbuffer;
/** Record of a linear allocation in the aperture. */
typedef struct _i830_memory i830_memory;
@@ -574,8 +574,8 @@ typedef struct _I830Rec {
/* batchbuffer support */
struct i965_exastate_buffer *exa965;
- struct intel_batchbuffer *batch;
- dri_bufmgr *bufmgr;
+ struct intelddx_batchbuffer *batch;
+ ddx_bufmgr *bufmgr;
unsigned int maxBatchSize;
Bool use_ttm_batch;
} I830Rec;
@@ -592,7 +592,7 @@ typedef struct _I830Rec {
/* i830 pixmap private for TTM */
struct i830_exa_pixmap_priv {
- dri_bo *bo;
+ ddx_bo *bo;
dri_fence *fence;
int flags;
};
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 46f969f..5988d33 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -184,7 +184,7 @@ I830Sync(ScrnInfoPtr pScrn)
if (pI830->entityPrivate && !pI830->entityPrivate->RingRunning) return;
if (pI830->use_ttm_batch) {
- intel_batchbuffer_finish(pI830->batch);
+ intelddx_batchbuffer_finish(pI830->batch);
}
else
{
@@ -216,7 +216,7 @@ I830EmitFlush(ScrnInfoPtr pScrn)
int flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
if (pI830->use_ttm_batch)
- intel_batchbuffer_flush(pI830->batch);
+ intelddx_batchbuffer_flush(pI830->batch);
else {
if (IS_I965G(pI830))
flags = 0;
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 2746e89..0102db9 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -524,13 +524,13 @@ I830InitBufMgr(ScreenPtr pScreen)
}
pI830->maxBatchSize = BATCH_SZ;
- pI830->bufmgr = intel_bufmgr_ttm_init(pI830->drmSubFD, DRM_FENCE_TYPE_EXE,
+ pI830->bufmgr = intelddx_bufmgr_ttm_init(pI830->drmSubFD, DRM_FENCE_TYPE_EXE,
DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
BATCH_SZ);
if (!pI830->bufmgr)
return;
- pI830->batch = intel_batchbuffer_alloc(pScrn);
+ pI830->batch = intelddx_batchbuffer_alloc(pScrn);
pI830->use_ttm_batch = TRUE;
}
@@ -1091,7 +1091,7 @@ I830DRIRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox)
return;
if (pI830->use_ttm_batch)
- intel_batchbuffer_flush(pI830->batch);
+ intelddx_batchbuffer_flush(pI830->batch);
I830DRIDoRefreshArea(pScrn, num, pbox, pI830->back_buffer->offset);
@@ -1100,7 +1100,7 @@ I830DRIRefreshArea (ScrnInfoPtr pScrn, int num, BoxPtr pbox)
}
if (pI830->use_ttm_batch)
- intel_batchbuffer_finish(pI830->batch);
+ intelddx_batchbuffer_finish(pI830->batch);
DamageEmpty(pI830->pDamage);
}
#endif
diff --git a/src/i830_driver.c b/src/i830_driver.c
index a8801c1..0ac7266 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2271,7 +2271,7 @@ I830BlockHandler(int i,
pScreen->BlockHandler = I830BlockHandler;
if (pI830->batch)
- intel_batchbuffer_flush(pI830->batch);
+ intelddx_batchbuffer_flush(pI830->batch);
I830VideoBlockHandler(i, blockData, pTimeout, pReadmask);
}
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 069df40..6e1c5bd 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -399,7 +399,7 @@ static void *I830EXACreatePixmap(ScreenPtr pScreen, int size, int align)
if (size == 0)
return new_priv;
- new_priv->bo = dri_bo_alloc(pI830->bufmgr, "pixmap",
+ new_priv->bo = ddx_bo_alloc(pI830->bufmgr, "pixmap",
size, 4096, DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED);
return new_priv;
@@ -412,9 +412,9 @@ static void I830EXADestroyPixmap(ScreenPtr pScreen, void *driverPriv)
struct i830_exa_pixmap_priv *driver_priv = driverPriv;
if (driver_priv->flags & I830_EXA_PIXMAP_IS_MAPPED)
- dri_bo_unmap(driver_priv->bo);
+ ddx_bo_unmap(driver_priv->bo);
- dri_bo_unreference(driver_priv->bo);
+ ddx_bo_unreference(driver_priv->bo);
xfree(driverPriv);
}
@@ -445,7 +445,7 @@ static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
return FALSE;
/* TODO : make this more conditional */
- intel_batchbuffer_flush(pI830->batch);
+ intelddx_batchbuffer_flush(pI830->batch);
dri_fence_wait(pI830->batch->last_fence);
if (driver_priv->bo) {
@@ -454,7 +454,7 @@ static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
if ((driver_priv->flags & I830_EXA_PIXMAP_IS_MAPPED))
return TRUE;
- ret = dri_bo_map(driver_priv->bo, 1);
+ ret = ddx_bo_map(driver_priv->bo, 1);
if (ret)
return FALSE;
@@ -481,7 +481,7 @@ static Bool I830EXAModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
driver_priv->flags |= I830_EXA_PIXMAP_IS_FRONTBUFFER;
/* get a reference to the front buffer handle */
- driver_priv->bo = intel_ttm_bo_create_from_handle(pI830->bufmgr, "front", pI830->front_buffer->bo.handle);
+ driver_priv->bo = intelddx_ttm_bo_create_from_handle(pI830->bufmgr, "front", pI830->front_buffer->bo.handle);
miModifyPixmapHeader(pPixmap, width, height, depth,
bitsPerPixel, devKind, NULL);
diff --git a/src/i965_render.c b/src/i965_render.c
index 1e423a2..142200e 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -703,14 +703,14 @@ i965_exastate_reset(struct i965_exastate_buffer *state)
I830Ptr pI830 = I830PTR(state->pScrn);
if (state->buf != NULL) {
- dri_bo_unreference(state->buf);
+ ddx_bo_unreference(state->buf);
state->buf = NULL;
}
- state->buf = dri_bo_alloc(pI830->bufmgr, "exa state buffer",
+ state->buf = ddx_bo_alloc(pI830->bufmgr, "exa state buffer",
EXASTATE_SZ, 4096,
DRM_BO_FLAG_MEM_TT);
- dri_bo_map(state->buf, TRUE);
+ ddx_bo_map(state->buf, TRUE);
state->map = state->buf->virtual;
i965_init_state_objects(state->pScrn, state->map);
@@ -809,7 +809,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
dest_surf_state->ss0.surface_format = dst_format;
if (pI830->use_ttm_batch) {
- intel_batchbuffer_emit_pixmap(pDst,
+ intelddx_batchbuffer_emit_pixmap(pDst,
DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_CACHED,
pI830->exa965->buf, dest_surf_offset + 4, 0);
@@ -828,7 +828,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
src_surf_state->ss0.surface_format = i965_get_card_format(pSrcPicture);
if (pI830->use_ttm_batch) {
- intel_batchbuffer_emit_pixmap(pSrc,
+ intelddx_batchbuffer_emit_pixmap(pSrc,
DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ | DRM_BO_FLAG_CACHED,
pI830->exa965->buf, src_surf_offset + 4, 0);
@@ -846,7 +846,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
mask_surf_state = (void *)(start_base + mask_surf_offset);
mask_surf_state->ss0.surface_format = i965_get_card_format(pMaskPicture);
if (pI830->use_ttm_batch) {
- intel_batchbuffer_emit_pixmap(pMask,
+ intelddx_batchbuffer_emit_pixmap(pMask,
DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ | DRM_BO_FLAG_CACHED,
pI830->exa965->buf, mask_surf_offset + 4, 0);
@@ -1265,8 +1265,8 @@ void i965_done_composite(PixmapPtr pDst)
}
if (pI830->use_ttm_batch) {
- dri_bo_unmap(pI830->exa965->buf);
- intel_batchbuffer_flush(pI830->batch);
+ ddx_bo_unmap(pI830->exa965->buf);
+ intelddx_batchbuffer_flush(pI830->batch);
} else {
I830Sync(pScrn);
}
diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index fdb7b51..f29f069 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -77,38 +77,38 @@
*/
void
-intel_batchbuffer_reset(struct intel_batchbuffer *batch)
+intelddx_batchbuffer_reset(struct intelddx_batchbuffer *batch)
{
I830Ptr pI830 = I830PTR(batch->pScrn);
if (batch->buf != NULL) {
- dri_bo_unreference(batch->buf);
+ ddx_bo_unreference(batch->buf);
batch->buf = NULL;
}
- batch->buf = dri_bo_alloc(pI830->bufmgr, "batchbuffer",
+ batch->buf = ddx_bo_alloc(pI830->bufmgr, "batchbuffer",
pI830->maxBatchSize, 4096,
DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED);
- dri_bo_map(batch->buf, TRUE);
+ ddx_bo_map(batch->buf, TRUE);
batch->map = batch->buf->virtual;
batch->size = pI830->maxBatchSize;
batch->ptr = batch->map;
}
-struct intel_batchbuffer *
-intel_batchbuffer_alloc(ScrnInfoPtr pScrn)
+struct intelddx_batchbuffer *
+intelddx_batchbuffer_alloc(ScrnInfoPtr pScrn)
{
- struct intel_batchbuffer *batch = calloc(sizeof(*batch), 1);
+ struct intelddx_batchbuffer *batch = calloc(sizeof(*batch), 1);
batch->pScrn = pScrn;
batch->last_fence = NULL;
- intel_batchbuffer_reset(batch);
+ intelddx_batchbuffer_reset(batch);
return batch;
}
void
-intel_batchbuffer_free(struct intel_batchbuffer *batch)
+intelddx_batchbuffer_free(struct intelddx_batchbuffer *batch)
{
if (batch->last_fence) {
dri_fence_wait(batch->last_fence);
@@ -116,10 +116,10 @@ intel_batchbuffer_free(struct intel_batchbuffer *batch)
batch->last_fence = NULL;
}
if (batch->map) {
- dri_bo_unmap(batch->buf);
+ ddx_bo_unmap(batch->buf);
batch->map = NULL;
}
- dri_bo_unreference(batch->buf);
+ ddx_bo_unreference(batch->buf);
batch->buf = NULL;
free(batch);
}
@@ -157,7 +157,7 @@ intel_exec_ioctl(ScrnInfoPtr pScrn,
exit(1);
}
- fo = intel_ttm_fence_create_from_arg(pI830->bufmgr, "fence buffers",
+ fo = intelddx_ttm_fence_create_from_arg(pI830->bufmgr, "fence buffers",
&execbuf.fence_arg);
if (!fo) {
fprintf(stderr, "failed to fence handle: %08x\n", execbuf.fence_arg.handle);
@@ -168,7 +168,7 @@ intel_exec_ioctl(ScrnInfoPtr pScrn,
static void
-do_flush_locked(struct intel_batchbuffer *batch,
+do_flush_locked(struct intelddx_batchbuffer *batch,
uint32_t used,
Bool ignore_cliprects, Bool allow_unlock)
{
@@ -196,7 +196,7 @@ do_flush_locked(struct intel_batchbuffer *batch,
}
void
-intel_batchbuffer_flush(struct intel_batchbuffer *batch)
+intelddx_batchbuffer_flush(struct intelddx_batchbuffer *batch)
{
I830Ptr pI830 = I830PTR(batch->pScrn);
uint32_t used = batch->ptr - batch->map;
@@ -226,13 +226,13 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch)
/* Reset the buffer:
*/
- intel_batchbuffer_reset(batch);
+ intelddx_batchbuffer_reset(batch);
}
void
-intel_batchbuffer_finish(struct intel_batchbuffer *batch)
+intelddx_batchbuffer_finish(struct intelddx_batchbuffer *batch)
{
- intel_batchbuffer_flush(batch);
+ intelddx_batchbuffer_flush(batch);
if (batch->last_fence != NULL)
dri_fence_wait(batch->last_fence);
}
@@ -241,8 +241,8 @@ intel_batchbuffer_finish(struct intel_batchbuffer *batch)
/* This is the only way buffers get added to the validate list.
*/
Bool
-intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
- dri_bo *buffer,
+intelddx_batchbuffer_emit_reloc(struct intelddx_batchbuffer *batch,
+ ddx_bo *buffer,
uint32_t flags, uint32_t delta)
{
dri_emit_reloc(batch->buf, flags, delta, batch->ptr - batch->map, buffer);
@@ -252,18 +252,18 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
}
void
-intel_batchbuffer_data(struct intel_batchbuffer *batch,
+intelddx_batchbuffer_data(struct intelddx_batchbuffer *batch,
const void *data, uint32_t bytes, uint32_t flags)
{
assert((bytes & 3) == 0);
- intel_batchbuffer_require_space(batch, bytes, flags);
+ intelddx_batchbuffer_require_space(batch, bytes, flags);
memcpy(batch->ptr, data, bytes);
batch->ptr += bytes;
}
Bool
-intel_batchbuffer_emit_pixmap(PixmapPtr pPixmap, unsigned int flags,
- unsigned int mask, dri_bo *reloc_buf,
+intelddx_batchbuffer_emit_pixmap(PixmapPtr pPixmap, unsigned int flags,
+ unsigned int mask, ddx_bo *reloc_buf,
unsigned int offset, unsigned int delta)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
@@ -272,7 +272,7 @@ intel_batchbuffer_emit_pixmap(PixmapPtr pPixmap, unsigned int flags,
struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPixmap);
if (driver_priv->flags & I830_EXA_PIXMAP_IS_MAPPED) {
- dri_bo_unmap(driver_priv->bo);
+ ddx_bo_unmap(driver_priv->bo);
driver_priv->flags &= ~I830_EXA_PIXMAP_IS_MAPPED;
}
dri_emit_reloc(reloc_buf, flags, delta, offset, driver_priv->bo);
diff --git a/src/intel_batchbuffer.h b/src/intel_batchbuffer.h
index 6784bdc..01e2e18 100644
--- a/src/intel_batchbuffer.h
+++ b/src/intel_batchbuffer.h
@@ -9,11 +9,11 @@ struct intel_context;
#define EXASTATE_SZ 48000
#define BATCH_RESERVED 16
-struct intel_batchbuffer
+struct intelddx_batchbuffer
{
ScrnInfoPtr pScrn;
- dri_bo *buf;
+ ddx_bo *buf;
dri_fence *last_fence;
uint32_t flags;
@@ -24,36 +24,36 @@ struct intel_batchbuffer
};
struct i965_exastate_buffer {
- dri_bo *buf;
+ ddx_bo *buf;
dri_fence *last_fence;
ScrnInfoPtr pScrn;
unsigned char *map;
};
-struct intel_batchbuffer *intel_batchbuffer_alloc(ScrnInfoPtr pScrn);
+struct intelddx_batchbuffer *intelddx_batchbuffer_alloc(ScrnInfoPtr pScrn);
-void intel_batchbuffer_free(struct intel_batchbuffer *batch);
+void intelddx_batchbuffer_free(struct intelddx_batchbuffer *batch);
-void intel_batchbuffer_finish(struct intel_batchbuffer *batch);
+void intelddx_batchbuffer_finish(struct intelddx_batchbuffer *batch);
-void intel_batchbuffer_flush(struct intel_batchbuffer *batch);
+void intelddx_batchbuffer_flush(struct intelddx_batchbuffer *batch);
-void intel_batchbuffer_reset(struct intel_batchbuffer *batch);
+void intelddx_batchbuffer_reset(struct intelddx_batchbuffer *batch);
/* Unlike bmBufferData, this currently requires the buffer be mapped.
* Consider it a convenience function wrapping multple
* intel_buffer_dword() calls.
*/
-void intel_batchbuffer_data(struct intel_batchbuffer *batch,
+void intelddx_batchbuffer_data(struct intelddx_batchbuffer *batch,
const void *data, uint32_t bytes, uint32_t flags);
-void intel_batchbuffer_release_space(struct intel_batchbuffer *batch,
+void intelddx_batchbuffer_release_space(struct intelddx_batchbuffer *batch,
uint32_t bytes);
-Bool intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
- dri_bo *buffer,
+Bool intelddx_batchbuffer_emit_reloc(struct intelddx_batchbuffer *batch,
+ ddx_bo *buffer,
uint32_t flags, uint32_t offset);
/* Inline functions - might actually be better off with these
@@ -62,38 +62,39 @@ Bool intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
* work...
*/
static inline uint32_t
-intel_batchbuffer_space(struct intel_batchbuffer *batch)
+intelddx_batchbuffer_space(struct intelddx_batchbuffer *batch)
{
return (batch->size - BATCH_RESERVED) - (batch->ptr - batch->map);
}
static inline void
-intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, uint32_t dword)
+intelddx_batchbuffer_emit_dword(struct intelddx_batchbuffer *batch, uint32_t dword)
{
assert(batch->map);
- assert(intel_batchbuffer_space(batch) >= 4);
+ assert(intelddx_batchbuffer_space(batch) >= 4);
*(uint32_t *) (batch->ptr) = dword;
batch->ptr += 4;
}
static inline void
-intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
+intelddx_batchbuffer_require_space(struct intelddx_batchbuffer *batch,
uint32_t sz, uint32_t flags)
{
assert(sz < batch->size - 8);
- if (intel_batchbuffer_space(batch) < sz ||
+ if (intelddx_batchbuffer_space(batch) < sz ||
(batch->flags != 0 && flags != 0 && batch->flags != flags))
- intel_batchbuffer_flush(batch);
+ intelddx_batchbuffer_flush(batch);
batch->flags |= flags;
}
-extern Bool intel_batchbuffer_emit_pixmap(PixmapPtr pPixmap, unsigned int flags,
- unsigned int mask,
- dri_bo *reloc_buf,
- unsigned int offset,
- unsigned int delta);
+extern Bool intelddx_batchbuffer_emit_pixmap(PixmapPtr pPixmap,
+ unsigned int flags,
+ unsigned int mask,
+ ddx_bo *reloc_buf,
+ unsigned int offset,
+ unsigned int delta);
/* Here are the crusty old macros, to be removed:
*/
@@ -102,13 +103,13 @@ extern Bool intel_batchbuffer_emit_pixmap(PixmapPtr pPixmap, unsigned int flags,
#define BEGIN_BATCH(n) \
RING_LOCALS \
if (pI830->use_ttm_batch) \
- intel_batchbuffer_require_space(pI830->batch, (n)*4, 0); \
+ intelddx_batchbuffer_require_space(pI830->batch, (n)*4, 0); \
else { \
DO_LP_RING(n) ; }
#define OUT_BATCH(d) \
if (pI830->use_ttm_batch) \
- intel_batchbuffer_emit_dword(pI830->batch, d); \
+ intelddx_batchbuffer_emit_dword(pI830->batch, d); \
else { OUT_RING(d); }
#define OUT_BATCH_F(x) do { \
@@ -118,11 +119,11 @@ extern Bool intel_batchbuffer_emit_pixmap(PixmapPtr pPixmap, unsigned int flags,
} while(0)
#define OUT_RELOC(buf, flags, delta) do { \
- intel_batchbuffer_emit_reloc(pI830->batch, buf, flags, delta); \
+ intelddx_batchbuffer_emit_reloc(pI830->batch, buf, flags, delta); \
} while (0)
#define OUT_PIXMAP_RELOC(pixmap, flags, mask, delta) if (pI830->use_ttm_batch) { \
- intel_batchbuffer_emit_pixmap((pixmap), (flags), (mask), \
+ intelddx_batchbuffer_emit_pixmap((pixmap), (flags), (mask), \
pI830->batch->buf, (pI830->batch->ptr - pI830->batch->map), (delta)); \
pI830->batch->ptr += 4; \
} else { \
diff --git a/src/intel_bufmgr_ttm.c b/src/intel_bufmgr_ttm.c
index a476f82..ccc93f4 100644
--- a/src/intel_bufmgr_ttm.c
+++ b/src/intel_bufmgr_ttm.c
@@ -87,8 +87,8 @@ struct intel_bo_list {
void (*destroy)(void *node);
};
-typedef struct _dri_bufmgr_ttm {
- dri_bufmgr bufmgr;
+typedef struct _ddx_bufmgr_ttm {
+ ddx_bufmgr bufmgr;
int fd;
unsigned int fence_type;
@@ -99,15 +99,15 @@ typedef struct _dri_bufmgr_ttm {
struct intel_bo_list list;
struct intel_bo_list reloc_list;
-} dri_bufmgr_ttm;
+} ddx_bufmgr_ttm;
-typedef struct _dri_bo_ttm {
- dri_bo bo;
+typedef struct _ddx_bo_ttm {
+ ddx_bo bo;
int refcount; /* Protected by bufmgr->mutex */
drmBO drm_bo;
const char *name;
-} dri_bo_ttm;
+} ddx_bo_ttm;
typedef struct _dri_fence_ttm
{
@@ -238,14 +238,14 @@ static void intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list)
}
}
-static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, unsigned flags,
+static int intel_add_validate_buffer(struct intel_bo_list *list, ddx_bo *buf, unsigned flags,
unsigned mask, int *itemLoc, void (*destroy_cb)(void *))
{
struct intel_bo_node *node, *cur;
drmMMListHead *l;
int count = 0;
int ret = 0;
- drmBO *buf_bo = &((dri_bo_ttm *)buf)->drm_bo;
+ drmBO *buf_bo = &((ddx_bo_ttm *)buf)->drm_bo;
cur = NULL;
for (l = list->list.next; l != &list->list; l = l->next) {
@@ -412,18 +412,18 @@ driFenceSignaled(DriFenceObject * fence, unsigned type)
}
#endif
-static dri_bo *
-dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name,
+static ddx_bo *
+dri_ttm_alloc(ddx_bufmgr *bufmgr, const char *name,
unsigned long size, unsigned int alignment,
unsigned int location_mask)
{
- dri_bufmgr_ttm *ttm_bufmgr;
- dri_bo_ttm *ttm_buf;
+ ddx_bufmgr_ttm *ttm_bufmgr;
+ ddx_bo_ttm *ttm_buf;
unsigned int pageSize = getpagesize();
int ret;
unsigned int flags, hint;
- ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
+ ttm_bufmgr = (ddx_bufmgr_ttm *)bufmgr;
ttm_buf = malloc(sizeof(*ttm_buf));
if (!ttm_buf)
@@ -462,28 +462,28 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name,
* privelege for the non-fake case, and the lock in the fake case where we were
* working around the X Server not creating buffers and passing handles to us.
*/
-static dri_bo *
-dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name,
+static ddx_bo *
+dri_ttm_alloc_static(ddx_bufmgr *bufmgr, const char *name,
unsigned long offset, unsigned long size, void *virtual,
unsigned int location_mask)
{
return NULL;
}
-/** Returns a dri_bo wrapping the given buffer object handle.
+/** Returns a ddx_bo wrapping the given buffer object handle.
*
* This can be used when one application needs to pass a buffer object
* to another.
*/
-dri_bo *
-intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
+ddx_bo *
+intelddx_ttm_bo_create_from_handle(ddx_bufmgr *bufmgr, const char *name,
unsigned int handle)
{
- dri_bufmgr_ttm *ttm_bufmgr;
- dri_bo_ttm *ttm_buf;
+ ddx_bufmgr_ttm *ttm_bufmgr;
+ ddx_bo_ttm *ttm_buf;
int ret;
- ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
+ ttm_bufmgr = (ddx_bufmgr_ttm *)bufmgr;
ttm_buf = malloc(sizeof(*ttm_buf));
if (!ttm_buf)
@@ -510,18 +510,18 @@ intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
}
static void
-dri_ttm_bo_reference(dri_bo *buf)
+dri_ttm_bo_reference(ddx_bo *buf)
{
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ ddx_bo_ttm *ttm_buf = (ddx_bo_ttm *)buf;
ttm_buf->refcount++;
}
static void
-dri_ttm_bo_unreference(dri_bo *buf)
+dri_ttm_bo_unreference(ddx_bo *buf)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ ddx_bufmgr_ttm *bufmgr_ttm = (ddx_bufmgr_ttm *)buf->bufmgr;
+ ddx_bo_ttm *ttm_buf = (ddx_bo_ttm *)buf;
if (!buf)
return;
@@ -544,13 +544,13 @@ dri_ttm_bo_unreference(dri_bo *buf)
}
static int
-dri_ttm_bo_map(dri_bo *buf, Bool write_enable)
+dri_ttm_bo_map(ddx_bo *buf, Bool write_enable)
{
- dri_bufmgr_ttm *bufmgr_ttm;
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ ddx_bufmgr_ttm *bufmgr_ttm;
+ ddx_bo_ttm *ttm_buf = (ddx_bo_ttm *)buf;
unsigned int flags;
- bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
+ bufmgr_ttm = (ddx_bufmgr_ttm *)buf->bufmgr;
flags = DRM_BO_FLAG_READ;
if (write_enable)
@@ -566,15 +566,15 @@ dri_ttm_bo_map(dri_bo *buf, Bool write_enable)
}
static int
-dri_ttm_bo_unmap(dri_bo *buf)
+dri_ttm_bo_unmap(ddx_bo *buf)
{
- dri_bufmgr_ttm *bufmgr_ttm;
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ ddx_bufmgr_ttm *bufmgr_ttm;
+ ddx_bo_ttm *ttm_buf = (ddx_bo_ttm *)buf;
if (buf == NULL)
return 0;
- bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
+ bufmgr_ttm = (ddx_bufmgr_ttm *)buf->bufmgr;
assert(buf->virtual != NULL);
@@ -587,19 +587,19 @@ dri_ttm_bo_unmap(dri_bo *buf)
return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo);
}
-/* Returns a dri_bo wrapping the given buffer object handle.
+/* Returns a ddx_bo wrapping the given buffer object handle.
*
* This can be used when one application needs to pass a buffer object
* to another.
*/
dri_fence *
-intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name,
+intelddx_ttm_fence_create_from_arg(ddx_bufmgr *bufmgr, const char *name,
drm_fence_arg_t *arg)
{
- dri_bufmgr_ttm *ttm_bufmgr;
+ ddx_bufmgr_ttm *ttm_bufmgr;
dri_fence_ttm *ttm_fence;
- ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
+ ttm_bufmgr = (ddx_bufmgr_ttm *)bufmgr;
ttm_fence = malloc(sizeof(*ttm_fence));
if (!ttm_fence)
@@ -641,7 +641,7 @@ static void
dri_ttm_fence_unreference(dri_fence *fence)
{
dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
+ ddx_bufmgr_ttm *bufmgr_ttm = (ddx_bufmgr_ttm *)fence->bufmgr;
if (!fence)
return;
@@ -668,7 +668,7 @@ static void
dri_ttm_fence_wait(dri_fence *fence)
{
dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
+ ddx_bufmgr_ttm *bufmgr_ttm = (ddx_bufmgr_ttm *)fence->bufmgr;
int ret;
ret = drmFenceWait(bufmgr_ttm->fd, 0, &fence_ttm->drm_fence, 0);
@@ -685,9 +685,9 @@ dri_ttm_fence_wait(dri_fence *fence)
}
static void
-dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr)
+ddx_bufmgr_ttm_destroy(ddx_bufmgr *bufmgr)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr;
+ ddx_bufmgr_ttm *bufmgr_ttm = (ddx_bufmgr_ttm *)bufmgr;
intel_bo_free_list(&bufmgr_ttm->list);
intel_bo_free_list(&bufmgr_ttm->reloc_list);
@@ -698,19 +698,19 @@ dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr)
static void intel_dribo_destroy_callback(void *priv)
{
- dri_bo *dribo = priv;
+ ddx_bo *dribo = priv;
if (dribo) {
- dri_bo_unreference(dribo);
+ ddx_bo_unreference(dribo);
}
}
static void
-dri_ttm_emit_reloc(dri_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset,
- dri_bo *relocatee)
+dri_ttm_emit_reloc(ddx_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t offset,
+ ddx_bo *relocatee)
{
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)batch_buf;
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
+ ddx_bo_ttm *ttm_buf = (ddx_bo_ttm *)batch_buf;
+ ddx_bufmgr_ttm *bufmgr_ttm = (ddx_bufmgr_ttm *)batch_buf->bufmgr;
int newItem;
struct intel_reloc_info reloc;
int mask;
@@ -724,7 +724,7 @@ dri_ttm_emit_reloc(dri_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t o
return;
if (ret == 1) {
- dri_bo_reference(relocatee);
+ ddx_bo_reference(relocatee);
}
reloc.type = I915_RELOC_TYPE_0;
@@ -739,13 +739,13 @@ dri_ttm_emit_reloc(dri_bo *batch_buf, uint32_t flags, uint32_t delta, uint32_t o
static void *
-dri_ttm_process_reloc(dri_bo *batch_buf, uint32_t *count)
+dri_ttm_process_reloc(ddx_bo *batch_buf, uint32_t *count)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
+ ddx_bufmgr_ttm *bufmgr_ttm = (ddx_bufmgr_ttm *)batch_buf->bufmgr;
void *ptr;
int itemLoc;
- dri_bo_unmap(batch_buf);
+ ddx_bo_unmap(batch_buf);
intel_add_validate_buffer(&bufmgr_ttm->list, batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE, &itemLoc, NULL);
@@ -756,9 +756,9 @@ dri_ttm_process_reloc(dri_bo *batch_buf, uint32_t *count)
}
static void
-dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence)
+dri_ttm_post_submit(ddx_bo *batch_buf, dri_fence **last_fence)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
+ ddx_bufmgr_ttm *bufmgr_ttm = (ddx_bufmgr_ttm *)batch_buf->bufmgr;
intel_free_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list);
intel_free_reloc_list(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list);
@@ -775,11 +775,11 @@ dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence)
* \param fence_type_flush Driver-specific fence type used for fences with a
* flush.
*/
-dri_bufmgr *
-intel_bufmgr_ttm_init(int fd, unsigned int fence_type,
+ddx_bufmgr *
+intelddx_bufmgr_ttm_init(int fd, unsigned int fence_type,
unsigned int fence_type_flush, int batch_size)
{
- dri_bufmgr_ttm *bufmgr_ttm;
+ ddx_bufmgr_ttm *bufmgr_ttm;
bufmgr_ttm = malloc(sizeof(*bufmgr_ttm));
bufmgr_ttm->fd = fd;
@@ -801,7 +801,7 @@ intel_bufmgr_ttm_init(int fd, unsigned int fence_type,
bufmgr_ttm->bufmgr.fence_reference = dri_ttm_fence_reference;
bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference;
bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait;
- bufmgr_ttm->bufmgr.destroy = dri_bufmgr_ttm_destroy;
+ bufmgr_ttm->bufmgr.destroy = ddx_bufmgr_ttm_destroy;
bufmgr_ttm->bufmgr.emit_reloc = dri_ttm_emit_reloc;
bufmgr_ttm->bufmgr.process_relocs = dri_ttm_process_reloc;
bufmgr_ttm->bufmgr.post_submit = dri_ttm_post_submit;
diff --git a/src/intel_bufmgr_ttm.h b/src/intel_bufmgr_ttm.h
index 0738839..d67a151 100644
--- a/src/intel_bufmgr_ttm.h
+++ b/src/intel_bufmgr_ttm.h
@@ -4,14 +4,14 @@
#include "dri_bufmgr.h"
-extern dri_bo *intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
+extern ddx_bo *intelddx_ttm_bo_create_from_handle(ddx_bufmgr *bufmgr, const char *name,
unsigned int handle);
-dri_fence *intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name,
+dri_fence *intelddx_ttm_fence_create_from_arg(ddx_bufmgr *bufmgr, const char *name,
drm_fence_arg_t *arg);
-dri_bufmgr *intel_bufmgr_ttm_init(int fd, unsigned int fence_type,
+ddx_bufmgr *intelddx_bufmgr_ttm_init(int fd, unsigned int fence_type,
unsigned int fence_type_flush, int batch_size);
#endif
commit 13cc4cfb03a3d79e1acd7a8bdb950fe2aec18dd7
Author: Dave Airlie <airlied at redhat.com>
Date: Thu Nov 1 10:43:10 2007 +1100
intel: add support for unsnooped cached mappings to batchbuffer code
diff --git a/src/dri_bufmgr.c b/src/dri_bufmgr.c
index 8f1d432..3c20789 100644
--- a/src/dri_bufmgr.c
+++ b/src/dri_bufmgr.c
@@ -39,9 +39,8 @@ dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 |
DRM_BO_FLAG_MEM_PRIV1 | DRM_BO_FLAG_MEM_PRIV2 |
- DRM_BO_FLAG_MEM_PRIV3 |
- DRM_BO_FLAG_MEM_PRIV4)) == 0);
-
+ DRM_BO_FLAG_MEM_PRIV3 | DRM_BO_FLAG_MEM_PRIV4 |
+ DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED)) == 0);
return bufmgr->bo_alloc(bufmgr, name, size, alignment, location_mask);
}
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 3106db9..069df40 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -400,7 +400,7 @@ static void *I830EXACreatePixmap(ScreenPtr pScreen, int size, int align)
return new_priv;
new_priv->bo = dri_bo_alloc(pI830->bufmgr, "pixmap",
- size, 4096, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_MEM_LOCAL);
+ size, 4096, DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED);
return new_priv;
}
diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index 24e4866..fdb7b51 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -88,7 +88,7 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
batch->buf = dri_bo_alloc(pI830->bufmgr, "batchbuffer",
pI830->maxBatchSize, 4096,
- DRM_BO_FLAG_MEM_TT);
+ DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_CACHED | DRM_BO_FLAG_CACHED_MAPPED);
dri_bo_map(batch->buf, TRUE);
batch->map = batch->buf->virtual;
batch->size = pI830->maxBatchSize;
commit 59f6c2912a39fe7dfc687f0a0cc5a79a9623177f
Merge: cc25171... ecd995d...
Author: Dave Airlie <airlied at redhat.com>
Date: Wed Oct 31 12:38:19 2007 +1100
Merge branch 'master' into intel-batchbuffer
commit ecd995d533d28b622afc71a20504d47c33ff5b8d
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue Oct 30 18:20:49 2007 -0700
Fix builds without DRI
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 0ab7e8f..488232d 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -172,6 +172,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdlib.h>
#include <stdio.h>
#include <sys/mman.h>
+#include <errno.h>
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -202,7 +203,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef XF86DRI
#include "dri.h"
#include <sys/ioctl.h>
-#include <errno.h>
#ifdef XF86DRI_MM
#include "xf86mm.h"
#endif
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 91d7beb..d9f8a26 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -313,12 +313,14 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
while (pI830->memory_list->next->next != NULL) {
i830_memory *mem = pI830->memory_list->next;
+#ifdef XF86DRI
/* Don't reset BO allocator, which we set up at init. */
if (pI830->memory_manager == mem) {
mem = mem->next;
if (mem->next == NULL)
break;
}
+#endif
i830_free_memory(pScrn, pI830->memory_list->next);
}
@@ -825,11 +827,14 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name,
I830Ptr pI830 = I830PTR(pScrn);
i830_memory *mem;
+#ifdef XF86DRI_MM
if (pI830->memory_manager && !(flags & NEED_PHYSICAL_ADDR) &&
!(flags & NEED_LIFETIME_FIXED))
{
return i830_allocate_memory_bo(pScrn, name, size, alignment, flags);
- } else {
+ } else
+#endif
+ {
mem = i830_allocate_aperture(pScrn, name, size, alignment, flags);
if (mem == NULL)
return NULL;
commit 7c88b58a93fce9fda59b6344acb87af16336e287
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date: Tue Oct 30 18:20:15 2007 -0700
Clear compiler error: "void functions cannot return values"
diff --git a/src/i830_display.c b/src/i830_display.c
index 292814c..a99b4a5 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -224,9 +224,9 @@ static void i9xx_clock(int refclk, intel_clock_t *clock)
static void intel_clock(I830Ptr pI830, int refclk, intel_clock_t *clock)
{
if (IS_I9XX(pI830))
- return i9xx_clock (refclk, clock);
+ i9xx_clock (refclk, clock);
else
- return i8xx_clock (refclk, clock);
+ i8xx_clock (refclk, clock);
}
static void
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);
}
commit 9f9b888525b274036d301d6e06351583d0415f9e
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 18 11:25:24 2007 -0700
Warn in the log if we choose a PLL clock that's way out of line.
diff --git a/src/i830_display.c b/src/i830_display.c
index 92e52ed..292814c 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -1025,6 +1025,14 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
if (!ok)
FatalError("Couldn't find PLL settings for mode!\n");
+ if (fabs(adjusted_mode->Clock - clock.dot) / clock.dot > .02) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Chosen PLL clock of %.1f Mhz more than 2%% away from "
+ "desired %.1f Mhz\n",
+ (float)clock.dot / 1000,
+ (float)adjusted_mode->Clock / 1000);
+ }
+
fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
dpll = DPLL_VGA_MODE_DIS;
commit 1f8bf110394cc1df66aae9acf5c818145ae19b52
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 18 11:17:38 2007 -0700
Add some nickle scripts for looking at PLL issues.
While here, move similar nickle scripts under src/scripts/
diff --git a/src/fix.5c b/src/fix.5c
deleted file mode 100644
index b758a43..0000000
--- a/src/fix.5c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Convert CSC fix point values to floats
- */
-
-real fixval (int fix)
-{
- int exp = fix >> 9;
- int mant = fix & ((1 << 9) - 1);
- real ret;
- if (exp == 0x7)
- return 1.0;
- ret = (2 ** -exp) * mant / (1 << 9);
- return ret;
-}
diff --git a/src/scripts/clock-graph.5c b/src/scripts/clock-graph.5c
new file mode 100644
index 0000000..98500e1
--- /dev/null
+++ b/src/scripts/clock-graph.5c
@@ -0,0 +1,148 @@
+autoload Cairo;
+import Cairo;
+library "examples/sort.5c";
+import Sort;
+
+int width = 1000, height = 200;
+
+int min = 0xffffffff;
+int max = 0;
+
+int max_clocks = 1000;
+int[4][max_clocks] clocks;
+int[4] clock_count = {0...};
+
+int[4] p2vals = {5,10,7,14};
+
+cairo_t cr = Cairo::new(width, height);
+
+void calc_p2(int p2i)
+{
+ int p2 = p2vals[p2i];
+ int min_p, max_p;
+
+ clocks[p2i] = (int [max_clocks]){0...};
+
+ if (p2 == 7 || p2 == 14) {
+ /* LVDS */
+ min_p = 7;
+ max_p = 98;
+ } else {
+ /* SDVO/DAC */
+ min_p = 5;
+ max_p = 80;
+ }
+
+ for (int m1 = 10; m1 <= 20; m1++) {
+ for (int m2 = 5; m2 <= 9; m2++) {
+ for (int n = 3; n <= 8; n++) {
+ for (int p1 = 1; p1 <= 8; p1++) {
+ int ref = 96000000;
+ int m = 5 * (m1 + 2) + (m2 + 2);
+ int p = p1 * p2;
+ int vco = floor(ref * m / (n + 2));
+ int clock = floor(vco / p);
+
+ if (p < min_p || p > max_p)
+ continue;
+ if (m < 70 || m > 120)
+ continue;
+ if (m2 > m1)
+ continue; /* won't happen */
+ if (vco < 1400000000 ||
+ vco > 2800000000)
+ continue;
+
+/*
+ printf("clock: %d (%d,%d), %d, "
+ "(%d,%d)\n",
+ floor(clock / 1000),
+ m1, m2, n, p1, p2);
+*/
+
+ clocks[p2i][clock_count[p2i]] = clock;
+ clock_count[p2i]++;
+ }
+ }
+ }
+ }
+}
+
+bool sort_p2(poly a, poly b)
+{
+ return a > b;
+}
+
+int min_rate = 25000 * 1000;
+int max_rate = 200000 * 1000;
+
+real scale_x(real clock)
+{
+ int min_x = 75, max_x = width - 50;
+
+ real frac = (clock - min_rate) / (max_rate - min_rate);
+
+ return min_x + frac * (max_x - min_x);
+}
+
+for (p2i = 0; p2i < dim(p2vals); p2i++) {
+ int p2 = p2vals[p2i];
+ calc_p2(p2i);
+ /*qsort(&p2vals[p2i], sort_p2);*/
+
+ switch (p2) {
+ case 5:
+ set_source_rgb(cr, 1,0,0);
+ break;
+ case 10:
+ set_source_rgb(cr, 0,1,0);
+ break;
+ case 7:
+ set_source_rgb(cr, 0,0,1);
+ break;
+ case 14:
+ set_source_rgb(cr, 0,0,0);
+ break;
+ }
+ for (int i = 0; i < clock_count[p2i]; i++) {
+ int clock = clocks[p2i][i];
+ real xpos;
+
+ if (clock < min_rate || clock > max_rate)
+ continue;
+
+ xpos = scale_x(clock);
+ move_to(cr, xpos, p2i / (dim(p2vals) + 1) * height);
+ line_to(cr, xpos, (p2i + 1) / (dim(p2vals) + 1) * height);
+ stroke(cr);
+ }
+
+ set_source_rgb(cr, 0, 0, 0);
+ string p2label = sprintf("p2 = %d", p2);
+ move_to(cr, 5, (p2i + .5) / (dim(p2vals) + 1) * height + 4);
+ show_text(cr, p2label);
+}
+
+void label_clock(real clock) {
+ real center_x = scale_x(clock);
+ string label = sprintf("%d", floor((clock + 500) / 1000000));
+ text_extents_t e = text_extents(cr, label);
+ real left_x = center_x - e.x_advance / 2;
+ save(cr);
+ move_to(cr, left_x, height - 20);
+ show_text(cr, label);
+ restore(cr);
+}
+
+label_clock(min_rate);
+label_clock(max_rate);
+label_clock(140 * 1000 * 1000);
+label_clock(115 * 1000 * 1000);
+label_clock(100 * 1000 * 1000);
+label_clock(82 * 1000 * 1000);
+
+string xlabel = "Clock in Mhz";
+text_extents_t e = text_extents(cr, xlabel);
+move_to(cr, width / 2 - e.x_advance / 2, height - 5);
+show_text(cr, xlabel);
+sleep(10);
diff --git a/src/scripts/clock.5c b/src/scripts/clock.5c
new file mode 100644
index 0000000..8ee9d90
--- /dev/null
+++ b/src/scripts/clock.5c
@@ -0,0 +1,40 @@
+int p2 = 14;
+int min_p, max_p;
+
+if (p2 == 7 || p2 == 14) {
+ /* LVDS */
+ min_p = 7;
+ max_p = 98;
+} else {
+ /* SDVO/DAC */
+ min_p = 5;
+ max_p = 80;
+}
+
+for (int m1 = 10; m1 <= 20; m1++) {
+ for (int m2 = 5; m2 <= 9; m2++) {
+ for (int n = 3; n <= 8; n++) {
+ for (int p1 = 1; p1 <= 8; p1++) {
+ int ref = 96000000;
+ int m = 5 * (m1 + 2) + (m2 + 2);
+ int p = p1 * p2;
+ int vco = floor(ref * m / (n + 2));
+ int clock = floor(vco / p);
+
+ if (p < min_p || p > max_p)
+ continue;
+ if (m < 70 || m > 120)
+ continue;
+ if (m2 > m1)
+ continue; /* won't happen */
+ if (vco < 1400000000 ||
+ vco > 2800000000)
+ continue;
+
+ printf("clock: %d (%d,%d),%d,(%d,%d)\n",
+ floor(clock / 1000),
+ m1, m2, n, p1, p2);
+ }
+ }
+ }
+}
diff --git a/src/scripts/fix.5c b/src/scripts/fix.5c
new file mode 100644
index 0000000..b758a43
--- /dev/null
+++ b/src/scripts/fix.5c
@@ -0,0 +1,14 @@
+/*
+ * Convert CSC fix point values to floats
+ */
+
+real fixval (int fix)
+{
+ int exp = fix >> 9;
+ int mant = fix & ((1 << 9) - 1);
+ real ret;
+ if (exp == 0x7)
+ return 1.0;
+ ret = (2 ** -exp) * mant / (1 << 9);
+ return ret;
+}
diff --git a/src/scripts/tv.5c b/src/scripts/tv.5c
new file mode 100644
index 0000000..b4a2ba6
--- /dev/null
+++ b/src/scripts/tv.5c
@@ -0,0 +1,128 @@
+/*
+ * tv.5c
+ *
+ * Compute tv encoder subcarrier dda constants
+ *
+ * The TV encoder subcarrier must be set precisely to the
+ * required frequency or the cumulative phase errors will be
+ * quite visible in the output. To accomplish this, the TV encoder
+ * has a complex circuit that takes a fixed clock, generated by the PLL
+ * and generates a precise subcarrier clock from that using the following
+ * formula:
+ *
+ * subcarrier = pixel_clock * (S1 + (S2 + (S3/Z3)) / Z2) / 4096
+ *
+ * Careful selection of the constants will provide the necessarily
+ * precise clock.
+ *
+ * In the code below, S1 is represented by dda1, S2/Z2 by dda2 and S3/Z3
+ * by dda3.
+ */
+
+typedef struct {
+ int step;
+ int size;
+} term_t;
+
+/*
+ * Find the approximation closest, but no larger than 'v', where
+ * 0 <= v < 1, and the result denominator must be less than 30000.
+ */
+term_t approx (rational v)
+{
+ rational best_dist = 1.0;
+ term_t best;
+
+ for (int den = 20000; den < 30000; den++)
+ {
+ int num = floor (v * den);
+ term_t approx = { step = num, size = den };
+ rational dist = v - approx.step/approx.size;
+ if (dist >= 0 && dist < best_dist)
+ {
+ best_dist = dist;
+ best = approx;
+ }
+ }
+ return best;
+}
+
+typedef struct {
+ rational subcarrier;
+ rational pixel;
+ rational result;
+ term_t dda1;
+ term_t dda2;
+ term_t dda3;
+} dda;
+
+/*
+ * Compute the dda constants for the given pixel clock and
+ * desired subcarrier frequency
+ */
+
+dda find_dda (rational pixel, rational subcarrier)
+{
+ dda d;
+
+ d.subcarrier = subcarrier;
+ d.pixel = pixel;
+
+ rational dda1 = subcarrier / pixel * 4096;
+ d.dda1 = (term_t) { step = floor (dda1), size = 4096 };
+
+ rational dda2 = dda1 - d.dda1.step;
+ d.dda2 = approx (dda2);
+
+ rational dda3 = dda2 * d.dda2.size - d.dda2.step;
+ d.dda3 = approx (dda3);
+
+ /* Compute the resulting pixel clock to compare */
+ d.result = d.pixel * (d.dda1.step +
+ (d.dda2.step + d.dda3.step/d.dda3.size) /
+ d.dda2.size) / d.dda1.size;
+ return d;
+}
+
+/*
+ * Print out the computed constants
+ */
+void print_dda (dda d)
+{
+ printf ("\t/* desired %9.7f actual %9.7f clock %g */\n",
+ d.subcarrier, d.result, d.pixel);
+ printf ("\t.dda1_inc\t= %6d,\n", d.dda1.step);
+ printf ("\t.dda2_inc\t= %6d,\t.dda2_size\t= %6d,\n",
+ d.dda2.step, d.dda2.step != 0 ? d.dda2.size : 0);
+ printf ("\t.dda3_inc\t= %6d,\t.dda3_size\t= %6d,\n",
+ d.dda3.step, d.dda3.step != 0 ? d.dda3.size : 0);
+}
+
+/*
+ * These are all of the required subcarrier frequencies
+ */
+rational[] subcarriers = {
+ /* these are the values we use; for some reason, this generates
+ * a more stable image (at least for NTSC) */
+ 3.580, 4.434, 3.582, 3.576, 4.430,
+
+ /* these are the values pulled out of the various specs */
+ 3.579545, 4.433618, 3.582056, 3.575611, 4.433618
+};
+
+/*
+ * We fix the pixel clock to a value which the hardware can
+ * generate exactly
+ */
+rational pixel = 107.520;
+
+void main ()
+{
+ for (int i = 0; i < dim(subcarriers); i++)
+ {
+ dda d = find_dda (pixel, subcarriers[i]);
+ print_dda (d);
+ }
+}
+
+main ();
diff --git a/src/tv.5c b/src/tv.5c
deleted file mode 100644
index b4a2ba6..0000000
--- a/src/tv.5c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * tv.5c
- *
- * Compute tv encoder subcarrier dda constants
- *
- * The TV encoder subcarrier must be set precisely to the
- * required frequency or the cumulative phase errors will be
- * quite visible in the output. To accomplish this, the TV encoder
- * has a complex circuit that takes a fixed clock, generated by the PLL
- * and generates a precise subcarrier clock from that using the following
- * formula:
- *
- * subcarrier = pixel_clock * (S1 + (S2 + (S3/Z3)) / Z2) / 4096
- *
- * Careful selection of the constants will provide the necessarily
- * precise clock.
- *
- * In the code below, S1 is represented by dda1, S2/Z2 by dda2 and S3/Z3
- * by dda3.
- */
-
-typedef struct {
- int step;
- int size;
-} term_t;
-
-/*
- * Find the approximation closest, but no larger than 'v', where
- * 0 <= v < 1, and the result denominator must be less than 30000.
- */
-term_t approx (rational v)
-{
- rational best_dist = 1.0;
- term_t best;
-
- for (int den = 20000; den < 30000; den++)
- {
- int num = floor (v * den);
- term_t approx = { step = num, size = den };
- rational dist = v - approx.step/approx.size;
- if (dist >= 0 && dist < best_dist)
- {
- best_dist = dist;
- best = approx;
- }
- }
- return best;
-}
-
-typedef struct {
- rational subcarrier;
- rational pixel;
- rational result;
- term_t dda1;
- term_t dda2;
- term_t dda3;
-} dda;
-
-/*
- * Compute the dda constants for the given pixel clock and
- * desired subcarrier frequency
- */
-
-dda find_dda (rational pixel, rational subcarrier)
-{
- dda d;
-
- d.subcarrier = subcarrier;
- d.pixel = pixel;
-
- rational dda1 = subcarrier / pixel * 4096;
- d.dda1 = (term_t) { step = floor (dda1), size = 4096 };
-
- rational dda2 = dda1 - d.dda1.step;
- d.dda2 = approx (dda2);
-
- rational dda3 = dda2 * d.dda2.size - d.dda2.step;
- d.dda3 = approx (dda3);
-
- /* Compute the resulting pixel clock to compare */
- d.result = d.pixel * (d.dda1.step +
- (d.dda2.step + d.dda3.step/d.dda3.size) /
- d.dda2.size) / d.dda1.size;
- return d;
-}
-
-/*
- * Print out the computed constants
- */
-void print_dda (dda d)
-{
- printf ("\t/* desired %9.7f actual %9.7f clock %g */\n",
- d.subcarrier, d.result, d.pixel);
- printf ("\t.dda1_inc\t= %6d,\n", d.dda1.step);
- printf ("\t.dda2_inc\t= %6d,\t.dda2_size\t= %6d,\n",
- d.dda2.step, d.dda2.step != 0 ? d.dda2.size : 0);
- printf ("\t.dda3_inc\t= %6d,\t.dda3_size\t= %6d,\n",
- d.dda3.step, d.dda3.step != 0 ? d.dda3.size : 0);
-}
-
-/*
- * These are all of the required subcarrier frequencies
- */
-rational[] subcarriers = {
- /* these are the values we use; for some reason, this generates
- * a more stable image (at least for NTSC) */
- 3.580, 4.434, 3.582, 3.576, 4.430,
-
- /* these are the values pulled out of the various specs */
- 3.579545, 4.433618, 3.582056, 3.575611, 4.433618
-};
-
-/*
- * We fix the pixel clock to a value which the hardware can
- * generate exactly
- */
-rational pixel = 107.520;
-
-void main ()
-{
- for (int i = 0; i < dim(subcarriers); i++)
- {
- dda d = find_dda (pixel, subcarriers[i]);
- print_dda (d);
- }
-}
-
-main ();
commit 79636b8c776ae024518103c9fa137c8498c21d48
Author: Eric Anholt <eric at anholt.net>
Date: Wed Oct 17 17:10:24 2007 -0700
Bump pciaccess version requirement for new API usage.
diff --git a/configure.ac b/configure.ac
index e5a7cf6..1e6ffe0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,7 +115,7 @@ AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
CFLAGS="$save_CFLAGS"
if test x$XSERVER_LIBPCIACCESS = xyes; then
- PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
+ PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10.0])
else
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.5.0],
have_libpciaccess=yes,
More information about the xorg-commit
mailing list