From 9b75627fab5bf2ea90f27ddd31b60c54895f6de6 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 15 Apr 2009 15:53:34 +0200 Subject: gallium: Make sure we flush before some texture / buffer operations. Also implement context member functions to optimize away those flushes whenever possible. Signed-off-by: Thomas Hellstrom --- src/gallium/drivers/softpipe/sp_context.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gallium/drivers/softpipe/sp_context.c') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 06ace27d14..6ae4d1ad7b 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -121,6 +121,21 @@ static void softpipe_destroy( struct pipe_context *pipe ) FREE( softpipe ); } +static unsigned int +softpipe_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level, + unsigned zslice) +{ + return PIPE_UNREFERENCED; +} + +static unsigned int +softpipe_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + return PIPE_UNREFERENCED; +} struct pipe_context * softpipe_create( struct pipe_screen *screen, @@ -190,6 +205,9 @@ softpipe_create( struct pipe_screen *screen, softpipe->pipe.clear = softpipe_clear; softpipe->pipe.flush = softpipe_flush; + softpipe->pipe.is_texture_referenced = softpipe_is_texture_referenced; + softpipe->pipe.is_buffer_referenced = softpipe_is_buffer_referenced; + softpipe_init_query_funcs( softpipe ); softpipe_init_texture_funcs( softpipe ); -- cgit v1.2.3 From 876e95dcc83d05dfecb0dcb890f42af0a565e6a6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 18 Apr 2009 23:06:11 +0100 Subject: softpipe: Fix softpipe_is_texture_referenced prototype. --- src/gallium/drivers/softpipe/sp_context.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gallium/drivers/softpipe/sp_context.c') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 6ae4d1ad7b..2c6a0b53b0 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -124,8 +124,7 @@ static void softpipe_destroy( struct pipe_context *pipe ) static unsigned int softpipe_is_texture_referenced( struct pipe_context *pipe, struct pipe_texture *texture, - unsigned face, unsigned level, - unsigned zslice) + unsigned face, unsigned level) { return PIPE_UNREFERENCED; } -- cgit v1.2.3 From dc1153ce83041a397b1d1815db4133ce8c53eaa1 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 18 Apr 2009 23:14:42 +0100 Subject: softpipe: Simplify softpipe_create's prototype. --- src/gallium/drivers/softpipe/sp_context.c | 6 ++---- src/gallium/drivers/softpipe/sp_winsys.h | 4 +--- src/gallium/state_trackers/python/st_softpipe_winsys.c | 2 +- src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c | 4 +--- src/gallium/winsys/egl_xlib/egl_xlib.c | 2 +- src/gallium/winsys/g3dvl/xsp_winsys.c | 2 +- src/gallium/winsys/gdi/gdi_softpipe_winsys.c | 2 +- src/gallium/winsys/xlib/xlib_softpipe.c | 2 +- 8 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src/gallium/drivers/softpipe/sp_context.c') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 2c6a0b53b0..62e8d99cfd 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -137,9 +137,7 @@ softpipe_is_buffer_referenced( struct pipe_context *pipe, } struct pipe_context * -softpipe_create( struct pipe_screen *screen, - struct pipe_winsys *pipe_winsys, - void *unused ) +softpipe_create( struct pipe_screen *screen ) { struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context); uint i; @@ -154,7 +152,7 @@ softpipe_create( struct pipe_screen *screen, softpipe->dump_fs = debug_get_bool_option( "GALLIUM_DUMP_FS", FALSE ); - softpipe->pipe.winsys = pipe_winsys; + softpipe->pipe.winsys = screen->winsys; softpipe->pipe.screen = screen; softpipe->pipe.destroy = softpipe_destroy; diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h index 44720b7960..cf91e7782b 100644 --- a/src/gallium/drivers/softpipe/sp_winsys.h +++ b/src/gallium/drivers/softpipe/sp_winsys.h @@ -45,9 +45,7 @@ struct pipe_winsys; struct pipe_context; -struct pipe_context *softpipe_create( struct pipe_screen *, - struct pipe_winsys *, - void *unused ); +struct pipe_context *softpipe_create( struct pipe_screen * ); struct pipe_screen * diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index 41cdeaa6fd..f0a4826a00 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -260,7 +260,7 @@ st_softpipe_screen_create(void) static struct pipe_context * st_softpipe_context_create(struct pipe_screen *screen) { - return softpipe_create(screen, screen->winsys, NULL); + return softpipe_create(screen); } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c index 3c0d6f11aa..f038bfa40e 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c @@ -37,7 +37,5 @@ struct pipe_context *radeon_create_softpipe(struct pipe_winsys* winsys) pipe_screen = softpipe_create_screen(winsys); - return softpipe_create(pipe_screen, - winsys, - NULL); + return softpipe_create(pipe_screen); } diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c index 68fe64a52e..b52f427e4a 100644 --- a/src/gallium/winsys/egl_xlib/egl_xlib.c +++ b/src/gallium/winsys/egl_xlib/egl_xlib.c @@ -359,7 +359,7 @@ xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, /* fall-through */ case EGL_OPENGL_API: /* create a softpipe context */ - ctx->pipe = softpipe_create(xdrv->screen, xdrv->winsys, NULL); + ctx->pipe = softpipe_create(xdrv->screen); /* Now do xlib / state tracker inits here */ _eglConfigToContextModesRec(conf, &visual); ctx->Context = st_create_context(ctx->pipe, &visual, share_ctx); diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c index 5b9fdb5c1f..698c2856a4 100644 --- a/src/gallium/winsys/g3dvl/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xsp_winsys.c @@ -261,7 +261,7 @@ struct pipe_context* create_pipe_context(Display *display, int screen) } sp_screen = softpipe_create_screen((struct pipe_winsys*)xsp_winsys); - sp_pipe = softpipe_create(sp_screen, (struct pipe_winsys*)xsp_winsys, NULL); + sp_pipe = softpipe_create(sp_screen); xsp_context = calloc(1, sizeof(struct xsp_context)); xsp_context->display = display; diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c index df7e43d56b..33826524d7 100644 --- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c @@ -263,7 +263,7 @@ gdi_softpipe_screen_create(void) static struct pipe_context * gdi_softpipe_context_create(struct pipe_screen *screen) { - return softpipe_create(screen, screen->winsys, NULL); + return softpipe_create(screen); } diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 762ebd9847..44b8464518 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -482,7 +482,7 @@ xlib_create_softpipe_context( struct pipe_screen *screen, { struct pipe_context *pipe; - pipe = softpipe_create(screen, screen->winsys, NULL); + pipe = softpipe_create(screen); if (pipe == NULL) goto fail; -- cgit v1.2.3 From d27d79db4a52327e437146cde3fa3fb85b37de9a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 20 Apr 2009 14:57:00 -0600 Subject: softpipe: fix softpipe_is_buffer/texture_referenced() regression Return the conservative PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE value for now. This fixes a bunch of regressions seen in piglit and glean. --- src/gallium/drivers/softpipe/sp_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers/softpipe/sp_context.c') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 62e8d99cfd..11aff81479 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -126,14 +126,14 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level) { - return PIPE_UNREFERENCED; + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } static unsigned int softpipe_is_buffer_referenced( struct pipe_context *pipe, struct pipe_buffer *buf) { - return PIPE_UNREFERENCED; + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } struct pipe_context * -- cgit v1.2.3 From 46ddcbc1a9e70d5dba257e6421eb69ed942dd1da Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 28 Apr 2009 14:29:27 -0600 Subject: softpipe: return PIPE_UNREFERENCED in softpipe_is_buffer/texture_referenced() This allows the engine demo to run again (avoid crash in VBO code). This stuff still needs to be revisited someday though... --- src/gallium/drivers/softpipe/sp_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers/softpipe/sp_context.c') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 11aff81479..62e8d99cfd 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -126,14 +126,14 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level) { - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + return PIPE_UNREFERENCED; } static unsigned int softpipe_is_buffer_referenced( struct pipe_context *pipe, struct pipe_buffer *buf) { - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + return PIPE_UNREFERENCED; } struct pipe_context * -- cgit v1.2.3