Saw a couple of typos fixes in the patch DragonFlyBSD carries [1], so
I ran codespell (a spell checker for code) on the whole repo.
[1] https://github.com/DragonFlyBSD/DPorts/blob/master/graphics/libdrm/files/patch-xf86drm.c
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This reverts 6d2379857b "xf86atomic: #undef internal define"
and b541d21a0a "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: 6d2379857b "xf86atomic: #undef internal define"
Fixes: b541d21a0a "freedreno: remove always-defined #ifdef"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
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>
With streaming stateobjs to upload uniforms, the submit.cmds table gets
much larger, and iterating over it for each ring to ring reloc starts
getting expensive.
TODO if we have flag to pass when constructing parent rb, we could
avoid dynamically allocating this and bo_table in get_cmd() or bo2idx
Signed-off-by: Rob Clark <robclark@freedesktop.org>
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>
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>
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>
It will make bugs like the one fixed with previous patch dead obvious.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Set/export the NM variable since it may not be set already.
Fixes: 4f08bfe96d ("*-symbol-check: Don't hard-code nm executable")
Cc: Heiko Becker <heirecka@exherbo.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Now that symbols that should be exported are annotated accordingly, make
all the rest hidden by default.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Now that symbols that should be exported are annotated accordingly, make
all the rest hidden by default.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
while read sym; do
read f func line _ <<<$(cscope -d -L -1 $sym)
if [ ! -z "$f" ]; then
sed -i "${line}s/^/drm_public /" $f
fi
done < /tmp/a.txt
In which /tmp/a.txt contains the public symbols from
freedreno-symbol-check. The idea here will be to switch the default
visibility to hidden so we don't export symbols we shouldn't.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
msm_drm.h file Generated using make headers_install.
Generated from
tree - git://people.freedesktop.org/~airlied/linux
branch - drm-next
commit - 6d08b06e67cd117f6992c46611dfb4ce267cd71e
Remove freedreno/msm/msm_drm.h to maintain only
one copy of msm_drm.h and change freedreno Makefile
and meson.build file accordingly.
v2: Remove private freedreno/msm/msm_drm.h
v3: meson.build update
v3: README update (by anholt)
Signed-off-by: Tanmay Shah <tanmay@codeaurora.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
We could be dropping last reference in ->flush(), so clear the entry in
the parent rb's table to avoid deref'ing after free'd.
Also, ring_bo_del()'s use of ring_cache expects that it is dropping the
last reference. So drop our ref to the stateobj's ring_bo first.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
One stateobj can be emitted multiple times in a single cmdstream, but
only the first time is a cmd entry added to the parent. Since it will
be only unref'd once after flush, we should only ref it the first time
it is emitted (ie. the time it is added to cmd table).
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Adds support for "state object" cmdstream buffers which can be
constructed once, and re-used many times. This enables the use
for CP_SET_DRAW_STATE packets on newer hardware, to lower the
CPU overhead.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Splitting code-motion out from next patch. Once we add stateobj rb's
this loop could add new entries to bos table, so it needs to be before
we set req.bos/req.nr_bos.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
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>
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>
In mesa/gallium, a pipe_fence can outlive the pipe_context it was
created from. But to wait on the fence we need to know the submit-
queue (ie. the fd_pipe).
The most straightforward way to fix this is to add reference counting
to the fd_pipe and let the fence hold a reference to the pipe (rather
than hanging on to the context, which might have been destroyed before
the fence).
Signed-off-by: Rob Clark <robclark@freedesktop.org>
This will prevent any more missing `#include "config.h"` bug, at the
cost of having to recompile some files that didn't need to be when
changing build options.
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Fixes: 1384c08123 "freedreno: add interface to get buffer address"
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
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>
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>
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>
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>
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>
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>
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>
`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>
`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>