summaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* i965/fs: Define logical texture sampling opcodes.Francisco Jerez2015-07-293-0/+148
| | | | | | | | | | | | | | | | | Each logical variant is largely equivalent to the original opcode but instead of taking a single payload source it expects the arguments separately as individual sources, like: tex_logical dst, coordinates, shadow_c, lod, lod2, sample_index, mcs, sampler, offset, num_coordinate_components, num_grad_components This patch defines the opcodes and usual instruction boilerplate, including a placeholder lowering function provided mostly as documentation for their source registers. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Reimplement emit_single_fb_write() in terms of logical framebuffer ↵Francisco Jerez2015-07-292-187/+21
| | | | | | | | | | | | | writes. The only non-trivial thing it still has to do is figure out where to take the src/dst depth values from and predicate the instruction if discard is in use. The manual SIMD unrolling logic in the dual-source case goes away because this is now handled transparently by the SIMD lowering pass. Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* i965/fs: Implement lowering of logical framebuffer writes.Francisco Jerez2015-07-291-1/+136
| | | | | | | | | | | | | | | | | | | | | This does essentially the same thing as fs_visitor::emit_single_fb_write(), with some slight differences: - We don't have to worry about exec_size and use_2nd_half anymore, 16-wide sources have already been lowered to 8-wide thanks to the previous commit and the manual argument unzipping is no longer required. - The src/dst_depth and sample_mask values are now explicit sources of the instruction instead of being taken from the visitor state directly. The same goes for the kill-pixel mask that will be passed to the instruction explicitly as predicate. - Everything is now done in static functions to improve encapsulation. Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* i965/fs: Hook up SIMD lowering to unroll FB writes of unsupported width.Francisco Jerez2015-07-291-0/+9
| | | | | | | | This shouldn't have any effect because we don't emit logical framebuffer writes yet. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Remove the FS_OPCODE_SET_OMASK pseudo-opcode.Francisco Jerez2015-07-294-42/+0
| | | | | | | This is now unused. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Don't attempt to copy the useless half of oMask for SIMD8 FB writes.Francisco Jerez2015-07-291-8/+18
| | | | | | | | | | | | | | | | | | There's no need to initialize the wrong half of oMask in the payload when we're doing an 8-wide framebuffer write because it will be ignored by the hardware anyway. By doing it this way we can let the SIMD lowering pass split the sample_mask source as a regular per-channel source, otherwise we would have to introduce some sort of per-instruction source query or use fs_inst::header_size for the lowering pass to be able to find out whether some source is header-like, and leave the source untouched in that case. As a bonus this achieves the same purpose as the previous code without making use of the SET_OMASK pseudo-instruction, which will be removed in a future commit. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Move up Gen6 no16 check to emit_fb_writes().Francisco Jerez2015-07-291-9/+11
| | | | | | | And update the comment. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Move up prog_data->uses_omask assignment up to brw_codegen_wm_prog().Francisco Jerez2015-07-292-3/+2
| | | | | Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Simplify control flow in emit_single_fb_write().Francisco Jerez2015-07-291-12/+16
| | | | | | | | Flatten the if ladder to match the way that the ordering of these fields is specified in the hardware documentation a bit more closely. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Fix slight layering violation in emit_single_fb_writes().Francisco Jerez2015-07-291-12/+10
| | | | | | | | | | | | | | | | | In cases where the color0 argument wasn't being provided, emit_single_fb_writes() would take the alpha channel directly from the visitor state instead of taking it from its arguments. This sort of hack didn't fit nicely into the logical send-message approach because all parameters of the instruction have to be visible to the SIMD lowering pass for it to be able to split them into halves at all. Fix it by using LOAD_PAYLOAD in fs_visitor::emit_fb_writes() to provide an actual color0 vector with undefined contents except for the alpha component to match the previous behavior when no color buffers are enabled. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Make sure that the type sizes are compatible during copy propagation.Francisco Jerez2015-07-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | It's surprising that we weren't checking for this already. A future patch will cause code like the following to be emitted: MOV(16) tmp<1>:uw, src MOV(8) dst<1>:ud, tmp<8,8,1>:ud The second MOV comes from the expansion of a LOAD_PAYLOAD header copy, so I don't have control over its types. Copy propagation will happily turn this into: MOV(8) dst<1>:ud, src Which has different semantics. Fix it by preventing propagation in cases where a single channel of the instruction would span several channels of the copy (this requirement could in fact be relaxed if the copy is just a trivial memcpy, but this case is unusual enough that I don't think it matters in practice). I'm deliberately only checking if the type of the instruction is larger than the original, because the converse case seems to be handled correctly already in the code below. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Honour the instruction force_sechalf and exec_size fields for FB ↵Francisco Jerez2015-07-291-2/+2
| | | | | | | | | | writes. We were previously guessing the half based on the EOT flag which seems rather gross. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Define logical framebuffer write opcode.Francisco Jerez2015-07-294-1/+53
| | | | | | | | | | | | | | | | The logical variant is largely equivalent to the original opcode but instead of taking a single payload source it expects its arguments that make up the payload separately as individual sources, like: fb_write_logical null, color0, color1, src0_alpha, src_depth, dst_depth, sample_mask, num_components This patch defines the opcode and usual instruction boilerplate, including a placeholder lowering function provided mainly as self-documentation. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965/fs: Implement pass to lower instructions of unsupported SIMD width.Francisco Jerez2015-07-292-0/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lowering pass implements an algorithm to expand SIMDN instructions into a sequence of SIMDM instructions in cases where the hardware doesn't support the original execution size natively for some particular instruction. The most important use-cases are: - Lowering send message instructions that don't support SIMD16 natively into SIMD8 (several texturing, framebuffer write and typed surface operations). - Lowering messages that don't support SIMD8 natively into SIMD16 (*cough*gen4*cough*). - 64-bit precision operations (e.g. FP64 and 64-bit integer multiplication). - SIMD32. The algorithm works by splitting the sources of the original instruction into chunks of width appropriate for the lowered instructions, and then interleaving the results component-wise into the destination of the original instruction. The pass is controlled by the get_lowered_simd_width() function that currently just returns the original execution size making the whole pass a no-op for the moment until some user is introduced. Reviewed-by: Jason Ekstrand <[email protected]> v2: Reverse order of the source transformations and split_inst emit call to make the code a bit easier to understand.
* i965/fs: Fix return value of fs_inst::regs_read() for BAD_FILE.Francisco Jerez2015-07-291-0/+1
| | | | | | | | | | | | Typically BAD_FILE sources are used to mark a source as not present what implies that no registers are read. This will become much more frequent with logical send opcodes which have a large number of sources, many of them optionally used and marked as BAD_FILE when they aren't applicable. It will prove to be useful to be able to rely on the value of regs_read() regardless of whether a source is present or not. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Add builder emit method taking a variable number of source registers.Francisco Jerez2015-07-291-3/+12
| | | | | | | | And start using it in fs_builder::LOAD_PAYLOAD(). This will be used to emit logical send message opcodes which have an unusually large number of arguments. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Add stub lowering pass for logical send-message opcodes.Francisco Jerez2015-07-292-1/+29
| | | | | | | | | | | | | | | | This pass will house ad-hoc lowering code for several send message-like virtual opcodes that will represent their logically independent arguments as separate instruction sources rather than as a single payload blob. This pass will basically just take the separate arguments that are supposed to be part of the payload and concatenate them to construct a message in the form required by the hardware. Virtual instructions in separate-source form will eventually allow some simplification of the visitor code and make several transformations easier like lowering SIMD16 instructions to SIMD8 algorithmically in cases where the hardware doesn't support the former natively. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Factor out source components calculation to a separate method.Francisco Jerez2015-07-292-10/+24
| | | | | | | | | | | | | | | | | | This cleans up fs_inst::regs_read() slightly by disentangling the calculation of "components" from the handling of message payload arguments. This will also simplify the SIMD lowering and logical send message lowering passes, because it will avoid expressions like 'regs_read * REG_SIZE / component_size' which are not only ugly, they may be inaccurate because regs_read rounds up the result to the closest register multiple so they could give incorrect results when the component size is lower than one register (e.g. uniforms). This didn't seem to be a problem right now because all such expressions happen to be dealing with per-channel GRFs only currently, but that's by no means obvious so better be safe than sorry. v2: Split PIXEL_X/Y and LINTERP into separate case blocks. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Simplify instruction rewrite loop in the register coalesce pass.Francisco Jerez2015-07-291-14/+13
| | | | | | | | | | | | For some reason the loop that rewrites all occurrences of the coalesced register was iterating over all possible offsets until it would find one that compares equal to the offset of a source or destination of any instruction in the program. Since the mapping between old and new offsets is already available in the regs_to_offset array and we know that the whole register has been coalesced we can just look it up. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Fix rewrite of the second half of 16-wide coalesced registers.Francisco Jerez2015-07-291-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | The register coalesce pass wasn't rewriting the destination and sources of instructions that accessed the second half of a coalesced register previously copied with a 16-wide MOV instruction. E.g.: | ADD (16) vgrf0:f, vgrf0:f, 1.0:f | MOV (16) vgrf1:f, vgrf0:f | MOV (8) vgrf2:f, vgrf0+1:f { sechalf } would get incorrectly register-coalesced into: | ADD (16) vgrf1:f, vgrf1:f, 1.0:f | MOV (8) vgrf2:f, vgrf0+1:f { sechalf } The reason is that the mov[i] pointer was being left equal to NULL for every other register. The fact that we've made it to the rewrite loop implies that the whole register will be coalesced, so it doesn't seem right not to update something that uses it depending on whether mov[i] is NULL or not. Fixes an amount of texturing and image_load_store piglit tests on my SIMD-lowering branch. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Detect multi-register MOVs correctly in register_coalesce.Francisco Jerez2015-07-291-1/+1
| | | | | | | | | | | register_coalesce() was considering the exec_size of the MOV instruction alone to decide whether the register at offset+1 of the source VGRF was being copied to inst->dst.reg_offset+1 of the destination VGRF, which is only a valid assumption if the move has a 32-bit execution type. Use regs_read() instead to find out the number of registers copied by the instruction. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/es3.1: enable GL_ARB_explicit_uniform_location for GLES 3.1Marta Lofstedt2015-07-292-1/+9
| | | | | Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* mesa/es3.1: enable GL_ARB_compute_shader for GLES 3.1Marta Lofstedt2015-07-292-10/+16
| | | | | Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* mesa/es3.1: enable GL_ARB_texture_gather for GLES 3.1Marta Lofstedt2015-07-292-2/+10
| | | | | | Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa/es3.1: enable GL_ARB_texture_multisample for GLES 3.1Marta Lofstedt2015-07-292-6/+14
| | | | | | Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa/es3.1: enable GL_ARB_shader_atomic_counters for GLES 3.1Marta Lofstedt2015-07-292-9/+17
| | | | | Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* mesa/es3.1: enable GL_ARB_shader_image_load_store for GLES 3.1Marta Lofstedt2015-07-292-6/+17
| | | | | | Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa/es3.1: Add ES 3.1 handling to get.c and get_hash_generator.pyMarta Lofstedt2015-07-292-5/+12
| | | | | Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* mesa: Return INVALID_ENUM in glClearBufferiv() when buffer is not color or ↵Eduardo Lima Mitev2015-07-291-0/+12
| | | | | | | | | | | | | | | stencil Page 497 of the PDF, section '17.4.3.1 Clearing Individual Buffers' of the OpenGL 4.5 spec states: "An INVALID_ENUM error is generated by ClearBufferiv and ClearNamedFramebufferiv if buffer is not COLOR or STENCIL." Fixes 1 dEQP test: * dEQP-GLES3.functional.negative_api.buffer.clear_bufferiv Reviewed-by: Ian Romanick <[email protected]>
* i965: Use real stage in "Unsupported form of variable indexing" warning.Kenneth Graunke2015-07-281-2/+3
| | | | | | | Other stages can be miserably slow too! Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* meta/copy_image: Stash off the scissorJason Ekstrand2015-07-281-2/+2
| | | | | | | | | | | The meta CopyImageSubData path uses BlitFramebuffers to do the actual copy. The only thing that can affect BlitFramebuffers other than the currently bound framebuffers is the scissor so we need to save that off and reset it. If we don't do this, applications that use a scissor together with CopyImageSubData will get accidentally scissored copies. Tested-by: Markus Wick <markus at selfnet.de> Reviewed-by: Anuj Phogat <[email protected]>
* st/mesa: remove st_context::missing textures and get_passthrough_fsMarek Olšák2015-07-292-28/+2
| | | | Reviewed-by: Brian Paul <[email protected]>
* st/mesa: remove st_finalize_textures atomMarek Olšák2015-07-293-47/+0
| | | | | | | | | It only checks fragment textures and ignores other shaders, which makes it incomplete, and textures are already finalized in update_single_texture. There are no piglit regressions. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: add shader dumping for shader-dbMarek Olšák2015-07-291-0/+66
| | | | Reviewed-by: Brian Paul <[email protected]>
* st/mesa: fix GLSL 1.30 texture shadow functions with the GL_ALPHA depth mode ↵Marek Olšák2015-07-293-47/+77
| | | | | | | | | | | | (v2) Fixes piglit: [email protected]@execution@fs-texture-sampler2dshadow-10 [email protected]@execution@fs-texture-sampler2dshadow-11 v2: use st_shader_stage_to_ptarget Reviewed-by: Brian Paul <[email protected]>
* i965: Support importing R8 and GR88 dma_bufsChad Versace2015-07-281-0/+6
| | | | | | | | | | | EGL_EXT_image_dma_buf_import now supports those formats. Tests: - Tested by Piglit ext_image_dma_buf_import-transcode-nv12-as-r8-gr88. - Tested by Peter in Kodi/XBMC to obtain 60fps NV12 transcode at 4K. Tested-by: Peter Frühberger <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* st/mesa: don't ignore texture buffer state changesMarek Olšák2015-07-253-5/+7
| | | | | | | | Fixes piglit: spec@arb_texture_buffer_range@ranges-2 Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: fix error checking for getting zero-sized texture imagesIlia Mirkin2015-07-241-9/+9
| | | | | | | | | | | | | | | | | | Commit 17f714836 (mesa: rearrange texture error checking order) moved the width/height/depth == 0 allowance before checking if the image was there. This was in part due to depth having to be == 1 for 2D images and width having to be == 1 for 1D images. Instead relax the height/depth checks to also accept 0 as valid. With this change, bin/arb_direct_state_access-get-textures starts passing again. Fixes: 17f714836 (mesa: rearrange texture error checking order) Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Fix typo in a commentAnuj Phogat2015-07-241-1/+1
| | | | Signed-off-by: Anuj Phogat <[email protected]>
* meta: Use _mesa_need_rgb_to_luminance_conversion() in decompress_texture_image()Anuj Phogat2015-07-241-5/+2
| | | | | Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: Change the signature of _mesa_need_rgb_to_luminance_conversion()Anuj Phogat2015-07-243-15/+20
| | | | | | | | | This allows us to handle cases when texImage->_BaseFormat doesn't match _mesa_format_get_base_format(texImage->Format). _BaseFormat is what we care about in this function. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* meta: Fix reading luminance texture as rgba in _mesa_meta_pbo_GetTexSubImage()Anuj Phogat2015-07-241-2/+34
| | | | | | | | | | | | | | After recent addition of pbo testing in piglit test getteximage-luminance, it fails on i965. This patch makes a sub test pass. This patch adds a clear color operation to meta pbo path, which I think is better than falling back to software path. V2: Fix color mask for GL_LUMINANCE_ALPHA Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* meta: Use _mesa_need_luminance_to_rgb_conversion() in decompress_texture_image()Anuj Phogat2015-07-241-10/+2
| | | | | Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: Add a helper function _mesa_need_luminance_to_rgb_conversion()Anuj Phogat2015-07-242-0/+22
| | | | | | Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* meta: Use _mesa_unpack_format_to_base_format() to handle integer formatsAnuj Phogat2015-07-241-4/+2
| | | | | | | | | | Replace a call to mesa_base_tex_format() that handles only internal formats with a call to the new _mesa_unpack_format_to_base_format() function that handles allowed unpack formats and does not care for internal formats at all. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: Add a helper function _mesa_unpack_format_to_base_format()Anuj Phogat2015-07-242-0/+47
| | | | | Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: Set green, blue channels to zero only for formats with these componentsAnuj Phogat2015-07-241-3/+10
| | | | | | | | | This is an optimization which avoids setting pixel transfer operations when not required. _mesa_ReadPixels falls back to slower path if transfer operations are set. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* meta: Don't do fragment color clamping in _mesa_meta_pbo_GetTexSubImageAnuj Phogat2015-07-241-0/+5
| | | | | | | | | | | | | | | _mesa_meta_pbo_GetTexSubImage() uses _mesa_meta_BlitFrameBuffer(), which will do fragment clamping if enabled. But fragment clamping doesn't affect ReadPixels and GetTexImage. Without this patch, piglit test arb_color_buffer_float-clear fails, when forced to use the meta pbo path. v2: Apply this fix to both glReadPixels and glGetTexImage. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* meta: Abort meta pbo path if readpixels need signed-unsigned conversionAnuj Phogat2015-07-241-0/+26
| | | | | | | | | | | | | | | | Meta pbo path for ReadPixels rely on BlitFramebuffer which doesn't support signed to unsigned integer conversions and vice versa. Without this patch, piglit test fbo_integer_readpixels_sint_uint fails, when forced to use the meta pbo path. v2: Make need_signed_unsigned_int_conversion() a static function. (Iago) Bump up the comment and the commit message. (Jason) Signed-off-by: Anuj Phogat <[email protected]> Cc: <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Iago Toral <[email protected]>
* meta: Fix transfer operations check in meta pbo path for readpixelsAnuj Phogat2015-07-241-4/+9
| | | | | | | | | | | | | | | | | | | Currently used ctx->_ImageTransferState check is not sufficient because it doesn't include the read color clamping enabled with GL_CLAMP_READ_COLOR. So, use the helper function _mesa_get_readpixels_transfer_ops(). Also, transfer operations don't affect glGetTexImage(). So, do the check only for glReadPixles. Without this patch, arb_color_buffer_float-readpixels test fails, when forced to use meta pbo path. V2: Add a comment and bump up the commit message. Signed-off-by: Anuj Phogat <[email protected]> Cc: <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>