mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
nouveau: quicky-port to gallium changes
This commit is contained in:
parent
a556034514
commit
3e39bc3d87
23 changed files with 126 additions and 260 deletions
|
|
@ -73,6 +73,7 @@ nouveau_context_create(const __GLcontextModes *glVis,
|
|||
*/
|
||||
{
|
||||
struct pipe_surface *fb_surf;
|
||||
struct nouveau_pipe_buffer *fb_buf;
|
||||
struct nouveau_bo_priv *fb_bo;
|
||||
|
||||
fb_bo = calloc(1, sizeof(struct nouveau_bo_priv));
|
||||
|
|
@ -87,12 +88,15 @@ nouveau_context_create(const __GLcontextModes *glVis,
|
|||
fb_bo->base.size = fb_bo->drm.size;
|
||||
fb_bo->base.device = nv_screen->device;
|
||||
|
||||
fb_buf = calloc(1, sizeof(struct nouveau_pipe_buffer));
|
||||
fb_buf->bo = &fb_bo->base;
|
||||
|
||||
fb_surf = calloc(1, sizeof(struct pipe_surface));
|
||||
fb_surf->cpp = nv_screen->front_cpp;
|
||||
fb_surf->pitch = nv_screen->front_pitch / fb_surf->cpp;
|
||||
fb_surf->height = nv_screen->front_height;
|
||||
fb_surf->refcount = 1;
|
||||
fb_surf->buffer = (void *)fb_bo;
|
||||
fb_surf->buffer = &fb_buf->base;
|
||||
|
||||
nv->frontbuffer = fb_surf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,6 @@ struct nouveau_context {
|
|||
void (*surface_copy_done)(struct nouveau_context *);
|
||||
int (*surface_fill)(struct nouveau_context *, struct pipe_surface *,
|
||||
unsigned, unsigned, unsigned, unsigned, unsigned);
|
||||
int (*surface_data)(struct nouveau_context *, struct pipe_surface *,
|
||||
unsigned, unsigned, const void *, unsigned,
|
||||
unsigned, unsigned, unsigned, unsigned);
|
||||
};
|
||||
|
||||
extern GLboolean nouveau_context_create(const __GLcontextModes *,
|
||||
|
|
|
|||
|
|
@ -60,9 +60,9 @@
|
|||
OUT_RING (nv->o->handle); \
|
||||
} while(0)
|
||||
|
||||
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
|
||||
nouveau_pushbuf_emit_reloc(nv->channel, nv->channel->pushbuf->cur, \
|
||||
(void*)(bo), (data), (flags), (vor), (tor));\
|
||||
#define OUT_RELOC(buf,data,flags,vor,tor) do { \
|
||||
nouveau_pipe_emit_reloc(nv->channel, nv->channel->pushbuf->cur, \
|
||||
buf, (data), (flags), (vor), (tor)); \
|
||||
OUT_RING(0); \
|
||||
} while(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -59,16 +59,13 @@ nouveau_pipe_surface_fill(struct nouveau_winsys *nvws, struct pipe_surface *dst,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_pipe_surface_data(struct nouveau_winsys *nvws, struct pipe_surface *dst,
|
||||
unsigned dx, unsigned dy, const void *src,
|
||||
unsigned src_pitch, unsigned sx, unsigned sy,
|
||||
unsigned w, unsigned h)
|
||||
int
|
||||
nouveau_pipe_emit_reloc(struct nouveau_channel *chan, void *ptr,
|
||||
struct pipe_buffer *buf, uint32_t data,
|
||||
uint32_t flags, uint32_t vor, uint32_t tor)
|
||||
{
|
||||
if (nvws->nv->surface_data(nvws->nv, dst, dx, dy, src, src_pitch, sx,
|
||||
sy, w, h))
|
||||
return 1;
|
||||
return 0;
|
||||
return nouveau_pushbuf_emit_reloc(chan, ptr, nouveau_buffer(buf)->bo,
|
||||
data, flags, vor, tor);
|
||||
}
|
||||
|
||||
struct pipe_context *
|
||||
|
|
@ -102,7 +99,7 @@ nouveau_pipe_create(struct nouveau_context *nv)
|
|||
nvws->res_alloc = nouveau_resource_alloc;
|
||||
nvws->res_free = nouveau_resource_free;
|
||||
|
||||
nvws->push_reloc = nouveau_pushbuf_emit_reloc;
|
||||
nvws->push_reloc = nouveau_pipe_emit_reloc;
|
||||
nvws->push_flush = nouveau_pushbuf_flush;
|
||||
|
||||
nvws->grobj_alloc = nouveau_pipe_grobj_alloc;
|
||||
|
|
@ -117,7 +114,6 @@ nouveau_pipe_create(struct nouveau_context *nv)
|
|||
|
||||
nvws->surface_copy = nouveau_pipe_surface_copy;
|
||||
nvws->surface_fill = nouveau_pipe_surface_fill;
|
||||
nvws->surface_data = nouveau_pipe_surface_data;
|
||||
|
||||
return hw_create(nouveau_create_pipe_winsys(nv), nvws, nv->chipset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "pipe/p_winsys.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_util.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "nouveau_context.h"
|
||||
#include "nouveau_device.h"
|
||||
|
|
@ -54,7 +55,6 @@ nouveau_surface_alloc_storage(struct pipe_winsys *ws, struct pipe_surface *surf,
|
|||
enum pipe_format format, unsigned flags)
|
||||
{
|
||||
unsigned pitch = ((width * pf_get_size(format)) + 63) & ~63;
|
||||
int ret;
|
||||
|
||||
surf->format = format;
|
||||
surf->width = width;
|
||||
|
|
@ -62,16 +62,11 @@ nouveau_surface_alloc_storage(struct pipe_winsys *ws, struct pipe_surface *surf,
|
|||
surf->cpp = pf_get_size(format);
|
||||
surf->pitch = pitch / surf->cpp;
|
||||
|
||||
surf->buffer = ws->buffer_create(ws, 256, 0, 0);
|
||||
surf->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
|
||||
pitch * height);
|
||||
if (!surf->buffer)
|
||||
return 1;
|
||||
|
||||
ret = ws->buffer_data(ws, surf->buffer, pitch * height, NULL, 0);
|
||||
if (ret) {
|
||||
ws->buffer_reference(ws, &surf->buffer, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -83,131 +78,87 @@ nouveau_surface_release(struct pipe_winsys *ws, struct pipe_surface **s)
|
|||
*s = NULL;
|
||||
if (--surf->refcount <= 0) {
|
||||
if (surf->buffer)
|
||||
ws->buffer_reference(ws, &surf->buffer, NULL);
|
||||
pipe_buffer_reference(ws, &surf->buffer, NULL);
|
||||
free(surf);
|
||||
}
|
||||
}
|
||||
|
||||
static struct pipe_buffer_handle *
|
||||
static struct pipe_buffer *
|
||||
nouveau_pipe_bo_create(struct pipe_winsys *pws, unsigned alignment,
|
||||
unsigned flags, unsigned hint)
|
||||
unsigned usage, unsigned size)
|
||||
{
|
||||
struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
|
||||
struct nouveau_device *dev = nvpws->nv->nv_screen->device;
|
||||
struct nouveau_bo *nvbo = NULL;
|
||||
struct nouveau_pipe_buffer *nvbuf;
|
||||
|
||||
if (nouveau_bo_new(dev, NOUVEAU_BO_LOCAL, alignment, 0, &nvbo))
|
||||
nvbuf = calloc(1, sizeof(*nvbuf));
|
||||
if (!nvbuf)
|
||||
return NULL;
|
||||
return (struct pipe_buffer_handle *)nvbo;
|
||||
nvbuf->base.refcount = 1;
|
||||
nvbuf->base.alignment = alignment;
|
||||
nvbuf->base.usage = usage;
|
||||
nvbuf->base.size = size;
|
||||
|
||||
if (nouveau_bo_new(dev, NOUVEAU_BO_LOCAL, alignment, size, &nvbuf->bo)) {
|
||||
free(nvbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &nvbuf->base;
|
||||
}
|
||||
|
||||
static struct pipe_buffer_handle *
|
||||
static struct pipe_buffer *
|
||||
nouveau_pipe_bo_user_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
|
||||
{
|
||||
struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
|
||||
struct nouveau_device *dev = nvpws->nv->nv_screen->device;
|
||||
struct nouveau_bo *nvbo = NULL;
|
||||
struct nouveau_pipe_buffer *nvbuf;
|
||||
|
||||
if (nouveau_bo_user(dev, ptr, bytes, &nvbo))
|
||||
nvbuf = calloc(1, sizeof(*nvbuf));
|
||||
if (!nvbuf)
|
||||
return NULL;
|
||||
return (struct pipe_buffer_handle *)nvbo;
|
||||
nvbuf->base.refcount = 1;
|
||||
nvbuf->base.size = bytes;
|
||||
|
||||
if (nouveau_bo_user(dev, ptr, bytes, &nvbuf->bo)) {
|
||||
free(nvbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &nvbuf->base;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_pipe_bo_del(struct pipe_winsys *ws, struct pipe_buffer *buf)
|
||||
{
|
||||
struct nouveau_pipe_buffer *nvbuf = nouveau_buffer(buf);
|
||||
|
||||
nouveau_bo_del(&nvbuf->bo);
|
||||
}
|
||||
|
||||
static void *
|
||||
nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer_handle *bo,
|
||||
nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
|
||||
unsigned flags)
|
||||
{
|
||||
struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
|
||||
struct nouveau_pipe_buffer *nvbuf = nouveau_buffer(buf);
|
||||
uint32_t map_flags = 0;
|
||||
|
||||
if (flags & PIPE_BUFFER_FLAG_READ)
|
||||
if (flags & PIPE_BUFFER_USAGE_CPU_READ)
|
||||
map_flags |= NOUVEAU_BO_RD;
|
||||
if (flags & PIPE_BUFFER_FLAG_WRITE)
|
||||
if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
|
||||
map_flags |= NOUVEAU_BO_WR;
|
||||
|
||||
if (nouveau_bo_map(nvbo, map_flags))
|
||||
if (nouveau_bo_map(nvbuf->bo, map_flags))
|
||||
return NULL;
|
||||
return nvbo->map;
|
||||
return nvbuf->bo->map;
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer_handle *bo)
|
||||
nouveau_pipe_bo_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
|
||||
{
|
||||
struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
|
||||
struct nouveau_pipe_buffer *nvbuf = nouveau_buffer(buf);
|
||||
|
||||
nouveau_bo_unmap(nvbo);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_pipe_bo_reference(struct pipe_winsys *pws,
|
||||
struct pipe_buffer_handle **ptr,
|
||||
struct pipe_buffer_handle *bo)
|
||||
{
|
||||
struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
|
||||
struct nouveau_context *nv = nvpws->nv;
|
||||
struct nouveau_device *dev = nv->nv_screen->device;
|
||||
|
||||
if (*ptr) {
|
||||
struct nouveau_bo *nvbo = (struct nouveau_bo *)*ptr;
|
||||
FIRE_RING();
|
||||
nouveau_bo_del(&nvbo);
|
||||
*ptr = NULL;
|
||||
}
|
||||
|
||||
if (bo) {
|
||||
struct nouveau_bo *nvbo = (struct nouveau_bo *)bo, *new = NULL;
|
||||
nouveau_bo_ref(dev, nvbo->handle, &new);
|
||||
*ptr = bo;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_pipe_bo_data(struct pipe_winsys *pws, struct pipe_buffer_handle *bo,
|
||||
unsigned size, const void *data, unsigned usage)
|
||||
{
|
||||
struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
|
||||
|
||||
if (nvbo->size != size)
|
||||
nouveau_bo_resize(nvbo, size);
|
||||
|
||||
if (data) {
|
||||
if (nouveau_bo_map(nvbo, NOUVEAU_BO_WR))
|
||||
return 1;
|
||||
memcpy(nvbo->map, data, size);
|
||||
nouveau_bo_unmap(nvbo);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_pipe_bo_subdata(struct pipe_winsys *pws, struct pipe_buffer_handle *bo,
|
||||
unsigned long offset, unsigned long size,
|
||||
const void *data)
|
||||
{
|
||||
struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
|
||||
|
||||
if (nouveau_bo_map(nvbo, NOUVEAU_BO_WR))
|
||||
return 1;
|
||||
memcpy(nvbo->map + offset, data, size);
|
||||
nouveau_bo_unmap(nvbo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_pipe_bo_get_subdata(struct pipe_winsys *pws,
|
||||
struct pipe_buffer_handle *bo, unsigned long offset,
|
||||
unsigned long size, void *data)
|
||||
{
|
||||
struct nouveau_bo *nvbo = (struct nouveau_bo *)bo;
|
||||
|
||||
if (nouveau_bo_map(nvbo, NOUVEAU_BO_RD))
|
||||
return 1;
|
||||
memcpy(data, nvbo->map + offset, size);
|
||||
nouveau_bo_unmap(nvbo);
|
||||
|
||||
return 0;
|
||||
nouveau_bo_unmap(nvbuf->bo);
|
||||
}
|
||||
|
||||
struct pipe_winsys *
|
||||
|
|
@ -230,13 +181,10 @@ nouveau_create_pipe_winsys(struct nouveau_context *nv)
|
|||
pws->surface_release = nouveau_surface_release;
|
||||
|
||||
pws->buffer_create = nouveau_pipe_bo_create;
|
||||
pws->buffer_destroy = nouveau_pipe_bo_del;
|
||||
pws->user_buffer_create = nouveau_pipe_bo_user_create;
|
||||
pws->buffer_map = nouveau_pipe_bo_map;
|
||||
pws->buffer_unmap = nouveau_pipe_bo_unmap;
|
||||
pws->buffer_reference = nouveau_pipe_bo_reference;
|
||||
pws->buffer_data = nouveau_pipe_bo_data;
|
||||
pws->buffer_subdata = nouveau_pipe_bo_subdata;
|
||||
pws->buffer_get_subdata= nouveau_pipe_bo_get_subdata;
|
||||
|
||||
pws->get_name = nouveau_get_name;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,17 @@
|
|||
#include "pipe/p_winsys.h"
|
||||
#include "nouveau_context.h"
|
||||
|
||||
struct nouveau_pipe_buffer {
|
||||
struct pipe_buffer base;
|
||||
struct nouveau_bo *bo;
|
||||
};
|
||||
|
||||
static inline struct nouveau_pipe_buffer *
|
||||
nouveau_buffer(struct pipe_buffer *buf)
|
||||
{
|
||||
return (struct nouveau_pipe_buffer *)buf;
|
||||
}
|
||||
|
||||
struct nouveau_pipe_winsys {
|
||||
struct pipe_winsys pws;
|
||||
|
||||
|
|
|
|||
|
|
@ -159,15 +159,6 @@ nv04_surface_fill(struct nouveau_context *nv, struct pipe_surface *dst,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nv04_surface_data(struct nouveau_context *nv, struct pipe_surface *dst,
|
||||
unsigned dx, unsigned dy, const void *src, unsigned src_pitch,
|
||||
unsigned sx, unsigned sy, unsigned w, unsigned h)
|
||||
{
|
||||
NOUVEAU_ERR("unimplemented!!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_surface_init_nv04(struct nouveau_context *nv)
|
||||
{
|
||||
|
|
@ -230,7 +221,6 @@ nouveau_surface_init_nv04(struct nouveau_context *nv)
|
|||
nv->surface_copy = nv04_surface_copy_blit;
|
||||
nv->surface_copy_done = nv04_surface_copy_done;
|
||||
nv->surface_fill = nv04_surface_fill;
|
||||
nv->surface_data = nv04_surface_data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,15 +133,6 @@ nv50_surface_fill(struct nouveau_context *nv, struct pipe_surface *dst,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nv50_surface_data(struct nouveau_context *nv, struct pipe_surface *dst,
|
||||
unsigned dx, unsigned dy, const void *src, unsigned src_pitch,
|
||||
unsigned sx, unsigned sy, unsigned w, unsigned h)
|
||||
{
|
||||
NOUVEAU_ERR("unimplemented!!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_surface_init_nv50(struct nouveau_context *nv)
|
||||
{
|
||||
|
|
@ -164,7 +155,6 @@ nouveau_surface_init_nv50(struct nouveau_context *nv)
|
|||
nv->surface_copy = nv50_surface_copy;
|
||||
nv->surface_copy_done = nv50_surface_copy_done;
|
||||
nv->surface_fill = nv50_surface_fill;
|
||||
nv->surface_data = nv50_surface_data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@
|
|||
NOUVEAU_PUSH_CONTEXT(pc); \
|
||||
pc->nvws->push_reloc(pc->nvws->channel, \
|
||||
pc->nvws->channel->pushbuf->cur, \
|
||||
(struct nouveau_bo *)(bo), \
|
||||
(data), (flags), (vor), (tor)); \
|
||||
(bo), (data), (flags), (vor), (tor)); \
|
||||
OUT_RING(0); \
|
||||
} while(0)
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ struct nouveau_winsys {
|
|||
void (*res_free)(struct nouveau_resource **);
|
||||
|
||||
int (*push_reloc)(struct nouveau_channel *, void *ptr,
|
||||
struct nouveau_bo *, uint32_t data,
|
||||
struct pipe_buffer *, uint32_t data,
|
||||
uint32_t flags, uint32_t vor, uint32_t tor);
|
||||
int (*push_flush)(struct nouveau_channel *, unsigned size);
|
||||
|
||||
|
|
@ -47,9 +47,6 @@ struct nouveau_winsys {
|
|||
unsigned, unsigned, unsigned, unsigned);
|
||||
int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
|
||||
unsigned, unsigned, unsigned, unsigned, unsigned);
|
||||
int (*surface_data)(struct nouveau_winsys *, struct pipe_surface *,
|
||||
unsigned, unsigned, const void *, unsigned,
|
||||
unsigned, unsigned, unsigned, unsigned);
|
||||
};
|
||||
|
||||
extern struct pipe_context *
|
||||
|
|
|
|||
|
|
@ -48,17 +48,17 @@ struct nv40_context {
|
|||
unsigned vp_samplers;
|
||||
|
||||
uint32_t rt_enable;
|
||||
struct pipe_buffer_handle *rt[4];
|
||||
struct pipe_buffer_handle *zeta;
|
||||
struct pipe_buffer *rt[4];
|
||||
struct pipe_buffer *zeta;
|
||||
|
||||
struct {
|
||||
struct pipe_buffer_handle *buffer;
|
||||
struct pipe_buffer *buffer;
|
||||
uint32_t format;
|
||||
} tex[16];
|
||||
|
||||
unsigned vb_enable;
|
||||
struct {
|
||||
struct pipe_buffer_handle *buffer;
|
||||
struct pipe_buffer *buffer;
|
||||
unsigned delta;
|
||||
} vb[16];
|
||||
|
||||
|
|
@ -69,14 +69,14 @@ struct nv40_context {
|
|||
struct nv40_vertex_program *active;
|
||||
|
||||
struct nv40_vertex_program *current;
|
||||
struct pipe_buffer_handle *constant_buf;
|
||||
struct pipe_buffer *constant_buf;
|
||||
} vertprog;
|
||||
|
||||
struct {
|
||||
struct nv40_fragment_program *active;
|
||||
|
||||
struct nv40_fragment_program *current;
|
||||
struct pipe_buffer_handle *constant_buf;
|
||||
struct pipe_buffer *constant_buf;
|
||||
} fragprog;
|
||||
|
||||
struct pipe_vertex_buffer vtxbuf[PIPE_ATTRIB_MAX];
|
||||
|
|
@ -124,7 +124,7 @@ extern void nv40_state_tex_update(struct nv40_context *nv40);
|
|||
extern boolean nv40_draw_arrays(struct pipe_context *, unsigned mode,
|
||||
unsigned start, unsigned count);
|
||||
extern boolean nv40_draw_elements(struct pipe_context *pipe,
|
||||
struct pipe_buffer_handle *indexBuffer,
|
||||
struct pipe_buffer *indexBuffer,
|
||||
unsigned indexSize,
|
||||
unsigned mode, unsigned start,
|
||||
unsigned count);
|
||||
|
|
|
|||
|
|
@ -8,18 +8,6 @@ struct nv40_draw_stage {
|
|||
struct nv40_context *nv40;
|
||||
};
|
||||
|
||||
static void
|
||||
nv40_draw_begin(struct draw_stage *draw)
|
||||
{
|
||||
NOUVEAU_ERR("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
nv40_draw_end(struct draw_stage *draw)
|
||||
{
|
||||
NOUVEAU_ERR("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
nv40_draw_point(struct draw_stage *draw, struct prim_header *prim)
|
||||
{
|
||||
|
|
@ -38,6 +26,11 @@ nv40_draw_tri(struct draw_stage *draw, struct prim_header *prim)
|
|||
NOUVEAU_ERR("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
nv40_draw_flush(struct draw_stage *draw, unsigned flags)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nv40_draw_reset_stipple_counter(struct draw_stage *draw)
|
||||
{
|
||||
|
|
@ -57,11 +50,10 @@ nv40_draw_render_stage(struct nv40_context *nv40)
|
|||
|
||||
nv40draw->nv40 = nv40;
|
||||
nv40draw->draw.draw = nv40->draw;
|
||||
nv40draw->draw.begin = nv40_draw_begin;
|
||||
nv40draw->draw.point = nv40_draw_point;
|
||||
nv40draw->draw.line = nv40_draw_line;
|
||||
nv40draw->draw.tri = nv40_draw_tri;
|
||||
nv40draw->draw.end = nv40_draw_end;
|
||||
nv40draw->draw.flush = nv40_draw_flush;
|
||||
nv40draw->draw.reset_stipple_counter = nv40_draw_reset_stipple_counter;
|
||||
nv40draw->draw.destroy = nv40_draw_destroy;
|
||||
|
||||
|
|
|
|||
|
|
@ -769,7 +769,7 @@ nv40_fragprog_bind(struct nv40_context *nv40, struct nv40_fragment_program *fp)
|
|||
|
||||
if (fp->nr_consts) {
|
||||
float *map = ws->buffer_map(ws, nv40->fragprog.constant_buf,
|
||||
PIPE_BUFFER_FLAG_READ);
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
for (i = 0; i < fp->nr_consts; i++) {
|
||||
struct nv40_fragment_program_data *fpd = &fp->consts[i];
|
||||
uint32_t *p = &fp->insn[fpd->offset];
|
||||
|
|
@ -788,10 +788,10 @@ nv40_fragprog_bind(struct nv40_context *nv40, struct nv40_fragment_program *fp)
|
|||
uint32_t *map;
|
||||
|
||||
if (!fp->buffer)
|
||||
fp->buffer = ws->buffer_create(ws, 0x100, 0, 0);
|
||||
ws->buffer_data(ws, fp->buffer, fp->insn_len * 4, NULL, 0);
|
||||
|
||||
map = ws->buffer_map(ws, fp->buffer, PIPE_BUFFER_FLAG_WRITE);
|
||||
fp->buffer = ws->buffer_create(ws, 0x100, 0,
|
||||
fp->insn_len * 4);
|
||||
map = ws->buffer_map(ws, fp->buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < fp->insn_len; i++) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_util.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "nv40_context.h"
|
||||
|
||||
|
|
@ -65,14 +66,13 @@ nv40_miptree_create(struct pipe_context *pipe, struct pipe_texture **pt)
|
|||
|
||||
nv40_miptree_layout(nv40mt);
|
||||
|
||||
nv40mt->buffer = ws->buffer_create(ws, 256, 0, 0);
|
||||
nv40mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
|
||||
nv40mt->total_size);
|
||||
if (!nv40mt->buffer) {
|
||||
free(nv40mt);
|
||||
return;
|
||||
}
|
||||
|
||||
ws->buffer_data(ws, nv40mt->buffer, nv40mt->total_size, NULL,
|
||||
PIPE_BUFFER_USAGE_PIXEL);
|
||||
*pt = &nv40mt->base;
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ nv40_miptree_release(struct pipe_context *pipe, struct pipe_texture **pt)
|
|||
struct nv40_miptree *nv40mt = (struct nv40_miptree *)mt;
|
||||
int l;
|
||||
|
||||
ws->buffer_reference(ws, &nv40mt->buffer, NULL);
|
||||
pipe_buffer_reference(ws, &nv40mt->buffer, NULL);
|
||||
for (l = mt->first_level; l <= mt->last_level; l++) {
|
||||
if (nv40mt->level[l].image_offset)
|
||||
free(nv40mt->level[l].image_offset);
|
||||
|
|
|
|||
|
|
@ -563,35 +563,17 @@ nv40_set_framebuffer_state(struct pipe_context *pipe,
|
|||
NV40TCL_RT_ENABLE_COLOR3))
|
||||
rt_enable |= NV40TCL_RT_ENABLE_MRT;
|
||||
|
||||
if (fb->zbuf) {
|
||||
if (fb->zsbuf) {
|
||||
if (colour_format) {
|
||||
assert(w == fb->zbuf->width);
|
||||
assert(h == fb->zbuf->height);
|
||||
assert(w == fb->zsbuf->width);
|
||||
assert(h == fb->zsbuf->height);
|
||||
} else {
|
||||
w = fb->zbuf->width;
|
||||
h = fb->zbuf->height;
|
||||
w = fb->zsbuf->width;
|
||||
h = fb->zsbuf->height;
|
||||
}
|
||||
|
||||
zeta_format = fb->zbuf->format;
|
||||
zeta = fb->zbuf;
|
||||
}
|
||||
|
||||
if (fb->sbuf) {
|
||||
if (colour_format) {
|
||||
assert(w == fb->sbuf->width);
|
||||
assert(h == fb->sbuf->height);
|
||||
} else {
|
||||
w = fb->zbuf->width;
|
||||
h = fb->zbuf->height;
|
||||
}
|
||||
|
||||
if (zeta_format) {
|
||||
assert(fb->sbuf->format == zeta_format);
|
||||
assert(fb->sbuf == zeta);
|
||||
} else {
|
||||
zeta_format = fb->sbuf->format;
|
||||
zeta = fb->sbuf;
|
||||
}
|
||||
zeta_format = fb->zsbuf->format;
|
||||
zeta = fb->zsbuf;
|
||||
}
|
||||
|
||||
rt_format = NV40TCL_RT_FORMAT_TYPE_LINEAR;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ struct nv40_fragment_program {
|
|||
struct nv40_fragment_program_data *consts;
|
||||
unsigned nr_consts;
|
||||
|
||||
struct pipe_buffer_handle *buffer;
|
||||
struct pipe_buffer *buffer;
|
||||
|
||||
uint32_t fp_control;
|
||||
};
|
||||
|
|
@ -134,7 +134,7 @@ struct nv40_depth_stencil_alpha_state {
|
|||
struct nv40_miptree {
|
||||
struct pipe_texture base;
|
||||
|
||||
struct pipe_buffer_handle *buffer;
|
||||
struct pipe_buffer *buffer;
|
||||
uint total_size;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ nv40_get_tex_surface(struct pipe_context *pipe, struct pipe_texture *pt,
|
|||
ps = ws->surface_alloc(ws);
|
||||
if (!ps)
|
||||
return NULL;
|
||||
ws->buffer_reference(ws, &ps->buffer, nv40mt->buffer);
|
||||
pipe_buffer_reference(ws, &ps->buffer, nv40mt->buffer);
|
||||
ps->format = pt->format;
|
||||
ps->cpp = pt->cpp;
|
||||
ps->width = pt->width[level];
|
||||
|
|
@ -103,19 +103,6 @@ nv40_get_tex_surface(struct pipe_context *pipe, struct pipe_texture *pt,
|
|||
return ps;
|
||||
}
|
||||
|
||||
static void
|
||||
nv40_surface_data(struct pipe_context *pipe, struct pipe_surface *dest,
|
||||
unsigned destx, unsigned desty, const void *src,
|
||||
unsigned src_stride, unsigned srcx, unsigned srcy,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
struct nv40_context *nv40 = nv40_context(pipe);
|
||||
struct nouveau_winsys *nvws = nv40->nvws;
|
||||
|
||||
nvws->surface_data(nvws, dest, destx, desty, src, src_stride,
|
||||
srcx, srcy, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
nv40_surface_copy(struct pipe_context *pipe, struct pipe_surface *dest,
|
||||
unsigned destx, unsigned desty, struct pipe_surface *src,
|
||||
|
|
@ -144,9 +131,6 @@ nv40_init_surface_functions(struct nv40_context *nv40)
|
|||
{
|
||||
nv40->pipe.is_format_supported = nv40_surface_format_supported;
|
||||
nv40->pipe.get_tex_surface = nv40_get_tex_surface;
|
||||
nv40->pipe.get_tile = pipe_get_tile_raw;
|
||||
nv40->pipe.put_tile = pipe_put_tile_raw;
|
||||
nv40->pipe.surface_data = nv40_surface_data;
|
||||
nv40->pipe.surface_copy = nv40_surface_copy;
|
||||
nv40->pipe.surface_fill = nv40_surface_fill;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ nv40_vbo_static_attrib(struct nv40_context *nv40, int attrib,
|
|||
type = nv40_vbo_type(ve->src_format);
|
||||
ncomp = nv40_vbo_ncomp(ve->src_format);
|
||||
|
||||
map = ws->buffer_map(ws, vb->buffer, PIPE_BUFFER_FLAG_READ);
|
||||
map = ws->buffer_map(ws, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map += vb->buffer_offset + ve->src_offset;
|
||||
|
||||
switch (type) {
|
||||
|
|
@ -149,7 +149,7 @@ nv40_vbo_arrays_update(struct nv40_context *nv40)
|
|||
|
||||
static boolean
|
||||
nv40_vbo_validate_state(struct nv40_context *nv40,
|
||||
struct pipe_buffer_handle *ib, unsigned ib_format)
|
||||
struct pipe_buffer *ib, unsigned ib_format)
|
||||
{
|
||||
unsigned inputs;
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ nv40_draw_elements_u32(struct nv40_context *nv40, void *ib,
|
|||
|
||||
static boolean
|
||||
nv40_draw_elements_inline(struct pipe_context *pipe,
|
||||
struct pipe_buffer_handle *ib, unsigned ib_size,
|
||||
struct pipe_buffer *ib, unsigned ib_size,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nv40_context *nv40 = nv40_context(pipe);
|
||||
|
|
@ -306,7 +306,7 @@ nv40_draw_elements_inline(struct pipe_context *pipe,
|
|||
|
||||
assert(nv40_vbo_validate_state(nv40, NULL, 0));
|
||||
|
||||
map = ws->buffer_map(ws, ib, PIPE_BUFFER_FLAG_READ);
|
||||
map = ws->buffer_map(ws, ib, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
if (!ib)
|
||||
assert(0);
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ nv40_draw_elements_inline(struct pipe_context *pipe,
|
|||
|
||||
static boolean
|
||||
nv40_draw_elements_vbo(struct pipe_context *pipe,
|
||||
struct pipe_buffer_handle *ib, unsigned ib_size,
|
||||
struct pipe_buffer *ib, unsigned ib_size,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nv40_context *nv40 = nv40_context(pipe);
|
||||
|
|
@ -388,7 +388,7 @@ nv40_draw_elements_vbo(struct pipe_context *pipe,
|
|||
|
||||
boolean
|
||||
nv40_draw_elements(struct pipe_context *pipe,
|
||||
struct pipe_buffer_handle *indexBuffer, unsigned indexSize,
|
||||
struct pipe_buffer *indexBuffer, unsigned indexSize,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
if (indexSize != 1) {
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ nv40_vertprog_bind(struct nv40_context *nv40, struct nv40_vertex_program *vp)
|
|||
|
||||
if (nv40->vertprog.constant_buf) {
|
||||
map = ws->buffer_map(ws, nv40->vertprog.constant_buf,
|
||||
PIPE_BUFFER_FLAG_READ);
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
}
|
||||
|
||||
for (i = 0; i < vp->nr_consts; i++) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ extern struct draw_stage *nv50_draw_render_stage(struct nv50_context *nv50);
|
|||
extern boolean nv50_draw_arrays(struct pipe_context *, unsigned mode,
|
||||
unsigned start, unsigned count);
|
||||
extern boolean nv50_draw_elements(struct pipe_context *pipe,
|
||||
struct pipe_buffer_handle *indexBuffer,
|
||||
struct pipe_buffer *indexBuffer,
|
||||
unsigned indexSize,
|
||||
unsigned mode, unsigned start,
|
||||
unsigned count);
|
||||
|
|
|
|||
|
|
@ -8,18 +8,6 @@ struct nv50_draw_stage {
|
|||
struct nv50_context *nv50;
|
||||
};
|
||||
|
||||
static void
|
||||
nv50_draw_begin(struct draw_stage *draw)
|
||||
{
|
||||
NOUVEAU_ERR("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_draw_end(struct draw_stage *draw)
|
||||
{
|
||||
NOUVEAU_ERR("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_draw_point(struct draw_stage *draw, struct prim_header *prim)
|
||||
{
|
||||
|
|
@ -38,6 +26,11 @@ nv50_draw_tri(struct draw_stage *draw, struct prim_header *prim)
|
|||
NOUVEAU_ERR("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_draw_flush(struct draw_stage *draw, unsigned flags)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_draw_reset_stipple_counter(struct draw_stage *draw)
|
||||
{
|
||||
|
|
@ -51,11 +44,10 @@ nv50_draw_render_stage(struct nv50_context *nv50)
|
|||
|
||||
nv50draw->nv50 = nv50;
|
||||
nv50draw->draw.draw = nv50->draw;
|
||||
nv50draw->draw.begin = nv50_draw_begin;
|
||||
nv50draw->draw.point = nv50_draw_point;
|
||||
nv50draw->draw.line = nv50_draw_line;
|
||||
nv50draw->draw.tri = nv50_draw_tri;
|
||||
nv50draw->draw.end = nv50_draw_end;
|
||||
nv50draw->draw.flush = nv50_draw_flush;
|
||||
nv50draw->draw.reset_stipple_counter = nv50_draw_reset_stipple_counter;
|
||||
|
||||
return &nv50draw->draw;
|
||||
|
|
|
|||
|
|
@ -42,19 +42,6 @@ nv50_get_tex_surface(struct pipe_context *pipe,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_surface_data(struct pipe_context *pipe, struct pipe_surface *dest,
|
||||
unsigned destx, unsigned desty, const void *src,
|
||||
unsigned src_stride, unsigned srcx, unsigned srcy,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
struct nv50_context *nv50 = (struct nv50_context *)pipe;
|
||||
struct nouveau_winsys *nvws = nv50->nvws;
|
||||
|
||||
nvws->surface_data(nvws, dest, destx, desty, src, src_stride,
|
||||
srcx, srcy, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
nv50_surface_copy(struct pipe_context *pipe, struct pipe_surface *dest,
|
||||
unsigned destx, unsigned desty, struct pipe_surface *src,
|
||||
|
|
@ -82,9 +69,6 @@ void
|
|||
nv50_init_surface_functions(struct nv50_context *nv50)
|
||||
{
|
||||
nv50->pipe.get_tex_surface = nv50_get_tex_surface;
|
||||
nv50->pipe.get_tile = pipe_get_tile_raw;
|
||||
nv50->pipe.put_tile = pipe_put_tile_raw;
|
||||
nv50->pipe.surface_data = nv50_surface_data;
|
||||
nv50->pipe.surface_copy = nv50_surface_copy;
|
||||
nv50->pipe.surface_fill = nv50_surface_fill;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
|
|||
|
||||
boolean
|
||||
nv50_draw_elements(struct pipe_context *pipe,
|
||||
struct pipe_buffer_handle *indexBuffer, unsigned indexSize,
|
||||
struct pipe_buffer *indexBuffer, unsigned indexSize,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
NOUVEAU_ERR("unimplemented\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue