summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/freedreno
AgeCommit message (Collapse)AuthorFilesLines
2019-01-18freedreno/a6xx: Turn on texture tiling by defaultKristian H. Kristensen7-43/+64
The color swap isn't available for tiled formats and it's not needed either. We pick one channel order and use for all non-linear formats. Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Rob Clark <robdclark@gmail.com>
2019-01-18freedreno: Synchronize batch and flush for staging resourceKristian H. Kristensen1-1/+15
Staging blit downloads would wait on the src resource instead of the staging resource and didn't make sure to submit the blit batch first. Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Rob Clark <robdclark@gmail.com>
2019-01-10freedreno/a6xx: fix 3d+tiled layoutRob Clark1-34/+52
The last round of fixing 3d layer+level layout skipped the tiled case, since tiled texture support was not in place yet. This finishes the job. Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-10freedreno/a6xx: move tile_mode to sampler-view CSORob Clark2-7/+7
This is known when the CSO is created, so no need to patch it in later. Also, it seems like smaller textures where the first level is small enough to be linear, it seems like we should set linear tile mode. See: dEQP-GLES3.functional.texture.format.unsized.rgb_unsigned_byte_3d_pot Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-10freedreno/a6xx: separate stencil restore/resolve fixesRob Clark1-14/+21
Previously we'd use format/etc from the primary (z32) buffer for the stencil (s8), due to confusion about rsc vs psurf. Rework this to drop extra arg and push down handling of separate stencil case (and make sure we take the fmt from the right place). This doesn't completely fix separate-stencil, but at least it avoids the GPU scribbling over random other cmdstream buffers and causing a bunch of bogus fails in dEQP. Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-08freedreno: Move register constant files to src/freedreno.Bas Nieuwenhuizen10-22475/+1
This way they can be shared. Build tested with meson, but not too sure on the autotools stuff though. Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Acked-by: Rob Clark <robdclark@gmail.com>
2019-01-08spirv: Add support for using derefs for UBO/SSBO accessJason Ekstrand1-0/+1
For now, it's hidden behind a cap. Hopefully, we can eventually drop that along with all the manual offset code in spirv_to_nir. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Tested-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2019-01-03freedreno: fix staging resource size for arraysRob Clark1-2/+10
A 2d-array texture (for example), should get the # of array elements from box->depth, rather than depth0 which is minified. Fixes dEQP-GLES3.functional.shaders.texture_functions.texture.sampler2darray_bias_float_fragment with tiled textures. Reported-by: Kristian H. Kristensen <hoegsberg@chromium.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-03freedreno: remove blit_via_copy_region()Rob Clark1-4/+0
If we hit the memcpy() path for copy_region(), that will try to do a transfer_map(), which goes badly for blits to/from staging triggered by transfer_map() or transfer_unmap(). We could possibly add fd_blit2() which has allow_transfer_map param, and call that for staging blits. But I'm not really sure if trying the blit via copy_region() is very useful. At least for newer gens that implement fd_context::blit(), it probably isn't. Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-03freedreno/a6xx: rework blitter APIRob Clark1-54/+8
Switch over to using fd_context::blit(), in the same way that a5xx does. The previous patch wires fd_resource_copy_region() up to the blitter so a6xx no longer needs to bypass the core layer to accelerate this. Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-03freedreno: try blitter for fd_resource_copy_region()Rob Clark1-0/+27
Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-03freedreno: rework blit APIRob Clark8-27/+29
First step to unify the way fd5 and fd6 blitter works. Currently a6xx bypasses the blit API in order to also accelerate resource_copy_region() But this approach can lead to infinite recursion: #0 fd_alloc_staging (ctx=0x5555936480, rsc=0x7fac485f90, level=0, box=0x7fbab29220) at ../src/gallium/drivers/freedreno/freedreno_resource.c:291 #1 0x0000007fbdebed04 in fd_resource_transfer_map (pctx=0x5555936480, prsc=0x7fac485f90, level=0, usage=258, box=0x7fbab29220, pptrans=0x7fbab29240) at ../src/gallium/drivers/freedreno/freedreno_resource.c:479 #2 0x0000007fbe5c5068 in u_transfer_helper_transfer_map (pctx=0x5555936480, prsc=0x7fac485f90, level=0, usage=258, box=0x7fbab29220, pptrans=0x7fbab29240) at ../src/gallium/auxiliary/util/u_transfer_helper.c:243 #3 0x0000007fbde2dcb8 in util_resource_copy_region (pipe=0x5555936480, dst=0x7fac485f90, dst_level=0, dst_x=0, dst_y=0, dst_z=0, src=0x7fac47c780, src_level=0, src_box_in=0x7fbab2945c) at ../src/gallium/auxiliary/util/u_surface.c:350 #4 0x0000007fbdf2282c in fd_resource_copy_region (pctx=0x5555936480, dst=0x7fac485f90, dst_level=0, dstx=0, dsty=0, dstz=0, src=0x7fac47c780, src_level=0, src_box=0x7fbab2945c) at ../src/gallium/drivers/freedreno/freedreno_blitter.c:173 #5 0x0000007fbdf085d4 in fd6_resource_copy_region (pctx=0x5555936480, dst=0x7fac485f90, dst_level=0, dstx=0, dsty=0, dstz=0, src=0x7fac47c780, src_level=0, src_box=0x7fbab2945c) at ../src/gallium/drivers/freedreno/a6xx/fd6_blitter.c:587 #6 0x0000007fbde2f3d0 in util_try_blit_via_copy_region (ctx=0x5555936480, blit=0x7fbab29430) at ../src/gallium/auxiliary/util/u_surface.c:864 #7 0x0000007fbdec02c4 in fd_blit (pctx=0x5555936480, blit_info=0x7fbab29588) at ../src/gallium/drivers/freedreno/freedreno_resource.c:993 #8 0x0000007fbdf08408 in fd6_blit (pctx=0x5555936480, info=0x7fbab29588) at ../src/gallium/drivers/freedreno/a6xx/fd6_blitter.c:546 #9 0x0000007fbdebdc74 in do_blit (ctx=0x5555936480, blit=0x7fbab29588, fallback=false) at ../src/gallium/drivers/freedreno/freedreno_resource.c:129 #10 0x0000007fbdebe58c in fd_blit_from_staging (ctx=0x5555936480, trans=0x7fac47b7e8) at ../src/gallium/drivers/freedreno/freedreno_resource.c:326 #11 0x0000007fbdebea38 in fd_resource_transfer_unmap (pctx=0x5555936480, ptrans=0x7fac47b7e8) at ../src/gallium/drivers/freedreno/freedreno_resource.c:416 #12 0x0000007fbe5c5c68 in u_transfer_helper_transfer_unmap (pctx=0x5555936480, ptrans=0x7fac47b7e8) at ../src/gallium/auxiliary/util/u_transfer_helper.c:516 #13 0x0000007fbde2de24 in util_resource_copy_region (pipe=0x5555936480, dst=0x7fac485f90, dst_level=0, dst_x=0, dst_y=0, dst_z=0, src=0x7fac47b8e0, src_level=0, src_box_in=0x7fbab2997c) at ../src/gallium/auxiliary/util/u_surface.c:376 #14 0x0000007fbdf2282c in fd_resource_copy_region (pctx=0x5555936480, dst=0x7fac485f90, dst_level=0, dstx=0, dsty=0, dstz=0, src=0x7fac47b8e0, src_level=0, src_box=0x7fbab2997c) at ../src/gallium/drivers/freedreno/freedreno_blitter.c:173 #15 0x0000007fbdf085d4 in fd6_resource_copy_region (pctx=0x5555936480, dst=0x7fac485f90, dst_level=0, dstx=0, dsty=0, dstz=0, src=0x7fac47b8e0, src_level=0, src_box=0x7fbab2997c) at ../src/gallium/drivers/freedreno/a6xx/fd6_blitter.c:587 ... Instead rework the API to push the fallback back to core code, so that we can rework resource_copy_region() to have it's own fallback path, and then finally convert fd6 over to work in the same way. This also makes ctx->blit() optional, and cleans up some unnecessary callers. Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-01-03freedreno: skip depth resolve if not writtenRob Clark3-4/+14
For multi-pass rendering, it is common to keep the same depth buffer from previous pass, to discard geometry that would be hidden by later draws. In the later passes with depth-test enabled, but depth-write disabled, there is no reason to do gmem2mem resolve. TODO probably do something similar for stencil.. although stencil buffer isn't used as commonly these days Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-22freedreno/a6xx: fix 3d texture layoutRob Clark3-3/+15
Maybe not 100% perfect, but seems to be a pretty good approximation of that. Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-22freedreno: update generated headersRob Clark7-21/+28
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-22freedreno/a6xx: improve setup_slices() debug msgsRob Clark1-6/+5
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-22freedreno/a6xx: simplify special case for 3d layoutRob Clark1-9/+10
This logic can be re-written as the two cases for 3d (ie. before/after the miplevel sizes start reducing) vs everything else. I think it is easier to read this way. Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-22freedreno: combine fd_resource_layer_offset()/fd_resource_offset()Rob Clark1-13/+2
We really only need this logic in one place. Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-14freedreno/a6xx: fix corrupted uniformsRob Clark1-1/+2
For older gen's fd_wfi() is used to conditionally insert a WFI if there hasn't already been one since last draw. But this doesn't work out well with stateobj since the order the stateobj is evaluated might not be what you expect. (Ie. stateobj might not be evaluated until a later draw if there is no geometry from the current draw in a given tile.) Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-13freedreno/a6xx: fix resource_copy_region()Rob Clark1-9/+24
pctx->resource_copy_region() needs to fall back to sw copy for non-renderable formats. But previously for things that we could not use the blitter for, would fall back to 3d. Which won't work if 3d can't render to the dst format either. Instead rework things to fallback to fd_resource_copy_region(), which will try 3d core and then fall back to memcpy(). Fixes (for example) dEQP-GLES3.functional.texture.format.sized.2d.rgb9_e5_pot Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-13freedreno: move fd_resource_copy_region()Rob Clark3-62/+73
Code-motion prep for next patch. Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-13freedreno/a6xx: more blitter fixesRob Clark1-10/+22
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-13freedreno: update generated headersRob Clark8-30/+39
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-13freedreno/a6xx: fix blitter crashRob Clark1-0/+17
Fixes a crash with unsupported formats in dEQP-GLES3.functional.texture.format.sized.2d.rgb9_e5_pot Also fixes gpu hangs with some formats that are supported, but which we don't know what internal-format to use for the blitter, for ex dEQP-GLES3.functional.texture.format.sized.2d_array.rgb10_a2_pot Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-13freedreno: also set DUMP flag on shadersRob Clark5-20/+22
If we emit shader as a pointer to a GEM object, also set the RELOC_DUMP flag as a hint to kernel that this is a useful buffer to snapshot for debug dumps. Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-13freedreno: debug GEM obj namesRob Clark8-17/+19
With a recent enough kernel, set debug names for GEM BOs, which will show up in $debugfs/gem Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-12meson: libfreedreno depends upon libdrm (for fence support)Rhys Kidd1-3/+1
Error message building freedreno Gallium driver with meson: ../src/gallium/drivers/freedreno/freedreno_fence.c:27:21: fatal error: libsync.h: No such file or directory \#include <libsync.h> Fixes: 4aa69cc4257 ("meson: build freedreno") Signed-off-by: Rhys Kidd <rhyskidd@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2018-12-07freedreno/ir3: track max flow control depth for a5xx/a6xxRob Clark2-4/+4
Rather than just hard-coding BRANCHSTACK size. Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-07freedreno/ir3: sync instr/disasmRob Clark1-1/+1
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-07freedreno/a6xx: blitter fixesRob Clark2-3/+80
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-07freedreno: update generated headersRob Clark7-35/+56
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-07freedreno/a5xx+a6xx: remove unused fs/vs pvt memRob Clark4-20/+0
copy/pasta from older gens Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-07freedreno: remove unused fd_surface fieldsRob Clark1-5/+0
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-06freedreno: Add support for EXT_multisampled_render_to_textureKristian H. Kristensen3-1/+7
There is not much to do in freedreno - tile layout and multisample state for gmem renderings is programmed based on the pfb sample count, while resolve blits take the destination sample count from the resource. Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2018-12-06freedreno/a6xx: MSAARob Clark10-24/+74
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-12-05gallium: Android build fixesKristian H. Kristensen1-0/+1
A couple of simple fixes for building on Android with autotools. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-11-27freedreno: implements get_sample_positionHyunjun Ko1-0/+45
Since 1285f71d3e landed, it needs to provide apps with proper sample position for MSAA. Currently no way to query this to hw, these are taken from blob driver. Fixes: dEQP-GLES31.functional.texture.multisample.samples_#.sample_position Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno/a3xx: also set FSSUPERTHREADENABLERob Clark1-0/+1
We set equiv bit in SP_FS_CTRL_REG0. Somehow the hw doesn't hang with this mismatched config, but does run slower. It is faster with either neither bit set, or both bits set, but both is the fastest of the three configurations. Worth a bit over 10% gain in glmark2. Spotted-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno: use MSM_BO_SCANOUT with scanout buffersJonathan Marek1-1/+3
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
2018-11-27freedreno: use GENERIC instead of TEXCOORD for blit programJonathan Marek1-1/+1
blip_fp uses GENERIC as input, so blit_vp should match for linking Signed-off-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno: a2xx texture updateJonathan Marek9-20/+212
Adds all missing texture related logic. For everything to work it also needs changes to ir2/fd2_program, which are part of the ir2 update patch. Note: it needs rnndb update Signed-off-by: Jonathan Marek <jonathan@marek.ca> [remove stray patch] Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno/a2xx: Compute depth base in gmem correctlyJonathan Marek1-5/+7
Note: it needs rnndb update Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno/a2xx: set VIZ_QUERY_ID on a20xJonathan Marek1-0/+5
Signed-off-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno: add missing a20x idsJonathan Marek1-0/+2
200: 256KiB GMEM A200 (imx53) 201: 128KiB GMEM A200 (imx51) Signed-off-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno/a2xx: fix POINT_MINMAX_MAX overflowJonathan Marek1-1/+1
As it stands, it overflows to zero. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno: a2xx: fd2_draw updateJonathan Marek6-20/+114
Signed-off-by: Jonathan Marek <jonathan@marek.ca> Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno: update generated headersRob Clark7-39/+287
Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno/a6xx: set guardband clipRob Clark4-7/+57
On older gens, the CLIP_ADJ bitfields were actually 3.6 fixed point. Which might make more sense. Although this formula comes up with values pretty close to what blob does for various viewport sizes (for at least a5xx and a6xx), and seems to work. Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno/a6xx: disable LRZ for z32Rob Clark1-1/+13
f6131d4ec7a had the side effect of enabling LRZ w/ 32b depth buffers. But there are some bugs with this, which aren't fully understood yet, so for now just skip LRZ w/ z32.. Fixes: f6131d4ec7a freedreno/a6xx: Clear z32 and separate stencil with blitter Signed-off-by: Rob Clark <robdclark@gmail.com>
2018-11-27freedreno/a6xx: Clear gmem buffers at flush timeKristian H. Kristensen4-178/+180
We generate an IB to clear the gmem at flush time and jump to it before rendering each tile. This lets us get rid of the command stream patching for gmem offsets. Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> Signed-off-by: Rob Clark <robdclark@gmail.com>