summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_gs.c
AgeCommit message (Collapse)AuthorFilesLines
2017-10-12intel: Allocate prog_data::[pull_]param deeper inside the compilerJason Ekstrand1-16/+6
Now that we're always growing the param array as-needed, we can allocate the param array in common code and stop repeating the allocation everywere. In order to keep things sane, we ralloc the [pull_]param array off of the compile context and then steal it back to a NULL context later. This doesn't get us all the way to where prog_data::[pull_]param is purely an out parameter of the back-end compiler but it gets us a lot closer. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-10-12i965: Store image_param in brw_context instead of prog_dataJason Ekstrand1-4/+0
This burns an extra 10k of memory or so in the case where you don't have any images. However, if you have several shaders which use images, this should be much less memory. It also gets rid of a part of prog_data that really has nothing to do with the compiler. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-10-12intel: Rewrite the world of push/pull paramsJason Ekstrand1-4/+2
This moves us away to the array of pointers model and onto a model where each param is represented by a generic uint32_t handle. We reserve 2^16 of these handles for builtins that get generated by somewhere inside the compiler and have well-defined meanings. Generic params have handles whose meanings are defined by the driver. The primary downside to this new approach is that it moves a little bit of the work that we would normally do at compile time to draw time. On my laptop this hurts OglBatch6 by no more than 1% and doesn't seem to have any measurable affect on OglBatch7. So, while this may come back to bite us, it doesn't look too bad. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-09-26i965: Convert brw->*_program into a brw->programs[i] array.Kenneth Graunke1-2/+4
This makes it easier to loop over programs. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
2017-09-21i965: Compute VS/GS output VUE map from the NIR info.Kenneth Graunke1-1/+1
unify_interfaces() only updates the NIR program info, not the copy in the gl_program itself. So, by using the old copy, we were missing out on these updates. The TCS/TES ones already did this correctly. Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
2017-09-15i965: drop unused variablesEric Engestrom1-1/+0
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2017-09-02i965: Fix state flagging of Gen6 SOL programs.Kenneth Graunke1-16/+0
It doesn't seem like the old code could possibly work. 1. brw_gs_state_dirty made us bail unless one of these flags were set: _NEW_TEXTURE, BRW_NEW_GEOMETRY_PROGRAM, BRW_NEW_TRANSFORM_FEEDBACK 2. If there was no geometry program, we called brw_upload_ff_gs_prog()3 3. That checked brw_ff_gs_state_dirty and bailed unless these were set: _NEW_LIGHT, BRW_NEW_PRIMITIVE, BRW_NEW_TRANSFORM_FEEDBACK, BRW_NEW_VS_PROG_DATA. 4. brw_ff_gs_prog_key pv_first and attr fields were set based on data depending on _NEW_LIGHT and BRW_NEW_VS_PROG_DATA. This means that if we needed a FF GS program, and changed the VS outputs or provoking vertex mode, we'd fail to notice that we needed to emit a new program. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-09-02i965: Drop useless gen6_brw_upload_ff_gs_prog() wrapper.Kenneth Graunke1-1/+1
gen6...brw? Drop some baklava layers. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-08-30i965: drop brw->gen in favor of devinfo->genLionel Landwerlin1-1/+2
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-07-13i965: Select ranges of UBO data to be uploaded as push constants.Kenneth Graunke1-0/+2
This adds a NIR pass that decides which portions of UBOS we should upload as push constants, rather than pull constants. v2: Switch to uint16_t for the UBO block number, because we may have a lot of them in Vulkan (suggested by Jason). Add more comments about bitfield trickery (requested by Matt). v3: Skip vec4 stages for now...I haven't finished wiring up support in the vec4 backend, and so pushing the data but not using it will just be wasteful. Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-04-10i965/drm: Rename drm_bacon_bo to brw_bo.Kenneth Graunke1-2/+2
The bacon is all gone. This renames both the class and the related functions. We're about to run indent on the bufmgr code, so no need to worry about fixing bad indentation. Acked-by: Jason Ekstrand <jason@jlekstrand.net>
2017-04-10i965/drm: Use our internal libdrm (drm_bacon) rather than the real one.Kenneth Graunke1-2/+2
Now we can actually test our changes. Acked-by: Jason Ekstrand <jason@jlekstrand.net>
2017-03-13i965: Move the back-end compiler to src/intel/compilerJason Ekstrand1-1/+1
Mostly a dummy git mv with a couple of noticable parts: - With the earlier header cleanups, nothing in src/intel depends files from src/mesa/drivers/dri/i965/ - Both Autoconf and Android builds are addressed. Thanks to Mauro and Tapani for the fixups in the latter - brw_util.[ch] is not really compiler specific, so it's moved to i965. v2: - move brw_eu_defines.h instead of brw_defines.h - remove no-longer applicable includes - add missing vulkan/ prefix in the Android build (thanks Tapani) v3: - don't list brw_defines.h in src/intel/Makefile.sources (Jason) - rebase on top of the oa patches [Emil Velikov: commit message, various small fixes througout] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2017-03-01i965: Reduce cross-pollination between the DRI driver and compilerJason Ekstrand1-1/+0
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-01-17i965: Make a helper for finding an existing shader variant.Kenneth Graunke1-17/+5
We had five copies of the same "walk the cache and look for an existing shader variant for this program" code. Now we have one helper function that returns the key. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
2017-01-06i965: stop passing gl_shader_program to the precompile and codegen functionsTimothy Arceri1-10/+4
We no longer need it. While we are at it we mark the vs, gs, and wm codegen functions as static. Reviewed-by: Eric Anholt <eric@anholt.net>
2017-01-06i965: stop passing gl_shader_program to brw_nir_setup_glsl_uniforms()Timothy Arceri1-1/+1
We can now just get the data needed from the gl_shader_program_data pointer in gl_program. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2017-01-06i965: stop passing gl_shader_program to ↵Timothy Arceri1-6/+3
brw_assign_common_binding_table_offsets() We now get everything we need directly from gl_program so there is no need for this. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2017-01-06i965: stop depending on gl_shader_program for brw_compute_vue_map() paramsTimothy Arceri1-1/+1
This removes another dependency on gl_shader_program from the codegen functions, this will help allow us to use gl_program for the CurrentProgram array rather than gl_shader_program. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2017-01-06i965: pass gl_program to the brw_*_debug_recompile() functionsTimothy Arceri1-5/+3
Rather then passing gl_shader_program. The only field use was Name which is the same as the Id field in gl_program. For wm and vs we also make the functions static and move them before the codegen functions. This change reduces the codegen functions dependency on gl_shader_program. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2017-01-03i965: stop passing gl_shader_program to brw_compile_gs() and gen6_gs_visitor()Timothy Arceri1-1/+1
Instead we caan just use gl_program. Reviewed-by: Eric Anholt <eric@anholt.net>
2017-01-03i965: get InfoLog and LinkStatus via the shader program data pointer in ↵Timothy Arceri1-1/+1
gl_program This removes another dependency on gl_shader_program in the codegen functions. Reviewed-by: Eric Anholt <eric@anholt.net>
2017-01-03i965: update brw_get_shader_time_index() not to take gl_shader_programTimothy Arceri1-1/+1
This removes another dependency on gl_shader_program in the codegen functions which will help allow us to use gl_program in the CurrentProgram array rather than gl_shader_program. Reviewed-by: Eric Anholt <eric@anholt.net>
2016-12-30i965: move compiled_once flag to brw_programTimothy Arceri1-5/+3
This allows us to delete brw_shader and removes the last use of gl_linked_shader in the codegen paths. Reviewed-by: Eric Anholt <eric@anholt.net>
2016-11-19i965: Use shader_info for brw_vue_prog_data::cull_distance_mask.Kenneth Graunke1-4/+0
This also allows us to move it from a GL specific location to a part of the compiler shared by both GL and Vulkan. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-11-19st/mesa/glsl/nir/i965: make use of new gl_shader_program_data in ↵Timothy Arceri1-1/+1
gl_shader_program Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-17i965: get num_images from shader_info rather than gl_linked_shaderTimothy Arceri1-2/+3
This is a step towards freeing gl_linked_shader after linking. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-17i965: only try print GLSL IR once when using INTEL_DEBUG to dump irTimothy Arceri1-3/+0
Since we started releasing GLSL IR after linking the only time we can print GLSL IR is during linking. When regenerating variants only NIR will be available. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-26i965: replace brw_geomerty_program with brw_programTimothy Arceri1-6/+4
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-10-26i965/mesa/st: eliminate gl_geometry_programTimothy Arceri1-11/+8
We now get all the gs metadata from shader_info. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-10-26i965: switch gs over to shared shader_infoTimothy Arceri1-1/+1
Note we access shader_info from the program struct rather than the nir_shader pointer because shader cache won't create a nir_shader. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-10-26nir/i965/anv/radv/gallium: make shader info a pointerTimothy Arceri1-1/+1
When restoring something from shader cache we won't have and don't want to create a nir_shader this change detaches the two. There are other advantages such as being able to reuse the shader info populated by GLSL IR. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-10-06i965: get outputs written from nir infoTimothy Arceri1-1/+1
This is a step towards dropping the GLSL IR version of do_set_program_inouts() in i965 and moving towards native nir support. This is important because we want to eventually convert to nir and use its optimisations passes before we can call this GLSL IR pass. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-10-05i965: Eliminate brw->gs.prog_data pointer.Kenneth Graunke1-6/+5
Just say no to: - brw->gs.base.prog_data = &brw->gs.prog_data->base.base; We'll just use the brw_stage_prog_data pointer in brw_stage_state and downcast it to brw_gs_prog_data as needed. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arcero@collabora.com>
2016-09-27i965: make gs key generation helper available to shader cacheTimothy Arceri1-1/+1
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-23i965: get rid of duplicated values from gen_device_infoLionel Landwerlin1-3/+4
Now that we have gen_device_info mutable, we can update its values and drop all copies we had in brw_context. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-23intel/i965: make gen_device_info mutableLionel Landwerlin1-2/+2
Make gen_device_info a mutable structure so we can update the fields that can be refined by querying the kernel (like subslices and EU numbers). This patch does not make any functional change, it just makes gen_get_device_info() fill a structure rather than returning a const pointer. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-09-20i965: Rename intelScreen to screen.Kenneth Graunke1-4/+4
"intelScreen" is wordy and also doesn't fit our style guidelines. "screen" is shorter, which is nice, because we use it fairly often. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-09-03intel: s/brw_device_info/gen_device_info/Jason Ekstrand1-1/+1
Generated by: sed -i -e 's/brw_device_info/gen_device_info/g' src/intel/**/*.c sed -i -e 's/brw_device_info/gen_device_info/g' src/intel/**/*.h sed -i -e 's/brw_device_info/gen_device_info/g' **/i965/*.c sed -i -e 's/brw_device_info/gen_device_info/g' **/i965/*.cpp sed -i -e 's/brw_device_info/gen_device_info/g' **/i965/*.h Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-07-28i965: remove unnecessary null checkTimothy Arceri1-4/+1
We would have hit a segfault already if this could be null. Fixes Coverity warning spotted by Matt. Reviewed-by: Matt Turner <mattst88@gmail.com>
2016-07-21i965: print error messages if gs fails to compileTimothy Arceri1-0/+6
We do this for all other stages. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-07-05i965: make more effective use of SamplersUsedTimothy Arceri1-3/+1
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
2016-06-30glsl/mesa: split gl_shader in twoTimothy Arceri1-3/+2
There are two distinctly different uses of this struct. The first is to store GL shader objects. The second is to store information about a shader stage thats been linked. The two uses actually share few fields and there is clearly confusion about their use. For example the linked shaders map one to one with a program so can simply be destroyed along with the program. However previously we were calling reference counting on the linked shaders. We were also creating linked shaders with a name even though it is always 0 and called the driver version of the _mesa_new_shader() function unnecessarily for GL shader objects. Acked-by: Iago Toral Quiroga <itoral@igalia.com>
2016-06-13i965: Keep track of the per-thread scratch allocation in brw_stage_state.Francisco Jerez1-5/+3
This will be used to find out what per-thread slot size a previously allocated scratch BO was used with in order to fix a hardware race condition without introducing additional stalls or memory allocations. Instead of calling brw_get_scratch_bo() manually from the various codegen functions, call a new helper function that keeps track of the per-thread scratch size and conditionally allocates a larger scratch BO. v2: Handle BO allocation manually instead of relying on brw_get_scratch_bo (Ken). Cc: <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-29i965: Shrink stage_prog_data param array lengthJordan Justen1-3/+1
It appears we were over-allocating these arrays. Previously we would use nir->num_uniforms directly for scalar programs, and multiply it by 4 for vec4 programs. Instead we should have been dividing by 4 in both cases to convert from bytes to a gl_constant_value count. The size of gl_constant_value is 4 bytes. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-22i965: remove redundant NULL checkTimothy Arceri1-1/+1
We would have segfaulted in the above code if prog could be NULL. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-05-16i965: Mark brw const in brw_state_dirty and callers.Kenneth Graunke1-1/+1
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-05-13i965: Add support for GL_ARB_cull_distanceKristian Høgsberg Kristensen1-0/+4
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-26glsl: move to compiler/Emil Velikov1-1/+1
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
2015-12-02i965: Add INTEL_DEBUG=perf information for GS recompiles.Kenneth Graunke1-0/+58
Surprisingly, this didn't exist at all. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>