Commit 575b35ee authored by Keith Whitwell's avatar Keith Whitwell

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
parents f29ac73f 9fc6c8b8
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
}
This diff is collapsed.
......@@ -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
......@@ -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);
......
......@@ -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",
......
......@@ -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);
......
......@@ -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 */
......@@ -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
......
/*
* 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
......@@ -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;
......
......@@ -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.
......
......@@ -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;
......
......@@ -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]);
}
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -7,7 +7,7 @@
#include "state_tracker/drm_api.h"
#include <drm.h>
struct drm_clip_rect;
struct pipe_screen;
struct pipe_winsys;
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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)
......
......@@ -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;
......
......@@ -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
......
......@@ -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"
......
......@@ -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;
......
......@@ -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++) {
......
......@@ -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,
......
......@@ -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(</