summaryrefslogtreecommitdiff
path: root/freedreno/freedreno_ringbuffer.h
Commit message (Collapse)AuthorAgeFilesLines
* freedreno: revert bad freedreno/atomic_ops commitsEric Engestrom2019-02-191-1/+2
| | | | | | | | | | | | | | | | This reverts 6d2379857b6fccc1cade "xf86atomic: #undef internal define" and b541d21a0a908bf98d44 "freedreno: remove always-defined #ifdef". I didn't realise at the time that freedreno/freedreno_ringbuffer.h gets installed, and then used by Mesa for instance. These two commits were fine in libdrm, but broke Mesa which needs to use struct fd_ringbuffer but doesn't need to access ::refcnt. The hack that I removed serves to keep the struct at the correct size while only exposing the ::refcnt member within libdrm. Fixes: 6d2379857b6fccc1cade "xf86atomic: #undef internal define" Fixes: b541d21a0a908bf98d44 "freedreno: remove always-defined #ifdef" Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
* freedreno: remove always-defined #ifdefEric Engestrom2019-01-031-2/+1
| | | | | | | | While at it, let's include xf86atomic.h explicitly, instead of relying on some other file accidentally including it before including this file. Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* freedreno/msm: remove reset of linked ringsRob Clark2018-10-131-0/+1
| | | | | | | | | The msm_cmd isn't refcount'd, so with stateobj rb's that have independent lifecycle, this is no longer a safe thing to do. Really, now that there is a bo-cache for rb's, fd_ringbuffer_reset() should be deprecated because it adds a bunch of pointless complexity. Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: remove deprecated ringmarker APIRob Clark2018-10-131-10/+0
| | | | | | | | | It's usage in mesa was removed more than two years ago. And it stands in the way of some optimizations needed to reduce the overhead of hw stateobjs (ie. CP_SET_DRAW_STATE, where the # of cmds in the submit ioctl goes up significantly). Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno/msm: support suballocation for stateobj rb'sRob Clark2018-10-131-0/+14
| | | | Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: add flags param for rb creationRob Clark2018-10-131-1/+13
| | | | | | | | For now, we want a way for gallium to be able to provide hints for the upcoming rb suballocation. But could be useful for other things down the road. Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: expose refcnt'ing on ringbuffersRob Clark2018-10-131-0/+14
| | | | | | | Move this out of msm_ringbuffer backend so that the gallium driver can refcnt rb's Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: add fd_ringbuffer_new_object()Rob Clark2018-07-301-2/+7
| | | | | | | | | Add new API for reusable "state objects" which can be re-used multiple times. Backend implementation for msm will follow. (Probably not needed to support this for any device that uses kgsl backend, since this is mostly useful for a5xx+.) Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: add user ptr to fd_ringbufferRob Clark2018-06-181-0/+5
| | | | | | | Something for users of fd_ringbuffer to use as they see fit. (For now, just so mesa can add some debugging state.) Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: 64bit supportRob Clark2016-11-261-1/+5
| | | | | | | | 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>
* freedreno: add fence fd supportRob Clark2016-11-051-0/+5
| | | | Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: support growable cmdstream buffersRob Clark2016-07-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* freedreno: add simpler ring-relocRob Clark2016-07-201-6/+8
| | | | | | | | | | | | 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>
* freedreno: annotate the device/bo/pipe/ringbuffer funcs as const dataEmil Velikov2015-09-041-1/+1
| | | | | Cc: freedreno@lists.freedesktop.org Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* freedreno: allow IB to different ringbufferRob Clark2014-01-071-0/+3
| | | | | | | | | Allow IB to different ringbuffer in addition to just different part of same ringbuffer. In particular, we need to add bo's to the parent (ie. one passed to flush) bo table, since the bo table applies to all the cmd buffers in submit ioctl. Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: support either kgsl or msmRob Clark2013-08-281-18/+14
| | | | | | | | Split out common code and backend. Current backend is for 'kgsl' android driver, but a new backend will provide support for the upstream msm drm/kms driver. Signed-off-by: Rob Clark <robclark@freedesktop.org>
* freedreno: add shifted relocRob Clark2013-04-131-0/+2
| | | | | | Needed for RB_COPY_DEST_BASE register on a3xx. Signed-off-by: Rob Clark <robdclark@gmail.com>
* freedreno: add freedreno DRMRob Clark2013-02-141-0/+87
The libdrm_freedreno helper layer for use by xf86-video-freedreno, fdre (freedreno r/e library and tests for driving gpu), and eventual gallium driver for the Adreno GPU. This uses the msm gpu driver from QCOM's android kernel tree. Note that current msm kernel driver is a bit strange. It provides a DRM interface for GEM, which is basically sufficient to have DRI2 working. But it does not provide KMS. And interface to 2d and 3d cores is via different other devices (/dev/kgsl-*). This is not quite how I'd write a DRM driver, but at this stage it is useful for xf86-video-freedreno and fdre (and eventual gallium driver) to be able to work on existing kernel driver from QCOM, to allow to capture cmdstream dumps from the binary blob drivers without having to reboot. So libdrm_freedreno attempts to hide most of the crazy. The intention is that when there is a proper kernel driver, it will be mostly just changes in libdrm_freedreno to adapt the gallium driver and xf86-video-freedreno (ignoring the fbdev->KMS changes). So don't look at freedreno as an example of how to write a libdrm module or a DRM driver.. it is just an attempt to paper over a non- standard kernel driver architecture. v1: original v2: hold ref's to pending bo's (because qcom's kernel driver doesn't), various bug fixes, add ringbuffer markers so we can emit IB's to portion of ringbuffer (so that gallium driver can use a single ringbuffer for both tile cmds and draw cmds. Signed-off-by: Rob Clark <robclark@freedesktop.org>