summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--progs/demos/winpos.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_object.c68
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_object.h13
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_sync.c7
-rw-r--r--src/mesa/drivers/x11/xm_buffer.c3
-rw-r--r--src/mesa/main/framebuffer.c1
9 files changed, 67 insertions, 41 deletions
diff --git a/progs/demos/winpos.c b/progs/demos/winpos.c
index 2ee1df69fbc..3a1a19ecdb9 100644
--- a/progs/demos/winpos.c
+++ b/progs/demos/winpos.c
@@ -77,7 +77,7 @@ static void init( void )
WindowPosFunc = &glWindowPos2fARB;
}
else
-#elif defined(GL_ARB_window_pos)
+#elif defined(GL_MESA_window_pos)
if (glutExtensionSupported("GL_MESA_window_pos")) {
printf("Using GL_MESA_window_pos\n");
WindowPosFunc = &glWindowPos2fMESA;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index f811dc1b72e..aec7b19771a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -141,9 +141,15 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_FB_PHYSICAL,
&nmesa->vram_phys))
return GL_FALSE;
+ if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_FB_SIZE,
+ &nmesa->vram_size))
+ return GL_FALSE;
if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_PHYSICAL,
&nmesa->agp_phys))
return GL_FALSE;
+ if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_SIZE,
+ &nmesa->agp_size))
+ return GL_FALSE;
if (!nouveauFifoInit(nmesa))
return GL_FALSE;
nouveauObjectInit(nmesa);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index f61fcbb48c0..f79a8675f44 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -100,7 +100,9 @@ typedef struct nouveau_context {
/* Physical addresses of AGP/VRAM apertures */
uint64_t vram_phys;
+ uint64_t vram_size;
uint64_t agp_phys;
+ uint64_t agp_size;
/* Channel synchronisation */
nouveau_notifier *syncNotifier;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c
index 302009c8b17..468b18e6d90 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_object.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c
@@ -4,17 +4,14 @@
#include "nouveau_reg.h"
-GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, int handle, int class, uint32_t flags, uint32_t dma_in, uint32_t dma_out, uint32_t dma_notifier)
+GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa,
+ uint32_t handle, int class)
{
drm_nouveau_object_init_t cto;
int ret;
cto.handle = handle;
cto.class = class;
- cto.flags = flags;
- cto.dma0= dma_in;
- cto.dma1= dma_out;
- cto.dma_notifier = dma_notifier;
ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_OBJECT_INIT, &cto, sizeof(cto));
return ret == 0;
@@ -22,6 +19,7 @@ GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, int handle, int cl
GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,
uint32_t handle,
+ int class,
uint32_t offset,
uint32_t size,
int target,
@@ -30,6 +28,7 @@ GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,
drm_nouveau_dma_object_init_t dma;
int ret;
+ dma.class = class;
dma.handle = handle;
dma.target = target;
dma.access = access;
@@ -40,6 +39,27 @@ GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,
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);
@@ -53,31 +73,25 @@ void nouveauObjectInit(nouveauContextPtr nmesa)
#endif
/* We need to know vram size.. and AGP size (and even if the card is AGP..) */
- nouveauCreateDmaObject( nmesa, NvDmaFB,
- 0, (256*1024*1024),
- 0 /*NV_DMA_TARGET_FB*/, 0 /*NV_DMA_ACCESS_RW*/);
- nouveauCreateDmaObject( nmesa, NvDmaAGP,
- nmesa->agp_phys, (128*1024*1024),
- 3 /* AGP */, 0 /* RW */);
-
- nouveauCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d,
- 0, 0, 0, 0);
+ 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,
- 0, 0, 0, 0);
- nouveauCreateContextObject(nmesa, NvImageBlit, NV10_IMAGE_BLIT,
- NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY, 0, 0, 0);
+ nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D);
+ nouveauCreateContextObject(nmesa, NvImageBlit, NV10_IMAGE_BLIT);
} else {
- nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV04_CONTEXT_SURFACES_2D,
- 0, 0, 0, 0);
- nouveauCreateContextObject(nmesa, NvCtxSurf3D, NV04_CONTEXT_SURFACES_3D,
- 0, 0, 0, 0);
- nouveauCreateContextObject(nmesa, NvImageBlit, NV_IMAGE_BLIT,
- NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY, 0, 0, 0);
+ nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV04_CONTEXT_SURFACES_2D);
+ nouveauCreateContextObject(nmesa, NvCtxSurf3D, NV04_CONTEXT_SURFACES_3D);
+ nouveauCreateContextObject(nmesa, NvImageBlit, NV_IMAGE_BLIT);
}
- nouveauCreateContextObject(nmesa, NvMemFormat,
- NV_MEMORY_TO_MEMORY_FORMAT,
- 0, 0, 0, 0);
+ nouveauCreateContextObject(nmesa, NvMemFormat, NV_MEMORY_TO_MEMORY_FORMAT);
#ifdef ALLOW_MULTI_SUBCHANNEL
nouveauObjectOnSubchannel(nmesa, NvSubCtxSurf2D, NvCtxSurf2D);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.h b/src/mesa/drivers/dri/nouveau/nouveau_object.h
index daad281029f..0be9b4309c6 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_object.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_object.h
@@ -30,15 +30,18 @@ enum DMASubchannel {
extern void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, int handle);
extern GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa,
- int handle, int class,
- uint32_t flags,
- uint32_t dma_in,
- uint32_t dma_out,
- uint32_t dma_notifier);
+ 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_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 881b20149f0..24e77750f93 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -327,8 +327,10 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 2, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 0, 0, 3 };
-
+ static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
+#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 4
+#error nouveau_drm.h version doesn't match expected version
+#endif
dri_interface = interface;
if (!driCheckDriDdxDrmVersions2("nouveau",
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_sync.c b/src/mesa/drivers/dri/nouveau/nouveau_sync.c
index c47ff3a985d..428b19b46ea 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_sync.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_sync.c
@@ -58,10 +58,9 @@ nouveau_notifier_new(GLcontext *ctx, GLuint handle, GLuint count)
return NULL;
}
- if (!nouveauCreateDmaObject(nmesa, handle, notifier->mem->offset,
- notifier->mem->size,
- 0 /* NV_DMA_TARGET_FB */,
- 0 /* NV_DMA_ACCESS_RW */)) {
+ if (!nouveauCreateDmaObjectFromMem(nmesa, handle, NV_DMA_IN_MEMORY,
+ notifier->mem,
+ NOUVEAU_MEM_ACCESS_RW)) {
nouveau_mem_free(ctx, notifier->mem);
FREE(notifier);
return NULL;
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index 187ae516cf2..a358ec25aec 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -355,8 +355,7 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
/**
* Called via gl_framebuffer::Delete() method when this buffer
- * is _really_ being
- * deleted.
+ * is _really_ being deleted.
*/
void
xmesa_delete_framebuffer(struct gl_framebuffer *fb)
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index d061d22d9b8..3fe70f449c2 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -216,6 +216,7 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
GLuint i;
assert(fb);
+ assert(fb->RefCount == 0);
_glthread_DESTROY_MUTEX(fb->Mutex);