From f6963f57d9d1e9bf630c05c1c89f188091b12fc5 Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Thu, 14 Jun 2007 00:44:16 +0200 Subject: nouveau: remove useless viewport xform with id matrix. --- src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 45 ++++++++++--------------------- 1 file changed, 14 insertions(+), 31 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') 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); /* -- cgit v1.2.3 From 17e81bda6ed1d2cc4e5c0fad895030911b4fa53c Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 8 Jun 2007 13:27:57 +1000 Subject: nouveau: NV30_TCL viewport/scissor fixes --- src/mesa/drivers/dri/nouveau/nouveau_buffers.c | 4 +++ src/mesa/drivers/dri/nouveau/nouveau_context.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_state.c | 4 +-- src/mesa/drivers/dri/nouveau/nv30_state.c | 50 ++++++++++++++++++-------- 4 files changed, 43 insertions(+), 17 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c index b54f68f402..e3968bd02f 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c @@ -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.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 87e4479da3..53f3393676 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -150,7 +150,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_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/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c index ad21fa2730..d329071d1e 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]); -- cgit v1.2.3 From 5e4a0f42f243cd5fbc8718660d78705e8c70808f Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sun, 10 Jun 2007 03:05:05 +1000 Subject: nouveau: match drm changes (0.0.7) --- src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c | 6 +-- src/mesa/drivers/dri/nouveau/nouveau_bufferobj.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_buffers.c | 6 +-- src/mesa/drivers/dri/nouveau/nouveau_context.c | 4 +- src/mesa/drivers/dri/nouveau/nouveau_context.h | 11 ++-- src/mesa/drivers/dri/nouveau/nouveau_fifo.c | 14 ++++- src/mesa/drivers/dri/nouveau/nouveau_object.c | 59 ++------------------- src/mesa/drivers/dri/nouveau/nouveau_object.h | 14 +---- src/mesa/drivers/dri/nouveau/nouveau_query.c | 9 ++-- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_span.c | 5 +- src/mesa/drivers/dri/nouveau/nouveau_sync.c | 67 ++++++++++++------------ src/mesa/drivers/dri/nouveau/nouveau_sync.h | 32 +++++------ src/mesa/drivers/dri/nouveau/nv30_state.c | 2 +- 14 files changed, 94 insertions(+), 139 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') 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 e3968bd02f..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; } 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 53f3393676..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; 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_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/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c index d329071d1e..9b010954b3 100644 --- a/src/mesa/drivers/dri/nouveau/nv30_state.c +++ b/src/mesa/drivers/dri/nouveau/nv30_state.c @@ -808,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); -- cgit v1.2.3 From 2adcd5bdd2ac4931bbbfd16140800330d3fd14f8 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 6 Jul 2007 23:55:51 +0200 Subject: NV1X don't support VIEWPORT_ORIGIN in hardware --- src/mesa/drivers/dri/nouveau/nv10_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c index 5f304ccab9..4db8296f04 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state.c @@ -739,11 +739,11 @@ static GLboolean nv10BindBuffers(nouveauContextPtr nmesa, int num_color, OUT_RING_CACHE(depth ? depth->offset : color[0]->offset); /* Always set to bottom left of buffer */ - BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4); + /*BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4); OUT_RING_CACHEf (0.0); OUT_RING_CACHEf ((GLfloat) h); OUT_RING_CACHEf (0.0); - OUT_RING_CACHEf (0.0); + OUT_RING_CACHEf (0.0);*/ return GL_TRUE; } -- cgit v1.2.3 From 69501d76fc6a45da48bf4c416ac9e15edd44e7a9 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 6 Jul 2007 23:59:29 +0200 Subject: NV_17 is different from NV_10 --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 1 + src/mesa/drivers/dri/nouveau/nouveau_state.c | 1 + src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index d96b00242c..319c0481bd 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -224,6 +224,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, nv04TriInitFunctions( ctx ); break; case NV_10: + case NV_17: case NV_20: case NV_30: case NV_40: diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index 7cb805902a..41fdd2d377 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -162,6 +162,7 @@ void nouveauDDInitState(nouveauContextPtr nmesa) nv04InitStateFuncs(nmesa->glCtx, &nmesa->glCtx->Driver); break; case NV_10: + case NV_17: nv10InitStateFuncs(nmesa->glCtx, &nmesa->glCtx->Driver); break; case NV_20: diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index 4576c1ede4..586e0b9d59 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -58,7 +58,7 @@ static void nv10ResetLineStipple( GLcontext *ctx ); static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t primitive,uint32_t size) { - if (nmesa->screen->card->type==NV_10) + if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_BEGIN_END,1); @@ -66,7 +66,7 @@ static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t pri BEGIN_RING_SIZE(NvSub3D,NV30_TCL_PRIMITIVE_3D_BEGIN_END,1); OUT_RING(primitive); - if (nmesa->screen->card->type==NV_10) + if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_VERTEX_ARRAY_DATA|NONINC_METHOD,size); else if (nmesa->screen->card->type==NV_20) BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_VERTEX_DATA|NONINC_METHOD,size); @@ -76,7 +76,7 @@ static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t pri inline void nv10FinishPrimitive(struct nouveau_context *nmesa) { - if (nmesa->screen->card->type==NV_10) + if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_BEGIN_END,1); @@ -454,7 +454,7 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa) /* * Tell the hardware about the vertex format */ - if (nmesa->screen->card->type==NV_10) { + if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) { int size; #define NV_VERTEX_ATTRIBUTE_TYPE_FLOAT 2 -- cgit v1.2.3 From a8ec5dac3c8c564b1c405798f7703e0d8e650f2d Mon Sep 17 00:00:00 2001 From: Arthur Huillet Date: Wed, 11 Jul 2007 02:48:40 +0200 Subject: bumped nouveau DRM interface version number --- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index bc7f39b042..c62063db05 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 != 7 +#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 8 #error nouveau_drm.h version doesn't match expected version #endif dri_interface = interface; -- cgit v1.2.3 From 922dadf422440e120c7123a728454e517289e430 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Wed, 11 Jul 2007 19:25:32 +0200 Subject: nouveau: nv20 does not support hw scissors --- src/mesa/drivers/dri/nouveau/nv20_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nv20_state.c b/src/mesa/drivers/dri/nouveau/nv20_state.c index 3d8d83a865..a6961edf0b 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state.c @@ -568,10 +568,10 @@ static void nv20Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) y += nmesa->drawY; } - BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SCISSOR_X2_X1, 1); + /*BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SCISSOR_X2_X1, 1); OUT_RING_CACHE((w << 16) | x ); BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SCISSOR_Y2_Y1, 1); - OUT_RING_CACHE((h << 16) | y ); + OUT_RING_CACHE((h << 16) | y );*/ } -- cgit v1.2.3 From cd8613e59d2d27b5f41d23d978afe8e33d206447 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 12 Jul 2007 11:08:17 +1000 Subject: nouveau: match drm 0.0.9 interface --- src/mesa/drivers/dri/nouveau/nouveau_buffers.c | 15 +++++---------- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c index 857cd30584..35afb36434 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c @@ -78,8 +78,8 @@ nouveau_mem_free(GLcontext *ctx, nouveau_mem *mem) if (mem->map) drmUnmap(mem->map, mem->size); - memf.flags = mem->type; - memf.region_offset = mem->offset; + memf.flags = mem->type; + memf.offset = mem->offset; drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_MEM_FREE, &memf, sizeof(memf)); FREE(mem); } @@ -111,7 +111,7 @@ nouveau_mem_alloc(GLcontext *ctx, int type, GLuint size, GLuint align) FREE(mem); return NULL; } - mem->offset = mema.region_offset; + mem->offset = mema.offset; mem->type = mema.flags; if (NOUVEAU_DEBUG & DEBUG_MEM) { @@ -120,7 +120,7 @@ nouveau_mem_alloc(GLcontext *ctx, int type, GLuint size, GLuint align) } if (type & NOUVEAU_MEM_MAPPED) - ret = drmMap(nmesa->driFd, mem->offset, mem->size, &mem->map); + ret = drmMap(nmesa->driFd, mema.map_handle, mem->size, &mem->map); if (ret) { mem->map = NULL; nouveau_mem_free(ctx, mem); @@ -135,12 +135,7 @@ nouveau_mem_gpu_offset_get(GLcontext *ctx, nouveau_mem *mem) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - 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->gart_phys; - else - return 0xDEADF00D; + return mem->offset; } static GLboolean diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index c62063db05..69b0691bb7 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 != 8 +#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 9 #error nouveau_drm.h version doesn't match expected version #endif dri_interface = interface; -- cgit v1.2.3 From e5dd38942989475f7fd8936a98738bbd57de6b50 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Thu, 12 Jul 2007 18:36:41 +0200 Subject: nv20 also don't support viewport_origin, like nv10 --- src/mesa/drivers/dri/nouveau/nv20_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nv20_state.c b/src/mesa/drivers/dri/nouveau/nv20_state.c index a6961edf0b..ccf2f6148b 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state.c @@ -764,11 +764,11 @@ static GLboolean nv20BindBuffers(nouveauContextPtr nmesa, int num_color, } /* Always set to bottom left of buffer */ - BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4); + /*BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4); OUT_RING_CACHEf (0.0); OUT_RING_CACHEf ((GLfloat) h); OUT_RING_CACHEf (0.0); - OUT_RING_CACHEf (0.0); + OUT_RING_CACHEf (0.0);*/ return GL_TRUE; } -- cgit v1.2.3 From 8fcfaa3238599f5a9b28794b748b8417e042c597 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 13 Jul 2007 23:39:24 +1000 Subject: Play "nuke the typedef" --- src/mesa/drivers/dri/nouveau/nouveau_buffers.c | 4 ++-- src/mesa/drivers/dri/nouveau/nouveau_context.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_context.h | 6 +++--- src/mesa/drivers/dri/nouveau/nouveau_driver.c | 4 ++-- src/mesa/drivers/dri/nouveau/nouveau_fifo.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_lock.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_object.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_sync.c | 23 ++++++++++++++--------- src/mesa/drivers/dri/nouveau/nouveau_sync.h | 16 +++++++++------- 9 files changed, 34 insertions(+), 27 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c index 35afb36434..f98d666563 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c @@ -69,7 +69,7 @@ void nouveau_mem_free(GLcontext *ctx, nouveau_mem *mem) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - drm_nouveau_mem_free_t memf; + struct drm_nouveau_mem_free memf; if (NOUVEAU_DEBUG & DEBUG_MEM) { fprintf(stderr, "%s: type=0x%x, offset=0x%x, size=0x%x\n", @@ -88,7 +88,7 @@ nouveau_mem * nouveau_mem_alloc(GLcontext *ctx, int type, GLuint size, GLuint align) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - drm_nouveau_mem_alloc_t mema; + struct drm_nouveau_mem_alloc mema; nouveau_mem *mem; int ret; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 319c0481bd..3b2bd21a46 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -180,7 +180,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, driParseConfigFiles (&nmesa->optionCache, &screen->optionCache, screen->driScreen->myNum, "nouveau"); - nmesa->sarea = (drm_nouveau_sarea_t *)((char *)sPriv->pSAREA + + nmesa->sarea = (struct drm_nouveau_sarea *)((char *)sPriv->pSAREA + screen->sarea_priv_offset); /* Enable any supported extensions */ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 10d2ed6e17..9a0be2cb2a 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -109,12 +109,12 @@ typedef struct nouveau_context { uint64_t gart_size; /* Channel synchronisation */ - drm_nouveau_notifier_alloc_t *syncNotifier; + struct drm_nouveau_notifier_alloc *syncNotifier; /* ARB_occlusion_query / EXT_timer_query */ GLuint query_object_max; GLboolean * query_alloc; - drm_nouveau_notifier_alloc_t *queryNotifier; + struct drm_nouveau_notifier_alloc *queryNotifier; /* Additional hw-specific functions */ nouveau_hw_func hw_func; @@ -168,7 +168,7 @@ typedef struct nouveau_context { nouveauShader *passthrough_fp; nouveauScreenRec *screen; - drm_nouveau_sarea_t *sarea; + struct drm_nouveau_sarea *sarea; __DRIcontextPrivate *driContext; /* DRI context */ __DRIscreenPrivate *driScreen; /* DRI screen */ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 00956aa8f8..ddc9535624 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -41,7 +41,7 @@ GLboolean nouveauDRMGetParam(nouveauContextPtr nmesa, unsigned int param, uint64_t* value) { - drm_nouveau_getparam_t getp; + struct drm_nouveau_getparam getp; getp.param = param; if (!value || drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_GETPARAM, @@ -56,7 +56,7 @@ GLboolean nouveauDRMSetParam(nouveauContextPtr nmesa, unsigned int param, uint64_t value) { - drm_nouveau_setparam_t setp; + struct drm_nouveau_setparam setp; setp.param = param; setp.value = value; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c index e9320918f9..7b5e96b4c2 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c @@ -98,7 +98,7 @@ void nouveauWaitForIdle(nouveauContextPtr nmesa) // here we call the fifo initialization ioctl and fill in stuff accordingly GLboolean nouveauFifoInit(nouveauContextPtr nmesa) { - drm_nouveau_fifo_alloc_t fifo_init; + struct drm_nouveau_fifo_alloc fifo_init; int i, ret; #ifdef NOUVEAU_RING_DEBUG diff --git a/src/mesa/drivers/dri/nouveau/nouveau_lock.c b/src/mesa/drivers/dri/nouveau/nouveau_lock.c index c119d14dd7..aa86c9e783 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_lock.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_lock.c @@ -44,7 +44,7 @@ void nouveauGetLock( nouveauContextPtr nmesa, GLuint flags ) { __DRIdrawablePrivate *dPriv = nmesa->driDrawable; __DRIscreenPrivate *sPriv = nmesa->driScreen; - drm_nouveau_sarea_t *sarea = nmesa->sarea; + struct drm_nouveau_sarea *sarea = nmesa->sarea; drmGetLock( nmesa->driFd, nmesa->hHWContext, flags ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c index 69f8dbf794..ec517f8b16 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_object.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c @@ -7,7 +7,7 @@ GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, uint32_t handle, int class) { - drm_nouveau_grobj_alloc_t cto; + struct drm_nouveau_grobj_alloc cto; int ret; cto.channel = nmesa->fifo.channel; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_sync.c b/src/mesa/drivers/dri/nouveau/nouveau_sync.c index 1d1eeede18..8abc847e1e 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_sync.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_sync.c @@ -39,11 +39,11 @@ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); \ volatile uint32_t *__v = (void*)nmesa->notifier_block + notifier->offset -drm_nouveau_notifier_alloc_t * +struct drm_nouveau_notifier_alloc * nouveau_notifier_new(GLcontext *ctx, GLuint handle, GLuint count) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - drm_nouveau_notifier_alloc_t *notifier; + struct drm_nouveau_notifier_alloc *notifier; int ret; #ifdef NOUVEAU_RING_DEBUG @@ -69,14 +69,16 @@ nouveau_notifier_new(GLcontext *ctx, GLuint handle, GLuint count) } void -nouveau_notifier_destroy(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier) +nouveau_notifier_destroy(GLcontext *ctx, + struct drm_nouveau_notifier_alloc *notifier) { /*XXX: free notifier object.. */ FREE(notifier); } void -nouveau_notifier_reset(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier, +nouveau_notifier_reset(GLcontext *ctx, + struct drm_nouveau_notifier_alloc *notifier, GLuint id) { NOTIFIER(n); @@ -93,7 +95,8 @@ nouveau_notifier_reset(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier, } GLuint -nouveau_notifier_status(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier, +nouveau_notifier_status(GLcontext *ctx, + struct drm_nouveau_notifier_alloc *notifier, GLuint id) { NOTIFIER(n); @@ -103,7 +106,8 @@ nouveau_notifier_status(GLcontext *ctx, drm_nouveau_notifier_alloc_t *notifier, GLuint nouveau_notifier_return_val(GLcontext *ctx, - drm_nouveau_notifier_alloc_t *notifier, GLuint id) + struct drm_nouveau_notifier_alloc *notifier, + GLuint id) { NOTIFIER(n); @@ -112,8 +116,8 @@ nouveau_notifier_return_val(GLcontext *ctx, GLboolean nouveau_notifier_wait_status(GLcontext *ctx, - drm_nouveau_notifier_alloc_t *notifier, GLuint id, - GLuint status, GLuint timeout) + struct drm_nouveau_notifier_alloc *notifier, + GLuint id, GLuint status, GLuint timeout) { NOTIFIER(n); unsigned int time = 0; @@ -146,7 +150,8 @@ nouveau_notifier_wait_status(GLcontext *ctx, void nouveau_notifier_wait_nop(GLcontext *ctx, - drm_nouveau_notifier_alloc_t *notifier, GLuint subc) + struct drm_nouveau_notifier_alloc *notifier, + GLuint subc) { NOTIFIER(n); GLboolean ret; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_sync.h b/src/mesa/drivers/dri/nouveau/nouveau_sync.h index b56cc5fb54..b76af17276 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_sync.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_sync.h @@ -47,22 +47,24 @@ #define NV_NOTIFY 0x00000104 #define NV_NOTIFY_STYLE_WRITE_ONLY 0 -extern drm_nouveau_notifier_alloc_t * +extern struct drm_nouveau_notifier_alloc * nouveau_notifier_new(GLcontext *, GLuint handle, GLuint count); extern void -nouveau_notifier_destroy(GLcontext *, drm_nouveau_notifier_alloc_t *); +nouveau_notifier_destroy(GLcontext *, struct drm_nouveau_notifier_alloc *); extern void -nouveau_notifier_reset(GLcontext *, drm_nouveau_notifier_alloc_t *, GLuint id); +nouveau_notifier_reset(GLcontext *, struct drm_nouveau_notifier_alloc *, + GLuint id); extern GLuint -nouveau_notifier_status(GLcontext *, drm_nouveau_notifier_alloc_t *, GLuint id); +nouveau_notifier_status(GLcontext *, struct drm_nouveau_notifier_alloc *, + GLuint id); extern GLuint -nouveau_notifier_return_val(GLcontext *, drm_nouveau_notifier_alloc_t *, +nouveau_notifier_return_val(GLcontext *, struct drm_nouveau_notifier_alloc *, GLuint id); extern GLboolean -nouveau_notifier_wait_status(GLcontext *, drm_nouveau_notifier_alloc_t *, +nouveau_notifier_wait_status(GLcontext *, struct drm_nouveau_notifier_alloc *, GLuint id, GLuint status, GLuint timeout); extern void -nouveau_notifier_wait_nop(GLcontext *ctx, drm_nouveau_notifier_alloc_t *, +nouveau_notifier_wait_nop(GLcontext *ctx, struct drm_nouveau_notifier_alloc *, GLuint subc); extern GLboolean nouveauSyncInitFuncs(GLcontext *ctx); -- cgit v1.2.3 From 24f85f047b8b9e9b465bd3f9af2cc113582bfc0d Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 14 Jul 2007 18:54:22 +0200 Subject: nouveau: nv10 and nv11,15 are different --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 1 + src/mesa/drivers/dri/nouveau/nouveau_object.c | 5 ++++- src/mesa/drivers/dri/nouveau/nouveau_state.c | 1 + src/mesa/drivers/dri/nouveau/nv10_state.c | 3 +-- src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 8 ++++---- 5 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 3b2bd21a46..44392c0267 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -224,6 +224,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, nv04TriInitFunctions( ctx ); break; case NV_10: + case NV_11: case NV_17: case NV_20: case NV_30: diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c index ec517f8b16..a143488e8d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_object.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c @@ -34,10 +34,13 @@ void nouveauObjectInit(nouveauContextPtr nmesa) nouveauCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d); if (nmesa->screen->card->type>=NV_10) { nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D); - nouveauCreateContextObject(nmesa, NvImageBlit, NV10_IMAGE_BLIT); } else { nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV04_CONTEXT_SURFACES_2D); nouveauCreateContextObject(nmesa, NvCtxSurf3D, NV04_CONTEXT_SURFACES_3D); + } + if (nmesa->screen->card->type>=NV_11) { + nouveauCreateContextObject(nmesa, NvImageBlit, NV10_IMAGE_BLIT); + } else { nouveauCreateContextObject(nmesa, NvImageBlit, NV_IMAGE_BLIT); } nouveauCreateContextObject(nmesa, NvMemFormat, NV_MEMORY_TO_MEMORY_FORMAT); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index 41fdd2d377..f618dcfc99 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -162,6 +162,7 @@ void nouveauDDInitState(nouveauContextPtr nmesa) nv04InitStateFuncs(nmesa->glCtx, &nmesa->glCtx->Driver); break; case NV_10: + case NV_11: case NV_17: nv10InitStateFuncs(nmesa->glCtx, &nmesa->glCtx->Driver); break; diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c index 4db8296f04..47c4b14ba6 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state.c @@ -697,8 +697,7 @@ static GLboolean nv10InitCard(nouveauContextPtr nmesa) BEGIN_RING_SIZE(NvSub3D, 0x03f4, 1); OUT_RING(0); - /* not for nv10, only for >= nv11 */ - if ((nmesa->screen->card->id>>4) >= 0x11) { + if (nmesa->screen->card->type >= NV_11) { BEGIN_RING_SIZE(NvSub3D, 0x120, 3); OUT_RING(0); OUT_RING(1); diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index 586e0b9d59..611469b6e4 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -58,7 +58,7 @@ static void nv10ResetLineStipple( GLcontext *ctx ); static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t primitive,uint32_t size) { - if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) + if ((nmesa->screen->card->type>=NV_10) && (nmesa->screen->card->type<=NV_17)) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_BEGIN_END,1); @@ -66,7 +66,7 @@ static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t pri BEGIN_RING_SIZE(NvSub3D,NV30_TCL_PRIMITIVE_3D_BEGIN_END,1); OUT_RING(primitive); - if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) + if ((nmesa->screen->card->type>=NV_10) && (nmesa->screen->card->type<=NV_17)) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_VERTEX_ARRAY_DATA|NONINC_METHOD,size); else if (nmesa->screen->card->type==NV_20) BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_VERTEX_DATA|NONINC_METHOD,size); @@ -76,7 +76,7 @@ static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t pri inline void nv10FinishPrimitive(struct nouveau_context *nmesa) { - if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) + if ((nmesa->screen->card->type>=NV_10) && (nmesa->screen->card->type<=NV_17)) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_BEGIN_END,1); @@ -454,7 +454,7 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa) /* * Tell the hardware about the vertex format */ - if ((nmesa->screen->card->type==NV_10) || (nmesa->screen->card->type==NV_17)) { + if ((nmesa->screen->card->type>=NV_10) && (nmesa->screen->card->type<=NV_17)) { int size; #define NV_VERTEX_ATTRIBUTE_TYPE_FLOAT 2 -- cgit v1.2.3 From dbfb375805d94cb80262b8816c67a8adc778bec5 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 17 Jul 2007 17:29:55 +0200 Subject: fix mesa fb binding Make sure that we bind the right buffer (draw or read) when rebinding the window framebuffer (the api doesn't allow binding different draw and read buffers at the same time, but the default window framebuffer is basically 2 fb objects, one for read, one for write, which can be different). Pass both of these two down the driver api (no driver uses this right now). --- src/mesa/drivers/dri/i915tex/intel_fbo.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_buffers.c | 7 +++++-- src/mesa/main/dd.h | 2 +- src/mesa/main/fbobject.c | 8 +++++--- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index 349912ffec..6f99f401c7 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -488,7 +488,7 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name) */ static void intel_bind_framebuffer(GLcontext * ctx, GLenum target, - struct gl_framebuffer *fb) + struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) { intel_draw_buffer(ctx, fb); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c index f98d666563..d498f616c9 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c @@ -390,9 +390,12 @@ nouveauNewRenderbuffer(GLcontext *ctx, GLuint name) } static void -nouveauBindFramebuffer(GLcontext *ctx, GLenum target, struct gl_framebuffer *fb) +nouveauBindFramebuffer(GLcontext *ctx, GLenum target, + struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { - nouveau_build_framebuffer(ctx, fb); + if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) { + nouveau_build_framebuffer(ctx, fb); + } } static void diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 88f33943b3..caa50dd682 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -782,7 +782,7 @@ struct dd_function_table { struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); void (*BindFramebuffer)(GLcontext *ctx, GLenum target, - struct gl_framebuffer *fb); + struct gl_framebuffer *fb, struct gl_framebuffer *fbread); void (*FramebufferRenderbuffer)(GLcontext *ctx, struct gl_framebuffer *fb, GLenum attachment, diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index e3bada5ae8..5345310ca1 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -924,7 +924,7 @@ check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) void GLAPIENTRY _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) { - struct gl_framebuffer *newFb; + struct gl_framebuffer *newFb, *newFbread; GLboolean bindReadBuf, bindDrawBuf; GET_CURRENT_CONTEXT(ctx); @@ -984,12 +984,14 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb); } + newFbread = newFb; } else { /* Binding the window system framebuffer (which was originally set * with MakeCurrent). */ newFb = ctx->WinSysDrawBuffer; + newFbread = ctx->WinSysReadBuffer; } ASSERT(newFb); @@ -1000,7 +1002,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) */ if (bindReadBuf) { - _mesa_reference_framebuffer(&ctx->ReadBuffer, newFb); + _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread); } if (bindDrawBuf) { @@ -1015,7 +1017,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } if (ctx->Driver.BindFramebuffer) { - ctx->Driver.BindFramebuffer(ctx, target, newFb); + ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread); } } -- cgit v1.2.3