From: Roland Scheidegger Date: Mon, 17 May 2010 19:33:37 +0000 (+0200) Subject: st/vega: adapt to interface changes X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c36c3d86b62b525291b1c6527de3ac5de93a2faf;p=profile%2Fivi%2Fmesa.git st/vega: adapt to interface changes --- diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 9c323b1..7c421df 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -270,7 +270,7 @@ struct vg_image * image_create(VGImageFormat format, image->sampler.normalized_coords = 1; assert(screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D, - PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW, 0)); memset(&pt, 0, sizeof(pt)); pt.target = PIPE_TEXTURE_2D; @@ -576,7 +576,7 @@ void image_set_pixels(VGint dx, VGint dy, pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); surf = screen->get_tex_surface(screen, image_texture(src), 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); + 0 /* no bind flags as surf isn't actually used??? */); vg_copy_surface(ctx, strb->surface, dx, dy, surf, sx+src->x, sy+src->y, width, height); @@ -601,7 +601,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy, pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); surf = screen->get_tex_surface(screen, image_texture(dst), 0, 0, 0, - PIPE_BIND_BLIT_SOURCE); + 0 /* no bind flags as surf isn't actually used??? */); vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy, strb->surface, sx, sy, width, height); diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index e6aea48..fe0f166 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -308,7 +308,7 @@ void renderer_copy_texture(struct renderer *ctx, #endif assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D, - PIPE_BIND_RENDER_TARGET, 0)); + 0, PIPE_BIND_RENDER_TARGET, 0)); /* save state (restored below) */ cso_save_blend(ctx->cso); @@ -415,7 +415,7 @@ void renderer_copy_surface(struct renderer *ctx, struct pipe_sampler_view view_templ; struct pipe_sampler_view *view; struct pipe_resource texTemp, *tex; - struct pipe_surface *texSurf; + struct pipe_subresource subsrc, subdst; struct pipe_framebuffer_state fb; struct st_framebuffer *stfb = ctx->owner->draw_buffer; const int srcW = abs(srcX1 - srcX0); @@ -441,11 +441,11 @@ void renderer_copy_surface(struct renderer *ctx, } assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, - PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW, 0)); assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - PIPE_BIND_SAMPLER_VIEW, 0)); + 0, PIPE_BIND_SAMPLER_VIEW, 0)); assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - PIPE_BIND_RENDER_TARGET, 0)); + 0, PIPE_BIND_RENDER_TARGET, 0)); /* * XXX for now we're always creating a temporary texture. @@ -460,6 +460,7 @@ void renderer_copy_surface(struct renderer *ctx, texTemp.width0 = srcW; texTemp.height0 = srcH; texTemp.depth0 = 1; + texTemp.bind = PIPE_BIND_SAMPLER_VIEW; tex = screen->resource_create(screen, &texTemp); if (!tex) @@ -471,24 +472,15 @@ void renderer_copy_surface(struct renderer *ctx, if (!view) return; - texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0, - PIPE_BIND_RENDER_TARGET); - - /* load temp texture */ - if (pipe->surface_copy) { - pipe->surface_copy(pipe, - texSurf, 0, 0, /* dest */ - src, srcLeft, srcTop, /* src */ - srcW, srcH); /* size */ - } else { - util_surface_copy(pipe, FALSE, - texSurf, 0, 0, /* dest */ - src, srcLeft, srcTop, /* src */ - srcW, srcH); /* size */ - } + subdst.face = 0; + subdst.level = 0; + subsrc.face = src->face; + subsrc.level = src->level; - /* free the surface, update the texture if necessary.*/ - screen->tex_surface_destroy(texSurf); + pipe->resource_copy_region(pipe, + tex, subdst, 0, 0, 0, /* dest */ + src->texture, subsrc, srcLeft, srcTop, src->zslice, /* src */ + srcW, srcH); /* size */ /* save state (restored below) */ cso_save_blend(ctx->cso); diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index 1a8952c..b55a2b5 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -451,8 +451,7 @@ void vg_prepare_blend_surface(struct vg_context *ctx) dest_surface = pipe->screen->get_tex_surface(pipe->screen, stfb->blend_texture_view->texture, 0, 0, 0, - PIPE_BIND_BLIT_DESTINATION | - PIPE_BIND_RENDER_TARGET); + PIPE_BIND_RENDER_TARGET); /* flip it, because we want to use it as a sampler */ util_blit_pixels_tex(ctx->blit, view, @@ -488,8 +487,7 @@ void vg_prepare_blend_surface_from_mask(struct vg_context *ctx) dest_surface = pipe->screen->get_tex_surface(pipe->screen, stfb->blend_texture_view->texture, 0, 0, 0, - PIPE_BIND_BLIT_DESTINATION | - PIPE_BIND_RENDER_TARGET); + PIPE_BIND_RENDER_TARGET); /* flip it, because we want to use it as a sampler */ util_blit_pixels_tex(ctx->blit, diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index aecac28..8a62a19 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -122,28 +122,22 @@ setup_new_alpha_mask(struct vg_context *ctx, struct st_framebuffer *stfb) /* 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); - pipe->surface_copy(pipe, - surface, - 0, 0, - old_surface, - 0, 0, - MIN2(old_surface->width, surface->width), - MIN2(old_surface->height, surface->height)); - if (surface) - pipe_surface_reference(&surface, NULL); - if (old_surface) - pipe_surface_reference(&old_surface, NULL); + struct pipe_subresource subsurf, subold_surf; + subsurf.face = 0; + subsurf.level = 0; + subold_surf.face = 0; + subold_surf.level = 0; + pipe->resource_copy_region(pipe, + stfb->alpha_mask_view->texture, + subsurf, + 0, 0, 0, + old_sampler_view->texture, + subold_surf, + 0, 0, 0, + MIN2(old_sampler_view->texture->width0, + stfb->alpha_mask_view->texture->width0), + MIN2(old_sampler_view->texture->height0, + stfb->alpha_mask_view->texture->height0)); } /* Free the old texture @@ -170,9 +164,7 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx, /* Probably need dedicated flags for surface usage too: */ - surface_usage = (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION); + surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */ dsrb->texture = create_texture(pipe, dsrb->format, width, height); if (!dsrb->texture) @@ -214,9 +206,7 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt) strb->texture = pt; strb->surface = screen->get_tex_surface(screen, strb->texture, 0, 0, 0, - PIPE_BIND_RENDER_TARGET | - PIPE_BIND_BLIT_SOURCE | - PIPE_BIND_BLIT_DESTINATION); + PIPE_BIND_RENDER_TARGET); if (!strb->surface) { pipe_resource_reference(&strb->texture, NULL); return TRUE;