summaryrefslogtreecommitdiffstats
path: root/src/intel/isl/isl.c
Commit message (Collapse)AuthorAgeFilesLines
* intel/isl: Add support for RGB formats in X and Y-tiled memoryJason Ekstrand2016-09-121-13/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, using a non-linear tiling format helps improve cache locality by ensuring that neighboring pixels are usually close-by in memory. For RGB formats, this still sort-of holds, but it can also lead to rather terrible memory access patterns where a single RGB pixel value crosses a tile boundary and gets split into two pieces in different 4K pages. It also makes for some rather awkward calculations because your tile size is no longer an even multiple of surface element size. For these reasons, we chose to simply never create tiled RGB images in the Vulkan driver. The GL driver, however, is not so kind so we need to support it somehow. I briefly toyed with a couple of different schemes but this is the best one I could come up with. The fundamental problem is that a tile no longer contains an integer number of surface elements. I briefly considered a couple other options but found them wanting: 1) Using floats for the logical tile size. This leads to potential rounding error problems. 2) When presented with a RGB format, just make the tile 3-times as wide. This isn't so nice because now our tiles are no longer power-of-two size. Also, it can force the row_pitch to be larger than needed which, while not strictly a problem for ISL, causes incompatibility problems with the way the GL driver chooses surface pitches. The chosen method requires that you pay attention and not just assume that your tile_info is in the units you think it is. However, it's nice because it provides a nice "these are the units" declaration in isl_tile_info itself. Previously, the tile_info wasn't usable as a stand-alone structure because you had to also know the format. It also forces figuring out how to deal with inconsistencies between tiling and format back to the caller which is good because the two different consumers of isl_tile_info really want to deal with it differently: Computation of the surface size wants the fewest number of horizontal tiles possible while get_intratile_offset is far more concerned with things aligning nicely. Signed-off-by: Jason Ekstrand <[email protected]> Acked-by: Chad Versace <[email protected]>
* intel/isl: Add a helper for getting the size of an interleaved pixelJason Ekstrand2016-09-121-5/+17
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* isl/gen8+: Allow 1D and 3D auxiliary surfacesTopi Pohjolainen2016-09-121-1/+2
| | | | | | | | | | | | | Otherwise once mcs buffer gets allocated without delay for lossless compression (same as we do for msaa), assert starts to fire in piglit case: tex3d. The test uses depth of one which is in fact supported even now. v2 (Jason): Allow also 1D case as there is nothing in the specs constraining it either. Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* intel: s/brw_device_info/gen_device_info/Jason Ekstrand2016-09-031-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 <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* isl: round format alignment to nearest power of 2Lionel Landwerlin2016-09-011-0/+1
| | | | | | | | | | | | A few inline asserts in anv assume alignments are power of 2, but with formats like R8G8B8 we have odd alignments. v2: round up to power of 2 (Ilia) v3: reuse util_next_power_of_two() from gallium/aux/util/u_math.h (Ilia) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* isl: Allow multisampled array texturesJason Ekstrand2016-08-261-4/+4
| | | | | | | | | | | This probably isn't the only thing that needs to be done to get multisampled array textures working in Vulkan but I think this is all that ISL really needs and it does fix 8 of the new CTS tests. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* intel/isl: Pass the dim_layout into choose_alignment_elJason Ekstrand2016-08-251-11/+12
| | | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* intel/isl: Use DIM_LAYOUT_GEN4_2D for tiled 1-D surfaces on SKLJason Ekstrand2016-08-251-5/+23
| | | | | | | | | The Sky Lake 1D layout is only used if the surface is linear. For tiled surfaces such as depth and stencil the old gen4 2D layout is used. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* isl: Add helpers for creating different types of aux surfacesJason Ekstrand2016-08-171-0/+121
| | | | Reviewed-by: Topi Pohjolainen <[email protected]>
* isl: Take the slice0_extent shortcut for interleaved MSAAJason Ekstrand2016-08-171-1/+1
| | | | | | The shortcut works just fine for MSAA and the comment even says so. Reviewed-by: Nanley Chery <[email protected]>
* isl: Remove duplicate px->sa conversionsJason Ekstrand2016-08-171-20/+0
| | | | | | | | In all three cases, we start with width and height taken from isl_surf::phys_slice0_extent_sa which is already in samples. There is no need to do the conversion and doing so gives us an incorrect value. Reviewed-by: Nanley Chery <[email protected]>
* isl: Add functions for computing surface offsets in samplesJason Ekstrand2016-08-171-12/+12
| | | | Reviewed-by: Topi Pohjolainen <[email protected]>
* isl: Fix get_image_offset_sa_gen4_2d for multisample surfacesJason Ekstrand2016-08-171-4/+9
| | | | | | | | | The function takes a logical array layer but was assuming it was a physical array layer. While we'er here, we also make it not assert-fail on gen9 3-D surfaces. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* isl: Add support for filling out surface states all the way back to gen4Jason Ekstrand2016-07-151-0/+22
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* isl: Fix the bs assertion in isl_tiling_get_infoJason Ekstrand2016-07-151-2/+5
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* Revert "isl: Don't filter tiling flags if a specific tiling bit is set"Nanley Chery2016-07-151-8/+5
| | | | | | | | | | This reverts commit 091f1da902c71ac8d3d27b325a118e2f683f1ae5 . Although a user may specify a specfic tiling bit, ISL should still prevent incompatible tiling/surface combinations. Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* isl: Add support for color control surfacesJason Ekstrand2016-07-131-0/+47
| | | | Reviewed-by: Chad Versace <[email protected]>
* isl: Add support for HiZ surfacesJason Ekstrand2016-07-131-1/+22
| | | | Reviewed-by: Chad Versace <[email protected]>
* isl: Kill off isl_format_layout::bsJason Ekstrand2016-07-131-5/+6
| | | | Reviewed-by: Chad Versace <[email protected]>
* isl: Take bpb rather than bs in tiling_get_infoJason Ekstrand2016-07-131-5/+5
| | | | Reviewed-by: Chad Versace <[email protected]>
* isl: Use bpb for determining YUV image paddingJason Ekstrand2016-07-131-1/+1
| | | | | | | When we initially dropped bpb in favor of bs, we accidentally didn't change this one line properly. This brings it back to what it should be. Reviewed-by: Chad Versace <[email protected]>
* isl: Change the physical size of a W-tile to 128x32Jason Ekstrand2016-07-131-2/+12
| | | | Reviewed-by: Chad Versace <[email protected]>
* isl: Rework the way we define tile sizes.Jason Ekstrand2016-07-131-77/+104
| | | | | | | | | | | This is based on a very long set of discussions between Chad and myself about how we should properly represent HiZ and CCS buffers. The end result of that discussion was that a tiling actually has two different sizes, a logical size in elements, and a physical size in bytes and rows. This commit reworks ISL's pitch and size calculations to work in terms of these two sizes. Reviewed-by: Chad Versace <[email protected]>
* isl: Rework the way we handle surface paddingJason Ekstrand2016-07-131-27/+25
| | | | Reviewed-by: Chad Versace <[email protected]>
* isl: Use ARRAY_PITCH_SPAN_FULL for depth/stencil surfaces on gen7Jason Ekstrand2016-07-131-1/+1
| | | | | | | We helpfully inserted a PRM quotation about how we need to use ARRAY_PITCH_SPAN_FULL and then set it to COMPACT. Oops... Reviewed-by: Chad Versace <[email protected]>
* isl: Stop multiplying height by block sizeJason Ekstrand2016-07-131-2/+2
| | | | | | | | The row pitch already specifies the size of a row of elements. Multiplying by the block height simply causes us to allocate as muc as 12 times more memory than needed for compressed textures. Reviewed-by: Chad Versace <[email protected]>
* isl: Get rid of tiling_get_extentJason Ekstrand2016-07-131-11/+0
| | | | | | It was unused Reviewed-by: Chad Versace <[email protected]>
* isl: Fix some tautological-compare warningsBen Widawsky2016-05-261-2/+2
| | | | | | | | | | | | Fixes: isl.c:62:22: warning: self-comparison always evaluates to true [-Wtautological-compare] assert(ISL_DEV_GEN(dev) == dev->info->gen); ^~ isl.c:63:33: warning: self-comparison always evaluates to true [-Wtautological-compare] assert(ISL_DEV_USE_SEPARATE_STENCIL(dev) == dev->use_separate_stencil); Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* isl: Handle npot ASTC block dimensions on Gen9+Nanley Chery2016-05-201-4/+4
| | | | | Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* isl: Mark default cases in switch unreachable.Matt Turner2016-05-181-0/+6
| | | | To silence -Wmaybe-uninitialized warnings.
* isl: fix warnings in release buildGrazvydas Ignotas2016-04-251-1/+1
| | | | | | | | | Mark variables MAYBE_UNUSED to avoid unused-but-set-variable warnings in release build. Signed-off-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* isl: Remove surf_get_intratile_offset_elJason Ekstrand2016-04-081-30/+0
| | | | | | | The intratile offset may not be a multiple of the element size so this calculation is invalid. Reviewed-by: Nanley Chery <[email protected]>
* isl: Rework the get_intratile_offset functionJason Ekstrand2016-04-081-21/+31
| | | | | | | | | | The old function tried to work in elements which isn't, strictly speaking, a valid thing to do. In the case of a non-power-of-two format, there is no guarantee that the x offset into the tile is a multiple of the format block size. This commit refactors it to work entirely in terms of a tiling (not a surface) and bytes/rows. Reviewed-by: Nanley Chery <[email protected]>
* isl: Don't filter tiling flags if a specific tiling bit is setNanley Chery2016-03-031-5/+8
| | | | | | | | If a specific bit is set, the intention to create a surface with a specific tiling format should be respected. Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* isl: Add function to get intratile offsets from x/y offsetsNanley Chery2016-03-031-12/+31
| | | | | Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* isl: Add a helper for filling a buffer surface stateJason Ekstrand2016-02-271-0/+23
|
* isl: Add a function for filling out a surface stateJason Ekstrand2016-02-271-0/+42
|
* isl: Fix isl_surf_get_image_intratile_offset_el()Nanley Chery2016-02-261-1/+1
| | | | | | | | | | | | Consecutive tiles are separated by the size of the tile, not by the logical tile width. v2: Remove extra subtraction (Ville) Add parenthesis (Jason) v3: Update the unit tests for the function Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* isl: Stop including mesa/main/imports.hJason Ekstrand2016-02-201-0/+2
| | | | It pulls in all sorts of stuff we don't want.
* Move isl to src/intelJason Ekstrand2016-02-181-0/+1428