Commit adfbba47 authored by Zack Rusin's avatar Zack Rusin

gallium: make p_winsys internal

move it to pipe/internal/p_winsys_screen.h and start converting
the state trackers to the screen usage
parent 3cfaccf9
......@@ -44,7 +44,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_error.h"
#include "pipe/p_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_thread.h"
#include "util/u_memory.h"
#include "util/u_double_list.h"
......
......@@ -36,7 +36,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_thread.h"
#include "util/u_memory.h"
#include "util/u_double_list.h"
......
......@@ -35,7 +35,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_thread.h"
#include "util/u_math.h"
#include "util/u_memory.h"
......
......@@ -34,7 +34,7 @@
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "pb_buffer.h"
......@@ -184,8 +184,8 @@ pb_winsys_buffer_destroy(struct pipe_winsys *winsys,
void
pb_init_winsys(struct pipe_winsys *winsys)
{
winsys->_user_buffer_create = pb_winsys_user_buffer_create;
winsys->_buffer_map = pb_winsys_buffer_map;
winsys->_buffer_unmap = pb_winsys_buffer_unmap;
winsys->_buffer_destroy = pb_winsys_buffer_destroy;
winsys->user_buffer_create = pb_winsys_user_buffer_create;
winsys->buffer_map = pb_winsys_buffer_map;
winsys->buffer_unmap = pb_winsys_buffer_unmap;
winsys->buffer_destroy = pb_winsys_buffer_destroy;
}
......@@ -37,7 +37,6 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_blit.h"
......
......@@ -29,7 +29,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "util/u_draw_quad.h"
......
......@@ -38,7 +38,6 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"
......
......@@ -37,7 +37,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/p_screen.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"
......
......@@ -29,7 +29,7 @@
* Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "u_timed_winsys.h"
#include "util/u_memory.h"
#include "util/u_time.h"
......@@ -122,7 +122,7 @@ timed_buffer_create(struct pipe_winsys *winsys,
uint64_t start = time_start();
struct pipe_buffer *buf =
backend->_buffer_create( backend, alignment, usage, size );
backend->buffer_create( backend, alignment, usage, size );
time_finish(winsys, start, 0, __FUNCTION__);
......@@ -140,7 +140,7 @@ timed_user_buffer_create(struct pipe_winsys *winsys,
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
uint64_t start = time_start();
struct pipe_buffer *buf = backend->_user_buffer_create( backend, data, bytes );
struct pipe_buffer *buf = backend->user_buffer_create( backend, data, bytes );
time_finish(winsys, start, 1, __FUNCTION__);
......@@ -156,7 +156,7 @@ timed_buffer_map(struct pipe_winsys *winsys,
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
uint64_t start = time_start();
void *map = backend->_buffer_map( backend, buf, flags );
void *map = backend->buffer_map( backend, buf, flags );
time_finish(winsys, start, 2, __FUNCTION__);
......@@ -171,7 +171,7 @@ timed_buffer_unmap(struct pipe_winsys *winsys,
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
uint64_t start = time_start();
backend->_buffer_unmap( backend, buf );
backend->buffer_unmap( backend, buf );
time_finish(winsys, start, 3, __FUNCTION__);
}
......@@ -184,7 +184,7 @@ timed_buffer_destroy(struct pipe_winsys *winsys,
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
uint64_t start = time_start();
backend->_buffer_destroy( backend, buf );
backend->buffer_destroy( backend, buf );
time_finish(winsys, start, 4, __FUNCTION__);
}
......@@ -216,7 +216,7 @@ timed_surface_buffer_create(struct pipe_winsys *winsys,
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
uint64_t start = time_start();
struct pipe_buffer *ret = backend->_surface_buffer_create( backend, width, height,
struct pipe_buffer *ret = backend->surface_buffer_create( backend, width, height,
format, usage, stride );
time_finish(winsys, start, 7, __FUNCTION__);
......@@ -296,12 +296,12 @@ struct pipe_winsys *u_timed_winsys_create( struct pipe_winsys *backend )
{
struct timed_winsys *ws = CALLOC_STRUCT(timed_winsys);
ws->base._user_buffer_create = timed_user_buffer_create;
ws->base._buffer_map = timed_buffer_map;
ws->base._buffer_unmap = timed_buffer_unmap;
ws->base._buffer_destroy = timed_buffer_destroy;
ws->base._buffer_create = timed_buffer_create;
ws->base._surface_buffer_create = timed_surface_buffer_create;
ws->base.user_buffer_create = timed_user_buffer_create;
ws->base.buffer_map = timed_buffer_map;
ws->base.buffer_unmap = timed_buffer_unmap;
ws->base.buffer_destroy = timed_buffer_destroy;
ws->base.buffer_create = timed_buffer_create;
ws->base.surface_buffer_create = timed_surface_buffer_create;
ws->base.flush_frontbuffer = timed_flush_frontbuffer;
ws->base.get_name = timed_get_name;
ws->base.fence_reference = timed_fence_reference;
......
......@@ -36,7 +36,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_format.h"
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_screen.h"
#include "draw/draw_context.h"
......
......@@ -33,7 +33,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "cell_context.h"
......@@ -52,7 +52,7 @@ cell_map_constant_buffers(struct cell_context *sp)
uint i;
for (i = 0; i < 2; i++) {
if (sp->constants[i].size) {
sp->mapped_constants[i] = ws->_buffer_map(ws, sp->constants[i].buffer,
sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
cell_flush_buffer_range(sp, sp->mapped_constants[i],
sp->constants[i].buffer->size);
......@@ -71,7 +71,7 @@ cell_unmap_constant_buffers(struct cell_context *sp)
uint i;
for (i = 0; i < 2; i++) {
if (sp->constants[i].size)
ws->_buffer_unmap(ws, sp->constants[i].buffer);
ws->buffer_unmap(ws, sp->constants[i].buffer);
sp->mapped_constants[i] = NULL;
}
}
......
......@@ -27,7 +27,7 @@
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
......
......@@ -28,7 +28,7 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_parse.h"
......
......@@ -34,7 +34,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
......@@ -112,7 +112,7 @@ cell_texture_create(struct pipe_screen *screen,
cell_texture_layout(ct);
ct->buffer = ws->_buffer_create(ws, 32, PIPE_BUFFER_USAGE_PIXEL,
ct->buffer = ws->buffer_create(ws, 32, PIPE_BUFFER_USAGE_PIXEL,
ct->buffer_size);
if (!ct->buffer) {
......@@ -324,11 +324,11 @@ cell_twiddle_texture(struct pipe_screen *screen,
/* allocate buffer for tiled data now */
struct pipe_winsys *ws = screen->winsys;
uint bytes = bufWidth * bufHeight * 4 * numFaces;
ct->tiled_buffer[level] = ws->_buffer_create(ws, 16,
ct->tiled_buffer[level] = ws->buffer_create(ws, 16,
PIPE_BUFFER_USAGE_PIXEL,
bytes);
/* and map it */
ct->tiled_mapped[level] = ws->_buffer_map(ws, ct->tiled_buffer[level],
ct->tiled_mapped[level] = ws->buffer_map(ws, ct->tiled_buffer[level],
PIPE_BUFFER_USAGE_GPU_READ);
}
dst = (uint *) ((ubyte *) ct->tiled_mapped[level] + offset);
......
......@@ -31,7 +31,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "cell_context.h"
......
......@@ -27,7 +27,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "pipe/p_context.h"
......
......@@ -34,7 +34,7 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"
......
......@@ -30,7 +30,7 @@
#include "i915_winsys.h"
#include "i915_debug.h"
#include "i915_batch.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_debug.h"
......
......@@ -72,7 +72,7 @@ void i915_print_ureg(const char *msg, unsigned ureg);
#if defined(DEBUG) && defined(FILE_DEBUG_FLAG)
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
static INLINE void
I915_DBG(
......
......@@ -28,7 +28,7 @@
#include "i915_reg.h"
#include "i915_debug.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
......
......@@ -42,7 +42,7 @@
#include "draw/draw_vbuf.h"
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
......
......@@ -27,7 +27,7 @@
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_string.h"
......
......@@ -30,7 +30,7 @@
#include "draw/draw_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
......@@ -536,10 +536,10 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
if (buf) {
void *mapped;
if (buf->buffer && buf->buffer->size &&
(mapped = ws->_buffer_map(ws, buf->buffer,
(mapped = ws->buffer_map(ws, buf->buffer,
PIPE_BUFFER_USAGE_CPU_READ))) {
memcpy(i915->current.constants[shader], mapped, buf->buffer->size);
ws->_buffer_unmap(ws, buf->buffer);
ws->buffer_unmap(ws, buf->buffer);
i915->current.num_user_constants[shader]
= buf->buffer->size / (4 * sizeof(float));
}
......
......@@ -31,7 +31,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_tile.h"
#include "util/u_rect.h"
......
......@@ -34,7 +34,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
......@@ -605,7 +605,7 @@ i915_texture_create(struct pipe_screen *screen,
tex_size = tex->stride * tex->total_nblocksy;
tex->buffer = ws->_buffer_create(ws, 64,
tex->buffer = ws->buffer_create(ws, 64,
PIPE_BUFFER_USAGE_PIXEL,
tex_size);
......@@ -613,10 +613,10 @@ i915_texture_create(struct pipe_screen *screen,
goto fail;
#if 0
void *ptr = ws->_buffer_map(ws, tex->buffer,
void *ptr = ws->buffer_map(ws, tex->buffer,
PIPE_BUFFER_USAGE_CPU_WRITE);
memset(ptr, 0x80, tex_size);
ws->_buffer_unmap(ws, tex->buffer);
ws->buffer_unmap(ws, tex->buffer);
#endif
return &tex->base;
......
......@@ -35,7 +35,7 @@
#include "brw_reg.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
......
......@@ -37,7 +37,7 @@
#include "brw_tex_layout.h"
#include "brw_winsys.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_context.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"
......
......@@ -38,7 +38,7 @@
#include "brw_util.h"
#include "brw_wm.h"
#include "pipe/p_state.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
......@@ -256,13 +256,13 @@ static void upload_constant_buffer(struct brw_context *brw)
/* FIXME: buffer size is num_consts + num_immediates */
if (brw->vs.prog_data->num_consts) {
/* map the vertex constant buffer and copy to curbe: */
void *data = ws->_buffer_map(ws, cbuffer->buffer, 0);
void *data = ws->buffer_map(ws, cbuffer->buffer, 0);
/* FIXME: this is wrong. the cbuffer->buffer->size currently
* represents size of consts + immediates. so if we'll
* have both we'll copy over the end of the buffer
* with the subsequent memcpy */
memcpy(&buf[offset], data, cbuffer->buffer->size);
ws->_buffer_unmap(ws, cbuffer->buffer);
ws->buffer_unmap(ws, cbuffer->buffer);
offset += cbuffer->buffer->size;
}
/*immediates*/
......
......@@ -34,7 +34,7 @@
#include "brw_state.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
static unsigned hw_prim[PIPE_PRIM_POLYGON+1] = {
_3DPRIM_POINTLIST,
......
......@@ -27,7 +27,7 @@
#include "util/u_memory.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_string.h"
#include "brw_context.h"
......
......@@ -30,7 +30,7 @@
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
......
......@@ -42,7 +42,7 @@
* the pool.
*/
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
......
......@@ -30,7 +30,7 @@
#include "brw_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_tile.h"
#include "util/u_rect.h"
......
......@@ -37,7 +37,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "brw_context.h"
......@@ -295,7 +295,7 @@ brw_texture_create_screen(struct pipe_screen *screen,
tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]);
if (brw_miptree_layout(tex))
tex->buffer = ws->_buffer_create(ws, 64,
tex->buffer = ws->buffer_create(ws, 64,
PIPE_BUFFER_USAGE_PIXEL,
tex->stride *
tex->total_nblocksy);
......
......@@ -2,7 +2,7 @@
#define NOUVEAU_WINSYS_H
#include <stdint.h>
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "nouveau/nouveau_bo.h"
......
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv04_context.h"
#include "nv04_screen.h"
......
......@@ -58,7 +58,7 @@ nv04_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
nv04_miptree_layout(mt);
mt->buffer = ws->_buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
mt->total_size);
if (!mt->buffer) {
FREE(mt);
......
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_compiler.h"
#include "draw/draw_vbuf.h"
......
......@@ -117,7 +117,7 @@ nv04_surface_map(struct pipe_screen *screen, struct pipe_surface *surface,
struct pipe_winsys *ws = screen->winsys;
void *map;
map = ws->_buffer_map(ws, surface->buffer, flags);
map = ws->buffer_map(ws, surface->buffer, flags);
if (!map)
return NULL;
......@@ -129,7 +129,7 @@ nv04_surface_unmap(struct pipe_screen *screen, struct pipe_surface *surface)
{
struct pipe_winsys *ws = screen->winsys;
ws->_buffer_unmap(ws, surface->buffer);
ws->buffer_unmap(ws, surface->buffer);
}
static void
......
......@@ -28,7 +28,7 @@
#include "nv04_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
......
......@@ -23,7 +23,7 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (nv04->vertex_buffer[i].buffer) {
void *buf
= pipe->winsys->_buffer_map(pipe->winsys,
= pipe->winsys->buffer_map(pipe->winsys,
nv04->vertex_buffer[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_vertex_buffer(draw, i, buf);
......@@ -32,7 +32,7 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
/* Map index buffer, if present */
if (indexBuffer) {
void *mapped_indexes
= pipe->winsys->_buffer_map(pipe->winsys, indexBuffer,
= pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
}
......@@ -49,12 +49,12 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
*/
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (nv04->vertex_buffer[i].buffer) {
pipe->winsys->_buffer_unmap(pipe->winsys, nv04->vertex_buffer[i].buffer);
pipe->winsys->buffer_unmap(pipe->winsys, nv04->vertex_buffer[i].buffer);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}
if (indexBuffer) {
pipe->winsys->_buffer_unmap(pipe->winsys, indexBuffer);
pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
draw_set_mapped_element_buffer(draw, 0, NULL);
}
......
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv10_context.h"
#include "nv10_screen.h"
......
......@@ -65,7 +65,7 @@ nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
nv10_miptree_layout(mt);
mt->buffer = ws->_buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
mt->total_size);
if (!mt->buffer) {
FREE(mt);
......
......@@ -40,7 +40,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
#include "pipe/internal/p_winsys_screen.h"
#include "nv10_context.h"
#include "nv10_state.h"
......@@ -111,11 +111,11 @@ nv10_vbuf_render_allocate_vertices( struct vbuf_render *render,
size_t size = (size_t)vertex_size * (size_t)nr_vertices;
assert(!nv10_render->buffer);
nv10_render->buffer = winsys->_buffer_create(winsys, 64, PIPE_BUFFER_USAGE_VERTEX, size);
nv10_render->buffer = winsys->buffer_create(winsys, 64, PIPE_BUFFER_USAGE_VERTEX, size);
nv10->dirty |= NV10_NEW_VTXARRAYS;
return winsys->_buffer_map(winsys,
return winsys->buffer_map(winsys,