summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/nouveau
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/nouveau')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_buffers.c10
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.h13
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_fifo.c14
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_object.c59
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_object.h14
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_query.c9
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_span.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_state.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_sync.c67
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_sync.h32
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_swtcl.c45
-rw-r--r--src/mesa/drivers/dri/nouveau/nv30_state.c52
16 files changed, 151 insertions, 187 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
index 684ed7b017..fc14060c04 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
@@ -41,7 +41,7 @@ nouveau_bo_download_from_screen(GLcontext *ctx, GLuint offset, GLuint size,
DEBUG("..sys_mem\n");
in_mem = nouveau_mem_alloc(ctx, NOUVEAU_MEM_AGP, size, 0);
if (in_mem) {
- DEBUG("....via AGP\n");
+ DEBUG("....via GART\n");
/* otherwise, try blitting to faster memory and
* copying from there
*/
@@ -86,7 +86,7 @@ nouveau_bo_upload_to_screen(GLcontext *ctx, GLuint offset, GLuint size,
NOUVEAU_MEM_MAPPED,
size, 0);
if (out_mem) {
- DEBUG("....via AGP\n");
+ DEBUG("....via GART\n");
_mesa_memcpy(out_mem->map,
nbo->cpu_mem_sys + offset, size);
nouveau_memformat_flat_emit(ctx, nbo->gpu_mem, out_mem,
@@ -511,7 +511,7 @@ nouveauBufferData(GLcontext *ctx, GLenum target, GLsizeiptrARB size,
gpu_flags = 0;
break;
default:
- gpu_flags = NOUVEAU_BO_VRAM_OK | NOUVEAU_BO_AGP_OK;
+ gpu_flags = NOUVEAU_BO_VRAM_OK | NOUVEAU_BO_GART_OK;
break;
}
nouveau_bo_init_storage(ctx, gpu_flags, size, data, usage, obj);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h
index 932450fd87..3439a35e7c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h
@@ -5,7 +5,7 @@
#include "nouveau_buffers.h"
#define NOUVEAU_BO_VRAM_OK (NOUVEAU_MEM_FB | NOUVEAU_MEM_FB_ACCEPTABLE)
-#define NOUVEAU_BO_AGP_OK (NOUVEAU_MEM_AGP | NOUVEAU_MEM_AGP_ACCEPTABLE)
+#define NOUVEAU_BO_GART_OK (NOUVEAU_MEM_AGP | NOUVEAU_MEM_AGP_ACCEPTABLE)
typedef struct nouveau_bufferobj_region_t {
uint32_t start;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
index b54f68f402..857cd30584 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
@@ -32,8 +32,8 @@ nouveau_memformat_flat_emit(GLcontext *ctx,
return GL_FALSE;
}
- src_handle = (src->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaAGP;
- dst_handle = (dst->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaAGP;
+ src_handle = (src->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaTT;
+ dst_handle = (dst->type & NOUVEAU_MEM_FB) ? NvDmaFB : NvDmaTT;
src_offset += nouveau_mem_gpu_offset_get(ctx, src);
dst_offset += nouveau_mem_gpu_offset_get(ctx, dst);
@@ -138,7 +138,7 @@ nouveau_mem_gpu_offset_get(GLcontext *ctx, nouveau_mem *mem)
if (mem->type & NOUVEAU_MEM_FB)
return (uint32_t)mem->offset - nmesa->vram_phys;
else if (mem->type & NOUVEAU_MEM_AGP)
- return (uint32_t)mem->offset - nmesa->agp_phys;
+ return (uint32_t)mem->offset - nmesa->gart_phys;
else
return 0xDEADF00D;
}
@@ -299,6 +299,8 @@ nouveau_cliprects_drawable_set(nouveauContextPtr nmesa,
nmesa->pClipRects = dPriv->pClipRects;
nmesa->drawX = dPriv->x;
nmesa->drawY = dPriv->y;
+ nmesa->drawW = dPriv->w;
+ nmesa->drawH = dPriv->h;
}
static void
@@ -313,6 +315,8 @@ nouveau_cliprects_renderbuffer_set(nouveauContextPtr nmesa,
nmesa->osClipRect.y2 = nrb->mesa.Height;
nmesa->drawX = 0;
nmesa->drawY = 0;
+ nmesa->drawW = nrb->mesa.Width;
+ nmesa->drawH = nrb->mesa.Height;
}
void
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 8e11eb6134..d96b00242c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -145,10 +145,10 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
&nmesa->vram_size))
return GL_FALSE;
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_PHYSICAL,
- &nmesa->agp_phys))
+ &nmesa->gart_phys))
return GL_FALSE;
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_SIZE,
- &nmesa->agp_size))
+ &nmesa->gart_size))
return GL_FALSE;
if (!nouveauFifoInit(nmesa))
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 87e4479da3..10d2ed6e17 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -99,19 +99,22 @@ typedef struct nouveau_context {
/* The read-only regs */
volatile unsigned char* mmio;
+ /* The per-channel notifier block */
+ volatile void *notifier_block;
+
/* Physical addresses of AGP/VRAM apertures */
uint64_t vram_phys;
uint64_t vram_size;
- uint64_t agp_phys;
- uint64_t agp_size;
+ uint64_t gart_phys;
+ uint64_t gart_size;
/* Channel synchronisation */
- nouveau_notifier *syncNotifier;
+ drm_nouveau_notifier_alloc_t *syncNotifier;
/* ARB_occlusion_query / EXT_timer_query */
GLuint query_object_max;
GLboolean * query_alloc;
- nouveau_notifier *queryNotifier;
+ drm_nouveau_notifier_alloc_t *queryNotifier;
/* Additional hw-specific functions */
nouveau_hw_func hw_func;
@@ -150,7 +153,7 @@ typedef struct nouveau_context {
GLuint numClipRects;
drm_clip_rect_t *pClipRects;
drm_clip_rect_t osClipRect;
- GLuint drawX, drawY;
+ GLuint drawX, drawY, drawW, drawH;
/* The rendering context information */
GLenum current_primitive; /* the current primitive enum */
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c
index bd2b2eddd0..e9320918f9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c
@@ -99,13 +99,14 @@ void nouveauWaitForIdle(nouveauContextPtr nmesa)
GLboolean nouveauFifoInit(nouveauContextPtr nmesa)
{
drm_nouveau_fifo_alloc_t fifo_init;
- int i;
+ int i, ret;
#ifdef NOUVEAU_RING_DEBUG
return GL_TRUE;
#endif
- int ret;
+ fifo_init.fb_ctxdma_handle = NvDmaFB;
+ fifo_init.tt_ctxdma_handle = NvDmaTT;
ret=drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_FIFO_ALLOC, &fifo_init, sizeof(fifo_init));
if (ret) {
FATAL("Fifo initialization ioctl failed (returned %d)\n",ret);
@@ -117,12 +118,21 @@ GLboolean nouveauFifoInit(nouveauContextPtr nmesa)
FATAL("Unable to map the fifo (returned %d)\n",ret);
return GL_FALSE;
}
+
ret = drmMap(nmesa->driFd, fifo_init.ctrl, fifo_init.ctrl_size, &nmesa->fifo.mmio);
if (ret) {
FATAL("Unable to map the control regs (returned %d)\n",ret);
return GL_FALSE;
}
+ ret = drmMap(nmesa->driFd, fifo_init.notifier,
+ fifo_init.notifier_size,
+ &nmesa->notifier_block);
+ if (ret) {
+ FATAL("Unable to map the notifier block (returned %d)\n",ret);
+ return GL_FALSE;
+ }
+
/* Setup our initial FIFO tracking params */
nmesa->fifo.channel = fifo_init.channel;
nmesa->fifo.put_base = fifo_init.put_base;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c
index b71acff430..69f8dbf794 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_object.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c
@@ -7,61 +7,18 @@
GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa,
uint32_t handle, int class)
{
- drm_nouveau_object_init_t cto;
+ drm_nouveau_grobj_alloc_t cto;
int ret;
cto.channel = nmesa->fifo.channel;
cto.handle = handle;
cto.class = class;
- ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_OBJECT_INIT, &cto, sizeof(cto));
+ ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_GROBJ_ALLOC,
+ &cto, sizeof(cto));
return ret == 0;
}
-GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,
- uint32_t handle,
- int class,
- uint32_t offset,
- uint32_t size,
- int target,
- int access)
-{
- drm_nouveau_dma_object_init_t dma;
- int ret;
-
- dma.channel = nmesa->fifo.channel;
- dma.class = class;
- dma.handle = handle;
- dma.target = target;
- dma.access = access;
- dma.offset = offset;
- dma.size = size;
- ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_DMA_OBJECT_INIT,
- &dma, sizeof(dma));
- return ret == 0;
-}
-
-GLboolean nouveauCreateDmaObjectFromMem(nouveauContextPtr nmesa,
- uint32_t handle, int class,
- nouveau_mem *mem,
- int access)
-{
- uint32_t offset = mem->offset;
- int target = mem->type & (NOUVEAU_MEM_FB | NOUVEAU_MEM_AGP);
-
- if (!target)
- return GL_FALSE;
-
- if (target & NOUVEAU_MEM_FB)
- offset -= nmesa->vram_phys;
- else if (target & NOUVEAU_MEM_AGP)
- offset -= nmesa->agp_phys;
-
- return nouveauCreateDmaObject(nmesa, handle, class,
- offset, mem->size,
- target, access);
-}
-
void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, int handle)
{
BEGIN_RING_SIZE(subchannel, 0, 1);
@@ -74,16 +31,6 @@ void nouveauObjectInit(nouveauContextPtr nmesa)
return;
#endif
-/* We need to know vram size.. and AGP size (and even if the card is AGP..) */
- nouveauCreateDmaObject( nmesa, NvDmaFB, NV_DMA_IN_MEMORY,
- 0, nmesa->vram_size,
- NOUVEAU_MEM_FB,
- NOUVEAU_MEM_ACCESS_RW);
- nouveauCreateDmaObject( nmesa, NvDmaAGP, NV_DMA_IN_MEMORY,
- 0, nmesa->agp_size,
- NOUVEAU_MEM_AGP,
- NOUVEAU_MEM_ACCESS_RW);
-
nouveauCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d);
if (nmesa->screen->card->type>=NV_10) {
nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.h b/src/mesa/drivers/dri/nouveau/nouveau_object.h
index 0be9b4309c..8c72d014da 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_object.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_object.h
@@ -14,7 +14,7 @@ enum DMAObjects {
NvMemFormat = 0x80000022,
NvCtxSurf3D = 0x80000023,
NvDmaFB = 0xD0FB0001,
- NvDmaAGP = 0xD0AA0001,
+ NvDmaTT = 0xD0AA0001,
NvSyncNotify = 0xD0000001,
NvQueryNotify = 0xD0000002
};
@@ -31,17 +31,5 @@ extern void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, i
extern GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa,
uint32_t handle, int class);
-extern GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,
- uint32_t handle,
- int class,
- uint32_t offset,
- uint32_t size,
- int target,
- int access);
-extern GLboolean nouveauCreateDmaObjectFromMem(nouveauContextPtr nmesa,
- uint32_t handle,
- int class,
- nouveau_mem *mem,
- int access);
#endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_query.c b/src/mesa/drivers/dri/nouveau/nouveau_query.c
index de3f5b0378..0154140069 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_query.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_query.c
@@ -68,7 +68,7 @@ nouveauBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
nouveau_query_object *nq = (nouveau_query_object *)q;
- nouveau_notifier_reset(nmesa->queryNotifier, nq->notifier_id);
+ nouveau_notifier_reset(ctx, nmesa->queryNotifier, nq->notifier_id);
switch (nmesa->screen->card->type) {
case NV_20:
@@ -105,12 +105,13 @@ nouveauUpdateQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
nouveau_query_object *nq = (nouveau_query_object *)q;
int status;
- status = nouveau_notifier_status(nmesa->queryNotifier,
+ status = nouveau_notifier_status(ctx, nmesa->queryNotifier,
nq->notifier_id);
q->Ready = (status == NV_NOTIFY_STATE_STATUS_COMPLETED);
if (q->Ready)
- q->Result = nouveau_notifier_return_val(nmesa->queryNotifier,
+ q->Result = nouveau_notifier_return_val(ctx,
+ nmesa->queryNotifier,
nq->notifier_id);
}
@@ -120,7 +121,7 @@ nouveauWaitQueryResult(GLcontext *ctx, GLenum target, struct gl_query_object *q)
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
nouveau_query_object *nq = (nouveau_query_object *)q;
- nouveau_notifier_wait_status(nmesa->queryNotifier, nq->notifier_id,
+ nouveau_notifier_wait_status(ctx, nmesa->queryNotifier, nq->notifier_id,
NV_NOTIFY_STATE_STATUS_COMPLETED, 0);
nouveauUpdateQuery(ctx, target, q);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 7a4b9f1cd0..bc7f39b042 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -328,7 +328,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
static const __DRIversion ddx_expected = { 1, 2, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
-#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 6
+#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 7
#error nouveau_drm.h version doesn't match expected version
#endif
dri_interface = interface;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c b/src/mesa/drivers/dri/nouveau/nouveau_span.c
index 74dec66afc..6e3f9fadf4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_span.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c
@@ -37,6 +37,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define HAVE_HW_STENCIL_SPANS 0
#define HAVE_HW_STENCIL_PIXELS 0
+static char *fake_span[1280*1024*4];
+
#define HW_CLIPLOOP() \
do { \
int _nc = nmesa->numClipRects; \
@@ -52,6 +54,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
GLuint height = nrb->mesa.Height; \
GLubyte *map = (GLubyte *)(nrb->map ? nrb->map : nrb->mem->map) + \
(nmesa->drawY * nrb->pitch) + (nmesa->drawX * nrb->cpp); \
+ map = fake_span; \
GLuint p; \
(void) p;
@@ -120,6 +123,6 @@ nouveauSpanSetFunctions(nouveau_renderbuffer *nrb, const GLvisual *vis)
{
if (nrb->mesa._ActualFormat == GL_RGBA8)
nouveauInitPointers_ARGB8888(&nrb->mesa);
- else if (nrb->mesa._ActualFormat == GL_RGB5)
+ else // if (nrb->mesa._ActualFormat == GL_RGB5)
nouveauInitPointers_RGB565(&nrb->mesa);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index e9fd188d73..7cb805902a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -60,14 +60,14 @@ static void nouveauCalcViewport(GLcontext *ctx)
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat *m = nmesa->viewport.m;
- GLfloat xoffset = nmesa->drawX, yoffset = nmesa->drawY;
+ GLfloat xoffset = nmesa->drawX, yoffset = nmesa->drawY + nmesa->drawH;
nmesa->depth_scale = 1.0 / ctx->DrawBuffer->_DepthMaxF;
m[MAT_SX] = v[MAT_SX];
m[MAT_TX] = v[MAT_TX] + xoffset + SUBPIXEL_X;
m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = v[MAT_TY] + yoffset + SUBPIXEL_Y;
+ m[MAT_TY] = (-v[MAT_TY]) + yoffset + SUBPIXEL_Y;
m[MAT_SZ] = v[MAT_SZ] * nmesa->depth_scale;
m[MAT_TZ] = v[MAT_TZ] * nmesa->depth_scale;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_sync.c b/src/mesa/drivers/dri/nouveau/nouveau_sync.c
index 30e6696269..1d1eeede18 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_sync.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_sync.c
@@ -35,53 +35,51 @@
#include "nouveau_msg.h"
#include "nouveau_sync.h"
-nouveau_notifier *
+#define NOTIFIER(__v) \
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); \
+ volatile uint32_t *__v = (void*)nmesa->notifier_block + notifier->offset
+
+drm_nouveau_notifier_alloc_t *
nouveau_notifier_new(GLcontext *ctx, GLuint handle, GLuint count)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
- nouveau_notifier *notifier;
+ drm_nouveau_notifier_alloc_t *notifier;
+ int ret;
#ifdef NOUVEAU_RING_DEBUG
return NULL;
#endif
- notifier = CALLOC_STRUCT(nouveau_notifier_t);
+ notifier = CALLOC_STRUCT(drm_nouveau_notifier_alloc);
if (!notifier)
return NULL;
- notifier->mem = nouveau_mem_alloc(ctx,
- NOUVEAU_MEM_FB | NOUVEAU_MEM_MAPPED,
- count * NV_NOTIFIER_SIZE,
- 0);
- if (!notifier->mem) {
- FREE(notifier);
- return NULL;
- }
-
- if (!nouveauCreateDmaObjectFromMem(nmesa, handle, NV_DMA_IN_MEMORY,
- notifier->mem,
- NOUVEAU_MEM_ACCESS_RW)) {
- nouveau_mem_free(ctx, notifier->mem);
+ notifier->channel = nmesa->fifo.channel;
+ notifier->handle = handle;
+ notifier->count = count;
+ ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_NOTIFIER_ALLOC,
+ notifier, sizeof(*notifier));
+ if (ret) {
+ MESSAGE("Failed to create notifier 0x%08x: %d\n", handle, ret);
FREE(notifier);
return NULL;
}
- notifier->handle = handle;
return notifier;
}
void
-nouveau_notifier_destroy(GLcontext *ctx, nouveau_notifier *notifier)
+nouveau_notifier_destroy(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier)
{
- /*XXX: free DMA object.. */
- nouveau_mem_free(ctx, notifier->mem);
+ /*XXX: free notifier object.. */
FREE(notifier);
}
void
-nouveau_notifier_reset(nouveau_notifier *notifier, GLuint id)
+nouveau_notifier_reset(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier,
+ GLuint id)
{
- volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
+ NOTIFIER(n);
#ifdef NOUVEAU_RING_DEBUG
return;
@@ -95,26 +93,29 @@ nouveau_notifier_reset(nouveau_notifier *notifier, GLuint id)
}
GLuint
-nouveau_notifier_status(nouveau_notifier *notifier, GLuint id)
+nouveau_notifier_status(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier,
+ GLuint id)
{
- volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
+ NOTIFIER(n);
return n[NV_NOTIFY_STATE/4] >> NV_NOTIFY_STATE_STATUS_SHIFT;
}
GLuint
-nouveau_notifier_return_val(nouveau_notifier *notifier, GLuint id)
+nouveau_notifier_return_val(GLcontext *ctx,
+ drm_nouveau_notifier_alloc_t *notifier, GLuint id)
{
- volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
+ NOTIFIER(n);
return n[NV_NOTIFY_RETURN_VALUE/4];
}
GLboolean
-nouveau_notifier_wait_status(nouveau_notifier *notifier, GLuint id,
+nouveau_notifier_wait_status(GLcontext *ctx,
+ drm_nouveau_notifier_alloc_t *notifier, GLuint id,
GLuint status, GLuint timeout)
{
- volatile GLuint *n = notifier->mem->map + (id * NV_NOTIFIER_SIZE);
+ NOTIFIER(n);
unsigned int time = 0;
#ifdef NOUVEAU_RING_DEBUG
@@ -144,13 +145,13 @@ nouveau_notifier_wait_status(nouveau_notifier *notifier, GLuint id,
}
void
-nouveau_notifier_wait_nop(GLcontext *ctx, nouveau_notifier *notifier,
- GLuint subc)
+nouveau_notifier_wait_nop(GLcontext *ctx,
+ drm_nouveau_notifier_alloc_t *notifier, GLuint subc)
{
- nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ NOTIFIER(n);
GLboolean ret;
- nouveau_notifier_reset(notifier, 0);
+ nouveau_notifier_reset(ctx, notifier, 0);
BEGIN_RING_SIZE(subc, NV_NOTIFY, 1);
OUT_RING (NV_NOTIFY_STYLE_WRITE_ONLY);
@@ -158,7 +159,7 @@ nouveau_notifier_wait_nop(GLcontext *ctx, nouveau_notifier *notifier,
OUT_RING (0);
FIRE_RING();
- ret = nouveau_notifier_wait_status(notifier, 0,
+ ret = nouveau_notifier_wait_status(ctx, notifier, 0,
NV_NOTIFY_STATE_STATUS_COMPLETED,
0 /* no timeout */);
if (ret == GL_FALSE) MESSAGE("wait on notifier failed\n");
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_sync.h b/src/mesa/drivers/dri/nouveau/nouveau_sync.h
index 019d5f6629..b56cc5fb54 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_sync.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_sync.h
@@ -47,21 +47,23 @@
#define NV_NOTIFY 0x00000104
#define NV_NOTIFY_STYLE_WRITE_ONLY 0
-typedef struct nouveau_notifier_t {
- GLuint handle;
- nouveau_mem *mem;
-} nouveau_notifier;
-
-extern nouveau_notifier *nouveau_notifier_new(GLcontext *, GLuint handle,
- GLuint count);
-extern void nouveau_notifier_destroy(GLcontext *, nouveau_notifier *);
-extern void nouveau_notifier_reset(nouveau_notifier *, GLuint id);
-extern GLuint nouveau_notifier_status(nouveau_notifier *, GLuint id);
-extern GLuint nouveau_notifier_return_val(nouveau_notifier *, GLuint id);
-extern GLboolean nouveau_notifier_wait_status(nouveau_notifier *r, GLuint id,
- GLuint status, GLuint timeout);
-extern void nouveau_notifier_wait_nop(GLcontext *ctx,
- nouveau_notifier *, GLuint subc);
+extern drm_nouveau_notifier_alloc_t *
+nouveau_notifier_new(GLcontext *, GLuint handle, GLuint count);
+extern void
+nouveau_notifier_destroy(GLcontext *, drm_nouveau_notifier_alloc_t *);
+extern void
+nouveau_notifier_reset(GLcontext *, drm_nouveau_notifier_alloc_t *, GLuint id);
+extern GLuint
+nouveau_notifier_status(GLcontext *, drm_nouveau_notifier_alloc_t *, GLuint id);
+extern GLuint
+nouveau_notifier_return_val(GLcontext *, drm_nouveau_notifier_alloc_t *,
+ GLuint id);
+extern GLboolean
+nouveau_notifier_wait_status(GLcontext *, drm_nouveau_notifier_alloc_t *,
+ GLuint id, GLuint status, GLuint timeout);
+extern void
+nouveau_notifier_wait_nop(GLcontext *ctx, drm_nouveau_notifier_alloc_t *,
+ GLuint subc);
extern GLboolean nouveauSyncInitFuncs(GLcontext *ctx);
#endif
diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c
index 3bc84d862d..4576c1ede4 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c
@@ -392,15 +392,6 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa)
int i;
int slots=0;
int total_size=0;
- /* t_vertex_generic dereferences a NULL pointer if we
- * pass NULL as the vp transform...
- */
- const GLfloat ident_vp[16] = {
- 1.0, 0.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0
- };
nmesa->vertex_attr_count = 0;
RENDERINPUTS_COPY(index, nmesa->render_inputs_bitset);
@@ -431,28 +422,20 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa)
if (RENDERINPUTS_TEST(index, i))
{
slots=i+1;
- if (i==_TNL_ATTRIB_POS)
- {
- /* special-case POS */
- EMIT_ATTR(_TNL_ATTRIB_POS,EMIT_3F_VIEWPORT);
- }
- else
+ switch(attr_size[i])
{
- switch(attr_size[i])
- {
- case 1:
- EMIT_ATTR(i,EMIT_1F);
- break;
- case 2:
- EMIT_ATTR(i,EMIT_2F);
- break;
- case 3:
- EMIT_ATTR(i,EMIT_3F);
- break;
- case 4:
- EMIT_ATTR(i,EMIT_4F);
- break;
- }
+ case 1:
+ EMIT_ATTR(i,EMIT_1F);
+ break;
+ case 2:
+ EMIT_ATTR(i,EMIT_2F);
+ break;
+ case 3:
+ EMIT_ATTR(i,EMIT_3F);
+ break;
+ case 4:
+ EMIT_ATTR(i,EMIT_4F);
+ break;
}
if (i==_TNL_ATTRIB_COLOR0)
nmesa->color_offset=total_size;
@@ -465,7 +448,7 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa)
nmesa->vertex_size=_tnl_install_attrs( ctx,
nmesa->vertex_attrs,
nmesa->vertex_attr_count,
- ident_vp, 0 );
+ NULL, 0 );
assert(nmesa->vertex_size==total_size*4);
/*
diff --git a/src/mesa/drivers/dri/nouveau/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c
index ad21fa2730..9b010954b3 100644
--- a/src/mesa/drivers/dri/nouveau/nv30_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv30_state.c
@@ -639,25 +639,45 @@ void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
/** Set rasterization mode */
void (*RenderMode)(GLcontext *ctx, GLenum mode );
+/* Translate GL coords to window coords, clamping w/h to the
+ * dimensions of the window.
+ */
+static void nv30WindowCoords(nouveauContextPtr nmesa,
+ GLuint x, GLuint y, GLuint w, GLuint h,
+ GLuint *wX, GLuint *wY, GLuint *wW, GLuint *wH)
+{
+ if ((x+w) > nmesa->drawW)
+ w = nmesa->drawW - x;
+ (*wX) = x + nmesa->drawX;
+ (*wW) = w;
+
+ if ((y+h) > nmesa->drawH)
+ h = nmesa->drawH - y;
+ (*wY) = (nmesa->drawH - y) - h + nmesa->drawY;
+ (*wH) = h;
+}
+
/** Define the scissor box */
static void nv30Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ GLuint wX, wY, wW, wH;
/* There's no scissor enable bit, so adjust the scissor to cover the
* maximum draw buffer bounds
*/
if (!ctx->Scissor.Enabled) {
- x = y = 0;
- w = h = 4095;
+ wX = nmesa->drawX;
+ wY = nmesa->drawY;
+ wW = nmesa->drawW;
+ wH = nmesa->drawH;
} else {
- x += nmesa->drawX;
- y += nmesa->drawY;
+ nv30WindowCoords(nmesa, x, y, w, h, &wX, &wY, &wW, &wH);
}
BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_SCISSOR_WIDTH_XPOS, 2);
- OUT_RING_CACHE(((w) << 16) | x);
- OUT_RING_CACHE(((h) << 16) | y);
+ OUT_RING_CACHE ((wW << 16) | wX);
+ OUT_RING_CACHE ((wH << 16) | wY);
}
/** Select flat or smooth shading */
@@ -751,19 +771,21 @@ static void nv30WindowMoved(nouveauContextPtr nmesa)
{
GLcontext *ctx = nmesa->glCtx;
GLfloat *v = nmesa->viewport.m;
- GLuint w = ctx->Viewport.Width;
- GLuint h = ctx->Viewport.Height;
- GLuint x = ctx->Viewport.X + nmesa->drawX;
- GLuint y = ctx->Viewport.Y + nmesa->drawY;
+ GLuint wX, wY, wW, wH;
+ nv30WindowCoords(nmesa, ctx->Viewport.X, ctx->Viewport.Y,
+ ctx->Viewport.Width, ctx->Viewport.Height,
+ &wX, &wY, &wW, &wH);
BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_VIEWPORT_DIMS_0, 2);
- OUT_RING_CACHE((w << 16) | x);
- OUT_RING_CACHE((h << 16) | y);
+ OUT_RING_CACHE ((wW << 16) | wX);
+ OUT_RING_CACHE ((wH << 16) | wY);
+
/* something to do with clears, possibly doesn't belong here */
BEGIN_RING_CACHE(NvSub3D,
NV30_TCL_PRIMITIVE_3D_VIEWPORT_COLOR_BUFFER_OFS0, 2);
- OUT_RING_CACHE(((w+x) << 16) | x);
- OUT_RING_CACHE(((h+y) << 16) | y);
+ OUT_RING_CACHE(((nmesa->drawX + nmesa->drawW) << 16) | nmesa->drawX);
+ OUT_RING_CACHE(((nmesa->drawY + nmesa->drawH) << 16) | nmesa->drawY);
+
/* viewport transform */
BEGIN_RING_CACHE(NvSub3D, NV30_TCL_PRIMITIVE_3D_VIEWPORT_XFRM_OX, 8);
OUT_RING_CACHEf (v[MAT_TX]);
@@ -786,7 +808,7 @@ static GLboolean nv30InitCard(nouveauContextPtr nmesa)
BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_SET_OBJECT1, 3);
OUT_RING(NvDmaFB);
- OUT_RING(NvDmaAGP);
+ OUT_RING(NvDmaTT);
OUT_RING(NvDmaFB);
BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_SET_OBJECT8, 1);
OUT_RING(NvDmaFB);