X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi965%2Fintel_tex.c;h=7ce2ceb9a2f7f72e555d34a5ccd5adccaa7284d3;hb=8c47ccb13a198f4d38c772df1de457de34dde23e;hp=3335fd1ff0d9c04fe0fd4a2c56545c9cf88d79f9;hpb=bf504b61274123f09720c80569a8b4f2d3495630;p=mesa.git diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c index 3335fd1ff0d..7ce2ceb9a2f 100644 --- a/src/mesa/drivers/dri/i965/intel_tex.c +++ b/src/mesa/drivers/dri/i965/intel_tex.c @@ -5,6 +5,7 @@ #include "main/mipmap.h" #include "drivers/common/meta.h" #include "brw_context.h" +#include "brw_defines.h" #include "intel_buffer_objects.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" @@ -15,7 +16,7 @@ static struct gl_texture_image * intelNewTextureImage(struct gl_context * ctx) { - DBG("%s\n", __FUNCTION__); + DBG("%s\n", __func__); (void) ctx; return (struct gl_texture_image *) CALLOC_STRUCT(intel_texture_image); } @@ -35,7 +36,7 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) (void) ctx; - DBG("%s\n", __FUNCTION__); + DBG("%s\n", __func__); if (obj == NULL) return NULL; @@ -70,7 +71,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, /* Quantize sample count */ if (image->NumSamples) { - image->NumSamples = intel_quantize_num_samples(brw->intelScreen, image->NumSamples); + image->NumSamples = intel_quantize_num_samples(brw->screen, image->NumSamples); if (!image->NumSamples) return false; } @@ -88,12 +89,14 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, intel_miptree_match_image(intel_texobj->mt, image)) { intel_miptree_reference(&intel_image->mt, intel_texobj->mt); DBG("%s: alloc obj %p level %d %dx%dx%d using object's miptree %p\n", - __FUNCTION__, texobj, image->Level, + __func__, texobj, image->Level, image->Width, image->Height, image->Depth, intel_texobj->mt); } else { intel_image->mt = intel_miptree_create_for_teximage(brw, intel_texobj, intel_image, - false); + 1 /* samples */); + if (!intel_image->mt) + return false; /* Even if the object currently has a mipmap tree associated * with it, this one is a more likely candidate to represent the @@ -103,7 +106,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx, intel_miptree_reference(&intel_texobj->mt, intel_image->mt); DBG("%s: alloc obj %p level %d %dx%dx%d using new miptree %p\n", - __FUNCTION__, texobj, image->Level, + __func__, texobj, image->Level, image->Width, image->Height, image->Depth, intel_image->mt); } @@ -127,7 +130,7 @@ intel_alloc_texture_storage(struct gl_context *ctx, struct brw_context *brw = brw_context(ctx); struct intel_texture_object *intel_texobj = intel_texture_object(texobj); struct gl_texture_image *first_image = texobj->Image[0][0]; - int num_samples = intel_quantize_num_samples(brw->intelScreen, + int num_samples = intel_quantize_num_samples(brw->screen, first_image->NumSamples); const int numFaces = _mesa_num_tex_faces(texobj->Target); int face; @@ -140,14 +143,14 @@ intel_alloc_texture_storage(struct gl_context *ctx, !intel_miptree_match_image(intel_texobj->mt, first_image) || intel_texobj->mt->last_level != levels - 1) { intel_miptree_release(&intel_texobj->mt); + + intel_get_image_dims(first_image, &width, &height, &depth); intel_texobj->mt = intel_miptree_create(brw, texobj->Target, first_image->TexFormat, 0, levels - 1, width, height, depth, - false, /* expect_accelerated */ - num_samples, - INTEL_MIPTREE_TILING_ANY, - false); + MAX2(num_samples, 1), + MIPTREE_LAYOUT_TILING_ANY); if (intel_texobj->mt == NULL) { return false; @@ -185,7 +188,7 @@ intel_free_texture_image_buffer(struct gl_context * ctx, { struct intel_texture_image *intelImage = intel_texture_image(texImage); - DBG("%s\n", __FUNCTION__); + DBG("%s\n", __func__); intel_miptree_release(&intelImage->mt); @@ -324,7 +327,7 @@ intel_set_texture_storage_for_buffer_object(struct gl_context *ctx, return false; } - if (!brw->format_supported_as_render_target[image->TexFormat]) { + if (!brw->mesa_format_supports_render[image->TexFormat]) { perf_debug("Non-renderable PBO format; fallback to CPU mapping\n"); return false; } @@ -332,16 +335,17 @@ intel_set_texture_storage_for_buffer_object(struct gl_context *ctx, assert(intel_texobj->mt == NULL); - drm_intel_bo *bo = intel_bufferobj_buffer(brw, intel_buffer_obj, + struct brw_bo *bo = intel_bufferobj_buffer(brw, intel_buffer_obj, buffer_offset, - row_stride * image->Height); + row_stride * image->Height, + !read_only); intel_texobj->mt = intel_miptree_create_for_bo(brw, bo, image->TexFormat, buffer_offset, image->Width, image->Height, image->Depth, row_stride, - false /*disable_aux_buffers*/); + 0); if (!intel_texobj->mt) return false; @@ -359,6 +363,24 @@ intel_set_texture_storage_for_buffer_object(struct gl_context *ctx, return true; } +static void +intel_texture_barrier(struct gl_context *ctx) +{ + struct brw_context *brw = brw_context(ctx); + + if (brw->gen >= 6) { + brw_emit_pipe_control_flush(brw, + PIPE_CONTROL_DEPTH_CACHE_FLUSH | + PIPE_CONTROL_RENDER_TARGET_FLUSH | + PIPE_CONTROL_CS_STALL); + + brw_emit_pipe_control_flush(brw, + PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE); + } else { + brw_emit_mi_flush(brw); + } +} + void intelInitTextureFuncs(struct dd_function_table *functions) { @@ -374,4 +396,5 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->TextureView = intel_texture_view; functions->SetTextureStorageForBufferObject = intel_set_texture_storage_for_buffer_object; + functions->TextureBarrier = intel_texture_barrier; }