X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fvega%2Fapi_filters.c;h=8ace9853368b15e8cbaeaa6f27c39c1d62afacc7;hb=c492066071c17e55740f3eed69b3344e6f1793ff;hp=a643f38624fd709da57c3fcaa18a949a8e841885;hpb=182c42c8da6edfa66819eef02f4dea310c1f68d7;p=mesa.git diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index a643f38624f..8ace9853368 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -28,6 +28,7 @@ #include "vg_context.h" #include "image.h" +#include "api.h" #include "renderer.h" #include "shaders_cache.h" #include "st_inlines.h" @@ -41,6 +42,7 @@ #include "util/u_format.h" #include "util/u_memory.h" #include "util/u_sampler.h" +#include "util/u_string.h" #include "asm_filters.h" @@ -57,14 +59,14 @@ struct filter_info { struct pipe_sampler_view *extra_texture_view; }; -static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, +static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx, const VGuint *color_data, const VGint color_data_len) { struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_texture *tex = 0; - struct pipe_texture templ; + struct pipe_resource *tex = 0; + struct pipe_resource templ; memset(&templ, 0, sizeof(templ)); templ.target = PIPE_TEXTURE_1D; @@ -73,20 +75,20 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, templ.width0 = color_data_len; templ.height0 = 1; templ.depth0 = 1; - templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + templ.bind = PIPE_BIND_SAMPLER_VIEW; - tex = screen->texture_create(screen, &templ); + tex = screen->resource_create(screen, &templ); { /* upload color_data */ struct pipe_transfer *transfer = - pipe->get_tex_transfer(pipe, tex, + pipe_get_transfer(pipe, tex, 0, 0, 0, PIPE_TRANSFER_READ_WRITE , 0, 0, tex->width0, tex->height0); void *map = pipe->transfer_map(pipe, transfer); memcpy(map, color_data, sizeof(VGint)*color_data_len); pipe->transfer_unmap(pipe, transfer); - pipe->tex_transfer_destroy(pipe, transfer); + pipe->transfer_destroy(pipe, transfer); } return tex; @@ -97,7 +99,7 @@ static INLINE struct pipe_sampler_view *create_texture_1d_view(struct vg_context const VGint color_data_len) { struct pipe_context *pipe = ctx->pipe; - struct pipe_texture *texture; + struct pipe_resource *texture; struct pipe_sampler_view view_templ; struct pipe_sampler_view *view; @@ -109,7 +111,7 @@ static INLINE struct pipe_sampler_view *create_texture_1d_view(struct vg_context 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_texture_reference(&texture, NULL); + pipe_resource_reference(&texture, NULL); return view; } @@ -121,7 +123,7 @@ static INLINE struct pipe_surface * setup_framebuffer(struct vg_image *dst) struct pipe_framebuffer_state fb; struct pipe_surface *dst_surf = pipe->screen->get_tex_surface( pipe->screen, dst->sampler_view->texture, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_WRITE); + PIPE_BIND_RENDER_TARGET); /* drawing dest */ memset(&fb, 0, sizeof(fb)); @@ -170,14 +172,14 @@ static void setup_constant_buffer(struct vg_context *ctx, const void *buffer, VGint param_bytes) { struct pipe_context *pipe = ctx->pipe; - struct pipe_buffer **cbuf = &ctx->filter.buffer; + struct pipe_resource **cbuf = &ctx->filter.buffer; /* We always need to get a new buffer, to keep the drivers simple and * avoid gratuitous rendering synchronization. */ - pipe_buffer_reference(cbuf, NULL); + pipe_resource_reference(cbuf, NULL); - *cbuf = pipe_buffer_create(pipe->screen, 16, - PIPE_BUFFER_USAGE_CONSTANT, + *cbuf = pipe_buffer_create(pipe->screen, + PIPE_BIND_CONSTANT_BUFFER, param_bytes); if (*cbuf) { @@ -270,7 +272,7 @@ static struct vg_shader * setup_convolution(struct vg_context *ctx, void *user_d VGint num_consts = (VGint)(long)(user_data); struct vg_shader *shader; - snprintf(buffer, 1023, convolution_asm, num_consts, num_consts / 2 + 1); + util_snprintf(buffer, 1023, convolution_asm, num_consts, num_consts / 2 + 1); shader = shader_create_from_text(ctx->pipe, buffer, 200, PIPE_SHADER_FRAGMENT); @@ -298,16 +300,16 @@ static struct vg_shader * setup_lookup_single(struct vg_context *ctx, void *user switch(channel) { case VG_RED: - snprintf(buffer, 1023, lookup_single_asm, "xxxx"); + util_snprintf(buffer, 1023, lookup_single_asm, "xxxx"); break; case VG_GREEN: - snprintf(buffer, 1023, lookup_single_asm, "yyyy"); + util_snprintf(buffer, 1023, lookup_single_asm, "yyyy"); break; case VG_BLUE: - snprintf(buffer, 1023, lookup_single_asm, "zzzz"); + util_snprintf(buffer, 1023, lookup_single_asm, "zzzz"); break; case VG_ALPHA: - snprintf(buffer, 1023, lookup_single_asm, "wwww"); + util_snprintf(buffer, 1023, lookup_single_asm, "wwww"); break; default: debug_assert(!"Unknown color channel"); @@ -361,8 +363,8 @@ static void execute_filter(struct vg_context *ctx, pipe_surface_reference(&dst_surf, NULL); } -void vgColorMatrix(VGImage dst, VGImage src, - const VGfloat * matrix) +void vegaColorMatrix(VGImage dst, VGImage src, + const VGfloat * matrix) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s; @@ -403,13 +405,13 @@ static VGfloat texture_offset(VGfloat width, VGint kernelSize, VGint current, VG return diff / width; } -void vgConvolve(VGImage dst, VGImage src, - VGint kernelWidth, VGint kernelHeight, - VGint shiftX, VGint shiftY, - const VGshort * kernel, - VGfloat scale, - VGfloat bias, - VGTilingMode tilingMode) +void vegaConvolve(VGImage dst, VGImage src, + VGint kernelWidth, VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernel, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) { struct vg_context *ctx = vg_current_context(); VGfloat *buffer; @@ -508,15 +510,15 @@ void vgConvolve(VGImage dst, VGImage src, free(buffer); } -void vgSeparableConvolve(VGImage dst, VGImage src, - VGint kernelWidth, - VGint kernelHeight, - VGint shiftX, VGint shiftY, - const VGshort * kernelX, - const VGshort * kernelY, - VGfloat scale, - VGfloat bias, - VGTilingMode tilingMode) +void vegaSeparableConvolve(VGImage dst, VGImage src, + VGint kernelWidth, + VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernelX, + const VGshort * kernelY, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) { struct vg_context *ctx = vg_current_context(); VGshort *kernel; @@ -600,10 +602,10 @@ static void compute_gaussian_kernel(VGfloat *kernel, } } -void vgGaussianBlur(VGImage dst, VGImage src, - VGfloat stdDeviationX, - VGfloat stdDeviationY, - VGTilingMode tilingMode) +void vegaGaussianBlur(VGImage dst, VGImage src, + VGfloat stdDeviationX, + VGfloat stdDeviationY, + VGTilingMode tilingMode) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s; @@ -699,13 +701,13 @@ void vgGaussianBlur(VGImage dst, VGImage src, free(kernel); } -void vgLookup(VGImage dst, VGImage src, - const VGubyte * redLUT, - const VGubyte * greenLUT, - const VGubyte * blueLUT, - const VGubyte * alphaLUT, - VGboolean outputLinear, - VGboolean outputPremultiplied) +void vegaLookup(VGImage dst, VGImage src, + const VGubyte * redLUT, + const VGubyte * greenLUT, + const VGubyte * blueLUT, + const VGubyte * alphaLUT, + VGboolean outputLinear, + VGboolean outputPremultiplied) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s; @@ -758,11 +760,11 @@ void vgLookup(VGImage dst, VGImage src, pipe_sampler_view_reference(&lut_texture_view, NULL); } -void vgLookupSingle(VGImage dst, VGImage src, - const VGuint * lookupTable, - VGImageChannel sourceChannel, - VGboolean outputLinear, - VGboolean outputPremultiplied) +void vegaLookupSingle(VGImage dst, VGImage src, + const VGuint * lookupTable, + VGImageChannel sourceChannel, + VGboolean outputLinear, + VGboolean outputPremultiplied) { struct vg_context *ctx = vg_current_context(); struct vg_image *d, *s;