Commit e75a8d5e authored by Keith Whitwell's avatar Keith Whitwell

gallium: bind flags

parent 058c5697
......@@ -186,8 +186,7 @@ get_next_slot( struct blit_state *ctx )
if (!ctx->vbuf) {
ctx->vbuf = pipe_buffer_create(ctx->pipe->screen,
32,
PIPE_BUFFER_USAGE_VERTEX,
PIPE_BIND_VERTEX_BUFFER,
max_slots * sizeof ctx->vertices);
}
......@@ -304,9 +303,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
filter == PIPE_TEX_MIPFILTER_LINEAR);
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0));
PIPE_BIND_SAMPLER_VIEW, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
PIPE_BIND_RENDER_TARGET, 0));
/* do the regions overlap? */
overlap = util_same_surface(src, dst) &&
......@@ -335,7 +334,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
}
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
PIPE_BIND_RENDER_TARGET, 0));
/* Create a temporary texture when src and dest alias or when src
* is anything other than a single-level 2d texture.
......@@ -389,7 +388,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
}
texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
PIPE_BUFFER_USAGE_BLIT_DESTINATION);
PIPE_BIND_BLIT_DESTINATION);
/* load temp texture */
if (pipe->surface_copy) {
......@@ -582,7 +581,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET,
PIPE_BIND_RENDER_TARGET,
0));
/* save state (restored below) */
......
......@@ -215,8 +215,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
/* create the vertex buffer */
ctx->vbuf = pipe_buffer_create(ctx->pipe->screen,
32,
PIPE_BUFFER_USAGE_VERTEX,
PIPE_BIND_VERTEX_BUFFER,
sizeof(ctx->vertices));
return &ctx->blitter;
......@@ -734,8 +733,8 @@ static void util_blitter_overlap_copy(struct blitter_context *blitter,
return;
tex_surf = screen->get_tex_surface(screen, texture, 0, 0, 0,
PIPE_BUFFER_USAGE_BLIT_SOURCE |
PIPE_BUFFER_USAGE_BLIT_DESTINATION);
PIPE_BIND_BLIT_SOURCE |
PIPE_BIND_BLIT_DESTINATION);
/* blit from the src to the temp */
util_blitter_do_copy(blitter, tex_surf, 0, 0,
......@@ -781,8 +780,8 @@ void util_blitter_copy(struct blitter_context *blitter,
is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
is_stencil = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 1) != 0;
dst_tex_usage = is_depth || is_stencil ? PIPE_TEXTURE_USAGE_DEPTH_STENCIL :
PIPE_TEXTURE_USAGE_RENDER_TARGET;
dst_tex_usage = is_depth || is_stencil ? PIPE_BIND_DEPTH_STENCIL :
PIPE_BIND_RENDER_TARGET;
/* check if we can sample from and render to the surfaces */
/* (assuming copying a stencil buffer is not possible) */
......@@ -790,7 +789,7 @@ void util_blitter_copy(struct blitter_context *blitter,
!screen->is_format_supported(screen, dst->format, dst->texture->target,
dst_tex_usage, 0) ||
!screen->is_format_supported(screen, src->format, src->texture->target,
PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
PIPE_BIND_SAMPLER_VIEW, 0)) {
util_surface_copy(pipe, FALSE, dst, dstx, dsty, src, srcx, srcy,
width, height);
return;
......@@ -827,7 +826,7 @@ void util_blitter_fill(struct blitter_context *blitter,
/* check if we can render to the surface */
if (util_format_is_depth_or_stencil(dst->format) || /* unlikely, but you never know */
!screen->is_format_supported(screen, dst->format, dst->texture->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
PIPE_BIND_RENDER_TARGET, 0)) {
util_surface_fill(pipe, dst, dstx, dsty, width, height, value);
return;
}
......
......@@ -477,7 +477,7 @@ void debug_dump_texture(struct pipe_context *pipe,
/* XXX for now, just dump image for face=0, level=0 */
surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
PIPE_TEXTURE_USAGE_SAMPLER);
PIPE_BIND_SAMPLER_VIEW);
if (surface) {
debug_dump_surface(pipe, prefix, surface);
screen->tex_surface_destroy(surface);
......
......@@ -114,7 +114,7 @@ util_draw_texquad(struct pipe_context *pipe,
v[29] = 1.0;
vbuf = pipe_user_buffer_create(pipe->screen, v, vertexBytes,
PIPE_BUFFER_USAGE_VERTEX);
PIPE_BIND_VERTEX_BUFFER);
if (!vbuf)
goto out;
......
......@@ -280,7 +280,9 @@ util_dump_template(struct os_stream *stream, const struct pipe_resource *templat
util_dump_member_end(stream);
util_dump_member(stream, uint, templat, last_level);
util_dump_member(stream, uint, templat, tex_usage);
util_dump_member(stream, uint, templat, _usage);
util_dump_member(stream, uint, templat, bind);
util_dump_member(stream, uint, templat, flags);
util_dump_struct_end(stream);
}
......
......@@ -1358,8 +1358,7 @@ get_next_slot(struct gen_mipmap_state *ctx)
if (!ctx->vbuf) {
ctx->vbuf = pipe_buffer_create(ctx->pipe->screen,
32,
PIPE_BUFFER_USAGE_VERTEX,
PIPE_BIND_VERTEX_BUFFER,
max_slots * sizeof ctx->vertices);
}
......@@ -1495,7 +1494,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
/* check if we can render in the texture's format */
if (!screen->is_format_supported(screen, psv->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
PIPE_BIND_RENDER_TARGET, 0)) {
fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel);
return;
}
......@@ -1541,7 +1540,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
struct pipe_surface *surf =
screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
PIPE_BUFFER_USAGE_RENDER_TARGET);
PIPE_BIND_RENDER_TARGET);
/*
* Setup framebuffer / dest surface
......
......@@ -128,13 +128,16 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_
static INLINE struct pipe_resource *
pipe_buffer_create( struct pipe_screen *screen,
unsigned alignment, unsigned usage, unsigned size )
unsigned bind,
unsigned size )
{
struct pipe_resource buffer;
memset(&buffer, 0, sizeof buffer);
buffer.target = PIPE_BUFFER;
buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
buffer.usage = usage;
buffer.bind = bind;
buffer._usage = PIPE_USAGE_DEFAULT;
buffer.flags = 0;
buffer.width0 = size;
buffer.height0 = 1;
buffer.depth0 = 1;
......
......@@ -118,7 +118,7 @@ struct pipe_winsys
* pools, or obtained directly from the windowing system.
*
* This callback is invoked by the pipe_screenwhen creating a texture marked
* with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying
* with the PIPE_BIND_DISPLAY_TARGET flag to get the underlying
* buffer storage.
*/
struct pipe_resource *(*surface_buffer_create)(struct pipe_winsys *ws,
......
......@@ -50,6 +50,7 @@
boolean
util_create_rgba_surface(struct pipe_screen *screen,
uint width, uint height,
uint bind,
struct pipe_resource **textureOut,
struct pipe_surface **surfaceOut)
{
......@@ -60,7 +61,6 @@ util_create_rgba_surface(struct pipe_screen *screen,
PIPE_FORMAT_NONE
};
const uint target = PIPE_TEXTURE_2D;
const uint usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
enum pipe_format format = PIPE_FORMAT_NONE;
struct pipe_resource templ;
uint i;
......@@ -68,7 +68,7 @@ util_create_rgba_surface(struct pipe_screen *screen,
/* Choose surface format */
for (i = 0; rgbaFormats[i]; i++) {
if (screen->is_format_supported(screen, rgbaFormats[i],
target, usage, 0)) {
target, bind, 0)) {
format = rgbaFormats[i];
break;
}
......@@ -84,7 +84,7 @@ util_create_rgba_surface(struct pipe_screen *screen,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
templ.tex_usage = usage;
templ.bind = bind;
*textureOut = screen->resource_create(screen, &templ);
if (!*textureOut)
......@@ -94,9 +94,7 @@ util_create_rgba_surface(struct pipe_screen *screen,
*surfaceOut = screen->get_tex_surface(screen,
*textureOut,
0, 0, 0,
(PIPE_BUFFER_USAGE_RENDER_TARGET |
PIPE_BUFFER_USAGE_BLIT_SOURCE |
PIPE_BUFFER_USAGE_BLIT_DESTINATION));
bind);
if (!*surfaceOut) {
pipe_resource_reference(textureOut, NULL);
return FALSE;
......
......@@ -52,7 +52,7 @@ util_same_surface(const struct pipe_surface *s1, const struct pipe_surface *s2)
extern boolean
util_create_rgba_surface(struct pipe_screen *screen,
uint width, uint height,
uint width, uint height, uint bind,
struct pipe_resource **textureOut,
struct pipe_surface **surfaceOut);
......
......@@ -149,7 +149,6 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
size = align(MAX2(upload->default_size, min_size), 4096);
upload->buffer = pipe_buffer_create( upload->pipe->screen,
upload->alignment,
upload->usage,
size );
if (upload->buffer == NULL)
......
......@@ -314,7 +314,7 @@ init_buffers(struct vl_compositor *c)
(
c->pipe->screen,
1,
PIPE_BUFFER_USAGE_VERTEX,
PIPE_BIND_VERTEX_BUFFER,
sizeof(struct vertex2f) * 4
);
......@@ -338,7 +338,7 @@ init_buffers(struct vl_compositor *c)
(
c->pipe->screen,
1,
PIPE_BUFFER_USAGE_VERTEX,
PIPE_BIND_VERTEX_BUFFER,
sizeof(struct vertex2f) * 4
);
......@@ -359,7 +359,7 @@ init_buffers(struct vl_compositor *c)
(
c->pipe->screen,
1,
PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD,
PIPE_BIND_CONSTANT_BUFFER | PIPE_BUFFER_USAGE_DISCARD,
sizeof(struct vertex_shader_consts)
);
......@@ -371,7 +371,7 @@ init_buffers(struct vl_compositor *c)
(
c->pipe->screen,
1,
PIPE_BUFFER_USAGE_CONSTANT,
PIPE_BIND_CONSTANT_BUFFER,
sizeof(struct fragment_shader_consts)
);
......
......@@ -898,7 +898,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
template.height0 = r->pot_buffers ?
util_next_power_of_two(r->picture_height) : r->picture_height;
template.depth0 = 1;
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC;
template.tex_usage = PIPE_BIND_SAMPLER_VIEW | PIPE_TEXTURE_USAGE_DYNAMIC;
r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template);
......@@ -927,7 +927,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
(
r->pipe->screen,
DEFAULT_BUF_ALIGNMENT,
PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_DISCARD,
PIPE_BIND_VERTEX_BUFFER | PIPE_BUFFER_USAGE_DISCARD,
sizeof(struct vertex2f) * 4 * 24 * r->macroblocks_per_batch
);
......@@ -939,7 +939,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
(
r->pipe->screen,
DEFAULT_BUF_ALIGNMENT,
PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_DISCARD,
PIPE_BIND_VERTEX_BUFFER | PIPE_BUFFER_USAGE_DISCARD,
sizeof(struct vertex2f) * 2 * 24 * r->macroblocks_per_batch
);
}
......@@ -948,7 +948,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
(
r->pipe->screen,
DEFAULT_BUF_ALIGNMENT,
PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD,
PIPE_BIND_CONSTANT_BUFFER | PIPE_BUFFER_USAGE_DISCARD,
sizeof(struct vertex_shader_consts)
);
......@@ -956,7 +956,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
(
r->pipe->screen,
DEFAULT_BUF_ALIGNMENT,
PIPE_BUFFER_USAGE_CONSTANT, sizeof(struct fragment_shader_consts)
PIPE_BIND_CONSTANT_BUFFER, sizeof(struct fragment_shader_consts)
);
memcpy
......
......@@ -141,9 +141,9 @@ cell_is_format_supported( struct pipe_screen *screen,
format == PIPE_FORMAT_A8B8G8R8_SRGB)
return FALSE;
if (tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
if (tex_usage & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
if (!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
return FALSE;
}
......
......@@ -130,9 +130,9 @@ cell_resource_create(struct pipe_screen *screen,
/* Create both a displaytarget (linear) and regular texture
* (twiddled). Convert twiddled->linear at flush_frontbuffer time.
*/
if (ct->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
if (ct->base.tex_usage & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
if (!cell_displaytarget_layout(screen, ct))
goto fail;
}
......
......@@ -45,7 +45,7 @@ struct cell_resource
unsigned long stride[CELL_MAX_TEXTURE_LEVELS];
/**
* Display target, for textures with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET
* Display target, for textures with the PIPE_BIND_DISPLAY_TARGET
* usage.
*/
struct sw_displaytarget *dt;
......
......@@ -137,7 +137,7 @@ struct pipe_resource *
i915_user_buffer_create(struct pipe_screen *screen,
void *ptr,
unsigned bytes,
unsigned usage)
unsigned bind)
{
struct i915_buffer *buf = CALLOC_STRUCT(i915_buffer);
......@@ -148,7 +148,9 @@ i915_user_buffer_create(struct pipe_screen *screen,
buf->b.vtbl = &i915_buffer_vtbl;
buf->b.b.screen = screen;
buf->b.b.format = PIPE_FORMAT_R8_UNORM; /* ?? */
buf->b.b.usage = usage;
buf->b.b._usage = PIPE_USAGE_IMMUTABLE;
buf->b.b.bind = bind;
buf->b.b.flags = 0;
buf->b.b.width0 = bytes;
buf->b.b.height0 = 1;
buf->b.b.depth0 = 1;
......
......@@ -219,12 +219,17 @@ i915_texture_layout_2d(struct i915_texture *tex)
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
/* used for scanouts that need special layouts */
if (pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
if (pt->bind & PIPE_BIND_SCANOUT)
if (i915_scanout_layout(tex))
return;
/* shared buffers needs to be compatible with X servers */
if (pt->tex_usage & PIPE_TEXTURE_USAGE_SHARED)
/* shared buffers needs to be compatible with X servers
*
* XXX: need a better name than shared for this if it is to be part
* of core gallium, and probably move the flag to resource.flags,
* rather than bindings.
*/
if (pt->bind & PIPE_BIND_SHARED)
if (i915_display_target_layout(tex))
return;
......@@ -369,12 +374,12 @@ i945_texture_layout_2d(struct i915_texture *tex)
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
/* used for scanouts that need special layouts */
if (tex->b.b.tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
if (tex->b.b.bind & PIPE_BIND_SCANOUT)
if (i915_scanout_layout(tex))
return;
/* shared buffers needs to be compatible with X servers */
if (tex->b.b.tex_usage & PIPE_TEXTURE_USAGE_SHARED)
if (tex->b.b.bind & PIPE_BIND_SHARED)
if (i915_display_target_layout(tex))
return;
......@@ -742,7 +747,11 @@ i915_texture_create(struct pipe_screen *screen,
tex_size = tex->stride * tex->total_nblocksy;
/* for scanouts and cursors, cursors arn't scanouts */
if ((template->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT) && template->width0 != 64)
/* XXX: use a custom flag for cursors, don't rely on magically
* guessing that this is Xorg asking for a cursor
*/
if ((template->bind & PIPE_BIND_SCANOUT) && template->width0 != 64)
buf_usage = INTEL_NEW_SCANOUT;
else
buf_usage = INTEL_NEW_TEXTURE;
......
......@@ -186,7 +186,7 @@ i915_is_format_supported(struct pipe_screen *screen,
const enum pipe_format *list;
uint i;
if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET)
if(tex_usage & PIPE_BIND_RENDER_TARGET)
list = surface_supported;
else
list = tex_supported;
......
......@@ -266,14 +266,14 @@ boolean brw_draw_init( struct brw_context *brw )
brw->vb.upload_vertex = u_upload_create( &brw->base,
128 * 1024,
64,
PIPE_BUFFER_USAGE_VERTEX );
PIPE_BIND_VERTEX_BUFFER );
if (brw->vb.upload_vertex == NULL)
return FALSE;
brw->vb.upload_index = u_upload_create( &brw->base,
32 * 1024,
64,
PIPE_BUFFER_USAGE_INDEX );
PIPE_BIND_INDEX_BUFFER );
if (brw->vb.upload_index == NULL)
return FALSE;
......
......@@ -143,17 +143,17 @@ brw_buffer_create(struct pipe_screen *screen,
pipe_reference_init(&buf->b.b.reference, 1);
buf->b.b.screen = screen;
switch (template->usage & (PIPE_BUFFER_USAGE_VERTEX |
PIPE_BUFFER_USAGE_INDEX |
PIPE_BUFFER_USAGE_CONSTANT))
switch (template->bind & (PIPE_BIND_VERTEX_BUFFER |
PIPE_BIND_INDEX_BUFFER |
PIPE_BIND_CONSTANT_BUFFER))
{
case PIPE_BUFFER_USAGE_VERTEX:
case PIPE_BUFFER_USAGE_INDEX:
case (PIPE_BUFFER_USAGE_VERTEX|PIPE_BUFFER_USAGE_INDEX):
case PIPE_BIND_VERTEX_BUFFER:
case PIPE_BIND_INDEX_BUFFER:
case (PIPE_BIND_VERTEX_BUFFER|PIPE_BIND_INDEX_BUFFER):
buffer_type = BRW_BUFFER_TYPE_VERTEX;
break;
case PIPE_BUFFER_USAGE_CONSTANT:
case PIPE_BIND_CONSTANT_BUFFER:
buffer_type = BRW_BUFFER_TYPE_SHADER_CONSTANTS;
break;
......@@ -177,7 +177,7 @@ struct pipe_resource *
brw_user_buffer_create(struct pipe_screen *screen,
void *ptr,
unsigned bytes,
unsigned usage)
unsigned bind)
{
struct brw_buffer *buf;
......@@ -189,7 +189,8 @@ brw_user_buffer_create(struct pipe_screen *screen,
buf->b.vtbl = &brw_buffer_vtbl;
buf->b.b.screen = screen;
buf->b.b.format = PIPE_FORMAT_R8_UNORM; /* ?? */
buf->b.b.usage = usage;
buf->b.b._usage = PIPE_USAGE_IMMUTABLE;
buf->b.b.bind = bind;
buf->b.b.width0 = bytes;
buf->b.b.height0 = 1;
buf->b.b.depth0 = 1;
......
......@@ -390,8 +390,8 @@ brw_texture_create( struct pipe_screen *screen,
goto fail;
if (template->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
if (template->bind & (PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
buffer_type = BRW_BUFFER_TYPE_SCANOUT;
}
else {
......
......@@ -276,9 +276,9 @@ brw_is_format_supported(struct pipe_screen *screen,
const enum pipe_format *list;
uint i;
if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL)
if (tex_usage & PIPE_BIND_DEPTH_STENCIL)
list = depth_supported;
else if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET)
else if (tex_usage & PIPE_BIND_RENDER_TARGET)
list = render_supported;
else
list = tex_supported;
......
......@@ -190,7 +190,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
break;
}
if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
if(tex_usage & PIPE_BIND_RENDER_TARGET) {
if(format_desc->block.width != 1 ||
format_desc->block.height != 1)
return FALSE;
......@@ -203,14 +203,14 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
return FALSE;
}
if(tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
if(tex_usage & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
if(!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
return FALSE;
}
if(tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
if(tex_usage & PIPE_BIND_DEPTH_STENCIL) {
if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
return FALSE;
......@@ -220,7 +220,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
}
/* FIXME: Temporary restrictions. See lp_bld_sample_soa.c */
if(tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
if(tex_usage & PIPE_BIND_SAMPLER_VIEW) {
if(format_desc->block.width != 1 ||
format_desc->block.height != 1)
return FALSE;
......
......@@ -128,9 +128,9 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
pipe_reference_init(&lpt->base.reference, 1);
lpt->base.screen = &screen->base;
if (lpt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
if (lpt->base.tex_usage & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
if (!llvmpipe_displaytarget_layout(screen, lpt))
goto fail;
}
......
......@@ -51,7 +51,7 @@ struct llvmpipe_resource
unsigned stride[LP_MAX_TEXTURE_2D_LEVELS];
/**
* Display target, for textures with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET
* Display target, for textures with the PIPE_BIND_DISPLAY_TARGET
* usage.
*/
struct sw_displaytarget *dt;
......
......@@ -46,19 +46,19 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
if (usage & NOUVEAU_BUFFER_USAGE_TRANSFER)
flags |= NOUVEAU_BO_GART;
else
if (usage & PIPE_BUFFER_USAGE_VERTEX) {
if (usage & NOUVEAU_BUFFER_USAGE_VERTEX) {
if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF))
flags |= NOUVEAU_BO_GART;
} else
if (usage & PIPE_BUFFER_USAGE_INDEX) {
if (usage & NOUVEAU_BUFFER_USAGE_INDEX) {
if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF))
flags |= NOUVEAU_BO_GART;
}
if (usage & PIPE_BUFFER_USAGE_PIXEL) {
if (usage & NOUVEAU_BUFFER_USAGE_PIXEL) {
if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE)
flags |= NOUVEAU_BO_GART;
if (!(usage & PIPE_BUFFER_USAGE_CPU_READ_WRITE))
if (!(usage & NOUVEAU_BUFFER_USAGE_CPU_READ_WRITE))
flags |= NOUVEAU_BO_VRAM;
if (dev->chipset == 0x50 || dev->chipset >= 0x80) {
......@@ -91,35 +91,16 @@ nouveau_screen_bo_user(struct pipe_screen *pscreen, void *ptr, unsigned bytes)
return bo;
}
static inline uint32_t
nouveau_screen_map_flags(unsigned pipe)
{
uint32_t flags = 0;
if (pipe & PIPE_BUFFER_USAGE_CPU_READ)
flags |= NOUVEAU_BO_RD;
if (pipe & PIPE_BUFFER_USAGE_CPU_WRITE)
flags |= NOUVEAU_BO_WR;
if (pipe & PIPE_BUFFER_USAGE_DISCARD)
flags |= NOUVEAU_BO_INVAL;
if (pipe & PIPE_BUFFER_USAGE_DONTBLOCK)
flags |= NOUVEAU_BO_NOWAIT;
else
if (pipe & PIPE_BUFFER_USAGE_UNSYNCHRONIZED)
flags |= NOUVEAU_BO_NOSYNC;
return flags;
}
void *
nouveau_screen_bo_map(struct pipe_screen *pscreen,
struct nouveau_bo *pb,
unsigned usage)
unsigned map_flags)
{
struct nouveau_screen *nscreen = nouveau_screen(pscreen);
int ret;
ret = nouveau_bo_map(bo, nouveau_screen_map_flags(usage));
ret = nouveau_bo_map(bo, map_flags);
if (ret) {
debug_printf("map failed: %d\n", ret);
return NULL;
......@@ -130,10 +111,9 @@ nouveau_screen_bo_map(struct pipe_screen *pscreen,
void *
nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct nouveau_bo *bo,
unsigned offset, unsigned length, unsigned usage)
unsigned offset, unsigned length, unsigned flags)
{
struct nouveau_screen *nscreen = nouveau_screen(pscreen);
uint32_t flags = nouveau_screen_map_flags(usage);
int ret;
ret = nouveau_bo_map_range(bo, offset, length, flags);
......
......@@ -16,14 +16,74 @@
#define NOUVEAU_CAP_HW_VTXBUF (0xbeef0000)
#define NOUVEAU_CAP_HW_IDXBUF (0xbeef0001)