diff options
Diffstat (limited to 'src/gallium/drivers/galahad')
-rw-r--r-- | src/gallium/drivers/galahad/glhd_context.c | 68 | ||||
-rw-r--r-- | src/gallium/drivers/galahad/glhd_objects.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/galahad/glhd_objects.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/galahad/glhd_screen.c | 45 |
4 files changed, 61 insertions, 66 deletions
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 50f66079c2a..a572ad22bd0 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -662,17 +662,13 @@ galahad_set_index_buffer(struct pipe_context *_pipe, static void galahad_resource_copy_region(struct pipe_context *_pipe, struct pipe_resource *_dst, - struct pipe_subresource subdst, + unsigned dst_level, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_resource *_src, - struct pipe_subresource subsrc, - unsigned srcx, - unsigned srcy, - unsigned srcz, - unsigned width, - unsigned height) + unsigned src_level, + const struct pipe_box *src_box) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct galahad_resource *glhd_resource_dst = galahad_resource(_dst); @@ -689,17 +685,13 @@ galahad_resource_copy_region(struct pipe_context *_pipe, pipe->resource_copy_region(pipe, dst, - subdst, + dst_level, dstx, dsty, dstz, src, - subsrc, - srcx, - srcy, - srcz, - width, - height); + src_level, + src_box); } static void @@ -781,8 +773,8 @@ galahad_flush(struct pipe_context *_pipe, static unsigned int galahad_is_resource_referenced(struct pipe_context *_pipe, struct pipe_resource *_resource, - unsigned face, - unsigned level) + unsigned level, + int layer) { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct galahad_resource *glhd_resource = galahad_resource(_resource); @@ -791,8 +783,8 @@ galahad_is_resource_referenced(struct pipe_context *_pipe, return pipe->is_resource_referenced(pipe, resource, - face, - level); + level, + layer); } static struct pipe_sampler_view * @@ -823,10 +815,40 @@ galahad_context_sampler_view_destroy(struct pipe_context *_pipe, galahad_sampler_view(_view)); } +static struct pipe_surface * +galahad_context_create_surface(struct pipe_context *_pipe, + struct pipe_resource *_resource, + const struct pipe_surface *templ) +{ + struct galahad_context *glhd_context = galahad_context(_pipe); + struct galahad_resource *glhd_resource = galahad_resource(_resource); + struct pipe_context *pipe = glhd_context->pipe; + struct pipe_resource *resource = glhd_resource->resource; + struct pipe_surface *result; + + result = pipe->create_surface(pipe, + resource, + templ); + + if (result) + return galahad_surface_create(glhd_context, glhd_resource, result); + return NULL; +} + +static void +galahad_context_surface_destroy(struct pipe_context *_pipe, + struct pipe_surface *_surface) +{ + galahad_surface_destroy(galahad_context(_pipe), + galahad_surface(_surface)); +} + + + static struct pipe_transfer * galahad_context_get_transfer(struct pipe_context *_context, struct pipe_resource *_resource, - struct pipe_subresource sr, + unsigned level, unsigned usage, const struct pipe_box *box) { @@ -838,7 +860,7 @@ galahad_context_get_transfer(struct pipe_context *_context, result = context->get_transfer(context, resource, - sr, + level, usage, box); @@ -915,7 +937,7 @@ galahad_context_transfer_unmap(struct pipe_context *_context, static void galahad_context_transfer_inline_write(struct pipe_context *_context, struct pipe_resource *_resource, - struct pipe_subresource sr, + unsigned level, unsigned usage, const struct pipe_box *box, const void *data, @@ -929,7 +951,7 @@ galahad_context_transfer_inline_write(struct pipe_context *_context, context->transfer_inline_write(context, resource, - sr, + level, usage, box, data, @@ -1004,6 +1026,8 @@ galahad_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) glhd_pipe->base.is_resource_referenced = galahad_is_resource_referenced; glhd_pipe->base.create_sampler_view = galahad_context_create_sampler_view; glhd_pipe->base.sampler_view_destroy = galahad_context_sampler_view_destroy; + glhd_pipe->base.create_surface = galahad_context_create_surface; + glhd_pipe->base.surface_destroy = galahad_context_surface_destroy; glhd_pipe->base.get_transfer = galahad_context_get_transfer; glhd_pipe->base.transfer_destroy = galahad_context_transfer_destroy; glhd_pipe->base.transfer_map = galahad_context_transfer_map; diff --git a/src/gallium/drivers/galahad/glhd_objects.c b/src/gallium/drivers/galahad/glhd_objects.c index 6c5a21ae704..b50d85655e8 100644 --- a/src/gallium/drivers/galahad/glhd_objects.c +++ b/src/gallium/drivers/galahad/glhd_objects.c @@ -71,7 +71,8 @@ galahad_resource_destroy(struct galahad_resource *glhd_resource) struct pipe_surface * -galahad_surface_create(struct galahad_resource *glhd_resource, +galahad_surface_create(struct galahad_context *glhd_context, + struct galahad_resource *glhd_resource, struct pipe_surface *surface) { struct galahad_surface *glhd_surface; @@ -100,10 +101,11 @@ error: } void -galahad_surface_destroy(struct galahad_surface *glhd_surface) +galahad_surface_destroy(struct galahad_context *glhd_context, + struct galahad_surface *glhd_surface) { pipe_resource_reference(&glhd_surface->base.texture, NULL); - pipe_surface_reference(&glhd_surface->surface, NULL); + glhd_context->pipe->surface_destroy(glhd_context->pipe, glhd_surface->surface); FREE(glhd_surface); } diff --git a/src/gallium/drivers/galahad/glhd_objects.h b/src/gallium/drivers/galahad/glhd_objects.h index dc74c5bebc9..13dc7485887 100644 --- a/src/gallium/drivers/galahad/glhd_objects.h +++ b/src/gallium/drivers/galahad/glhd_objects.h @@ -149,11 +149,13 @@ void galahad_resource_destroy(struct galahad_resource *glhd_resource); struct pipe_surface * -galahad_surface_create(struct galahad_resource *glhd_resource, +galahad_surface_create(struct galahad_context *glhd_context, + struct galahad_resource *glhd_resource, struct pipe_surface *surface); void -galahad_surface_destroy(struct galahad_surface *glhd_surface); +galahad_surface_destroy(struct galahad_context *glhd_context, + struct galahad_surface *glhd_surface); struct pipe_sampler_view * galahad_sampler_view_create(struct galahad_context *glhd_context, diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c index b6cc41d908b..b4825bef66d 100644 --- a/src/gallium/drivers/galahad/glhd_screen.c +++ b/src/gallium/drivers/galahad/glhd_screen.c @@ -223,39 +223,6 @@ galahad_screen_resource_destroy(struct pipe_screen *screen, galahad_resource_destroy(galahad_resource(_resource)); } -static struct pipe_surface * -galahad_screen_get_tex_surface(struct pipe_screen *_screen, - struct pipe_resource *_resource, - unsigned face, - unsigned level, - unsigned zslice, - unsigned usage) -{ - struct galahad_screen *glhd_screen = galahad_screen(_screen); - struct galahad_resource *glhd_resource = galahad_resource(_resource); - struct pipe_screen *screen = glhd_screen->screen; - struct pipe_resource *resource = glhd_resource->resource; - struct pipe_surface *result; - - result = screen->get_tex_surface(screen, - resource, - face, - level, - zslice, - usage); - - if (result) - return galahad_surface_create(glhd_resource, result); - return NULL; -} - -static void -galahad_screen_tex_surface_destroy(struct pipe_surface *_surface) -{ - galahad_surface_destroy(galahad_surface(_surface)); -} - - static struct pipe_resource * galahad_screen_user_buffer_create(struct pipe_screen *_screen, @@ -281,16 +248,18 @@ galahad_screen_user_buffer_create(struct pipe_screen *_screen, static void galahad_screen_flush_frontbuffer(struct pipe_screen *_screen, - struct pipe_surface *_surface, + struct pipe_resource *_resource, + unsigned level, unsigned layer, void *context_private) { struct galahad_screen *glhd_screen = galahad_screen(_screen); - struct galahad_surface *glhd_surface = galahad_surface(_surface); + struct galahad_resource *glhd_resource = galahad_resource(_resource); struct pipe_screen *screen = glhd_screen->screen; - struct pipe_surface *surface = glhd_surface->surface; + struct pipe_resource *resource = glhd_resource->resource; screen->flush_frontbuffer(screen, - surface, + resource, + level, layer, context_private); } @@ -360,8 +329,6 @@ galahad_screen_create(struct pipe_screen *screen) glhd_screen->base.resource_from_handle = galahad_screen_resource_from_handle; glhd_screen->base.resource_get_handle = galahad_screen_resource_get_handle; glhd_screen->base.resource_destroy = galahad_screen_resource_destroy; - glhd_screen->base.get_tex_surface = galahad_screen_get_tex_surface; - glhd_screen->base.tex_surface_destroy = galahad_screen_tex_surface_destroy; glhd_screen->base.user_buffer_create = galahad_screen_user_buffer_create; glhd_screen->base.flush_frontbuffer = galahad_screen_flush_frontbuffer; glhd_screen->base.fence_reference = galahad_screen_fence_reference; |