Commit Graph

64550 Commits

Author SHA1 Message Date
Eric Anholt 0bc2aed90f vc4: Add a bunch of validation of the binning mode config. 2014-08-11 14:45:31 -07:00
Eric Anholt b6caa9556c vc4: Validate that the same BO doesn't get reused for different purposes.
We don't care if things like vertex data get smashed by render target
data, but we do need to make sure that shader code doesn't get rendered
to.

v2: Fix overflowing read of gl_relocs[] that incorrect flagged of some
    VBOs as shader code.
2014-08-11 14:45:31 -07:00
Eric Anholt fa26d334cb vc4: Use the packet #defines in the kernel validation code. 2014-08-11 14:45:31 -07:00
Eric Anholt 5969f9b79c vc4: Rename GEM_HANDLES to be in a namespace.
It's not a real VC4 hardware packet, but I've put in a comment to explain
it.
2014-08-11 14:45:31 -07:00
Eric Anholt 27b8a0a025 vc4: Clean up TMU write validation.
The comment conflicted with the support in the code, so I moved the TMU
write validation to where the comment was, and dropped some dead arguments
from the functions while changing their signatures.
2014-08-11 14:45:31 -07:00
Eric Anholt 7969a15325 vc4: Update a comment about shader validation 2014-08-11 14:45:31 -07:00
Eric Anholt 99070c6daa vc4: Add proper translation from Zc to Zs for vertex output.
This fixes the remaining failure in depthfunc.
2014-08-11 14:45:31 -07:00
Eric Anholt 4160ac5ee4 vc4: Add support for depth clears and tests within a tile.
This doesn't load/store the Z contents across submits yet.  It also
disables early Z, since it's going to require tracking of Z functions
across multiple state updates to track the early Z direction and whether
it can be used.

v2: Move the key setup to before the search for the key.
2014-08-11 14:45:31 -07:00
Eric Anholt 2259cc5aeb vc4: Avoid flushing when mapping buffers that aren't in the batch.
This should prevent a bunch of unnecessary flushes for things like
updating immediate vertex data.
2014-08-11 14:45:31 -07:00
Eric Anholt 6b2583412f vc4: Drop the flush at the end of the draw
Now we actally get multiple draw calls per submit.
2014-08-11 14:45:31 -07:00
Eric Anholt c047f13603 vc4: Align following shader recs to 16 bytes.
Otherwise, the low address bits will end up being interpreted as attribute
counts.
2014-08-11 14:45:31 -07:00
Eric Anholt 766ca5c7a5 vc4: Fix a potential src buffer overflow in shader rec validation. 2014-08-11 14:45:31 -07:00
Eric Anholt 027d730aff vc4: Keep a reference to BOs queued for rendering.
Otherwise, once we're not flushing at the end of every draw, we'll free
things like gallium resources, and free the backing GEM object, before
we've flushed the rendering using it to the kernel.
2014-08-11 14:45:30 -07:00
Eric Anholt 771d86abd6 vc4: Compute the proper end address of the relocated command lists.
render_cl_size/bin_cl_size includes relocations, while the hardware buffer
doesn't.  If you don't emit a HALT packet, the command parser continues
until the end register's value.  We can't allow executing unvalidated
buffer contents (and it's actually harmful in the render lists Mesa is
emitting, since VC4_PACKET_STORE_MS_TILE_BUFFER_AND_EOF doesn't trigger a
halt).
2014-08-11 14:45:30 -07:00
Eric Anholt c58f35393e vc4: Walk tiles horizontally, then vertically.
I was confused looking at my addresses in dumps because I was seeing the
tile branch offsets jumping all over.
2014-08-11 14:45:30 -07:00
Eric Anholt 165ca6b5ad vc4: Track clears veresus uncleared draws, and the clear color.
This is a step toward queueing more than one draw per frame.

Fixes piglit attribute0 test, since we get a working clear color now.
2014-08-11 14:45:30 -07:00
Eric Anholt 9c631f30c9 vc4: Move the rest of RCL setup to flush time.
We only want to set up render target config and clear colors once per
frame.
2014-08-11 14:45:30 -07:00
Eric Anholt 100e5679c7 vc4: Move render command list calls to vc4_flush() 2014-08-11 14:45:30 -07:00
Eric Anholt fbaac8407a vc4: Move bin command list ending commands to vc4_flush() 2014-08-11 14:45:29 -07:00
Eric Anholt 5e062cb2b4 vc4: Rename fields in the kernel interface.
I decided I didn't like "len" compared to "size", and I keep typing
shader_rec instead of shader_record[s] elsewhere, so make it consistent.
2014-08-11 14:45:28 -07:00
Eric Anholt 2b16b3d75f vc4: Fix things to validate more than one shader state in a submit. 2014-08-11 14:45:28 -07:00
Eric Anholt a8f2bf0f51 vc4: Rewrite the kernel ABI to support texture uniform relocation.
This required building a shader parser that would walk the program to find
where the texturing-related uniforms are in the uniforms stream.

Note that as of this commit, a new kernel is required for rendering on
actual VC4 hardware (currently that commit is named "drm/vc4: Introduce
shader validation and better command stream validation.", but is likely to
be squashed as part of an eventual merge of the kernel driver).
2014-08-11 14:45:28 -07:00
Eric Anholt 6a5ece12aa vc4: Add docs for the drm interface 2014-08-11 14:45:28 -07:00
Eric Anholt 11fbee3201 vc4: Add load/store to the validator 2014-08-11 14:40:45 -07:00
Eric Anholt a3cd3c0d19 vc4: Switch simulator to using kernel validator
This ensures that when I'm using the simulator, I get a closer match to
what behavior on real hardware will be.  It lets me rapidly iterate on the
kernel validation code (which otherwise has a several-minute turnaround
time), and helps catch buffer overflow bugs in the userspace driver
faster.
2014-08-11 14:40:45 -07:00
Eric Anholt a02c658908 vc4: Drop pointless shader state struct 2014-08-11 14:40:45 -07:00
Eric Anholt 857dcc09fa vc4: Add support for texture rectangles
v2: Rebase on helpers change.
2014-08-11 14:40:45 -07:00
Eric Anholt 66c6c40127 vc4: Add support for texturing (under simulation)
Only rgba8888 works, and only a single texture unit, and it's only under
simulation because I haven't built the kernel interface yet.

v2: Rebase on helpers.
v3: Fold in the don't-break-the-arm-build fix.
2014-08-11 14:40:45 -07:00
Eric Anholt d5a6e3dd9b vc4: Drop PIPE_SHADER_CAP_MAX_ADDRS
Fixes the build since c10332bbb8
2014-08-11 14:40:42 -07:00
Marek Olšák c10332bbb8 gallium: remove PIPE_SHADER_CAP_MAX_ADDRS
This limit is fixed in Mesa core and cannot be changed.
It only affects ARB_vertex_program and ARB_fragment_program.

The minimum value for ARB_vertex_program is 1 according to the spec.
The maximum value for ARB_vertex_program is limited to 1 by Mesa core.

The value should be zero for ARB_fragment_program, because it doesn't
support ARL.

Finally, drivers shouldn't mess with these values arbitrarily.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 718d4b97ef st/mesa: compute supported GL versions at DRIscreen creation
This computes all GL versions before any context is created.
It's a requirement for GLX_MESA_query_renderer.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák fceadfe7ef gallium: pass st_config_options to query_versions
So move it from dri_context to dri_screen.
This will be needed for version computations.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák f1f5366629 mesa: return version 0 if the computed core profile version is too low
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 7207830047 mesa: add _mesa_get_version, a ctx-independent variant of _mesa_compute_version
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 537cbb7e1a mesa: add a context-independent variant of _mesa_override_gl_version
v2: changed GLboolean -> bool

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák ee9a2b1ae9 mesa: make _mesa_init_constants context-independent and public
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 858452e542 mesa: make _mesa_init_extensions context-independent
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 35e755faa7 st/mesa: make st_init_limits context-independent
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 002211f9ee mesa: move ShaderCompilerOptions into gl_constants
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 5c69173907 st/mesa: make st_init_extensions context-independent
Setting Const.MaxSamples needed a rework, so that it doesn't call
st_choose_format, which depends on st_context.

Other than that, there is no change in functionality.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák d9a6f4360a mesa: make _mesa_override_glsl_version context-independent
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák c6cbde5008 gallium/stapi: move setting GL versions to the state tracker
All flags are set for st/mesa, so the state tracker doesn't have to check
them.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-08-11 21:53:57 +02:00
Marek Olšák 0127d26e6c st/mesa: convert the ETC1 format to an uncompressed one if unsupported
I don't know of any hardware which supports it.
With this, GL_OES_compressed_ETC1_RGB8_texture is supported if RGBA8
is supported.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
2014-08-11 21:53:57 +02:00
Marek Olšák 547e2880bc st/mesa: add st_context parameter to st_mesa_format_to_pipe_format
This will be used by the next commit.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
2014-08-11 21:53:57 +02:00
Marek Olšák 3d56732c1f st/mesa: advertise ARB_ES3_compatibility if GLSL 3.30 and ETC2 are supported 2014-08-11 21:53:57 +02:00
Marek Olšák 463b0ea1f6 st/mesa: add support for ETC2 formats
The formats are emulated by translating them into plain uncompressed
formats, because I don't know of any hardware which supports them.

This is required for GLES 3.0 and ARB_ES3_compatibility (GL 4.3).
2014-08-11 21:53:57 +02:00
Marek Olšák ddc8003c61 mesa: add helper _mesa_is_format_etc2
v2: renamed GLboolean -> bool

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-08-11 21:53:57 +02:00
Brian Paul f24be73401 mesa: add missing GLAPIENTRY in copyimage.c
Fixes MinGW build.  Trivial.
2014-08-11 12:59:47 -06:00
Jason Ekstrand f5cc3fdcf1 i965/cse: Don't eliminate instructions with side-effects
This casues problems when converting atomics to use the GRF.  Sometimes the atomic operation would get eaten by CSE when it shouldn't.

v2: Roll the has_side_effects check into is_expression

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-08-11 11:40:32 -07:00
Jason Ekstrand 34ee3f5a34 docs/GL3: Mark ARB_copy_image as implemented on i965 2014-08-11 11:26:14 -07:00