summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-03-21 22:03:25 +0000
committerKeith Whitwell <keithw@vmware.com>2010-03-21 22:03:25 +0000
commit575b35ee6b683d77095ef21c573c1de207107e79 (patch)
tree7a41e0969fa01883c0186dc7dd3b00719e17cfbf
parentf29ac73f3f626d5779a627b7fa6fecdb60a35aab (diff)
parent9fc6c8b831e5b43ae86ece6a531fc892f6f66356 (diff)
Merge commit 'origin/master' into gallium-resources
Conflicts: src/gallium/drivers/llvmpipe/lp_texture.c src/gallium/drivers/r300/r300_context.c src/gallium/drivers/r300/r300_texture.c src/gallium/winsys/drm/radeon/core/radeon_buffer.h
-rw-r--r--include/GL/internal/dri_interface.h8
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c9
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_clear.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c278
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.h4
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c2
-rw-r--r--src/gallium/drivers/r300/r300_blit.c3
-rw-r--r--src/gallium/drivers/r300/r300_context.c7
-rw-r--r--src/gallium/drivers/r300/r300_context.h16
-rw-r--r--src/gallium/drivers/r300/r300_cs.h3
-rw-r--r--src/gallium/drivers/r300/r300_defines.h47
-rw-r--r--src/gallium/drivers/r300/r300_render.c7
-rw-r--r--src/gallium/drivers/r300/r300_screen.c4
-rw-r--r--src/gallium/drivers/r300/r300_screen.h4
-rw-r--r--src/gallium/drivers/r300/r300_state.c19
-rw-r--r--src/gallium/drivers/r300/r300_texture.c36
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h9
-rw-r--r--src/gallium/include/state_tracker/dri1_api.h2
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.c4
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c26
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c17
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_winsys.h5
-rw-r--r--src/glx/drisw_glx.c24
-rw-r--r--src/mesa/drivers/dri/common/drisw_util.c (renamed from src/mesa/drivers/dri/common/dri_sw.c)4
-rw-r--r--src/mesa/drivers/dri/common/drisw_util.h (renamed from src/mesa/drivers/dri/common/dri_sw.h)0
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_render.h4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_state.c1
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c31
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_fb.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tex.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tnl.c51
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_fb.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tex.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tnl.c51
-rw-r--r--src/mesa/drivers/dri/swrast/Makefile4
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_priv.h2
38 files changed, 375 insertions, 333 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 1d4e82e154..aa56eb45d7 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -41,7 +41,13 @@
#define DRI_INTERFACE_H
/* For archs with no drm.h */
-#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__)
+#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
+#ifndef __NOT_HAVE_DRM_H
+#define __NOT_HAVE_DRM_H
+#endif
+#endif
+
+#ifndef __NOT_HAVE_DRM_H
#include <drm.h>
#else
typedef unsigned int drm_context_t;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 86f9266c95..0f2ae05dae 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -227,6 +227,8 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
pb_size size,
const struct pb_desc *desc)
{
+ void *map;
+
if(buf->base.base.size < size)
return FALSE;
@@ -239,6 +241,13 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
if(!pb_check_usage(desc->usage, buf->base.base.usage))
return FALSE;
+
+ map = pb_map(buf->buffer, PIPE_BUFFER_USAGE_DONTBLOCK);
+ if (!map) {
+ return FALSE;
+ }
+
+ pb_unmap(buf->buffer);
return TRUE;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 45e6e44d33..71459abcfc 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -509,8 +509,8 @@ void
llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen)
{
screen->resource_create = llvmpipe_resource_create;
- screen->resource_from_handle = llvmpipe_resource_from_handle;
screen->resource_destroy = llvmpipe_resource_destroy;
+ screen->resource_from_handle = llvmpipe_resource_from_handle;
screen->resource_get_handle = llvmpipe_resource_get_handle;
screen->user_buffer_create = llvmpipe_user_buffer_create;
diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c
index 8afc95c9fc..5447904e9c 100644
--- a/src/gallium/drivers/nv50/nv50_clear.c
+++ b/src/gallium/drivers/nv50/nv50_clear.c
@@ -35,7 +35,10 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct pipe_framebuffer_state *fb = &nv50->framebuffer;
unsigned mode = 0, i;
+ const unsigned dirty = nv50->dirty;
+ /* don't need NEW_BLEND, NV50TCL_COLOR_MASK doesn't affect CLEAR_BUFFERS */
+ nv50->dirty &= NV50_NEW_FRAMEBUFFER | NV50_NEW_SCISSOR;
if (!nv50_state_validate(nv50, 64))
return;
@@ -64,5 +67,6 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1);
OUT_RING (chan, (i << 6) | 0x3c);
}
+ nv50->dirty = dirty;
}
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index d7f5863fb7..1a4606d9e2 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -109,7 +109,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_TWO_SIDED_STENCIL:
return 1;
case PIPE_CAP_GLSL:
- return 0;
+ return 1;
case PIPE_CAP_ANISOTROPIC_FILTER:
return 1;
case PIPE_CAP_POINT_SPRITE:
@@ -190,8 +190,6 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
nouveau_bo_ref(NULL, &screen->tic);
if (screen->tsc)
nouveau_bo_ref(NULL, &screen->tsc);
- if (screen->static_init)
- so_ref(NULL, &screen->static_init);
nouveau_notifier_free(&screen->sync);
nouveau_grobj_free(&screen->tesla);
@@ -204,16 +202,65 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
FREE(screen);
}
+#define BGN_RELOC(ch, bo, gr, m, n, fl) \
+ OUT_RELOC(ch, bo, (n << 18) | (gr->subc << 13) | m, fl, 0, 0)
+
+void
+nv50_screen_relocs(struct nv50_screen *screen)
+{
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *tesla = screen->tesla;
+ unsigned i;
+ const unsigned rl = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY;
+
+ MARK_RING (chan, 28, 26);
+
+ /* cause grobj autobind */
+ BEGIN_RING(chan, tesla, 0x0100, 1);
+ OUT_RING (chan, 0);
+
+ BGN_RELOC (chan, screen->tic, tesla, NV50TCL_TIC_ADDRESS_HIGH, 2, rl);
+ OUT_RELOCh(chan, screen->tic, 0, rl);
+ OUT_RELOCl(chan, screen->tic, 0, rl);
+
+ BGN_RELOC (chan, screen->tsc, tesla, NV50TCL_TSC_ADDRESS_HIGH, 2, rl);
+ OUT_RELOCh(chan, screen->tsc, 0, rl);
+ OUT_RELOCl(chan, screen->tsc, 0, rl);
+
+ BGN_RELOC (chan, screen->constbuf_misc[0],
+ tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RELOC (chan, screen->constbuf_misc[0],
+ (NV50_CB_PMISC << 16) | 0x0200, rl, 0, 0);
+
+ BGN_RELOC (chan, screen->constbuf_misc[0],
+ tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RELOC (chan, screen->constbuf_misc[0],
+ (NV50_CB_AUX << 16) | 0x0200, rl, 0, 0);
+
+ for (i = 0; i < 3; ++i) {
+ BGN_RELOC (chan, screen->constbuf_parm[i],
+ tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl);
+ OUT_RELOCh(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RELOC (chan, screen->constbuf_parm[i],
+ ((NV50_CB_PVP + i) << 16) | 0x0800, rl, 0, 0);
+ }
+}
+
struct pipe_screen *
nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
{
struct nv50_screen *screen = CALLOC_STRUCT(nv50_screen);
struct nouveau_channel *chan;
struct pipe_screen *pscreen;
- struct nouveau_stateobj *so;
unsigned chipset = dev->chipset;
unsigned tesla_class = 0;
int ret, i;
+ const unsigned rl = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
if (!screen)
return NULL;
@@ -296,64 +343,58 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
}
/* Static M2MF init */
- so = so_new(1, 3, 0);
- so_method(so, screen->m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 3);
- so_data (so, screen->sync->handle);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_emit(chan, so);
- so_ref (NULL, &so);
+ BEGIN_RING(chan, screen->m2mf,
+ NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 3);
+ OUT_RING (chan, screen->sync->handle);
+ OUT_RING (chan, chan->vram->handle);
+ OUT_RING (chan, chan->vram->handle);
/* Static 2D init */
- so = so_new(4, 7, 0);
- so_method(so, screen->eng2d, NV50_2D_DMA_NOTIFY, 4);
- so_data (so, screen->sync->handle);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_method(so, screen->eng2d, NV50_2D_OPERATION, 1);
- so_data (so, NV50_2D_OPERATION_SRCCOPY);
- so_method(so, screen->eng2d, NV50_2D_CLIP_ENABLE, 1);
- so_data (so, 0);
- so_method(so, screen->eng2d, 0x0888, 1);
- so_data (so, 1);
- so_emit(chan, so);
- so_ref(NULL, &so);
+ BEGIN_RING(chan, screen->eng2d, NV50_2D_DMA_NOTIFY, 4);
+ OUT_RING (chan, screen->sync->handle);
+ OUT_RING (chan, chan->vram->handle);
+ OUT_RING (chan, chan->vram->handle);
+ OUT_RING (chan, chan->vram->handle);
+ BEGIN_RING(chan, screen->eng2d, NV50_2D_OPERATION, 1);
+ OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY);
+ BEGIN_RING(chan, screen->eng2d, NV50_2D_CLIP_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, screen->eng2d, 0x0888, 1);
+ OUT_RING (chan, 1);
/* Static tesla init */
- so = so_new(47, 95, 24);
-
- so_method(so, screen->tesla, NV50TCL_COND_MODE, 1);
- so_data (so, NV50TCL_COND_MODE_ALWAYS);
- so_method(so, screen->tesla, NV50TCL_DMA_NOTIFY, 1);
- so_data (so, screen->sync->handle);
- so_method(so, screen->tesla, NV50TCL_DMA_ZETA, 11);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_COND_MODE, 1);
+ OUT_RING (chan, NV50TCL_COND_MODE_ALWAYS);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_DMA_NOTIFY, 1);
+ OUT_RING (chan, screen->sync->handle);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_DMA_ZETA, 11);
for (i = 0; i < 11; i++)
- so_data(so, chan->vram->handle);
- so_method(so, screen->tesla, NV50TCL_DMA_COLOR(0),
- NV50TCL_DMA_COLOR__SIZE);
+ OUT_RING (chan, chan->vram->handle);
+ BEGIN_RING(chan, screen->tesla,
+ NV50TCL_DMA_COLOR(0), NV50TCL_DMA_COLOR__SIZE);
for (i = 0; i < NV50TCL_DMA_COLOR__SIZE; i++)
- so_data(so, chan->vram->handle);
- so_method(so, screen->tesla, NV50TCL_RT_CONTROL, 1);
- so_data (so, 1);
+ OUT_RING (chan, chan->vram->handle);
+
+ BEGIN_RING(chan, screen->tesla, NV50TCL_RT_CONTROL, 1);
+ OUT_RING (chan, 1);
/* activate all 32 lanes (threads) in a warp */
- so_method(so, screen->tesla, NV50TCL_WARP_HALVES, 1);
- so_data (so, 0x2);
- so_method(so, screen->tesla, 0x1400, 1);
- so_data (so, 0xf);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_WARP_HALVES, 1);
+ OUT_RING (chan, 2);
+ BEGIN_RING(chan, screen->tesla, 0x1400, 1);
+ OUT_RING (chan, 0xf);
/* max TIC (bits 4:8) & TSC (ignored) bindings, per program type */
for (i = 0; i < 3; ++i) {
- so_method(so, screen->tesla, NV50TCL_TEX_LIMITS(i), 1);
- so_data (so, 0x54);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_TEX_LIMITS(i), 1);
+ OUT_RING (chan, 0x54);
}
/* origin is top left (set to 1 for bottom left) */
- so_method(so, screen->tesla, NV50TCL_Y_ORIGIN_BOTTOM, 1);
- so_data (so, 0);
- so_method(so, screen->tesla, NV50TCL_VP_REG_ALLOC_RESULT, 1);
- so_data (so, 8);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_Y_ORIGIN_BOTTOM, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_VP_REG_ALLOC_RESULT, 1);
+ OUT_RING (chan, 8);
/* constant buffers for immediates and VP/FP parameters */
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (32 * 4) * 4,
@@ -362,6 +403,14 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
nv50_screen_destroy(pscreen);
return NULL;
}
+ BEGIN_RING(chan, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RING (chan, (NV50_CB_PMISC << 16) | 0x0200);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RING (chan, (NV50_CB_AUX << 16) | 0x0200);
for (i = 0; i < 3; i++) {
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (256 * 4) * 4,
@@ -370,6 +419,10 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
nv50_screen_destroy(pscreen);
return NULL;
}
+ BEGIN_RING(chan, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RING (chan, ((NV50_CB_PVP + i) << 16) | 0x0800);
}
if (nouveau_resource_init(&screen->immd_heap[0], 0, 128) ||
@@ -381,80 +434,16 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
return NULL;
}
- /*
- // map constant buffers:
- // B = buffer ID (maybe more than 1 byte)
- // N = CB index used in shader instruction
- // P = program type (0 = VP, 2 = GP, 3 = FP)
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x000BBNP1);
- */
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PMISC << 16) | 0x00000200);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000001 | (NV50_CB_PMISC << 12));
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000021 | (NV50_CB_PMISC << 12));
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000031 | (NV50_CB_PMISC << 12));
-
- /* bind auxiliary constbuf to immediate data bo */
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_misc[0], (128 * 4) * 4,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_misc[0], (128 * 4) * 4,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_AUX << 16) | 0x00000200);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000201 | (NV50_CB_AUX << 12));
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000221 | (NV50_CB_AUX << 12));
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_VERTEX], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_VERTEX], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PVP << 16) | 0x00000800);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000101 | (NV50_CB_PVP << 12));
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_GEOMETRY], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_GEOMETRY], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PGP << 16) | 0x00000800);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000121 | (NV50_CB_PGP << 12));
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_FRAGMENT], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_FRAGMENT], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PFP << 16) | 0x00000800);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000131 | (NV50_CB_PFP << 12));
-
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 3 * 32 * (8 * 4),
&screen->tic);
if (ret) {
nv50_screen_destroy(pscreen);
return NULL;
}
-
- so_method(so, screen->tesla, NV50TCL_TIC_ADDRESS_HIGH, 3);
- so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 3 * 32 - 1);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_TIC_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->tic, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, screen->tic, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RING (chan, 3 * 32 - 1);
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 3 * 32 * (8 * 4),
&screen->tsc);
@@ -462,37 +451,50 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
nv50_screen_destroy(pscreen);
return NULL;
}
-
- so_method(so, screen->tesla, NV50TCL_TSC_ADDRESS_HIGH, 3);
- so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00000000); /* ignored if TSC_LINKED (0x1234) = 1 */
-
+ BEGIN_RING(chan, screen->tesla, NV50TCL_TSC_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->tsc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, screen->tsc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RING (chan, 0); /* ignored if TSC_LINKED (0x1234) == 1 */
+
+ /* map constant buffers:
+ * B = buffer ID (maybe more than 1 byte)
+ * N = CB index used in shader instruction
+ * P = program type (0 = VP, 2 = GP, 3 = FP)
+ * SET_PROGRAM_CB = 0x000BBNP1
+ */
+ BEGIN_RING_NI(chan, screen->tesla, NV50TCL_SET_PROGRAM_CB, 8);
+ /* bind immediate buffer */
+ OUT_RING (chan, 0x001 | (NV50_CB_PMISC << 12));
+ OUT_RING (chan, 0x021 | (NV50_CB_PMISC << 12));
+ OUT_RING (chan, 0x031 | (NV50_CB_PMISC << 12));
+ /* bind auxiliary constbuf to immediate data bo */
+ OUT_RING (chan, 0x201 | (NV50_CB_AUX << 12));
+ OUT_RING (chan, 0x221 | (NV50_CB_AUX << 12));
+ /* bind parameter buffers */
+ OUT_RING (chan, 0x101 | (NV50_CB_PVP << 12));
+ OUT_RING (chan, 0x121 | (NV50_CB_PGP << 12));
+ OUT_RING (chan, 0x131 | (NV50_CB_PFP << 12));
/* Vertex array limits - max them out */
for (i = 0; i < 16; i++) {
- so_method(so, screen->tesla, NV50TCL_VERTEX_ARRAY_LIMIT_HIGH(i), 2);
- so_data (so, 0x000000ff);
- so_data (so, 0xffffffff);
+ BEGIN_RING(chan, screen->tesla,
+ NV50TCL_VERTEX_ARRAY_LIMIT_HIGH(i), 2);
+ OUT_RING (chan, 0x000000ff);
+ OUT_RING (chan, 0xffffffff);
}
- so_method(so, screen->tesla, NV50TCL_DEPTH_RANGE_NEAR(0), 2);
- so_data (so, fui(0.0));
- so_data (so, fui(1.0));
+ BEGIN_RING(chan, screen->tesla, NV50TCL_DEPTH_RANGE_NEAR(0), 2);
+ OUT_RINGf (chan, 0.0f);
+ OUT_RINGf (chan, 1.0f);
/* no dynamic combination of TIC & TSC entries => only BIND_TIC used */
- so_method(so, screen->tesla, NV50TCL_LINKED_TSC, 1);
- so_data (so, 1);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_LINKED_TSC, 1);
+ OUT_RING (chan, 1);
- so_method(so, screen->tesla, NV50TCL_EDGEFLAG_ENABLE, 1);
- so_data (so, 1); /* default edgeflag to TRUE */
+ BEGIN_RING(chan, screen->tesla, NV50TCL_EDGEFLAG_ENABLE, 1);
+ OUT_RING (chan, 1); /* default edgeflag to TRUE */
- so_emit(chan, so);
- so_ref (so, &screen->static_init);
- so_ref (NULL, &so);
- nouveau_pushbuf_flush(chan, 0);
+ FIRE_RING (chan);
screen->force_push = debug_get_bool_option("NV50_ALWAYS_PUSH", FALSE);
return pscreen;
diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h
index 22fe7e46bb..092333a3b1 100644
--- a/src/gallium/drivers/nv50/nv50_screen.h
+++ b/src/gallium/drivers/nv50/nv50_screen.h
@@ -27,8 +27,6 @@ struct nv50_screen {
struct nouveau_bo *tic;
struct nouveau_bo *tsc;
- struct nouveau_stateobj *static_init;
-
boolean force_push;
};
@@ -38,4 +36,6 @@ nv50_screen(struct pipe_screen *screen)
return (struct nv50_screen *)screen;
}
+extern void nv50_screen_relocs(struct nv50_screen *);
+
#endif
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 356bdcd74b..565cf2f8b3 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -436,7 +436,7 @@ nv50_state_validate(struct nv50_context *nv50, unsigned wait_dwords)
so_emit_reloc_markers(chan, nv50->state.hw[3]); /* vp */
so_emit_reloc_markers(chan, nv50->state.hw[4]); /* fp */
so_emit_reloc_markers(chan, nv50->state.hw[17]); /* vb */
- so_emit_reloc_markers(chan, nv50->screen->static_init);
+ nv50_screen_relocs(nv50->screen);
/* No idea.. */
BEGIN_RING(chan, tesla, 0x142c, 1);
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index f99f9dffaa..bcdf950df9 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -149,6 +149,9 @@ void r300_surface_copy(struct pipe_context* pipe,
case 4:
new_format = PIPE_FORMAT_B8G8R8A8_UNORM;
break;
+ case 8:
+ new_format = PIPE_FORMAT_R16G16B16A16_UNORM;
+ break;
default:
debug_printf("r300: surface_copy: Unhandled format: %s. Falling back to software.\n"
"r300: surface_copy: Software fallback doesn't work for tiled textures.\n",
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 261117a366..e805a84290 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -33,10 +33,11 @@
#include "r300_query.h"
#include "r300_render.h"
#include "r300_screen.h"
+#include "r300_screen_buffer.h"
#include "r300_state_invariant.h"
#include "r300_texture.h"
-
-#include "radeon_winsys.h"
+#include "r300_transfer.h"
+#include "r300_winsys.h"
static void r300_destroy_context(struct pipe_context* context)
{
@@ -177,7 +178,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
/* Open up the OQ BO. */
r300->oqbo = pipe_buffer_create(screen, 4096,
- PIPE_BUFFER_USAGE_VERTEX, 4096);
+ PIPE_BUFFER_USAGE_PIXEL, 4096);
make_empty_list(&r300->query_list);
r300_init_flush_functions(r300);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index ca15d87d1f..bcf87b3866 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -31,6 +31,7 @@
#include "util/u_inlines.h"
#include "util/u_transfer.h"
+#include "r300_defines.h"
#include "r300_screen.h"
struct u_upload_mgr;
@@ -136,8 +137,6 @@ struct r300_texture_format_state {
uint32_t format2; /* R300_TX_FORMAT2: 0x4500 */
};
-#define R300_MAX_TEXTURE_LEVELS 13
-
struct r300_texture_fb_state {
/* Colorbuffer. */
uint32_t colorpitch[R300_MAX_TEXTURE_LEVELS]; /* R300_RB3D_COLORPITCH[0-3]*/
@@ -196,12 +195,6 @@ struct r300_ztop_state {
uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */
};
-#define R300_NEW_FRAGMENT_SHADER 0x00000020
-#define R300_NEW_FRAGMENT_SHADER_CONSTANTS 0x00000040
-#define R300_NEW_VERTEX_SHADER_CONSTANTS 0x10000000
-#define R300_NEW_QUERY 0x40000000
-#define R300_NEW_KITCHEN_SINK 0x7fffffff
-
/* The next several objects are not pure Radeon state; they inherit from
* various Gallium classes. */
@@ -239,12 +232,6 @@ struct r300_query {
struct r300_query* next;
};
-enum r300_buffer_tiling {
- R300_BUFFER_LINEAR = 0,
- R300_BUFFER_TILED,
- R300_BUFFER_SQUARETILED
-};
-
struct r300_texture {
/* Parent class */
struct u_resource b;
@@ -444,4 +431,3 @@ static INLINE void CTX_DBG(struct r300_context * ctx, unsigned flags,
#define DBG CTX_DBG
#endif /* R300_CONTEXT_H */
-
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index ad07efbffd..456b2ec7b9 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -26,8 +26,7 @@
#include "util/u_math.h"
#include "r300_reg.h"
-
-#include "radeon_winsys.h"
+#include "r300_winsys.h"
/* Yes, I know macros are ugly. However, they are much prettier than the code
* that they neatly hide away, and don't have the cost of function setup,so
diff --git a/src/gallium/drivers/r300/r300_defines.h b/src/gallium/drivers/r300/r300_defines.h
new file mode 100644
index 0000000000..2e04876de9
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_defines.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef R300_DEFINES_H
+#define R300_DEFINES_H
+
+#include "pipe/p_defines.h"
+
+#define R300_MAX_TEXTURE_LEVELS 13
+#define R300_MAX_DRAW_VBO_SIZE (1024 * 1024)
+
+#define R300_TEXTURE_USAGE_TRANSFER PIPE_TEXTURE_USAGE_CUSTOM
+
+/* Non-atom dirty state flags. */
+#define R300_NEW_FRAGMENT_SHADER 0x00000020
+#define R300_NEW_FRAGMENT_SHADER_CONSTANTS 0x00000040
+#define R300_NEW_VERTEX_SHADER_CONSTANTS 0x10000000
+#define R300_NEW_QUERY 0x40000000
+#define R300_NEW_KITCHEN_SINK 0x7fffffff
+
+/* Tiling flags. */
+enum r300_buffer_tiling {
+ R300_BUFFER_LINEAR = 0,
+ R300_BUFFER_TILED,
+ R300_BUFFER_SQUARETILED
+};
+
+#endif
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 65a4a6388d..fa641ae8d0 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -41,9 +41,6 @@
#include "r300_render.h"
#include "r300_state_derived.h"
-/* r300_render: Vertex and index buffer primitive emission. */
-#define R300_MAX_VBO_SIZE (1024 * 1024)
-
/* XXX The DRM rejects VAP_ALT_NUM_VERTICES.. */
//#define ENABLE_ALT_NUM_VERTS
@@ -709,9 +706,9 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render,
r300render->vbo = pipe_buffer_create(screen,
64,
PIPE_BUFFER_USAGE_VERTEX,
- R300_MAX_VBO_SIZE);
+ R300_MAX_DRAW_VBO_SIZE);
r300render->vbo_offset = 0;
- r300render->vbo_size = R300_MAX_VBO_SIZE;
+ r300render->vbo_size = R300_MAX_DRAW_VBO_SIZE;
}
r300render->vertex_size = vertex_size;
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index ec7c65f468..c0620972f1 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -26,10 +26,8 @@
#include "r300_context.h"
#include "r300_texture.h"
-
-#include "radeon_winsys.h"
-
#include "r300_screen_buffer.h"
+#include "r300_winsys.h"
/* Return the identifier behind whom the brave coders responsible for this
* amalgamation of code, sweat, and duct tape, routinely obscure their names.
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 9972a7da07..f49aae715a 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -28,10 +28,6 @@
#include "r300_chipset.h"
-#define R300_TEXTURE_USAGE_TRANSFER PIPE_TEXTURE_USAGE_CUSTOM
-
-struct radeon_winsys;
-
struct r300_screen {
/* Parent class */
struct pipe_screen screen;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 429d371f64..4759ccb5ec 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -38,8 +38,7 @@
#include "r300_state_inlines.h"
#include "r300_fs.h"
#include "r300_vs.h"
-
-#include "radeon_winsys.h"
+#include "r300_winsys.h"
/* r300_state: Functions used to intialize state context by translating
* Gallium state objects into semi-native r300 state objects. */
@@ -528,8 +527,8 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
if (tex) {
r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[0],
- tex->microtile != 0,
- tex->macrotile != 0);
+ tex->microtile,
+ tex->macrotile);
}
}
if (old_state->zsbuf &&
@@ -540,8 +539,8 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
if (tex) {
r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[0],
- tex->microtile != 0,
- tex->macrotile != 0);
+ tex->microtile,
+ tex->macrotile);
}
}
@@ -552,8 +551,8 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[level],
- tex->microtile != 0,
- tex->mip_macrotile[level] != 0);
+ tex->microtile,
+ tex->mip_macrotile[level]);
}
if (new_state->zsbuf) {
tex = (struct r300_texture*)new_state->zsbuf->texture;
@@ -561,8 +560,8 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[level],
- tex->microtile != 0,
- tex->mip_macrotile[level] != 0);
+ tex->microtile,
+ tex->mip_macrotile[level]);
}
}
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 1e3052e51c..f4040b2431 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -32,8 +32,7 @@
#include "r300_transfer.h"
#include "r300_screen.h"
#include "r300_state_inlines.h"
-
-#include "radeon_winsys.h"
+#include "r300_winsys.h"
#define TILE_WIDTH 0
#define TILE_HEIGHT 1
@@ -47,6 +46,18 @@ static const unsigned microblock_table[5][3][2] = {
{{ 2, 1}, {0, 0}, {0, 0}} /* 128 bits per pixel */
};
+/* Return true for non-compressed and non-YUV formats. */
+static boolean r300_format_is_plain(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ if (!format) {
+ return FALSE;
+ }
+
+ return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN;
+}
+
/* Translate a pipe_format into a useful texture format for sampling.
*
* Some special formats are translated directly using R300_EASY_TX_FORMAT,
@@ -641,7 +652,7 @@ unsigned r300_texture_get_stride(struct r300_screen* screen,
width = u_minify(tex->b.b.width0, level);
- if (!util_format_is_compressed(tex->b.b.format)) {
+ if (r300_format_is_plain(tex->b.b.format)) {
tile_width = r300_texture_get_tile_size(tex, TILE_WIDTH,
tex->mip_macrotile[level]);
width = align(width, tile_width);
@@ -659,7 +670,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture* tex,
height = u_minify(tex->b.b.height0, level);
- if (!util_format_is_compressed(tex->b.b.format)) {
+ if (r300_format_is_plain(tex->b.b.format)) {
tile_height = r300_texture_get_tile_size(tex, TILE_HEIGHT,
tex->mip_macrotile[level]);
height = align(height, tile_height);
@@ -716,10 +727,11 @@ static void r300_setup_flags(struct r300_texture* tex)
static void r300_setup_tiling(struct pipe_screen *screen,
struct r300_texture *tex)
{
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
enum pipe_format format = tex->b.b.format;
boolean rv350_mode = r300_screen(screen)->caps->family >= CHIP_FAMILY_RV350;
- if (util_format_is_compressed(format)) {
+ if (!r300_format_is_plain(format)) {
return;
}
@@ -735,12 +747,12 @@ static void r300_setup_tiling(struct pipe_screen *screen,
tex->microtile = R300_BUFFER_TILED;
break;
- /* XXX Square-tiling doesn't work with kernel older than 2.6.34,
- * XXX need to check the DRM version */
- /*case 2:
+ case 2:
case 8:
- tex->microtile = R300_BUFFER_SQUARETILED;
- break;*/
+ if (rws->get_value(rws, R300_VID_SQUARE_TILING_SUPPORT)) {
+ tex->microtile = R300_BUFFER_SQUARETILED;
+ }
+ break;
}
/* Set macrotiling. */
@@ -843,8 +855,8 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
tex->size);
rws->buffer_set_tiling(rws, tex->buffer,
tex->pitch[0],
- tex->microtile != R300_BUFFER_LINEAR,
- tex->macrotile != R300_BUFFER_LINEAR);
+ tex->microtile,
+ tex->macrotile);
if (!tex->buffer) {
FREE(tex);
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index e478802c2f..61ec49c619 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -30,6 +30,8 @@
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "r300_defines.h"
+
struct r300_winsys_screen;
/* Creates a new r300 screen. */
@@ -42,10 +44,9 @@ enum r300_value_id {
R300_VID_PCI_ID,
R300_VID_GB_PIPES,
R300_VID_Z_PIPES,
+ R300_VID_SQUARE_TILING_SUPPORT
};
-#define R300_USAGE_FLAG_DONT_SYNC (1 << 17)
-
struct r300_winsys_screen {
void (*destroy)(struct r300_winsys_screen *ws);
@@ -143,8 +144,8 @@ struct r300_winsys_screen {
void (*buffer_set_tiling)(struct r300_winsys_screen *winsys,
struct r300_winsys_buffer *buffer,
uint32_t pitch,
- boolean microtiled,
- boolean macrotiled);
+ enum r300_buffer_tiling microtiled,
+ enum r300_buffer_tiling macrotiled);
uint32_t (*get_value)(struct r300_winsys_screen *winsys,
enum r300_value_id vid);
diff --git a/src/gallium/include/state_tracker/dri1_api.h b/src/gallium/include/state_tracker/dri1_api.h
index 0dc91ca58d..777bb9590e 100644
--- a/src/gallium/include/state_tracker/dri1_api.h
+++ b/src/gallium/include/state_tracker/dri1_api.h
@@ -7,7 +7,7 @@
#include "state_tracker/drm_api.h"
-#include <drm.h>
+struct drm_clip_rect;
struct pipe_screen;
struct pipe_winsys;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index 72d571fc22..acfb36f7e0 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -92,6 +92,10 @@ static void do_ioctls(int fd, struct radeon_libdrm_winsys* winsys)
exit(1);
}
+ // Supported since 2.1.0.
+ winsys->squaretiling = version->version_major > 2 ||
+ version->version_minor >= 1;
+
info.request = RADEON_INFO_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (retval) {
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
index bdaf95d793..d9870e8519 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
@@ -71,17 +71,22 @@ radeon_drm_buffer_map(struct pb_buffer *_buf,
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
int write;
+ if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+ if ((_buf->base.usage & PIPE_BUFFER_USAGE_VERTEX) ||
+ (_buf->base.usage & PIPE_BUFFER_USAGE_INDEX))
+ if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs))
+ return NULL;
+ }
+
if (buf->bo->ptr != NULL)
return buf->bo->ptr;
-
+
if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
uint32_t domain;
-
if (radeon_bo_is_busy(buf->bo, &domain))
return NULL;
}
-
if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) {
buf->mgr->rws->flush_cb(buf->mgr->rws->flush_data);
}
@@ -300,14 +305,19 @@ boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
}
-void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf, boolean microtiled, boolean macrotiled, uint32_t pitch)
+void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf,
+ enum r300_buffer_tiling microtiled,
+ enum r300_buffer_tiling macrotiled,
+ uint32_t pitch)
{
struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
uint32_t flags = 0, old_flags, old_pitch;
- if (microtiled)
- flags |= RADEON_BO_FLAGS_MICRO_TILE;
- if (macrotiled)
- flags |= RADEON_BO_FLAGS_MACRO_TILE;
+ if (microtiled == R300_BUFFER_TILED)
+ flags |= RADEON_BO_FLAGS_MICRO_TILE;
+ else if (microtiled == R300_BUFFER_SQUARETILED)
+ flags |= RADEON_BO_FLAGS_MICRO_TILE_SQUARE;
+ if (macrotiled == R300_BUFFER_TILED)
+ flags |= RADEON_BO_FLAGS_MACRO_TILE;
radeon_bo_get_tiling(buf->bo, &old_flags, &old_pitch);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index e0895c1113..2f89484f7d 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -43,6 +43,9 @@ radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,
if (usage & PIPE_BUFFER_USAGE_CONSTANT)
provider = ws->mman;
+ else if ((usage & PIPE_BUFFER_USAGE_VERTEX) ||
+ (usage & PIPE_BUFFER_USAGE_INDEX))
+ provider = ws->cman;
else
provider = ws->kman;
buffer = provider->create_buffer(provider, size, &desc);
@@ -61,8 +64,8 @@ static void radeon_r300_winsys_buffer_destroy(struct r300_winsys_buffer *buf)
static void radeon_r300_winsys_buffer_set_tiling(struct r300_winsys_screen *rws,
struct r300_winsys_buffer *buf,
uint32_t pitch,
- boolean microtiled,
- boolean macrotiled)
+ enum r300_buffer_tiling microtiled,
+ enum r300_buffer_tiling macrotiled)
{
struct pb_buffer *_buf = radeon_pb_buffer(buf);
radeon_drm_bufmgr_set_tiling(_buf, microtiled, macrotiled, pitch);
@@ -249,6 +252,8 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
return ws->gb_pipes;
case R300_VID_Z_PIPES:
return ws->z_pipes;
+ case R300_VID_SQUARE_TILING_SUPPORT:
+ return ws->squaretiling;
}
return 0;
}
@@ -259,6 +264,7 @@ radeon_winsys_destroy(struct r300_winsys_screen *rws)
struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
radeon_cs_destroy(ws->cs);
+ ws->cman->destroy(ws->cman);
ws->kman->destroy(ws->kman);
ws->mman->destroy(ws->mman);
@@ -280,6 +286,10 @@ radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
if (!ws->kman)
goto fail;
+ ws->cman = pb_cache_manager_create(ws->kman, 100000);
+ if (!ws->cman)
+ goto fail;
+
ws->mman = pb_malloc_bufmgr_create();
if (!ws->mman)
goto fail;
@@ -324,7 +334,8 @@ fail:
if (ws->bom)
radeon_bo_manager_gem_dtor(ws->bom);
-
+ if (ws->cman)
+ ws->cman->destroy(ws->cman);
if (ws->kman)
ws->kman->destroy(ws->kman);
if (ws->mman)
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
index 16cc701ad6..4260dbaad7 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
@@ -38,6 +38,8 @@ struct radeon_libdrm_winsys {
struct pb_manager *kman;
+ struct pb_manager *cman;
+
struct pb_manager *mman;
/* PCI ID */
@@ -55,6 +57,9 @@ struct radeon_libdrm_winsys {
/* VRAM size. */
uint32_t vram_size;
+ /* Square tiling support. */
+ boolean squaretiling;
+
/* DRM FD */
int fd;
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 1b94a56fd1..3db2d63f1f 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -85,11 +85,14 @@ XCreateDrawable(__GLXDRIdrawablePrivate * pdp,
visMask = (VisualScreenMask | VisualIDMask);
pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
- pdp->ximage = XCreateImage(dpy, pdp->visinfo->visual, pdp->visinfo->depth, ZPixmap, 0, /* format, offset */
- NULL, /* data */
- 0, 0, /* size */
- 32, /* bitmap_pad */
- 0); /* bytes_per_line */
+ pdp->ximage = XCreateImage(dpy,
+ pdp->visinfo->visual,
+ pdp->visinfo->depth,
+ ZPixmap, 0, /* format, offset */
+ NULL, /* data */
+ 0, 0, /* size */
+ 32, /* bitmap_pad */
+ 0); /* bytes_per_line */
/* get the true number of bits per pixel */
pdp->bpp = pdp->ximage->bits_per_pixel;
@@ -334,10 +337,17 @@ driCreateDrawable(__GLXscreenConfigs * psc,
return pdraw;
}
-static void
-driSwapBuffers(__GLXDRIdrawable * pdraw)
+static int64_t
+driSwapBuffers(__GLXDRIdrawable * pdraw,
+ int64_t target_msc, int64_t divisor, int64_t remainder)
{
+ (void) target_msc;
+ (void) divisor;
+ (void) remainder;
+
(*pdraw->psc->core->swapBuffers) (pdraw->driDrawable);
+
+ return 0;
}
static void
diff --git a/src/mesa/drivers/dri/common/dri_sw.c b/src/mesa/drivers/dri/common/drisw_util.c
index b7f9036f47..141ca302d0 100644
--- a/src/mesa/drivers/dri/common/dri_sw.c
+++ b/src/mesa/drivers/dri/common/drisw_util.c
@@ -22,12 +22,12 @@
*/
/**
- * \file dri_sw.c
+ * \file drisw_util.c
*
* DRISW utility functions, i.e. dri_util.c stripped from drm-specific bits.
*/
-#include "dri_sw.h"
+#include "drisw_util.h"
#include "utils.h"
diff --git a/src/mesa/drivers/dri/common/dri_sw.h b/src/mesa/drivers/dri/common/drisw_util.h
index e353e26b34..e353e26b34 100644
--- a/src/mesa/drivers/dri/common/dri_sw.h
+++ b/src/mesa/drivers/dri/common/drisw_util.h
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render.h b/src/mesa/drivers/dri/nouveau/nouveau_render.h
index bff0ccfd76..923b79b2cf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render.h
@@ -32,8 +32,8 @@
struct nouveau_array_state;
typedef void (*dispatch_t)(GLcontext *, unsigned int, int, unsigned int);
-typedef unsigned (*extract_u_t)(struct nouveau_array_state *a, int i, int j);
-typedef float (*extract_f_t)(struct nouveau_array_state *a, int i, int j);
+typedef unsigned (*extract_u_t)(struct nouveau_array_state *, int, int);
+typedef float (*extract_f_t)(struct nouveau_array_state *, int, int);
struct nouveau_attr_info {
int vbo_index;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index ef2cc787de..7697090f6a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -189,6 +189,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_LIGHTING:
context_dirty(ctx, FRAG);
context_dirty(ctx, MODELVIEW);
+ context_dirty(ctx, LIGHT_MODEL);
context_dirty(ctx, LIGHT_ENABLE);
for (i = 0; i < MAX_LIGHTS; i++) {
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.h b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
index b91facbdeb..251f537bba 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
@@ -41,7 +41,7 @@ struct nouveau_texture {
#define to_nouveau_texture(x) ((struct nouveau_texture *)(x))
#define texture_dirty(t) \
- to_nouveau_texture(t)->dirty = GL_TRUE;
+ to_nouveau_texture(t)->dirty = GL_TRUE
void
nouveau_set_texbuffer(__DRIcontext *dri_ctx,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 0c29eec8ee..e5858f8268 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -85,6 +85,18 @@ vbo_deinit_array(struct nouveau_array_state *a)
a->fields = 0;
}
+static int
+get_array_stride(GLcontext *ctx, const struct gl_client_array *a)
+{
+ struct nouveau_render_state *render = to_render_state(ctx);
+
+ if (render->mode == VBO && !_mesa_is_bufferobj(a->BufferObj))
+ /* Pack client buffers. */
+ return align(_mesa_sizeof_type(a->Type) * a->Size, 4);
+ else
+ return a->StrideB;
+}
+
static void
vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
const struct gl_client_array **arrays)
@@ -101,18 +113,10 @@ vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
if (attr >= 0) {
const struct gl_client_array *array = arrays[attr];
- int stride;
-
- if (render->mode == VBO &&
- !_mesa_is_bufferobj(array->BufferObj))
- /* Pack client buffers. */
- stride = align(_mesa_sizeof_type(array->Type)
- * array->Size, 4);
- else
- stride = array->StrideB;
vbo_init_array(&render->attrs[attr], attr,
- stride, array->Size, array->Type,
+ get_array_stride(ctx, array),
+ array->Size, array->Type,
array->BufferObj, array->Ptr,
render->mode == IMM);
}
@@ -245,7 +249,7 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_POS);
}
-static unsigned
+static int
get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
@@ -258,7 +262,7 @@ get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
const struct gl_client_array *a = arrays[attr];
if (!_mesa_is_bufferobj(a->BufferObj))
- s = MAX2(a->StrideB, s);
+ s = MAX2(s, get_array_stride(ctx, a));
}
}
@@ -327,6 +331,7 @@ vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays,
* array->StrideB;
if (a->bo) {
+ /* Array in a buffer obj. */
a->offset = (intptr_t)array->Ptr + delta;
} else {
int j, n = max_index - min_index + 1;
@@ -334,6 +339,8 @@ vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays,
char *dp = get_scratch_vbo(ctx, n * a->stride,
&a->bo, &a->offset);
+ /* Array in client memory, move it to
+ * a scratch buffer obj. */
for (j = 0; j < n; j++)
memcpy(dp + j * a->stride,
sp + j * array->StrideB,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index f7c3d36e1c..a2fcb6b695 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -172,15 +172,13 @@ nv10_emit_viewport(GLcontext *ctx, int emit)
struct nouveau_grobj *celsius = context_eng3d(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};
- int i;
get_viewport_translate(ctx, a);
a[0] -= 2048;
a[1] -= 2048;
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_TRANSLATE_X, 4);
- for (i = 0; i < 4; i++)
- OUT_RINGf(chan, a[i]);
+ OUT_RINGp(chan, a, 4);
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_CLIP_HORIZ(0), 1);
OUT_RING(chan, (fb->Width - 1) << 16 | 0x08000800);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 35f41d7295..6dedb18c72 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -54,10 +54,7 @@ nv10_emit_tex_gen(GLcontext *ctx, int emit)
if (k) {
BEGIN_RING(chan, celsius,
TX_GEN_COEFF(i, j), 4);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
+ OUT_RINGp(chan, k, 4);
}
BEGIN_RING(chan, celsius, TX_GEN_MODE(i, j), 1);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
index 2624c9bf30..0e592a1629 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
@@ -140,9 +140,7 @@ nv10_emit_fog(GLcontext *ctx, int emit)
OUT_RING(chan, pack_rgba_f(MESA_FORMAT_RGBA8888_REV, f->Color));
BEGIN_RING(chan, celsius, NV10TCL_FOG_EQUATION_CONSTANT, 3);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
+ OUT_RINGp(chan, k, 3);
context_dirty(ctx, FRAG);
}
@@ -284,9 +282,7 @@ nv10_emit_light_source(GLcontext *ctx, int emit)
if (l->_Flags & LIGHT_POSITIONAL) {
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_POSITION_X(i), 3);
- OUT_RINGf(chan, l->_Position[0]);
- OUT_RINGf(chan, l->_Position[1]);
- OUT_RINGf(chan, l->_Position[2]);
+ OUT_RINGp(chan, l->_Position, 3);
BEGIN_RING(chan, celsius,
NV10TCL_LIGHT_ATTENUATION_CONSTANT(i), 3);
@@ -296,14 +292,10 @@ nv10_emit_light_source(GLcontext *ctx, int emit)
} else {
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_DIRECTION_X(i), 3);
- OUT_RINGf(chan, l->_VP_inf_norm[0]);
- OUT_RINGf(chan, l->_VP_inf_norm[1]);
- OUT_RINGf(chan, l->_VP_inf_norm[2]);
+ OUT_RINGp(chan, l->_VP_inf_norm, 3);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_HALF_VECTOR_X(i), 3);
- OUT_RINGf(chan, l->_h_inf_norm[0]);
- OUT_RINGf(chan, l->_h_inf_norm[1]);
- OUT_RINGf(chan, l->_h_inf_norm[2]);
+ OUT_RINGp(chan, l->_h_inf_norm, 3);
}
if (l->_Flags & LIGHT_SPOT) {
@@ -312,13 +304,7 @@ nv10_emit_light_source(GLcontext *ctx, int emit)
nv10_get_spot_coeff(l, k);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_SPOT_CUTOFF_A(i), 7);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
- OUT_RINGf(chan, k[6]);
+ OUT_RINGp(chan, k, 7);
}
}
@@ -350,15 +336,11 @@ nv10_emit_material_ambient(GLcontext *ctx, int emit)
}
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_MODEL_AMBIENT_R, 3);
- OUT_RINGf(chan, c_scene[0]);
- OUT_RINGf(chan, c_scene[1]);
- OUT_RINGf(chan, c_scene[2]);
+ OUT_RINGp(chan, c_scene, 3);
if (ctx->Light.ColorMaterialEnabled) {
BEGIN_RING(chan, celsius, NV10TCL_MATERIAL_FACTOR_R, 3);
- OUT_RINGf(chan, c_factor[0]);
- OUT_RINGf(chan, c_factor[1]);
- OUT_RINGf(chan, c_factor[2]);
+ OUT_RINGp(chan, c_factor, 3);
}
foreach(l, &ctx->Light.EnabledList) {
@@ -368,9 +350,7 @@ nv10_emit_material_ambient(GLcontext *ctx, int emit)
l->_MatAmbient[0]);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_AMBIENT_R(i), 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -392,9 +372,7 @@ nv10_emit_material_diffuse(GLcontext *ctx, int emit)
l->_MatDiffuse[0]);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_DIFFUSE_R(i), 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -412,9 +390,7 @@ nv10_emit_material_specular(GLcontext *ctx, int emit)
l->_MatSpecular[0]);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_SPECULAR_R(i), 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -455,12 +431,7 @@ nv10_emit_material_shininess(GLcontext *ctx, int emit)
k);
BEGIN_RING(chan, celsius, NV10TCL_MATERIAL_SHININESS(0), 6);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
+ OUT_RINGp(chan, k, 6);
}
void
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index d638541df9..21da4f7af1 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -106,13 +106,11 @@ nv20_emit_viewport(GLcontext *ctx, int emit)
struct nouveau_grobj *kelvin = context_eng3d(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};
- int i;
get_viewport_translate(ctx, a);
BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_TRANSLATE_X, 4);
- for (i = 0; i < 4; i++)
- OUT_RINGf(chan, a[i]);
+ OUT_RINGp(chan, a, 4);
BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_HORIZ(0), 1);
OUT_RING(chan, (fb->Width - 1) << 16);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index bb8a79c2c9..e46118e4fc 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -53,10 +53,7 @@ nv20_emit_tex_gen(GLcontext *ctx, int emit)
if (k) {
BEGIN_RING(chan, kelvin, TX_GEN_COEFF(i, j), 4);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
+ OUT_RINGp(chan, k, 4);
}
BEGIN_RING(chan, kelvin, TX_GEN_MODE(i, j), 1);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
index df22adf272..62efe80fe4 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
@@ -139,9 +139,7 @@ nv20_emit_fog(GLcontext *ctx, int emit)
OUT_RING(chan, pack_rgba_f(MESA_FORMAT_RGBA8888_REV, f->Color));
BEGIN_RING(chan, kelvin, NV20TCL_FOG_EQUATION_CONSTANT, 3);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
+ OUT_RINGp(chan, k, 3);
}
void
@@ -176,9 +174,7 @@ nv20_emit_light_source(GLcontext *ctx, int emit)
if (l->_Flags & LIGHT_POSITIONAL) {
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_POSITION_X(i), 3);
- OUT_RINGf(chan, l->_Position[0]);
- OUT_RINGf(chan, l->_Position[1]);
- OUT_RINGf(chan, l->_Position[2]);
+ OUT_RINGp(chan, l->_Position, 3);
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_ATTENUATION_CONSTANT(i), 3);
OUT_RINGf(chan, l->ConstantAttenuation);
@@ -187,14 +183,10 @@ nv20_emit_light_source(GLcontext *ctx, int emit)
} else {
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_DIRECTION_X(i), 3);
- OUT_RINGf(chan, l->_VP_inf_norm[0]);
- OUT_RINGf(chan, l->_VP_inf_norm[1]);
- OUT_RINGf(chan, l->_VP_inf_norm[2]);
+ OUT_RINGp(chan, l->_VP_inf_norm, 3);
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_HALF_VECTOR_X(i), 3);
- OUT_RINGf(chan, l->_h_inf_norm[0]);
- OUT_RINGf(chan, l->_h_inf_norm[1]);
- OUT_RINGf(chan, l->_h_inf_norm[2]);
+ OUT_RINGp(chan, l->_h_inf_norm, 3);
}
if (l->_Flags & LIGHT_SPOT) {
@@ -203,13 +195,7 @@ nv20_emit_light_source(GLcontext *ctx, int emit)
nv10_get_spot_coeff(l, k);
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_SPOT_CUTOFF_A(i), 7);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
- OUT_RINGf(chan, k[6]);
+ OUT_RINGp(chan, k, 7);
}
}
@@ -246,15 +232,11 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
}
BEGIN_RING(chan, kelvin, m_scene[side], 3);
- OUT_RINGf(chan, c_scene[0]);
- OUT_RINGf(chan, c_scene[1]);
- OUT_RINGf(chan, c_scene[2]);
+ OUT_RINGp(chan, c_scene, 3);
if (ctx->Light.ColorMaterialEnabled) {
BEGIN_RING(chan, kelvin, m_factor[side], 3);
- OUT_RINGf(chan, c_factor[0]);
- OUT_RINGf(chan, c_factor[1]);
- OUT_RINGf(chan, c_factor[2]);
+ OUT_RINGp(chan, c_factor, 3);
}
foreach(l, &ctx->Light.EnabledList) {
@@ -266,9 +248,7 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
l->_MatAmbient[side]);
BEGIN_RING(chan, kelvin, m_light[side], 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -295,9 +275,7 @@ nv20_emit_material_diffuse(GLcontext *ctx, int emit)
l->_MatDiffuse[side]);
BEGIN_RING(chan, kelvin, m_light[side], 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -318,9 +296,7 @@ nv20_emit_material_specular(GLcontext *ctx, int emit)
l->_MatSpecular[side]);
BEGIN_RING(chan, kelvin, m_light[side], 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -340,12 +316,7 @@ nv20_emit_material_shininess(GLcontext *ctx, int emit)
k);
BEGIN_RING(chan, kelvin, mthd[side], 6);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
+ OUT_RINGp(chan, k, 6);
}
void
diff --git a/src/mesa/drivers/dri/swrast/Makefile b/src/mesa/drivers/dri/swrast/Makefile
index cc59eefdb2..d2cf6dbc55 100644
--- a/src/mesa/drivers/dri/swrast/Makefile
+++ b/src/mesa/drivers/dri/swrast/Makefile
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
LIBNAME = swrast_dri.so
+DRIVER_DEFINES = -D__NOT_HAVE_DRM_H
+
DRIVER_SOURCES = \
swrast.c \
swrast_span.c
@@ -18,7 +20,7 @@ ASM_SOURCES =
SWRAST_COMMON_SOURCES = \
../../common/driverfuncs.c \
../common/utils.c \
- ../common/dri_sw.c
+ ../common/drisw_util.c
include ../Makefile.template
diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h
index 77670d89a5..007642be95 100644
--- a/src/mesa/drivers/dri/swrast/swrast_priv.h
+++ b/src/mesa/drivers/dri/swrast/swrast_priv.h
@@ -30,7 +30,7 @@
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#include "main/mtypes.h"
-#include "dri_sw.h"
+#include "drisw_util.h"
/**