X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fi915%2Fi915_surface.c;h=57e90c6ed23a8c2c672c5966cef606d3fda817be;hb=4379dcc12d36bf9993a06c628c9426d4f54ba58d;hp=8afe8d07867f5042e75dff5ca1286f9ac2899429;hpb=82a76e61e7bee68bc3dcc1cca94db94ce21ea268;p=mesa.git diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index 8afe8d07867..57e90c6ed23 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -81,52 +81,36 @@ i915_surface_copy_render(struct pipe_context *pipe, struct pipe_resource *src, unsigned src_level, const struct pipe_box *src_box) { - struct pipe_screen *screen = pipe->screen; struct i915_context *i915 = i915_context(pipe); - struct i915_texture *dst_tex = i915_texture(dst); - struct i915_texture *src_tex = i915_texture(src); unsigned src_width0 = src->width0; unsigned src_height0 = src->height0; unsigned dst_width0 = dst->width0; unsigned dst_height0 = dst->height0; - unsigned layout; struct pipe_box dstbox; struct pipe_sampler_view src_templ, *src_view; struct pipe_surface dst_templ, *dst_view; + const struct util_format_description *desc; - /* Fallback for buffers and npot. */ - if ((dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) || - !util_is_power_of_two(src_width0) || !util_is_power_of_two(src_height0)) { - util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz, - src, src_level, src_box); - return; - } + /* Fallback for buffers. */ + if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) + goto fallback; - layout = util_format_description(dst_templ.format)->layout; - - if (!util_blitter_is_copy_supported(i915->blitter, dst, src)) { - switch (util_format_get_blocksize(dst_templ.format)) { - case 1: - dst_templ.format = PIPE_FORMAT_I8_UNORM; - break; - case 2: - dst_templ.format = PIPE_FORMAT_B5G6R5_UNORM; - break; - case 4: - dst_templ.format = PIPE_FORMAT_B8G8R8A8_UNORM; - break; - default: - debug_printf("i915: copy_region: Unhandled format: %s. Falling back to software.\n" - "i915: copy_region: Software fallback doesn't work for tiled textures.\n", - util_format_short_name(dst_templ.format)); - } - src_templ.format = dst_templ.format; - } + /* Fallback for depth&stencil. XXX: see if we can use a proxy format */ + desc = util_format_description(src->format); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) + goto fallback; - i915_util_blitter_save_states(i915); + desc = util_format_description(dst->format); + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) + goto fallback; util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz); - util_blitter_default_src_texture(&src_templ, src, src_level); + util_blitter_default_src_texture(i915->blitter, &src_templ, src, src_level); + + if (!util_blitter_is_copy_supported(i915->blitter, dst, src)) + goto fallback; + + i915_util_blitter_save_states(i915); dst_view = i915_create_surface_custom(pipe, dst, &dst_templ, dst_width0, dst_height0); src_view = i915_create_sampler_view_custom(pipe, src, &src_templ, src_width0, src_height0); @@ -136,7 +120,13 @@ i915_surface_copy_render(struct pipe_context *pipe, util_blitter_blit_generic(i915->blitter, dst_view, &dstbox, src_view, src_box, src_width0, src_height0, - PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL); + PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL, + FALSE); + return; + +fallback: + util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz, + src, src_level, src_box); } static void @@ -144,7 +134,8 @@ i915_clear_render_target_render(struct pipe_context *pipe, struct pipe_surface *dst, const union pipe_color_union *color, unsigned dstx, unsigned dsty, - unsigned width, unsigned height) + unsigned width, unsigned height, + bool render_condition_enabled) { struct i915_context *i915 = i915_context(pipe); struct pipe_framebuffer_state fb_state; @@ -176,7 +167,8 @@ i915_clear_depth_stencil_render(struct pipe_context *pipe, double depth, unsigned stencil, unsigned dstx, unsigned dsty, - unsigned width, unsigned height) + unsigned width, unsigned height, + bool render_condition_enabled) { struct i915_context *i915 = i915_context(pipe); struct pipe_framebuffer_state fb_state; @@ -291,7 +283,8 @@ i915_clear_render_target_blitter(struct pipe_context *pipe, struct pipe_surface *dst, const union pipe_color_union *color, unsigned dstx, unsigned dsty, - unsigned width, unsigned height) + unsigned width, unsigned height, + bool render_condition_enabled) { struct i915_texture *tex = i915_texture(dst->texture); struct pipe_resource *pt = &tex->b.b; @@ -319,7 +312,8 @@ i915_clear_depth_stencil_blitter(struct pipe_context *pipe, double depth, unsigned stencil, unsigned dstx, unsigned dsty, - unsigned width, unsigned height) + unsigned width, unsigned height, + bool render_condition_enabled) { struct i915_texture *tex = i915_texture(dst->texture); struct pipe_resource *pt = &tex->b.b;