diff options
author | Chia-I Wu <olv@lunarg.com> | 2010-04-12 16:39:18 +0800 |
---|---|---|
committer | Chia-I Wu <olv@lunarg.com> | 2010-04-13 15:15:43 +0800 |
commit | a1dbd009d4a725b432a08093dc52486f896915d9 (patch) | |
tree | 11bb95867d2b10657a748903d8d792f2429029a0 /src/gallium/state_trackers | |
parent | 76708c665c393c8316fff8592ee55a5be0d13d14 (diff) | |
download | external_mesa3d-a1dbd009d4a725b432a08093dc52486f896915d9.zip external_mesa3d-a1dbd009d4a725b432a08093dc52486f896915d9.tar.gz external_mesa3d-a1dbd009d4a725b432a08093dc52486f896915d9.tar.bz2 |
st/vega: Drop st_public support.
There is no user of st_public now.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/vega/Makefile | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/vg_manager.c | 18 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/vg_tracker.c | 463 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/vg_tracker.h | 128 |
4 files changed, 0 insertions, 610 deletions
diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile index 8b5a31c..b871990 100644 --- a/src/gallium/state_trackers/vega/Makefile +++ b/src/gallium/state_trackers/vega/Makefile @@ -27,7 +27,6 @@ VG_SOURCES = \ vg_context.c \ vg_manager.c \ vg_state.c \ - vg_tracker.c \ vg_translate.c \ polygon.c \ bezier.c \ diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index 5ed5ae1..e422675 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -282,16 +282,6 @@ vg_manager_flush_frontbuffer(struct vg_context *ctx) if (!stfb) return; - /* st_public.h is used */ - if (!stfb->iface) { - struct pipe_screen *screen = ctx->pipe->screen; - if (screen->flush_frontbuffer) { - screen->flush_frontbuffer(screen, - stfb->strb->surface, ctx->pipe->priv); - } - return; - } - switch (stfb->strb_att) { case ST_ATTACHMENT_FRONT_LEFT: case ST_ATTACHMENT_FRONT_RIGHT: @@ -315,14 +305,6 @@ vg_manager_validate_framebuffer(struct vg_context *ctx) if (!stfb) return; - /* st_public.h is used */ - if (!stfb->iface) { - struct pipe_screen *screen = ctx->pipe->screen; - if (screen->update_buffer) - screen->update_buffer(screen, ctx->pipe->priv); - return; - } - if (!p_atomic_read(&ctx->draw_buffer_invalid)) return; diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c deleted file mode 100644 index 117c6d3..0000000 --- a/src/gallium/state_trackers/vega/vg_tracker.c +++ /dev/null @@ -1,463 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "vg_context.h" -#include "vg_tracker.h" -#include "mask.h" - -#include "pipe/p_context.h" -#include "util/u_inlines.h" -#include "pipe/p_screen.h" -#include "util/u_format.h" -#include "util/u_sampler.h" -#include "util/u_memory.h" -#include "util/u_math.h" -#include "util/u_rect.h" - -/* advertise OpenVG support */ -PUBLIC const int st_api_OpenVG = 1; - -static struct pipe_resource * -create_texture(struct pipe_context *pipe, enum pipe_format format, - VGint width, VGint height) -{ - struct pipe_resource templ; - - memset(&templ, 0, sizeof(templ)); - - if (format != PIPE_FORMAT_NONE) { - templ.format = format; - } - else { - templ.format = PIPE_FORMAT_B8G8R8A8_UNORM; - } - - templ.target = PIPE_TEXTURE_2D; - templ.width0 = width; - templ.height0 = height; - templ.depth0 = 1; - templ.last_level = 0; - - if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) { - templ.bind = PIPE_BIND_DEPTH_STENCIL; - } else { - templ.bind = (PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_SAMPLER_VIEW); - } - - return pipe->screen->resource_create(pipe->screen, &templ); -} - -static struct pipe_sampler_view * -create_tex_and_view(struct pipe_context *pipe, enum pipe_format format, - VGint width, VGint height) -{ - struct pipe_resource *texture; - struct pipe_sampler_view view_templ; - struct pipe_sampler_view *view; - - texture = create_texture(pipe, format, width, height); - - if (!texture) - return NULL; - - u_sampler_view_default_template(&view_templ, texture, texture->format); - view = pipe->create_sampler_view(pipe, texture, &view_templ); - /* want the texture to go away if the view is freed */ - pipe_resource_reference(&texture, NULL); - - return view; -} - -/** - * Allocate a renderbuffer for a an on-screen window (not a user-created - * renderbuffer). The window system code determines the format. - */ -static struct st_renderbuffer * -st_new_renderbuffer_fb(enum pipe_format format) -{ - struct st_renderbuffer *strb; - - strb = CALLOC_STRUCT(st_renderbuffer); - if (!strb) { - /*_vega_error(NULL, VG_OUT_OF_MEMORY, "creating renderbuffer");*/ - return NULL; - } - - strb->format = format; - - return strb; -} - - -/** - * This is called to allocate the original drawing surface, and - * during window resize. - */ -static VGboolean -st_renderbuffer_alloc_storage(struct vg_context * ctx, - struct st_renderbuffer *strb, - VGuint width, VGuint height) -{ - struct pipe_context *pipe = ctx->pipe; - unsigned surface_usage; - - /* Free the old surface and texture - */ - pipe_surface_reference(&strb->surface, NULL); - pipe_resource_reference(&strb->texture, NULL); - - - /* Probably need dedicated flags for surface usage too: - */ - surface_usage = (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION); - - strb->texture = create_texture(pipe, strb->format, width, height); - - - if (!strb->texture) - return FALSE; - - strb->surface = pipe->screen->get_tex_surface(pipe->screen, - strb->texture, - 0, 0, 0, - surface_usage); - strb->width = width; - strb->height = height; - - assert(strb->surface->width == width); - assert(strb->surface->height == height); - - return strb->surface != NULL; -} - -struct vg_context * st_create_context(struct pipe_context *pipe, - const void *visual, - struct vg_context *share) -{ - struct vg_context *ctx = vg_create_context(pipe, visual, share); - /*debug_printf("--------- CREATE CONTEXT %p\n", ctx);*/ - return ctx; -} - -void st_destroy_context(struct vg_context *st) -{ - /*debug_printf("--------- DESTROY CONTEXT %p\n", st);*/ - vg_destroy_context(st); -} - -void st_copy_context_state(struct vg_context *dst, struct vg_context *src, - uint mask) -{ - fprintf(stderr, "FIXME: %s\n", __FUNCTION__); -} - -void st_get_framebuffer_dimensions(struct st_framebuffer *stfb, - uint *width, - uint *height) -{ - *width = stfb->strb->width; - *height = stfb->strb->height; -} - -struct st_framebuffer * st_create_framebuffer(const void *visual, - enum pipe_format colorFormat, - enum pipe_format depthFormat, - enum pipe_format stencilFormat, - uint width, uint height, - void *privateData) -{ - struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer); - if (stfb) { - struct st_renderbuffer *rb = - st_new_renderbuffer_fb(colorFormat); - stfb->strb = rb; -#if 0 - if (doubleBuffer) { - struct st_renderbuffer *rb = - st_new_renderbuffer_fb(colorFormat); - } -#endif - - /* we want to combine the depth/stencil */ - if (stencilFormat == depthFormat) - stfb->dsrb = st_new_renderbuffer_fb(stencilFormat); - else - stfb->dsrb = st_new_renderbuffer_fb(PIPE_FORMAT_Z24_UNORM_S8_USCALED); - - /*### currently we always allocate it but it's possible it's - not necessary if EGL_ALPHA_MASK_SIZE was 0 - */ - stfb->alpha_mask_view = NULL; - - stfb->width = width; - stfb->height = height; - stfb->privateData = privateData; - } - - return stfb; -} - -static void setup_new_alpha_mask(struct vg_context *ctx, - struct st_framebuffer *stfb, - uint width, uint height) -{ - struct pipe_context *pipe = ctx->pipe; - struct pipe_sampler_view *old_sampler_view = stfb->alpha_mask_view; - - /* - we use PIPE_FORMAT_B8G8R8A8_UNORM because we want to render to - this texture and use it as a sampler, so while this wastes some - space it makes both of those a lot simpler - */ - stfb->alpha_mask_view = - create_tex_and_view(pipe, PIPE_FORMAT_B8G8R8A8_UNORM, width, height); - - if (!stfb->alpha_mask_view) { - if (old_sampler_view) - pipe_sampler_view_reference(&old_sampler_view, NULL); - return; - } - - vg_validate_state(ctx); - - /* alpha mask starts with 1.f alpha */ - mask_fill(0, 0, width, height, 1.f); - - /* if we had an old surface copy it over */ - if (old_sampler_view) { - struct pipe_surface *surface = pipe->screen->get_tex_surface( - pipe->screen, - stfb->alpha_mask_view->texture, - 0, 0, 0, - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_BLIT_DESTINATION); - struct pipe_surface *old_surface = pipe->screen->get_tex_surface( - pipe->screen, - old_sampler_view->texture, - 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); - if (pipe->surface_copy) { - pipe->surface_copy(pipe, - surface, - 0, 0, - old_surface, - 0, 0, - MIN2(old_surface->width, width), - MIN2(old_surface->height, height)); - } else { - util_surface_copy(pipe, FALSE, - surface, - 0, 0, - old_surface, - 0, 0, - MIN2(old_surface->width, width), - MIN2(old_surface->height, height)); - } - if (surface) - pipe_surface_reference(&surface, NULL); - if (old_surface) - pipe_surface_reference(&old_surface, NULL); - } - - /* Free the old texture - */ - if (old_sampler_view) - pipe_sampler_view_reference(&old_sampler_view, NULL); -} - -void st_resize_framebuffer(struct st_framebuffer *stfb, - uint width, uint height) -{ - struct vg_context *ctx = vg_current_context(); - struct st_renderbuffer *strb = stfb->strb; - struct pipe_framebuffer_state *state; - - if (!ctx) - return; - - state = &ctx->state.g3d.fb; - - /* If this is a noop, exit early and don't do the clear, etc below. - */ - if (stfb->width == width && - stfb->height == height && - state->zsbuf) - return; - - stfb->width = width; - stfb->height = height; - - if (strb->width != width || strb->height != height) - st_renderbuffer_alloc_storage(ctx, strb, - width, height); - - if (stfb->dsrb->width != width || stfb->dsrb->height != height) - st_renderbuffer_alloc_storage(ctx, stfb->dsrb, - width, height); - - { - VGuint i; - - memset(state, 0, sizeof(struct pipe_framebuffer_state)); - - state->width = width; - state->height = height; - - state->nr_cbufs = 1; - state->cbufs[0] = strb->surface; - for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) - state->cbufs[i] = 0; - - state->zsbuf = stfb->dsrb->surface; - - cso_set_framebuffer(ctx->cso_context, state); - } - - ctx->state.dirty |= VIEWPORT_DIRTY; - ctx->state.dirty |= DEPTH_STENCIL_DIRTY;/*to reset the scissors*/ - - ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_DEPTHSTENCIL, - NULL, 0.0, 0); - - /* we need all the other state already set */ - - setup_new_alpha_mask(ctx, stfb, width, height); - - pipe_sampler_view_reference( &stfb->blend_texture_view, NULL ); - stfb->blend_texture_view = create_tex_and_view(ctx->pipe, PIPE_FORMAT_B8G8R8A8_UNORM, - width, height); -} - -void st_set_framebuffer_surface(struct st_framebuffer *stfb, - uint surfIndex, struct pipe_surface *surf) -{ - struct st_renderbuffer *rb = stfb->strb; - - /* unreference existing surfaces */ - pipe_surface_reference( &rb->surface, NULL ); - pipe_resource_reference( &rb->texture, NULL ); - - /* reference new ones */ - pipe_surface_reference( &rb->surface, surf ); - pipe_resource_reference( &rb->texture, surf->texture ); - - rb->width = surf->width; - rb->height = surf->height; -} - -int st_get_framebuffer_surface(struct st_framebuffer *stfb, - uint surfIndex, struct pipe_surface **surf) -{ - struct st_renderbuffer *rb = stfb->strb; - *surf = rb->surface; - return VG_TRUE; -} - -int st_get_framebuffer_texture(struct st_framebuffer *stfb, - uint surfIndex, struct pipe_resource **tex) -{ - struct st_renderbuffer *rb = stfb->strb; - *tex = rb->texture; - return VG_TRUE; -} - -void * st_framebuffer_private(struct st_framebuffer *stfb) -{ - return stfb->privateData; -} - -void st_unreference_framebuffer(struct st_framebuffer *stfb) -{ - /* FIXME */ -} - -boolean st_make_current(struct vg_context *st, - struct st_framebuffer *draw, - struct st_framebuffer *read, - void *winsys_drawable_handle) -{ - vg_set_current_context(st); - if (st) - st->draw_buffer = draw; - return VG_TRUE; -} - -struct vg_context *st_get_current(void) -{ - return vg_current_context(); -} - -void st_flush(struct vg_context *st, uint pipeFlushFlags, - struct pipe_fence_handle **fence) -{ - st->pipe->flush(st->pipe, pipeFlushFlags, fence); -} - -void st_finish(struct vg_context *st) -{ - struct pipe_fence_handle *fence = NULL; - - st_flush(st, PIPE_FLUSH_RENDER_CACHE, &fence); - - st->pipe->screen->fence_finish(st->pipe->screen, fence, 0); - st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL); -} - -void st_notify_swapbuffers(struct st_framebuffer *stfb) -{ - struct vg_context *ctx = vg_current_context(); - if (ctx && ctx->draw_buffer == stfb) { - st_flush(ctx, - PIPE_FLUSH_RENDER_CACHE | - PIPE_FLUSH_SWAPBUFFERS | - PIPE_FLUSH_FRAME, - NULL); - } -} - -void st_notify_swapbuffers_complete(struct st_framebuffer *stfb) -{ -} - -int st_bind_texture_surface(struct pipe_surface *ps, int target, int level, - enum pipe_format format) -{ - return 0; -} - -int st_unbind_texture_surface(struct pipe_surface *ps, int target, int level) -{ - return 0; -} - -st_proc st_get_proc_address(const char *procname) -{ - return NULL; -} diff --git a/src/gallium/state_trackers/vega/vg_tracker.h b/src/gallium/state_trackers/vega/vg_tracker.h deleted file mode 100644 index c16d55f..0000000 --- a/src/gallium/state_trackers/vega/vg_tracker.h +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef VG_TRACKER_H -#define VG_TRACKER_H - -#include "VG/openvg.h" - -#include "pipe/p_compiler.h" -#include "pipe/p_format.h" - -#define ST_SURFACE_FRONT_LEFT 0 -#define ST_SURFACE_BACK_LEFT 1 -#define ST_SURFACE_FRONT_RIGHT 2 -#define ST_SURFACE_BACK_RIGHT 3 -#define ST_SURFACE_DEPTH 8 - -struct vg_context; -struct st_framebuffer; -struct pipe_context; -struct pipe_fence_handle; -struct pipe_surface; - - -PUBLIC -struct vg_context *st_create_context(struct pipe_context *pipe, - const void *visual, - struct vg_context *share); - -PUBLIC -void st_destroy_context( struct vg_context *st ); - -PUBLIC -void st_copy_context_state(struct vg_context *dst, struct vg_context *src, - uint mask); - -PUBLIC -struct st_framebuffer *st_create_framebuffer(const void *visual, - enum pipe_format colorFormat, - enum pipe_format depthFormat, - enum pipe_format stencilFormat, - uint width, uint height, - void *privateData); - -PUBLIC -void st_resize_framebuffer(struct st_framebuffer *stfb, - uint width, uint height); - -PUBLIC -void st_set_framebuffer_surface(struct st_framebuffer *stfb, - uint surfIndex, struct pipe_surface *surf); - -PUBLIC -void st_get_framebuffer_dimensions( struct st_framebuffer *stfb, - uint *width, uint *height); - -PUBLIC -int st_bind_texture_surface(struct pipe_surface *ps, int target, int level, - enum pipe_format format); - -PUBLIC -int st_unbind_texture_surface(struct pipe_surface *ps, int target, int level); - -PUBLIC -int st_get_framebuffer_surface(struct st_framebuffer *stfb, - uint surfIndex, struct pipe_surface **surf); - -PUBLIC -int st_get_framebuffer_texture(struct st_framebuffer *stfb, - uint surfIndex, struct pipe_resource **tex); - -PUBLIC -void *st_framebuffer_private(struct st_framebuffer *stfb); - -PUBLIC -void st_unreference_framebuffer(struct st_framebuffer *stfb); - -PUBLIC -boolean st_make_current(struct vg_context *st, - struct st_framebuffer *draw, - struct st_framebuffer *read, - void *winsys_drawable_handle); - -PUBLIC -struct vg_context *st_get_current(void); - -PUBLIC -void st_flush(struct vg_context *st, uint pipeFlushFlags, - struct pipe_fence_handle **fence); -PUBLIC -void st_finish(struct vg_context *st); - -PUBLIC -void st_notify_swapbuffers(struct st_framebuffer *stfb); -PUBLIC -void st_notify_swapbuffers_complete(struct st_framebuffer *stfb); - - -/** Generic function type */ -typedef void (*st_proc)(); - -PUBLIC -st_proc st_get_proc_address(const char *procname); - -#endif |