Mesa (master): nv50/ir: fix bb positions after exit instructions
Module: Mesa Branch: master Commit: e988999791c32fd2594986fde742367d7f71c724 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e988999791c32fd2594986fde742367d7f71c724 Author: Ilia Mirkin Date: Sat Aug 13 22:19:39 2016 -0400 nv50/ir: fix bb positions after exit instructions It's fairly rare that the BB layout puts BBs after the exit block, which is likely the reason these issues lingered for so long. This fixes a fraction of issues with the giant pixmark piano shader. Signed-off-by: Ilia Mirkin Reviewed-by: Samuel Pitoiset Cc: --- src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp index 7878f2f..cc2a88e 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp @@ -2139,7 +2139,7 @@ makeInstructionLong(Instruction *insn) insn->encSize = 8; for (int i = fn->bbCount - 1; i >= 0 && fn->bbArray[i] != insn->bb; --i) { - fn->bbArray[i]->binPos += 4; + fn->bbArray[i]->binPos += adj; } fn->binSize += adj; insn->bb->binSize += adj; @@ -2191,9 +2191,16 @@ replaceExitWithModifier(Function *func) return; } } - epilogue->binSize -= 8; - func->binSize -= 8; + + int adj = epilogue->getExit()->encSize; + epilogue->binSize -= adj; + func->binSize -= adj; delete_Instruction(func->getProgram(), epilogue->getExit()); + + // There may be BB's that are laid out after the exit block + for (int i = func->bbCount - 1; i >= 0 && func->bbArray[i] != epilogue; --i) { + func->bbArray[i]->binPos -= adj; + } } void ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nv50/ir: properly clear upper bits of a bitset fill
Module: Mesa Branch: master Commit: 0b5f40b881d149d6c960d4ff8f69b58596cf9660 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b5f40b881d149d6c960d4ff8f69b58596cf9660 Author: Ilia Mirkin Date: Sat Aug 13 15:45:35 2016 -0400 nv50/ir: properly clear upper bits of a bitset fill Found by inspection. In practice, val is always == 0, so this never got triggered. Signed-off-by: Ilia Mirkin --- src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp index 682c569..1daf778 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp @@ -297,8 +297,8 @@ void BitSet::fill(uint32_t val) unsigned int i; for (i = 0; i < (size + 31) / 32; ++i) data[i] = val; - if (val) - data[i] &= ~(0x << (size % 32)); // BE ? + if (val && i) + data[i - 1] &= (1 << (size % 32)) - 1; } void BitSet::setOr(BitSet *pA, BitSet *pB) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/fs: Lower TEX to TXL during NIR translation.
Module: Mesa Branch: master Commit: 0c754d1c4203d87dbb9d2dd882ef42686e6d01ec URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c754d1c4203d87dbb9d2dd882ef42686e6d01ec Author: Francisco Jerez Date: Fri Aug 12 11:38:29 2016 -0700 i965/fs: Lower TEX to TXL during NIR translation. This simplifies the code slightly and will allow the SIMD lowering pass to find out easily what the actual texturing opcode is in order to determine the maximum execution size of texturing instructions. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 -- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 10 ++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index d1ac80a..f236089 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -4091,16 +4091,6 @@ lower_sampler_logical_send_gen7(const fs_builder &bld, fs_inst *inst, opcode op, bool coordinate_done = false; - /* The sampler can only meaningfully compute LOD for fragment shader -* messages. For all other stages, we change the opcode to TXL and -* hardcode the LOD to 0. -*/ - if (bld.shader->stage != MESA_SHADER_FRAGMENT && - op == SHADER_OPCODE_TEX) { - op = SHADER_OPCODE_TXL; - lod = brw_imm_f(0.0f); - } - /* Set up the LOD info */ switch (op) { case FS_OPCODE_TXB: diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 134cd01..df033e1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -4439,9 +4439,10 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr) srcs[TEX_LOGICAL_SRC_COORD_COMPONENTS] = brw_imm_d(instr->coord_components); srcs[TEX_LOGICAL_SRC_GRAD_COMPONENTS] = brw_imm_d(lod_components); - if (instr->op == nir_texop_query_levels) { - /* textureQueryLevels() is implemented in terms of TXS so we need to - * pass a valid LOD argument. + if (instr->op == nir_texop_query_levels || + (instr->op == nir_texop_tex && stage != MESA_SHADER_FRAGMENT)) { + /* textureQueryLevels() and texture() are implemented in terms of TXS + * and TXL respectively, so we need to pass a valid LOD argument. */ assert(srcs[TEX_LOGICAL_SRC_LOD].file == BAD_FILE); srcs[TEX_LOGICAL_SRC_LOD] = brw_imm_ud(0u); @@ -4450,7 +4451,8 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr) enum opcode opcode; switch (instr->op) { case nir_texop_tex: - opcode = SHADER_OPCODE_TEX_LOGICAL; + opcode = (stage == MESA_SHADER_FRAGMENT ? SHADER_OPCODE_TEX_LOGICAL : +SHADER_OPCODE_TXL_LOGICAL); break; case nir_texop_txb: opcode = FS_OPCODE_TXB_LOGICAL; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/fs: Return zero from fs_inst:: components_read for non-present sources.
Module: Mesa Branch: master Commit: 61a02fb74c07d574b726a8b27517a02251aa4be4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=61a02fb74c07d574b726a8b27517a02251aa4be4 Author: Francisco Jerez Date: Fri Aug 12 18:33:58 2016 -0700 i965/fs: Return zero from fs_inst::components_read for non-present sources. This makes it easier for the caller to find out how many scalar components are actually read by the instruction. As a bonus we no longer need to special-case BAD_FILE in the implementation of fs_inst::regs_read. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs.cpp | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index f236089..1842d56 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -715,6 +715,10 @@ fs_inst::is_partial_write() const unsigned fs_inst::components_read(unsigned i) const { + /* Return zero if the source is not present. */ + if (src[i].file == BAD_FILE) + return 0; + switch (opcode) { case FS_OPCODE_LINTERP: if (i == 0) @@ -895,11 +899,10 @@ fs_inst::regs_read(int arg) const } switch (src[arg].file) { - case BAD_FILE: - return 0; case UNIFORM: case IMM: return 1; + case BAD_FILE: case ARF: case FIXED_GRF: case VGRF: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/fs: Estimate maximum sampler message execution size more accurately.
Module: Mesa Branch: master Commit: 4d436c011fd9f7ebcadbaebef05090d2056e9d48 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4d436c011fd9f7ebcadbaebef05090d2056e9d48 Author: Francisco Jerez Date: Fri Aug 12 14:05:19 2016 -0700 i965/fs: Estimate maximum sampler message execution size more accurately. The current logic used to determine the execution size of sampler messages was based on special-casing several argument and opcode combinations, which unsurprisingly missed the possibility that some messages could exceed the payload size limit or not depending on the number of coordinate components present. In particular: - The TXL, TXB and TEX messages (the latter on non-FS stages only) would attempt to use SIMD16 on Gen7+ hardware even if a shadow reference was present and the texture was a cubemap array, causing it to overflow the maximum supported sampler payload size and crash. - The TG4_OFFSET message with shadow comparison was falling back to SIMD8 regardless of the number of coordinate components, which is unnecessary when two coordinates or less are present. Both cases have been handled incorrectly ever since cubemap arrays and texture gather were respectively enabled (the current logic used by the SIMD lowering pass is almost unchanged from the previous no16 fall-back logic used pre-SIMD lowering times). Fixes the following GL4.5 conformance test on Gen7-8 (the bug also affects Gen9+ in principle, but SKL passes the test by luck because it manages to use the TXL_LZ message instead of TXL): GL45-CTS.texture_cube_map_array.sampling Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97267 Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs.cpp | 109 +++ 1 file changed, 72 insertions(+), 37 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 1842d56..b89c672 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -4198,9 +4198,6 @@ lower_sampler_logical_send_gen7(const fs_builder &bld, fs_inst *inst, opcode op, coordinate_done = true; break; case SHADER_OPCODE_TG4_OFFSET: - /* gather4_po_c should have been lowered in SIMD16 mode. */ - assert(bld.dispatch_width() == 8 || shadow_c.file == BAD_FILE); - /* More crazy intermixing */ for (unsigned i = 0; i < 2; i++) /* u, v */ bld.MOV(sources[length++], offset(coordinate, bld, i)); @@ -4687,6 +4684,67 @@ get_fpu_lowered_simd_width(const struct brw_device_info *devinfo, } /** + * Get the maximum allowed SIMD width for instruction \p inst accounting for + * various payload size restrictions that apply to sampler message + * instructions. + * + * This is only intended to provide a maximum theoretical bound for the + * execution size of the message based on the number of argument components + * alone, which in most cases will determine whether the SIMD8 or SIMD16 + * variant of the message can be used, though some messages may have + * additional restrictions not accounted for here (e.g. pre-ILK hardware uses + * the message length to determine the exact SIMD width and argument count, + * which makes a number of sampler message combinations impossible to + * represent). + */ +static unsigned +get_sampler_lowered_simd_width(const struct brw_device_info *devinfo, + const fs_inst *inst) +{ + /* Calculate the number of coordinate components that have to be present +* assuming that additional arguments follow the texel coordinates in the +* message payload. On IVB+ there is no need for padding, on ILK-SNB we +* need to pad to four or three components depending on the message, +* pre-ILK we need to pad to at most three components. +*/ + const unsigned req_coord_components = + (devinfo->gen >= 7 || + !inst->components_read(TEX_LOGICAL_SRC_COORDINATE)) ? 0 : + (devinfo->gen >= 5 && inst->opcode != SHADER_OPCODE_TXF_LOGICAL && +inst->opcode != SHADER_OPCODE_TXF_CMS_LOGICAL) ? 4 : + 3; + + /* On Gen9+ the LOD argument is for free if we're able to use the LZ +* variant of the TXL or TXF message. +*/ + const bool implicit_lod = devinfo->gen >= 9 && + (inst->opcode == SHADER_OPCODE_TXL || + inst->opcode == SHADER_OPCODE_TXF) && + inst->src[TEX_LOGICAL_SRC_LOD].is_zero(); + + /* Calculate the total number of argument components that need to be passed +* to the sampler unit. +*/ + const unsigned num_payload_components = + MAX2(inst->components_read(TEX_LOGICAL_SRC_COORDINATE), + req_coord_components) + + inst->components_read(TEX_LOGICAL_SRC_SHADOW_C) + + (implicit_lod ? 0 : inst->components_read(TEX_LOGICAL_SRC_LOD)) + + inst->components_read(TEX_LOGICAL_SRC_LOD2) + + inst->components
Mesa (master): freedreno/a3xx: fix generic clear path
Module: Mesa Branch: master Commit: 5def00875de4f0895e22de94cba29131a26c0430 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5def00875de4f0895e22de94cba29131a26c0430 Author: Rob Clark Date: Tue Aug 16 19:13:55 2016 -0400 freedreno/a3xx: fix generic clear path Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_draw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index efc1dd2..cfe13cd 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -256,6 +256,7 @@ fd_blitter_clear(struct pipe_context *pctx, unsigned buffers, struct pipe_draw_info info = { .mode = PIPE_PRIM_MAX,/* maps to DI_PT_RECTLIST */ .count = 2, + .max_index = 1, .instance_count = 1, }; ctx->draw_vbo(ctx, &info); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/util: minor reformatting in u_box.h
Module: Mesa Branch: master Commit: 66debeae9d225ab2026c0b7454532ed3ca960a87 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=66debeae9d225ab2026c0b7454532ed3ca960a87 Author: Brian Paul Date: Thu Aug 11 09:16:39 2016 -0600 gallium/util: minor reformatting in u_box.h Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_box.h | 42 -- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/src/gallium/auxiliary/util/u_box.h b/src/gallium/auxiliary/util/u_box.h index 00f231d..eb41f8a 100644 --- a/src/gallium/auxiliary/util/u_box.h +++ b/src/gallium/auxiliary/util/u_box.h @@ -4,10 +4,8 @@ #include "pipe/p_state.h" #include "util/u_math.h" -static inline -void u_box_1d( unsigned x, - unsigned w, - struct pipe_box *box ) +static inline void +u_box_1d(unsigned x, unsigned w, struct pipe_box *box) { box->x = x; box->y = 0; @@ -17,12 +15,8 @@ void u_box_1d( unsigned x, box->depth = 1; } -static inline -void u_box_2d( unsigned x, - unsigned y, - unsigned w, - unsigned h, - struct pipe_box *box ) +static inline void +u_box_2d(unsigned x,unsigned y, unsigned w, unsigned h, struct pipe_box *box) { box->x = x; box->y = y; @@ -32,10 +26,8 @@ void u_box_2d( unsigned x, box->depth = 1; } -static inline -void u_box_origin_2d( unsigned w, - unsigned h, - struct pipe_box *box ) +static inline void +u_box_origin_2d(unsigned w, unsigned h, struct pipe_box *box) { box->x = 0; box->y = 0; @@ -45,13 +37,9 @@ void u_box_origin_2d( unsigned w, box->depth = 1; } -static inline -void u_box_2d_zslice( unsigned x, - unsigned y, - unsigned z, - unsigned w, - unsigned h, - struct pipe_box *box ) +static inline void +u_box_2d_zslice(unsigned x, unsigned y, unsigned z, +unsigned w, unsigned h, struct pipe_box *box) { box->x = x; box->y = y; @@ -61,14 +49,10 @@ void u_box_2d_zslice( unsigned x, box->depth = 1; } -static inline -void u_box_3d( unsigned x, - unsigned y, - unsigned z, - unsigned w, - unsigned h, - unsigned d, - struct pipe_box *box ) +static inline void +u_box_3d(unsigned x, unsigned y, unsigned z, + unsigned w, unsigned h, unsigned d, + struct pipe_box *box) { box->x = x; box->y = y; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: use pipe var instead of st-> pipe in st_create_context_priv()
Module: Mesa Branch: master Commit: df2dcf62008c22a8e2ca6b17936bf27c025e9416 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=df2dcf62008c22a8e2ca6b17936bf27c025e9416 Author: Brian Paul Date: Fri Aug 12 12:37:02 2016 -0600 st/mesa: use pipe var instead of st->pipe in st_create_context_priv() As is done in most other places in the function. Reviewed-by: Marek Olšák --- src/mesa/state_tracker/st_context.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 687ca19..ddc11a4 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -337,11 +337,11 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, /* Create upload manager for vertex data for glBitmap, glDrawPixels, * glClear, etc. */ - st->uploader = u_upload_create(st->pipe, 65536, PIPE_BIND_VERTEX_BUFFER, + st->uploader = u_upload_create(pipe, 65536, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM); if (!screen->get_param(screen, PIPE_CAP_USER_INDEX_BUFFERS)) { - st->indexbuf_uploader = u_upload_create(st->pipe, 128 * 1024, + st->indexbuf_uploader = u_upload_create(pipe, 128 * 1024, PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM); } @@ -433,8 +433,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, screen->get_param(screen, PIPE_CAP_MULTI_DRAW_INDIRECT); /* GL limits and extensions */ - st_init_limits(st->pipe->screen, &ctx->Const, &ctx->Extensions); - st_init_extensions(st->pipe->screen, &ctx->Const, + st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions); + st_init_extensions(pipe->screen, &ctx->Const, &ctx->Extensions, &st->options, ctx->Mesa_DXTn); if (st_have_perfmon(st)) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: remove unused u_clear.h file
Module: Mesa Branch: master Commit: 038b1b11fe596a3a7e0a1492c7887fada75ce1ca URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=038b1b11fe596a3a7e0a1492c7887fada75ce1ca Author: Brian Paul Date: Thu Aug 11 09:32:18 2016 -0600 gallium: remove unused u_clear.h file Reviewed-by: Marek Olšák --- src/gallium/auxiliary/Makefile.sources | 1 - src/gallium/auxiliary/util/u_clear.h | 64 -- 2 files changed, 65 deletions(-) diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 2a4919b..093c45b 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -188,7 +188,6 @@ C_SOURCES := \ util/u_cache.h \ util/u_caps.c \ util/u_caps.h \ - util/u_clear.h \ util/u_cpu_detect.c \ util/u_cpu_detect.h \ util/u_debug.c \ diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h deleted file mode 100644 index 6413530..000 --- a/src/gallium/auxiliary/util/u_clear.h +++ /dev/null @@ -1,64 +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. - * - **/ - -/* Authors: - *Michel Dänzer - */ - - -#include "pipe/p_context.h" -#include "pipe/p_state.h" - - -/** - * Clear the given buffers to the specified values. - * No masking, no scissor (clear entire buffer). - */ -static inline void -util_clear(struct pipe_context *pipe, - struct pipe_framebuffer_state *framebuffer, unsigned buffers, - const union pipe_color_union *color, double depth, unsigned stencil) -{ - unsigned i; - - for (i = 0; i < framebuffer->nr_cbufs; i++) { - if (buffers & (PIPE_CLEAR_COLOR0 << i)) { - struct pipe_surface *ps = framebuffer->cbufs[i]; - - if (ps) { -pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width, - ps->height, true); - } - } - } - - if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { - struct pipe_surface *ps = framebuffer->zsbuf; - pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL, -depth, stencil, -0, 0, ps->width, ps->height, true); - } -} ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: avoid a calloc in svga_buffer_transfer_map()
Module: Mesa Branch: master Commit: 1e5eb79d9a7464482189d7ee8c0f495a31b7f0a3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e5eb79d9a7464482189d7ee8c0f495a31b7f0a3 Author: Brian Paul Date: Tue Aug 2 14:30:41 2016 -0600 svga: avoid a calloc in svga_buffer_transfer_map() Just initialize the two other pipe_transfer fields explicitly. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_resource_buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index c126ff9..94788e7 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -84,7 +84,7 @@ svga_buffer_transfer_map(struct pipe_context *pipe, assert(box->height == 1); assert(box->depth == 1); - transfer = CALLOC_STRUCT(pipe_transfer); + transfer = MALLOC_STRUCT(pipe_transfer); if (!transfer) { return NULL; } @@ -93,6 +93,8 @@ svga_buffer_transfer_map(struct pipe_context *pipe, transfer->level = level; transfer->usage = usage; transfer->box = *box; + transfer->stride = 0; + transfer->layer_stride = 0; if ((usage & PIPE_TRANSFER_READ) && sbuf->dirty) { enum pipe_error ret; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: minor clean-ups in define_rasterizer_object()
Module: Mesa Branch: master Commit: 88efaf987823802926c211401c401081a0e2f17a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=88efaf987823802926c211401c401081a0e2f17a Author: Brian Paul Date: Fri Jul 29 09:10:02 2016 -0600 svga: minor clean-ups in define_rasterizer_object() Add const qualifiers, new comment. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_pipe_rasterizer.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c index 569fbe1..ce566ef 100644 --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -107,17 +107,18 @@ define_rasterizer_object(struct svga_context *svga, { struct svga_screen *svgascreen = svga_screen(svga->pipe.screen); unsigned fill_mode = translate_fill_mode(rast->templ.fill_front); - unsigned cull_mode = translate_cull_mode(rast->templ.cull_face); - int depth_bias = rast->templ.offset_units; - float slope_scaled_depth_bias = rast->templ.offset_scale; - float depth_bias_clamp = 0.0; /* XXX fix me */ - unsigned try; + const unsigned cull_mode = translate_cull_mode(rast->templ.cull_face); + const int depth_bias = rast->templ.offset_units; + const float slope_scaled_depth_bias = rast->templ.offset_scale; + /* PIPE_CAP_POLYGON_OFFSET_CLAMP not supported: */ + const float depth_bias_clamp = 0.0; const float line_width = rast->templ.line_width > 0.0f ? rast->templ.line_width : 1.0f; const uint8 line_factor = rast->templ.line_stipple_enable ? rast->templ.line_stipple_factor : 0; const uint16 line_pattern = rast->templ.line_stipple_enable ? rast->templ.line_stipple_pattern : 0; + unsigned try; rast->id = util_bitmask_add(svga->rast_object_id_bm); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: don't call os_get_time() when not needed by Gallium HUD
Module: Mesa Branch: master Commit: f934117bbb9d58f0f5d9cfb4397fec9c6371ed64 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f934117bbb9d58f0f5d9cfb4397fec9c6371ed64 Author: Brian Paul Date: Tue Aug 2 14:27:33 2016 -0600 svga: don't call os_get_time() when not needed by Gallium HUD The calls to os_get_time() were showing up higher than expected in profiles. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_context.c | 5 ++--- src/gallium/drivers/svga/svga_context.h | 15 +++ src/gallium/drivers/svga/svga_pipe_query.c | 7 +-- src/gallium/drivers/svga/svga_resource_buffer.c | 5 ++--- src/gallium/drivers/svga/svga_resource_texture.c | 5 ++--- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index f623caf..52956fa 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -31,7 +31,6 @@ #include "util/u_memory.h" #include "util/u_bitmask.h" #include "util/u_upload_mgr.h" -#include "os/os_time.h" #include "svga_context.h" #include "svga_screen.h" @@ -320,9 +319,9 @@ void svga_context_flush( struct svga_context *svga, /* Flush pending commands to hardware: */ - t0 = os_time_get(); + t0 = svga_get_time(svga); svga->swc->flush(svga->swc, &fence); - svga->hud.flush_time += (os_time_get() - t0); + svga->hud.flush_time += (svga_get_time(svga) - t0); svga->hud.num_flushes++; diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 4eb8a19..1e62e71 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -31,6 +31,8 @@ #include "pipe/p_defines.h" #include "pipe/p_state.h" +#include "os/os_time.h" + #include "util/u_blitter.h" #include "util/list.h" @@ -544,6 +546,8 @@ struct svga_context uint64_t num_surface_views; /**< SVGA_QUERY_NUM_SURFACE_VIEWS */ uint64_t num_bytes_uploaded; /**< SVGA_QUERY_NUM_BYTES_UPLOADED */ uint64_t num_generate_mipmap; /**< SVGA_QUERY_NUM_GENERATE_MIPMAP */ + + boolean uses_time;/**< os_time_get() calls needed? */ } hud; /** The currently bound stream output targets */ @@ -703,4 +707,15 @@ svga_rects_equal(const SVGA3dRect *r1, const SVGA3dRect *r2) return memcmp(r1, r2, sizeof(*r1)) == 0; } +/** + * If the Gallium HUD is enabled, this will return the current time. + * Otherwise, just return zero. + */ +static inline int64_t +svga_get_time(struct svga_context *svga) +{ + return svga->hud.uses_time ? os_time_get() : 0; +} + + #endif diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 65e58fe..bf074b6 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -731,11 +731,9 @@ svga_create_query(struct pipe_context *pipe, case SVGA_QUERY_NUM_FALLBACKS: case SVGA_QUERY_NUM_FLUSHES: case SVGA_QUERY_NUM_VALIDATIONS: - case SVGA_QUERY_MAP_BUFFER_TIME: case SVGA_QUERY_NUM_RESOURCES_MAPPED: case SVGA_QUERY_NUM_BYTES_UPLOADED: case SVGA_QUERY_COMMAND_BUFFER_SIZE: - case SVGA_QUERY_FLUSH_TIME: case SVGA_QUERY_SURFACE_WRITE_FLUSHES: case SVGA_QUERY_MEMORY_USED: case SVGA_QUERY_NUM_SHADERS: @@ -749,6 +747,11 @@ svga_create_query(struct pipe_context *pipe, case SVGA_QUERY_NUM_CONST_BUF_UPDATES: case SVGA_QUERY_NUM_CONST_UPDATES: break; + case SVGA_QUERY_FLUSH_TIME: + case SVGA_QUERY_MAP_BUFFER_TIME: + /* These queries need os_time_get() */ + svga->hud.uses_time = TRUE; + break; default: assert(!"unexpected query type in svga_create_query()"); } diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index 68ce103..c126ff9 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -29,7 +29,6 @@ #include "pipe/p_defines.h" #include "util/u_inlines.h" #include "os/os_thread.h" -#include "os/os_time.h" #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_resource.h" @@ -78,7 +77,7 @@ svga_buffer_transfer_map(struct pipe_context *pipe, struct svga_buffer *sbuf = svga_buffer(resource); struct pipe_transfer *transfer; uint8_t *map; - int64_t begin = os_time_get(); + int64_t begin = svga_get_time(svga); assert(box->y == 0); assert(box->z == 0); @@ -264,7 +263,7 @@ svga_buffer_transfer_map(struct pipe_context *pipe, FREE(transfer); } - svga->hud.map_buffer_time += (os_time_get() - begin); + svga->hud.map_buffer_time += (svga_get_time(svga) - begin); return map; } diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 230221a..30dc4d9 100644 --- a
Mesa (master): svga: remove unneeded memset() call in draw_vgpu10()
Module: Mesa Branch: master Commit: dcf2126f90a1daf226417bde71a62ccf0305adea URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dcf2126f90a1daf226417bde71a62ccf0305adea Author: Brian Paul Date: Mon Aug 1 16:31:13 2016 -0600 svga: remove unneeded memset() call in draw_vgpu10() All three fields of the vbuffer_attrs[] array are assigned in the following loop. The remaining elements of the array are not used. Tested with full Piglit run, Heaven 4.0, etc. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_draw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index 14a7406..9d3f9ef 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -533,11 +533,10 @@ draw_vgpu10(struct svga_hwtnl *hwtnl, { SVGA3dVertexBuffer vbuffer_attrs[PIPE_MAX_ATTRIBS]; - memset(vbuffer_attrs, 0, sizeof(vbuffer_attrs)); - for (i = 0; i < vbuf_count; i++) { vbuffer_attrs[i].stride = hwtnl->cmd.vbufs[i].stride; vbuffer_attrs[i].offset = hwtnl->cmd.vbufs[i].buffer_offset; + vbuffer_attrs[i].sid = 0; } /* If we haven't yet emitted a drawing command or if any ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: reduce looping in svga_mark_surfaces_dirty()
Module: Mesa Branch: master Commit: ced0dd0e9575c3eacd9a618c34175dde0463f393 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ced0dd0e9575c3eacd9a618c34175dde0463f393 Author: Brian Paul Date: Mon Aug 1 16:30:14 2016 -0600 svga: reduce looping in svga_mark_surfaces_dirty() We don't need to loop over the max number of color buffers, just the current number (which is usually one). Tested with full Piglit run, Heaven 4.0, etc. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index e5943cf..e299063 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -562,7 +562,7 @@ svga_mark_surfaces_dirty(struct svga_context *svga) struct svga_screen *svgascreen = svga_screen(svga->pipe.screen); unsigned i; - for (i = 0; i < svgascreen->max_color_buffers; i++) { + for (i = 0; i < svga->curr.framebuffer.nr_cbufs; i++) { if (svga->curr.framebuffer.cbufs[i]) svga_mark_surface_dirty(svga->curr.framebuffer.cbufs[i]); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/i915: inline the util_clear() code into i915_clear_blitter()
Module: Mesa Branch: master Commit: 22b8288b336d506997d69e3b026fcf16c996a973 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=22b8288b336d506997d69e3b026fcf16c996a973 Author: Brian Paul Date: Thu Aug 11 09:30:51 2016 -0600 gallium/i915: inline the util_clear() code into i915_clear_blitter() This is the only place the util_clear() function was used. Reviewed-by: Marek Olšák --- src/gallium/drivers/i915/i915_clear.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/i915/i915_clear.c b/src/gallium/drivers/i915/i915_clear.c index 57244a6..a1af789 100644 --- a/src/gallium/drivers/i915/i915_clear.c +++ b/src/gallium/drivers/i915/i915_clear.c @@ -30,7 +30,6 @@ */ -#include "util/u_clear.h" #include "util/u_format.h" #include "util/u_pack_color.h" #include "i915_context.h" @@ -221,8 +220,27 @@ i915_clear_blitter(struct pipe_context *pipe, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { - util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, color, depth, - stencil); + struct pipe_framebuffer_state *framebuffer = + &i915_context(pipe)->framebuffer; + unsigned i; + + for (i = 0; i < framebuffer->nr_cbufs; i++) { + if (buffers & (PIPE_CLEAR_COLOR0 << i)) { + struct pipe_surface *ps = framebuffer->cbufs[i]; + + if (ps) { +pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width, + ps->height, true); + } + } + } + + if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { + struct pipe_surface *ps = framebuffer->zsbuf; + pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL, +depth, stencil, +0, 0, ps->width, ps->height, true); + } } void ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: additional comments for svga_hw_draw_state members
Module: Mesa Branch: master Commit: 06b23f747dd747f69efa7aba7256a0131346fe11 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=06b23f747dd747f69efa7aba7256a0131346fe11 Author: Brian Paul Date: Fri Aug 12 13:13:22 2016 -0600 svga: additional comments for svga_hw_draw_state members And re-order a few fields. Signed-off-by: Brian Paul --- src/gallium/drivers/svga/svga_context.h | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 49c6030..4eb8a19 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -332,21 +332,28 @@ struct svga_hw_view_state */ struct svga_hw_draw_state { + /** VGPU9 rasterization state */ unsigned rs[SVGA3D_RS_MAX]; + /** VGPU9 texture sampler and bindings state */ unsigned ts[SVGA3D_PIXEL_SAMPLERREG_MAX][SVGA3D_TS_MAX]; + /** VGPU9 texture views */ + unsigned num_views; + struct svga_hw_view_state views[PIPE_MAX_SAMPLERS]; + /** VGPU9 constant buffer values */ float cb[PIPE_SHADER_TYPES][SVGA3D_CONSTREG_MAX][4]; + /** Currently bound shaders */ struct svga_shader_variant *fs; struct svga_shader_variant *vs; struct svga_shader_variant *gs; - struct svga_hw_view_state views[PIPE_MAX_SAMPLERS]; - unsigned num_views; + + /** Currently bound constant buffer, per shader stage */ struct pipe_resource *constbuf[PIPE_SHADER_TYPES]; - /* Bitmask of enabled constant bufffers */ + /** Bitmask of enabled constant buffers */ unsigned enabled_constbufs[PIPE_SHADER_TYPES]; - /* VGPU10 HW state (used to prevent emitting redundant state) */ + /** VGPU10 HW state (used to prevent emitting redundant state) */ SVGA3dDepthStencilStateId depth_stencil_id; unsigned stencil_ref; SVGA3dBlendStateId blend_id; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: use the sws local var to simplify some code
Module: Mesa Branch: master Commit: 7c5eda6f4e0801b97aa8b6c87a82c33e1d1202c5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c5eda6f4e0801b97aa8b6c87a82c33e1d1202c5 Author: Brian Paul Date: Mon Aug 15 11:38:39 2016 -0600 svga: use the sws local var to simplify some code Signed-off-by: Brian Paul --- src/gallium/drivers/svga/svga_screen_cache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c index 4344a87..bce46df 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.c +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -332,7 +332,7 @@ svga_screen_cache_flush(struct svga_screen *svgascreen, /* remove entry from the invalidated list */ LIST_DEL(&entry->head); - svgascreen->sws->fence_reference(svgascreen->sws, &entry->fence, fence); + sws->fence_reference(sws, &entry->fence, fence); /* Add entry to the unused list */ LIST_ADD(&entry->head, &cache->unused); @@ -393,8 +393,7 @@ svga_screen_cache_cleanup(struct svga_screen *svgascreen) } if (cache->entries[i].fence) - svgascreen->sws->fence_reference(svgascreen->sws, - &cache->entries[i].fence, NULL); + sws->fence_reference(sws, &cache->entries[i].fence, NULL); } pipe_mutex_destroy(cache->mutex); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: remove unused var in svga_mark_surfaces_dirty()
Module: Mesa Branch: master Commit: b6c81a780f4afe58350d3bf327c25045f09e4050 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6c81a780f4afe58350d3bf327c25045f09e4050 Author: Brian Paul Date: Tue Aug 16 08:27:49 2016 -0600 svga: remove unused var in svga_mark_surfaces_dirty() Signed-off-by: Brian Paul --- src/gallium/drivers/svga/svga_surface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index e299063..8dd1868 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -559,7 +559,6 @@ svga_mark_surface_dirty(struct pipe_surface *surf) void svga_mark_surfaces_dirty(struct svga_context *svga) { - struct svga_screen *svgascreen = svga_screen(svga->pipe.screen); unsigned i; for (i = 0; i < svga->curr.framebuffer.nr_cbufs; i++) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: minor whitespace and code clean-ups
Module: Mesa Branch: master Commit: 7b821941f63907524c3671cc964f4c1eb2ec9e59 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b821941f63907524c3671cc964f4c1eb2ec9e59 Author: Brian Paul Date: Thu Aug 11 09:52:31 2016 -0600 svga: minor whitespace and code clean-ups Signed-off-by: Brian Paul --- .../drivers/svga/svga_resource_buffer_upload.c | 57 ++ 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c b/src/gallium/drivers/svga/svga_resource_buffer_upload.c index be4c694..d519c9d 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c +++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c @@ -96,7 +96,7 @@ svga_buffer_destroy_hw_storage(struct svga_screen *ss, struct svga_buffer *sbuf) { struct svga_winsys_screen *sws = ss->sws; - assert(!sbuf->map.count); + assert(sbuf->map.count == 0); assert(sbuf->hwbuf); if (sbuf->hwbuf) { sws->buffer_destroy(sws, sbuf->hwbuf); @@ -175,7 +175,8 @@ svga_buffer_create_host_surface(struct svga_screen *ss, sbuf->key.cachable = 1; sbuf->key.arraySize = 1; - SVGA_DBG(DEBUG_DMA, "surface_create for buffer sz %d\n", sbuf->b.b.width0); + SVGA_DBG(DEBUG_DMA, "surface_create for buffer sz %d\n", + sbuf->b.b.width0); sbuf->handle = svga_screen_surface_create(ss, sbuf->b.b.bind, sbuf->b.b.usage, &sbuf->key); @@ -188,7 +189,8 @@ svga_buffer_create_host_surface(struct svga_screen *ss, */ sbuf->dma.flags.discard = TRUE; - SVGA_DBG(DEBUG_DMA, " --> got sid %p sz %d (buffer)\n", sbuf->handle, sbuf->b.b.width0); + SVGA_DBG(DEBUG_DMA, " --> got sid %p sz %d (buffer)\n", + sbuf->handle, sbuf->b.b.width0); } return PIPE_OK; @@ -200,7 +202,8 @@ svga_buffer_destroy_host_surface(struct svga_screen *ss, struct svga_buffer *sbuf) { if (sbuf->handle) { - SVGA_DBG(DEBUG_DMA, " ungrab sid %p sz %d\n", sbuf->handle, sbuf->b.b.width0); + SVGA_DBG(DEBUG_DMA, " ungrab sid %p sz %d\n", + sbuf->handle, sbuf->b.b.width0); svga_screen_surface_destroy(ss, &sbuf->key, &sbuf->handle); } } @@ -219,7 +222,7 @@ svga_buffer_upload_gb_command(struct svga_context *svga, struct svga_winsys_context *swc = svga->swc; SVGA3dCmdUpdateGBImage *update_cmd; struct svga_3d_update_gb_image *whole_update_cmd = NULL; - uint32 numBoxes = sbuf->map.num_ranges; + const uint32 numBoxes = sbuf->map.num_ranges; struct pipe_resource *dummy; unsigned i; @@ -330,9 +333,9 @@ svga_buffer_upload_hb_command(struct svga_context *svga, struct svga_winsys_context *swc = svga->swc; struct svga_winsys_buffer *guest = sbuf->hwbuf; struct svga_winsys_surface *host = sbuf->handle; - SVGA3dTransferType transfer = SVGA3D_WRITE_HOST_VRAM; + const SVGA3dTransferType transfer = SVGA3D_WRITE_HOST_VRAM; SVGA3dCmdSurfaceDMA *cmd; - uint32 numBoxes = sbuf->map.num_ranges; + const uint32 numBoxes = sbuf->map.num_ranges; SVGA3dCopyBox *boxes; SVGA3dCmdSurfaceDMASuffix *pSuffix; unsigned region_flags; @@ -519,9 +522,7 @@ svga_buffer_upload_flush(struct svga_context *svga, * We try to lump as many contiguous DMA transfers together as possible. */ void -svga_buffer_add_range(struct svga_buffer *sbuf, - unsigned start, - unsigned end) +svga_buffer_add_range(struct svga_buffer *sbuf, unsigned start, unsigned end) { unsigned i; unsigned nearest_range; @@ -540,15 +541,10 @@ svga_buffer_add_range(struct svga_buffer *sbuf, /* * Try to grow one of the ranges. */ - for (i = 0; i < sbuf->map.num_ranges; ++i) { - int left_dist; - int right_dist; - int dist; - - left_dist = start - sbuf->map.ranges[i].end; - right_dist = sbuf->map.ranges[i].start - end; - dist = MAX2(left_dist, right_dist); + const int left_dist = start - sbuf->map.ranges[i].end; + const int right_dist = sbuf->map.ranges[i].start - end; + const int dist = MAX2(left_dist, right_dist); if (dist <= 0) { /* @@ -559,7 +555,6 @@ svga_buffer_add_range(struct svga_buffer *sbuf, * anything. If the ranges overlap here it must surely be because * PIPE_TRANSFER_UNSYNCHRONIZED was set. */ - sbuf->map.ranges[i].start = MIN2(sbuf->map.ranges[i].start, start); sbuf->map.ranges[i].end = MAX2(sbuf->map.ranges[i].end, end); return; @@ -568,7 +563,6 @@ svga_buffer_add_range(struct svga_buffer *sbuf, /* * Discontiguous ranges -- keep track of the nearest range. */ - if (dist < nearest_dist) { nearest_range = i; nearest_dist = dist; @@ -605,8 +599,10 @@ svga_buffer_add_range(struct svga_buffer *sbuf, assert(nea
Mesa (master): svga: remove incorrect buffer invalidation code
Module: Mesa Branch: master Commit: ce9c05a5934ae7ded58ee79b8acbdb6a16589e0d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce9c05a5934ae7ded58ee79b8acbdb6a16589e0d Author: Brian Paul Date: Mon Aug 15 16:33:16 2016 -0600 svga: remove incorrect buffer invalidation code Fixes regression with team_fortress_2 trace. This change has been in our in-house tree for some time. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_screen_cache.c | 5 - 1 file changed, 5 deletions(-) diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c index bce46df..86a0413 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.c +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -558,11 +558,6 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen, * that case. */ if (SVGA_SURFACE_CACHE_ENABLED && key->cachable) { - - /* Invalidate the surface before putting it into the recycle pool */ - if (key->format != SVGA3D_BUFFER) - sws->surface_invalidate(sws, *p_handle); - svga_screen_cache_add(svgascreen, key, p_handle); } else { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/u_blitter: split out a helper for common clear state
Module: Mesa Branch: master Commit: 142dd7b9c043fca81f8ef1d0bbd378968f9260df URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=142dd7b9c043fca81f8ef1d0bbd378968f9260df Author: Rob Clark Date: Sat Aug 13 10:51:51 2016 -0400 gallium/u_blitter: split out a helper for common clear state Signed-off-by: Rob Clark Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_blitter.c | 38 ++ src/gallium/auxiliary/util/u_blitter.h | 5 + 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 9fbef9b..e008100 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -1268,19 +1268,13 @@ static void *get_clear_blend_state(struct blitter_context_priv *ctx, return ctx->blend_clear[index]; } -static void util_blitter_clear_custom(struct blitter_context *blitter, - unsigned width, unsigned height, - unsigned num_layers, - unsigned clear_buffers, - const union pipe_color_union *color, - double depth, unsigned stencil, - void *custom_blend, void *custom_dsa) +void util_blitter_common_clear_setup(struct blitter_context *blitter, + unsigned width, unsigned height, + unsigned clear_buffers, + void *custom_blend, void *custom_dsa) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; - struct pipe_stencil_ref sr = { { 0 } }; - - assert(ctx->has_layered || num_layers <= 1); util_blitter_set_running_flag(blitter); blitter_check_saved_vertex_states(ctx); @@ -1306,14 +1300,32 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil); } + pipe->set_sample_mask(pipe, ~0); + blitter_set_dst_dimensions(ctx, width, height); +} + +static void util_blitter_clear_custom(struct blitter_context *blitter, + unsigned width, unsigned height, + unsigned num_layers, + unsigned clear_buffers, + const union pipe_color_union *color, + double depth, unsigned stencil, + void *custom_blend, void *custom_dsa) +{ + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + struct pipe_context *pipe = ctx->base.pipe; + struct pipe_stencil_ref sr = { { 0 } }; + + assert(ctx->has_layered || num_layers <= 1); + + util_blitter_common_clear_setup(blitter, width, height, clear_buffers, + custom_blend, custom_dsa); + sr.ref_value[0] = stencil & 0xff; pipe->set_stencil_ref(pipe, &sr); pipe->bind_vertex_elements_state(pipe, ctx->velem_state); bind_fs_write_all_cbufs(ctx); - pipe->set_sample_mask(pipe, ~0); - - blitter_set_dst_dimensions(ctx, width, height); if (num_layers > 1 && ctx->has_layered) { blitter_set_common_draw_rect_state(ctx, FALSE, TRUE); diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index 0f5da6b..d7d9f4a 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -542,6 +542,11 @@ util_blitter_save_render_condition(struct blitter_context *blitter, blitter->saved_render_cond_cond = condition; } +void util_blitter_common_clear_setup(struct blitter_context *blitter, + unsigned width, unsigned height, + unsigned clear_buffers, + void *custom_blend, void *custom_dsa); + void util_blitter_set_running_flag(struct blitter_context *blitter); void util_blitter_unset_running_flag(struct blitter_context *blitter); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): freedreno: support for using generic clear path
Module: Mesa Branch: master Commit: a8e6734a83816df2a39e5c4c49721d762caee86b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8e6734a83816df2a39e5c4c49721d762caee86b Author: Rob Clark Date: Thu Aug 11 11:57:28 2016 -0400 freedreno: support for using generic clear path Since clears are more or less just normal draws, there isn't that much benefit in having hand-rolled clear path. Add support to use u_blitter instead if gen specific backend doesn't implement ctx->clear(). Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_context.c | 3 + src/gallium/drivers/freedreno/freedreno_context.h | 1 + src/gallium/drivers/freedreno/freedreno_draw.c | 74 ++ src/gallium/drivers/freedreno/freedreno_resource.c | 20 +++--- src/gallium/drivers/freedreno/freedreno_resource.h | 4 ++ 5 files changed, 92 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index 402e88f..ad62fd6 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -115,6 +115,9 @@ fd_context_destroy(struct pipe_context *pctx) if (ctx->blitter) util_blitter_destroy(ctx->blitter); + if (ctx->clear_rs_state) + pctx->delete_rasterizer_state(pctx, ctx->clear_rs_state); + if (ctx->primconvert) util_primconvert_destroy(ctx->primconvert); diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index ffc4d9e..037c199 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -117,6 +117,7 @@ struct fd_context { struct util_queue flush_queue; struct blitter_context *blitter; + void *clear_rs_state; struct primconvert_context *primconvert; /* slab for pipe_transfer allocations: */ diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 715ad21..efc1dd2 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -203,6 +203,72 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) fd_batch_check_size(batch); } +/* Generic clear implementation (partially) using u_blitter: */ +static void +fd_blitter_clear(struct pipe_context *pctx, unsigned buffers, + const union pipe_color_union *color, double depth, unsigned stencil) +{ + struct fd_context *ctx = fd_context(pctx); + struct pipe_framebuffer_state *pfb = &ctx->batch->framebuffer; + struct blitter_context *blitter = ctx->blitter; + + fd_blitter_pipe_begin(ctx, false, true, FD_STAGE_CLEAR); + + util_blitter_common_clear_setup(blitter, pfb->width, pfb->height, + buffers, NULL, NULL); + + struct pipe_stencil_ref sr = { + .ref_value = { stencil & 0xff } + }; + pctx->set_stencil_ref(pctx, &sr); + + struct pipe_constant_buffer cb = { + .buffer_size = 16, + .user_buffer = &color->ui, + }; + pctx->set_constant_buffer(pctx, PIPE_SHADER_FRAGMENT, 0, &cb); + + if (!ctx->clear_rs_state) { + const struct pipe_rasterizer_state tmpl = { + .cull_face = PIPE_FACE_NONE, + .half_pixel_center = 1, + .bottom_edge_rule = 1, + .flatshade = 1, + .depth_clip = 1, + }; + ctx->clear_rs_state = pctx->create_rasterizer_state(pctx, &tmpl); + } + pctx->bind_rasterizer_state(pctx, ctx->clear_rs_state); + + struct pipe_viewport_state vp = { + .scale = { 0.5f * pfb->width, -0.5f * pfb->height, depth }, + .translate = { 0.5f * pfb->width, 0.5f * pfb->height, 0.0f }, + }; + pctx->set_viewport_states(pctx, 0, 1, &vp); + + pctx->bind_vertex_elements_state(pctx, ctx->solid_vbuf_state.vtx); + pctx->set_vertex_buffers(pctx, blitter->vb_slot, 1, + &ctx->solid_vbuf_state.vertexbuf.vb[0]); + pctx->set_stream_output_targets(pctx, 0, NULL, NULL); + pctx->bind_vs_state(pctx, ctx->solid_prog.vp); + pctx->bind_fs_state(pctx, ctx->solid_prog.fp); + + struct pipe_draw_info info = { + .mode = PIPE_PRIM_MAX,/* maps to DI_PT_RECTLIST */ + .count = 2, + .instance_count = 1, + }; + ctx->draw_vbo(ctx, &info); + + util_blitter_restore_constant_buffer_state(blitter); + util_blitter_restore_vertex_states(blitter); + util_blitter_restore_fragment_states(blitter); + util_blitter_restore_render_cond(blitter); + util_blitter_unset_running_flag(blitter); + + fd_blitt
Mesa (master): freedreno/a4xx: use generic clear path
Module: Mesa Branch: master Commit: 27f12dd8fd3626fe20ff2f5ea5371238631eaa20 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=27f12dd8fd3626fe20ff2f5ea5371238631eaa20 Author: Rob Clark Date: Thu Aug 11 12:00:52 2016 -0400 freedreno/a4xx: use generic clear path Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a4xx/fd4_context.c | 3 +- src/gallium/drivers/freedreno/a4xx/fd4_draw.c| 216 +-- 2 files changed, 4 insertions(+), 215 deletions(-) diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_context.c b/src/gallium/drivers/freedreno/a4xx/fd4_context.c index 8ef715f..291df2d 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_context.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_context.c @@ -54,7 +54,7 @@ fd4_context_destroy(struct pipe_context *pctx) fd_context_destroy(pctx); } -static const uint8_t primtypes[PIPE_PRIM_MAX] = { +static const uint8_t primtypes[] = { [PIPE_PRIM_POINTS] = DI_PT_POINTLIST, [PIPE_PRIM_LINES] = DI_PT_LINELIST, [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, @@ -62,6 +62,7 @@ static const uint8_t primtypes[PIPE_PRIM_MAX] = { [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, + [PIPE_PRIM_MAX]= DI_PT_RECTLIST, /* internal clear blits */ }; struct pipe_context * diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c index 200e4f2..06d16fe 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c @@ -131,9 +131,8 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) .vclamp_color = ctx->rasterizer->clamp_vertex_color, .fclamp_color = ctx->rasterizer->clamp_fragment_color, .rasterflat = ctx->rasterizer->flatshade, - // TODO set .half_precision based on render target format, - // ie. float16 and smaller use half, float32 use full.. - .half_precision = !!(fd_mesa_debug & FD_DBG_FRAGHALF), + .half_precision = ctx->in_blit && + fd_half_precision(&ctx->batch->framebuffer), .ucp_enables = ctx->rasterizer->clip_plane_enable, .has_per_samp = (fd4_ctx->fsaturate || fd4_ctx->vsaturate || fd4_ctx->fastc_srgb || fd4_ctx->vastc_srgb), @@ -193,220 +192,9 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) return true; } -/* clear operations ignore viewport state, so we need to reset it - * based on framebuffer state: - */ -static void -reset_viewport(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb) -{ - float half_width = pfb->width * 0.5f; - float half_height = pfb->height * 0.5f; - - OUT_PKT0(ring, REG_A4XX_GRAS_CL_VPORT_XOFFSET_0, 4); - OUT_RING(ring, A4XX_GRAS_CL_VPORT_XOFFSET_0(half_width)); - OUT_RING(ring, A4XX_GRAS_CL_VPORT_XSCALE_0(half_width)); - OUT_RING(ring, A4XX_GRAS_CL_VPORT_YOFFSET_0(half_height)); - OUT_RING(ring, A4XX_GRAS_CL_VPORT_YSCALE_0(-half_height)); -} - -/* TODO maybe we should just migrate u_blitter for clear and do it in - * core (so we get normal draw pass state mgmt and binning).. That should - * work well enough for a3xx/a4xx (but maybe not a2xx?) - */ - -static void -fd4_clear_binning(struct fd_context *ctx, unsigned dirty) -{ - struct fd_ringbuffer *ring = ctx->batch->binning; - struct fd4_emit emit = { - .debug = &ctx->debug, - .vtx = &ctx->solid_vbuf_state, - .prog = &ctx->solid_prog, - .key = { - .binning_pass = true, - .half_precision = true, - }, - .dirty = dirty, - }; - - fd4_emit_state(ctx, ring, &emit); - fd4_emit_vertex_bufs(ring, &emit); - reset_viewport(ring, &ctx->batch->framebuffer); - - OUT_PKT0(ring, REG_A4XX_PC_PRIM_VTX_CNTL, 2); - OUT_RING(ring, A4XX_PC_PRIM_VTX_CNTL_VAROUT(0) | - A4XX_PC_PRIM_VTX_CNTL_PROVOKING_VTX_LAST); - OUT_RING(ring, A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_FRONT_PTYPE(PC_DRAW_TRIANGLES) | - A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_BACK_PTYPE(PC_DRAW_TRIANGLES)); - - OUT_PKT0(ring, REG_A4XX_GRAS_ALPHA_CONTROL, 1); - OUT_RING(ring, 0x0002); - - fd4_draw(ctx->batch, ring, DI_PT_RECTLIST, IGNORE_VISIBILITY, - DI_SRC_SEL_AUTO_INDEX, 2, 1, INDEX_SIZE_IGN, 0, 0, NULL); -} - -static void -fd4_clear(struct fd_context *ctx, unsigned buffers, - const union pipe_color_union *color, do
Mesa (master): freedreno/a3xx: use generic clear path
Module: Mesa Branch: master Commit: f77e59e76c43625921da754239af806df58541e8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f77e59e76c43625921da754239af806df58541e8 Author: Rob Clark Date: Thu Aug 11 11:59:51 2016 -0400 freedreno/a3xx: use generic clear path Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a3xx/fd3_context.c | 3 +- src/gallium/drivers/freedreno/a3xx/fd3_draw.c| 201 +-- 2 files changed, 4 insertions(+), 200 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_context.c b/src/gallium/drivers/freedreno/a3xx/fd3_context.c index af5e60a..dac5941 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_context.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_context.c @@ -54,7 +54,7 @@ fd3_context_destroy(struct pipe_context *pctx) fd_context_destroy(pctx); } -static const uint8_t primtypes[PIPE_PRIM_MAX] = { +static const uint8_t primtypes[] = { [PIPE_PRIM_POINTS] = DI_PT_POINTLIST, [PIPE_PRIM_LINES] = DI_PT_LINELIST, [PIPE_PRIM_LINE_STRIP] = DI_PT_LINESTRIP, @@ -62,6 +62,7 @@ static const uint8_t primtypes[PIPE_PRIM_MAX] = { [PIPE_PRIM_TRIANGLES] = DI_PT_TRILIST, [PIPE_PRIM_TRIANGLE_STRIP] = DI_PT_TRISTRIP, [PIPE_PRIM_TRIANGLE_FAN] = DI_PT_TRIFAN, + [PIPE_PRIM_MAX]= DI_PT_RECTLIST, /* internal clear blits */ }; struct pipe_context * diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c index 9e6a8bc..a1594b6 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c @@ -141,9 +141,8 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) .color_two_side = ctx->rasterizer->light_twoside, .vclamp_color = ctx->rasterizer->clamp_vertex_color, .fclamp_color = ctx->rasterizer->clamp_fragment_color, - // TODO set .half_precision based on render target format, - // ie. float16 and smaller use half, float32 use full.. - .half_precision = !!(fd_mesa_debug & FD_DBG_FRAGHALF), + .half_precision = ctx->in_blit && + fd_half_precision(&ctx->batch->framebuffer), .has_per_samp = (fd3_ctx->fsaturate || fd3_ctx->vsaturate), .vsaturate_s = fd3_ctx->vsaturate_s, .vsaturate_t = fd3_ctx->vsaturate_t, @@ -180,205 +179,9 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info) return true; } -/* clear operations ignore viewport state, so we need to reset it - * based on framebuffer state: - */ -static void -reset_viewport(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb) -{ - float half_width = pfb->width * 0.5f; - float half_height = pfb->height * 0.5f; - - OUT_PKT0(ring, REG_A3XX_GRAS_CL_VPORT_XOFFSET, 4); - OUT_RING(ring, A3XX_GRAS_CL_VPORT_XOFFSET(half_width - 0.5)); - OUT_RING(ring, A3XX_GRAS_CL_VPORT_XSCALE(half_width)); - OUT_RING(ring, A3XX_GRAS_CL_VPORT_YOFFSET(half_height - 0.5)); - OUT_RING(ring, A3XX_GRAS_CL_VPORT_YSCALE(-half_height)); -} - -/* binning pass cmds for a clear: - * NOTE: newer blob drivers don't use binning for clear, which is probably - * preferable since it is low vtx count. However that doesn't seem to - * actually work for me. Not sure if it is depending on support for - * clear pass (rather than using solid-fill shader), or something else - * that newer blob is doing differently. Once that is figured out, we - * can remove fd3_clear_binning(). - */ -static void -fd3_clear_binning(struct fd_context *ctx, unsigned dirty) -{ - struct fd_ringbuffer *ring = ctx->batch->binning; - struct fd3_emit emit = { - .debug = &ctx->debug, - .vtx = &ctx->solid_vbuf_state, - .prog = &ctx->solid_prog, - .key = { - .binning_pass = true, - .half_precision = true, - }, - .dirty = dirty, - }; - - fd3_emit_state(ctx, ring, &emit); - fd3_emit_vertex_bufs(ring, &emit); - reset_viewport(ring, &ctx->batch->framebuffer); - - OUT_PKT0(ring, REG_A3XX_PC_PRIM_VTX_CNTL, 1); - OUT_RING(ring, A3XX_PC_PRIM_VTX_CNTL_STRIDE_IN_VPC(0) | - A3XX_PC_PRIM_VTX_CNTL_POLYMODE_FRONT_PTYPE(PC_DRAW_TRIANGLES) | - A3XX_PC_PRIM_VTX_CNTL_POLYMODE_BACK_PTYPE(PC_DRAW_TRIANGLES) | - A3XX_PC_PRIM_VTX_CNTL_PROVOKING_VTX_LAST); - OUT_PKT0(ring, REG_A3XX_VFD_INDEX_MIN, 4); - OUT_RING(ring, 0);/* VFD_INDEX_MIN */ - OUT_RING(ring, 2);/* VFD_INDEX_MAX */ -
Mesa (master): gallium/u_blitter: export some functions
Module: Mesa Branch: master Commit: 433e12fea86eee7b88a166637d54b1e87bab0081 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=433e12fea86eee7b88a166637d54b1e87bab0081 Author: Rob Clark Date: Sat Aug 13 10:35:23 2016 -0400 gallium/u_blitter: export some functions Signed-off-by: Rob Clark Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_blitter.c | 145 + src/gallium/auxiliary/util/u_blitter.h | 9 ++ 2 files changed, 84 insertions(+), 70 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index d06b3a8..8e5ed45 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -510,26 +510,26 @@ void util_blitter_set_texture_multisample(struct blitter_context *blitter, ctx->has_texture_multisample = supported; } -static void blitter_set_running_flag(struct blitter_context_priv *ctx) +void util_blitter_set_running_flag(struct blitter_context *blitter) { - if (ctx->base.running) { + if (blitter->running) { _debug_printf("u_blitter:%i: Caught recursion. This is a driver bug.\n", __LINE__); } - ctx->base.running = TRUE; + blitter->running = TRUE; - ctx->base.pipe->set_active_query_state(ctx->base.pipe, false); + blitter->pipe->set_active_query_state(blitter->pipe, false); } -static void blitter_unset_running_flag(struct blitter_context_priv *ctx) +void util_blitter_unset_running_flag(struct blitter_context *blitter) { - if (!ctx->base.running) { + if (!blitter->running) { _debug_printf("u_blitter:%i: Caught recursion. This is a driver bug.\n", __LINE__); } - ctx->base.running = FALSE; + blitter->running = FALSE; - ctx->base.pipe->set_active_query_state(ctx->base.pipe, true); + blitter->pipe->set_active_query_state(blitter->pipe, true); } static void blitter_check_saved_vertex_states(struct blitter_context_priv *ctx) @@ -543,8 +543,9 @@ static void blitter_check_saved_vertex_states(struct blitter_context_priv *ctx) assert(ctx->base.saved_rs_state != INVALID_PTR); } -static void blitter_restore_vertex_states(struct blitter_context_priv *ctx) +void util_blitter_restore_vertex_states(struct blitter_context *blitter) { + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; unsigned i; @@ -601,8 +602,9 @@ static void blitter_check_saved_fragment_states(struct blitter_context_priv *ctx assert(ctx->base.saved_blend_state != INVALID_PTR); } -static void blitter_restore_fragment_states(struct blitter_context_priv *ctx) +void util_blitter_restore_fragment_states(struct blitter_context *blitter) { + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; /* Fragment shader. */ @@ -644,8 +646,9 @@ static void blitter_disable_render_cond(struct blitter_context_priv *ctx) } } -static void blitter_restore_render_cond(struct blitter_context_priv *ctx) +void util_blitter_restore_render_cond(struct blitter_context *blitter) { + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; if (ctx->base.saved_render_cond_query) { @@ -656,8 +659,9 @@ static void blitter_restore_render_cond(struct blitter_context_priv *ctx) } } -static void blitter_restore_fb_state(struct blitter_context_priv *ctx) +void util_blitter_restore_fb_state(struct blitter_context *blitter) { + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; pipe->set_framebuffer_state(pipe, &ctx->base.saved_fb_state); @@ -670,8 +674,9 @@ static void blitter_check_saved_textures(struct blitter_context_priv *ctx) assert(ctx->base.saved_num_sampler_views != ~0u); } -static void blitter_restore_textures(struct blitter_context_priv *ctx) +void util_blitter_restore_textures(struct blitter_context *blitter) { + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->base.pipe; unsigned i; @@ -1267,7 +1272,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, assert(ctx->has_layered || num_layers <= 1); - blitter_set_running_flag(ctx); + util_blitter_set_running_flag(blitter); blitter_check_saved_vertex_states(ctx); blitter_check_saved_fragment_states(ctx); blitter_disable_render_cond(ctx); @@ -1311,10 +1316,10 @@ static void util_blitter_clear_custom(struct blitter_context *blitter, UTIL_BLITTER_ATTRIB_COLOR, color); } - blitter_restore_vertex_states(ctx); - blitter_restore_fragment_states(ctx); - blitter_restore_render_cond(ctx); - blitter_unset_running_flag(ctx); + util_blitter_restore_vertex_states(blitter); + util_blitter_r
Mesa (master): gallium/u_blitter: add helper to save FS const buffer state
Module: Mesa Branch: master Commit: 2b2f436c696c4da9e1a45fb03406876340ae31ed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b2f436c696c4da9e1a45fb03406876340ae31ed Author: Rob Clark Date: Sat Aug 13 10:36:00 2016 -0400 gallium/u_blitter: add helper to save FS const buffer state Not (currently) state that is overwridden by u_blitter itself, but drivers with custom blit/clear which are reusing part of the u_blitter infrastructure will use it. Signed-off-by: Rob Clark Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_blitter.c | 10 ++ src/gallium/auxiliary/util/u_blitter.h | 15 +++ 2 files changed, 25 insertions(+) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 8e5ed45..9fbef9b 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -283,6 +283,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->rs_discard_state = pipe->create_rasterizer_state(pipe, &rs_state); } + ctx->base.cb_slot = 0; /* 0 for now */ ctx->base.vb_slot = 0; /* 0 for now */ /* vertex elements states */ @@ -698,6 +699,15 @@ void util_blitter_restore_textures(struct blitter_context *blitter) ctx->base.saved_num_sampler_views = ~0; } +void util_blitter_restore_constant_buffer_state(struct blitter_context *blitter) +{ + struct pipe_context *pipe = blitter->pipe; + + pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, blitter->cb_slot, +&blitter->saved_fs_constant_buffer); + pipe_resource_reference(&blitter->saved_fs_constant_buffer.buffer, NULL); +} + static void blitter_set_rectangle(struct blitter_context_priv *ctx, int x1, int y1, int x2, int y2, float depth) diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index 06e21e6..0f5da6b 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -111,6 +111,9 @@ struct blitter_context unsigned saved_num_sampler_views; struct pipe_sampler_view *saved_sampler_views[PIPE_MAX_SAMPLERS]; + unsigned cb_slot; + struct pipe_constant_buffer saved_fs_constant_buffer; + unsigned vb_slot; struct pipe_vertex_buffer saved_vertex_buffer; @@ -486,6 +489,17 @@ util_blitter_save_fragment_sampler_views(struct blitter_context *blitter, } static inline void +util_blitter_save_fragment_constant_buffer_slot( + struct blitter_context *blitter, + struct pipe_constant_buffer *constant_buffers) +{ + pipe_resource_reference(&blitter->saved_fs_constant_buffer.buffer, + constant_buffers[blitter->cb_slot].buffer); + memcpy(&blitter->saved_fs_constant_buffer, &constant_buffers[blitter->cb_slot], + sizeof(struct pipe_constant_buffer)); +} + +static inline void util_blitter_save_vertex_buffer_slot(struct blitter_context *blitter, struct pipe_vertex_buffer *vertex_buffers) { @@ -536,6 +550,7 @@ void util_blitter_restore_fragment_states(struct blitter_context *blitter); void util_blitter_restore_render_cond(struct blitter_context *blitter); void util_blitter_restore_fb_state(struct blitter_context *blitter); void util_blitter_restore_textures(struct blitter_context *blitter); +void util_blitter_restore_constant_buffer_state(struct blitter_context *blitter); #ifdef __cplusplus } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): egl/dri2: dri2_make_current: Release previous context' s display
Module: Mesa Branch: master Commit: 78e3cea4197802253401766fc44362786898e024 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=78e3cea4197802253401766fc44362786898e024 Author: Nicolas Boichat Date: Thu Aug 11 16:43:32 2016 +0800 egl/dri2: dri2_make_current: Release previous context's display eglMakeCurrent can also be used to change the active display. In that case, we need to decrement ref_count of the previous display (possibly destroying it), and increment it on the next display. Also, old_dsurf/old_rsurf cannot be non-NULL if old_ctx is NULL, so we only need to test if old_ctx is non-NULL. v2: Save the old display before destroying the context. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97214 Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display) Cc: "12.0" Reported-by: Alexandr Zelinsky Tested-by: Alexandr Zelinsky Reviewed-and-Tested-by: Michel Dänzer Signed-off-by: Nicolas Boichat --- src/egl/drivers/dri2/egl_dri2.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 3205a36..3e3d1c8 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1280,13 +1280,14 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, drv->API.DestroySurface(drv, disp, old_dsurf); if (old_rsurf) drv->API.DestroySurface(drv, disp, old_rsurf); - if (old_ctx) - drv->API.DestroyContext(drv, disp, old_ctx); if (!unbind) dri2_dpy->ref_count++; - if (old_dsurf || old_rsurf || old_ctx) - dri2_display_release(disp); + if (old_ctx) { + EGLDisplay old_disp = _eglGetDisplayHandle(old_ctx->Resource.Display); + drv->API.DestroyContext(drv, disp, old_ctx); + dri2_display_release(old_disp); + } return EGL_TRUE; } else { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/vdpau: change the order in which filters are applied(v3)
Module: Mesa Branch: master Commit: 09dff7ae2e179d5a3490481762c6bd3d50430c9f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=09dff7ae2e179d5a3490481762c6bd3d50430c9f Author: Nayan Deshmukh Date: Fri Aug 12 19:50:51 2016 +0530 st/vdpau: change the order in which filters are applied(v3) Apply the median and matrix filter before the compostioning we apply the deinterlacing first to avoid the extra overhead in processing the past and the future surfaces in deinterlacing. v2: apply the filters on all the surfaces (Christian) v3: use get_sampler_view_planes() instead of get_sampler_view_components() and iterate over VL_MAX_SURFACES (Christian) Signed-off-by: Nayan Deshmukh Reviewed-by: Christian König --- src/gallium/state_trackers/vdpau/mixer.c | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index cb0ef03..56b667d 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -240,8 +240,8 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, struct u_rect rect, clip, *prect, dirty_area; unsigned i, layer = 0; struct pipe_video_buffer *video_buffer; - struct pipe_sampler_view *sampler_view; - struct pipe_surface *surface; + struct pipe_sampler_view *sampler_view, **sampler_views; + struct pipe_surface *surface, **surfaces; vlVdpVideoMixer *vmixer; vlVdpSurface *surf; @@ -325,6 +325,22 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, } } + surfaces = video_buffer->get_surfaces(video_buffer); + sampler_views = video_buffer->get_sampler_view_planes(video_buffer); + + for(i = 0; i < VL_MAX_SURFACES; ++i) { + if(sampler_views[i] != NULL && surfaces[i] != NULL) { + if (vmixer->noise_reduction.filter) +vl_median_filter_render(vmixer->noise_reduction.filter, +sampler_views[i], surfaces[i]); + + if (vmixer->sharpness.filter) +vl_matrix_filter_render(vmixer->sharpness.filter, +sampler_views[i], surfaces[i]); + + } + } + prect = RectToPipe(video_source_rect, &rect); if (!prect) { rect.x0 = 0; @@ -394,14 +410,6 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer, else { vl_compositor_render(&vmixer->cstate, compositor, surface, &dirty_area, true); - if (vmixer->noise_reduction.filter) - vl_median_filter_render(vmixer->noise_reduction.filter, - sampler_view, surface); - - if (vmixer->sharpness.filter) - vl_matrix_filter_render(vmixer->sharpness.filter, - sampler_view, surface); - if (vmixer->bicubic.filter) vl_bicubic_filter_render(vmixer->bicubic.filter, sampler_view, dst->surface, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit