summaryrefslogtreecommitdiff
path: root/freedreno
AgeCommit message (Collapse)AuthorFilesLines
2018-02-26freedreno: add interface to get buffer addressRob Clark4-0/+27
Needed for clover/OpenCL. Fortunately the kernel interface is already in place. Include a stub _put_iova() so mesa can tell us when it no longer needs the buffer to be pinned. There is no kernel interface for this (yet), but at least if we want to unpin buffers we won't need mesa changes. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2018-02-23*-symbol-check: Don't hard-code nm executableHeiko Becker2-1/+2
Helpful if your nm executable has a prefix based on the architecture, for example. Signed-off-by: Heiko Becker <heirecka@exherbo.org> Cc: Timo Gurr <timo.gurr@gmail.com> [Eric: v2: rebase and add Meson support] Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-01-29always define HAVE_VALGRINDEric Engestrom1-1/+1
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2018-01-29always define HAVE_FREEDRENO_KGSLEric Engestrom2-2/+2
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2018-01-26freedreno: clamp priority based on # of ringsRob Clark2-12/+18
In case of a kernel that is new enough to support multiple submit- queues, but with an adreno generation which doesn't support multiple prioritized ringbuffers, we'd attempt to open a submit-queue with prio=1 (medium), which is rejected by the kernel. This could happen either w/ an older mesa (which uses fd_pipe_new()) or a newer mesa which defaults to prio=1 if no pipe context priority flags are set. The simple answer to fix both cases is to clamp the requested priority according to the number of rings. This might not do exactly what you want, if we hypothetically had 2 rings (it would result in requested medium priority being high priority instead of low priority). But the number of rings (for hw gen's that support this) is purely a software construct, so the easy answer there is to have the kernel advertise at least 3 rings if it supports more than one. There isn't really any reason to do otherwise. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2018-01-25meson: set proper pkg-config version for libdrm_freedrenoDylan Baker1-1/+1
Copy and paste error from exynos. Signed-off-by: Dylan Baker <dylan.c.baker@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2018-01-12Add meson build systemDylan Baker1-0/+76
This patch adds a complete meson build system, including tests and install. It has the necessary hooks to allow it be used as a subproject for other meson based builds such as mesa. Signed-off-by: Dylan Baker <dylan.c.baker@intel.com> Reviewed-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-11-07freedreno: add the API fd_pipe_new2 to the symbol testEmil Velikov1-0/+1
As kindly spotted by `make check' Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-11-04freedreno: submit-queue context priorityRob Clark8-7/+68
With a new-enough kernel to support prioritized submit-queues, we can expose priority level support to mesa. Open a submit queue associated with the fd_pipe and pass it's id back to SUBMIT ioctl. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2017-11-04freedreno: sync uapi header (driver version 1.3.0)Rob Clark1-6/+34
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2017-09-15freedreno/kgsl: fix pointer-to-int castEric Engestrom1-1/+1
Fixes this warning: freedreno/kgsl/kgsl_ringbuffer.c: In function ‘kgsl_ringbuffer_flush’: freedreno/kgsl/kgsl_ringbuffer.c:149:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] req.timestamp = (uint32_t)kgsl_ring->bo->hostptr; ^ Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
2017-08-07freedreno: prevent deadlock in error pathEric Engestrom1-0/+1
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Rob Clark <robdclark@gmail.com>
2017-08-07freedreno/msm: remove dead error pathEric Engestrom1-6/+2
`ring` cannot be non-null, so the label reduces to a simple return. Then, there is no point initialising `ring` just to overwrite it before anyone reads it. Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Rob Clark <robdclark@gmail.com>
2017-08-07freedreno: remove dead error pathEric Engestrom1-7/+3
`pipe` cannot be non-null, so the label reduces to a simple return. Then, there is no point initialising `pipe` just to overwrite it before anyone reads it. Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Rob Clark <robdclark@gmail.com>
2017-04-15freedreno: fix double-free on exitRob Clark1-3/+3
Fixes: a07ae97 ("freedreno: fix device close issues") Signed-off-by: Rob Clark <robclark@freedesktop.org>
2017-03-23freedreno: fix device close issuesRob Clark1-1/+2
Move closing the fd to after subclass ->destroy() (since it might want to delete gem bo's, etc), and actually free() the fd_device object. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2017-03-23freedreno: valgrind supportRob Clark6-2/+75
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2017-03-21freedreno: fix potential use-after-free on a5xx+Rob Clark1-1/+6
Something that valgrind spotted: ==8441== Invalid read of size 4 ==8441== at 0x5DEE168: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:506) ==8441== by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241) ==8441== by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131) ==8441== by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450) ==8441== by 0x5B4910F: fd5_emit_tile_gmem2mem (fd5_gmem.c:477) ==8441== by 0x5B14943: render_tiles (freedreno_gmem.c:342) ==8441== by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416) ==8441== by 0x5B0FBA7: batch_flush (freedreno_batch.c:281) ==8441== by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306) ==8441== by 0x5B11FE7: fd_context_flush (freedreno_context.c:52) ==8441== by 0x58AD783: st_glFlush (st_cb_flush.c:121) ==8441== by 0x5751EE7: _mesa_make_current (context.c:1652) ==8441== by 0x58E6A97: st_api_make_current (st_manager.c:811) ==8441== by 0x5A2CE43: dri_unbind_context (dri_context.c:207) ==8441== by 0x5A2C77F: driUnbindContext (dri_util.c:589) ==8441== by 0x4AC8A67: MakeContextCurrent (glxcurrent.c:214) ==8441== Address 0x6f5eb1c is 204 bytes inside a block of size 240 free'd ==8441== at 0x4868F44: realloc (vg_replace_malloc.c:785) ==8441== by 0x5DEE143: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:502) ==8441== by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241) ==8441== by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131) ==8441== by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450) ==8441== by 0x5B4910F: fd5_emit_tile_gmem2mem (fd5_gmem.c:477) ==8441== by 0x5B14943: render_tiles (freedreno_gmem.c:342) ==8441== by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416) ==8441== by 0x5B0FBA7: batch_flush (freedreno_batch.c:281) ==8441== by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306) ==8441== by 0x5B11FE7: fd_context_flush (freedreno_context.c:52) ==8441== by 0x58AD783: st_glFlush (st_cb_flush.c:121) ==8441== by 0x5751EE7: _mesa_make_current (context.c:1652) ==8441== by 0x58E6A97: st_api_make_current (st_manager.c:811) ==8441== by 0x5A2CE43: dri_unbind_context (dri_context.c:207) ==8441== by 0x5A2C77F: driUnbindContext (dri_util.c:589) ==8441== Block was alloc'd at ==8441== at 0x4868F44: realloc (vg_replace_malloc.c:785) ==8441== by 0x5DEE08B: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:481) ==8441== by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241) ==8441== by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131) ==8441== by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450) ==8441== by 0x5B4909F: fd5_emit_tile_gmem2mem (fd5_gmem.c:465) ==8441== by 0x5B14943: render_tiles (freedreno_gmem.c:342) ==8441== by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416) ==8441== by 0x5B0FBA7: batch_flush (freedreno_batch.c:281) ==8441== by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306) ==8441== by 0x5B11FE7: fd_context_flush (freedreno_context.c:52) ==8441== by 0x58AD783: st_glFlush (st_cb_flush.c:121) ==8441== by 0x5751EE7: _mesa_make_current (context.c:1652) ==8441== by 0x58E6A97: st_api_make_current (st_manager.c:811) ==8441== by 0x5A2CE43: dri_unbind_context (dri_context.c:207) ==8441== by 0x5A2C77F: driUnbindContext (dri_util.c:589) Signed-off-by: Rob Clark <robclark@freedesktop.org>
2017-01-27android: introduce Android.common.mk to reduce boilerplateEmil Velikov1-5/+2
... across the makefiles. Currently this isn't much but that will change shortly. As an added bonus this fixes all present and future cases where we've forgotten to strip out the headers from LOCAL_SRC_FILES. In a couple of cases (the tests) we start setting LOCAL_EXPORT_C_INCLUDE_DIRS, which shouldn't be an issue. Cc: Chih-Wei Huang <cwhuang@android-x86.org> Cc: Rob Herring <robh@kernel.org> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27android: remove LOCAL_MODULE_TAGS := optional tagEmil Velikov1-1/+0
Seems to be the default option since ~2009 with commit 2f31293ba78 "auto import from //branches/cupcake/...@137197". Fleshed out from a larger commit in the AOSP repo/fork. Cc: Dan Willemsen <dwillemsen@google.com> Cc: Chih-Wei Huang <cwhuang@android-x86.org> Cc: Rob Herring <robh@kernel.org> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Rob Herring <robh@kernel.org>
2016-11-26freedreno: 64bit supportRob Clark7-4/+49
a5xx and later are 64bit devices.. make reloc's handle that. A new public symbol is introduced to avoid silent problems with new mesa and old libdrm (since on 64b reloc consumes two dwords). Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-11-14freedreno: Add fd_ringbuffer_flush2 to symbol check.Matt Turner1-0/+1
2016-11-05freedreno: add fence fd supportRob Clark6-6/+36
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-11-05freedreno: sync uapi headerRob Clark2-2/+22
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-23automake: Don't include Android Makefiles in the release tarballAndreas Boll1-1/+1
Currently only some Android Makefiles are included in the release tarball. To be more consistent one could either add the remaining files or don't ship Android Makefiles altogether. According to Emil the Android folk doesn't use our release tarballs. Thus it makes sense to remove those files from distribution which also means less work for maintenance in the future. Suggested-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-07-21freedreno: fix warningsRob Clark1-2/+2
Signed-off-by: Rob Clark <robclark@freedesktop.org> Tested-by: Rob Herring <robh@kernel.org>
2016-07-21freedreno: fix android build breakRob Clark1-2/+2
The 'deprecated' #define was causing problems with bionic system headers which used __attribute__((deprecated)). Signed-off-by: Rob Clark <robclark@freedesktop.org> Tested-by: Rob Herring <robh@kernel.org>
2016-07-21freedreno: fix distcheck errorsRob Clark1-0/+4
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: move legacy kgsl related READMERob Clark1-0/+10
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno/msm: use hashtable to track bo idxRob Clark2-23/+31
Note: cache the last ring the bo was emitted on, to avoid excess hashtable lookups. We do this by tracking ring seqno to avoid problems with dangling pointers. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: support growable cmdstream buffersRob Clark5-36/+166
The issue that userspace needed to solve is that there is ~two orders of magnitude size difference in cmdstream buffers (both for gmem commands and for draw commands), and that the previous practice of allocating worst-case sizes is quite wasteful. Previously a submit would be constructed (for example) like: CMD TARGET DESCRIPTION g0 N gmem/tiling commands b0 Y binning commands d0 Y draw commands Which, after the one non-IB-target cmd buffer is inserted into the kernel controlled ringbuffer, looks like (not to scale): b0: d0: +-----+ +-----+ IB1 | ... | | ... | +-----+ +-----+ ^ ^ | | +-----+ +-+---------+ g0: | | | +----+----+----+----+----+----+---- IB0 | .. | IB | .. | IB | .. | IB | ... +----+----+----+----+----+----+---- ^ tile0 tile1 | +-----------+ userspace | ~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel | ----+----+---- ringbuffer ... | IB | ... ----+----+---- Now, multiple physical cmdstream buffers per fd_ringbuffer are supported, so this becomes: CMD TARGET DESCRIPTION g0 N ... N gmem/tiling commands gN N b0 Y ... Y binning commands bN Y d0 Y ... Y draw commands dN Y Which, after the non-IB-target cmd buffers (g0..gN) are inserted into the kernel controlled ringbuffer, looks like: b0: b1 d0: d1 +-----+ +-----+ +-----+ +-----+ IB1 | ... | | ... | ... | ... | | ... | ... +-----+ +-----+ +-----+ +-----+ ^ ^ ^ ^ | | | | | +-+ | +-----+------+ +-----+ | | | | | | +--+----------+ | g0: | | | | | | +----+----+----+----+----+----+---+----+----+---- IB0 | .. | IB | IB | .. | IB | IB |.. | IB | IB |... +----+----+----+----+----+----+---+----+----+---- ^ tile0 tile1 | to b0 to b1 | | | to|d0 to|d1 | | +----+ | +-+-----------+ | | | | | | | +------+ | +-+-------------+ | | g1: | | | | | | | +----+----+----+----+----+----+---+----+----+---- IB0 | | .. | IB | IB | .. | IB | IB |.. | IB | IB |... | +----+----+----+----+----+----+---+----+----+---- | ^ tileX tileY | | | +-----------+ +-----------+ | userspace | | ~~~~~~~~~~~~~~~~~~~|~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel | | ----+----+----+---- ringbuffer ... | IB | IB | ... ----+----+----+---- Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno/msm: split out dump_submit() helperRob Clark1-18/+24
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno/msm: split out cmd buffer tracking from ringRob Clark1-45/+83
First step towards supporting a single logical ringbuffer mapping to multiple physical cmd buffers, which will enable dynamically growing ringbuffers. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno/msm: drop return from get_cmd()Rob Clark1-20/+16
Not actually needed. It just needs to ensure that there is a corresponding entry in the submit's cmds table. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno/msm: use private bo-cache for ringbuffer bo'sRob Clark3-2/+39
Since they get vmap'd on the kernel side, they are a bit more costly. Don't let them mingle with the riffraff. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: fix potential leak at freeRob Clark2-6/+7
If user has emit'd reloc's, and then resets or deletes the ring, we want to drop the ref's that the ring holds to the bo's to avoid a leak. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: ocdRob Clark2-7/+5
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: support either coarse or fine-grained bucket sizesRob Clark3-7/+14
The normal bo cache uses some intermediate steps between power of two jumps to reduce memory wastage. But for a ringbuffer bo cache, we do not need this. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: expose kernel driver versionRob Clark4-2/+12
gallium needs to know if the kernel is new enough to support explicit fencing, dynamically grown ringbuffers, etc. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: fix potential fd leak in error pathRob Clark1-1/+4
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: add madvise supportRob Clark5-0/+55
With a new enough drm/msm, we can let the kernel know about buffers that are in the bo cache, so the kernel can free them under memory pressure. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: sync uapiRob Clark1-39/+70
(from drm-next for 4.8) Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: move bo-cache to it's own fileRob Clark4-178/+209
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: refactor bo-cache APIRob Clark3-33/+58
Split out interface to allocate from and release to bo-cache, and get rid of direct usage of bucket level API from fd_bo/etc. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: split out fd_bo_cacheRob Clark3-34/+37
Eventually we'll want a separate bo-cache for ringbuffer bo's, since ringbuffer bo's get vmap'd on the kernel side, it is preferrable to re-use them as ringbuffers rather than something else. Plus should help to add madvise support if it is a bit better decoupled from bo allocation (next patch). Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: add simpler ring-relocRob Clark3-7/+28
Provide a way to insert a reference (ie. OUT_IB()) to a target ring, executing all the cmds in the target ring from the start. Sometimes the ringmarker stuff is just overkill. And it will won't really work properly once we support multiple physical cmdstream buffers per fd_ringbuffer. So in the future the old ringmarker related APIs will be deprecated in a few releases. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20freedreno: rework internal ring->emit_reloc_ring()Rob Clark4-18/+23
No need for it to deal with ringmarkers. Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-06Android: strip out header files from sources listRob Herring1-1/+1
AOSP master now errors if LOCAL_SRC_FILES contains headers, so filter out header files from the source lists. Signed-off-by: Rob Herring <robh@kernel.org>
2016-06-13freedreno/msm: fix memory leak on ringbuffer freeRob Clark1-0/+5
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-04-21freedreno: add dummy fd_bo_from_fbdev implementation when KGSL is disabledNicolas Dechesne1-0/+7
Make sure that this function is defined (even empty/dummy) when KGSL support is disabled, since it's part of the driver i/f and it was reported to cause symbols issues when building against musl libc implementation. Reported-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Rob Clark <robclark@freedesktop.org>