Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
va+size will overflow if va equals to AMDGPU_INVALID_VA_ADDRESS, just
return when hit that condition
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
0xffffffff was appended to the higher 32bit with (intptr_t) when use
32bit libdrm_amdgpu.so with 64bit kernel, and it caused segmentation
fault for 32bit application.
v2: switch to uintptr_t
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
The active RB pipes can be retrieved from enabled_rb_pipes_mask,
for which each bit indicates one active pipe if it is '1'.
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Instead of taking a look at the device major/minor we
just compare the primary device name to figure out if
two fds are pointing to the same device.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
v2: cleanup comments and function parameter
v3: rebased on internal branch
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Remove the mostly unused device parameter, for the few cases
where we really need it keep a copy in the context structure.
v2: rebased on internal branch
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
original method is just totally wrong, it loses the bo_list handler at
all after command stream accomplished
Signed-off-by: Monk.Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This adds some basic unit tests for the new amdgpu driver.
v2: use common util_math.h
v3: implement suggestions from Emil
replace malloc/memset with calloc
make header guards all caps
use posix_memalign rather than mem_align
replace malloc with calloc for pm4 allocations
make CU_SuiteInfo static
fix Makefile.am
fix fd numbering
use drmGetVersion/drmFreeVersion rather than open coding it
close fd, clean up CU registry on error
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This is the new ioctl wrapper used by the new admgpu driver.
It's primarily used by xf86-video-amdgpu and mesa.
v2: fix amdgpu_drm.h install
v3: Integrate some of the sugestions from Emil:
clean up Makefile.am, configure.ac
capitalize header guards
fix _FILE_OFFSET_BITS with config.h
use drm_mmap/drm_munmap
Remove unused ARRAY_SIZE macro
use shared list implementation
use shared math implementation
use drmGetNodeTypeFromFd helper
v4: remove unused tiling defines
v5: include amdgpu.h in Makefile.am
v6: update amdgpu_drm.h
v7: libdrm.h -> libdrm_macros.h
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This is used by radeon and freedreno and will be used
by amdgpu. I looked at switching to libdrm_lists.h,
but it's pretty horrible. E.g., DRMLISTFOREACHENTRYSAFE.
v2: remove missed list.h from tests/radeon/Makefile.am
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
We now have a separate tool for this in intel-gpu-tools and we don't
need to clutter up libdrm with this feature. We leave the entry points
in there to avoid breaking API/ABI.
Install intel-gpu-tools, then run (for example)
$ intel_aubdump --output=trace.aub glxgears -geometry 500x500
See the intel_aubdump man page for more details.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Add defines for the device minor names and make use of them
in drmGetMinorName() so the correct paths will be used on OpenBSD.
v2: don't add new defines to xf86drm.h to keep them out of the API
as requested by Emil.
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
As far as I can tell no OpenBSD platform ever used 81
for a drm major. While the value was added to libdrm in 2003
or earlier drm didn't appear in OpenBSD till 2007.
Of the OpenBSD platforms that support drm amd64/macppc/sparc64
use a major of 87, i386 uses 88.
v2: rearrange ifdefs as suggested by Emil.
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This is implemented with kms ioctls so it could also be used as a
generic fallback.
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
The whole thing is quite messy - the file is used to indicate that the
man pages were correctly generated prior to applying the "fixup" (alias)
At the same time we use a rule with the same name, to create the same
file if the generation has failed.
In other words - it attempts to create the file either way. So there is
little point in it and we can remove it.
Spotted while attempting to build with bmake which kindly blocked on the
following (non compliant construct)
.man_fixup: | $(miscman_DATA)
Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
If the number of items to process in the request is zero, we can forgo
duplicating, sorting the request and feeding it into the kernel and
instead report success immediately. This prevents a NULL dereference of
the sorted->items for the no-op request.
Fixes: ed44e0b958
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Rob Clark <robclark@freedesktop.org>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
The vbltest doesn't have any dependency of LIBUDEV.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Follow the approach used through the rest of the project.
Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Spotted by looking for similar "let's assume fd == 0 is invalid" bugs.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Equivalent to the previous patch.
Cc: Rob Clark <robdclark@gmail.com>
Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Abeit quite unlikely to get hit by this bug here, let just fix it.
v2: Correct conditional (do not call ioctl(DRM_IOCTL_PRIME_HANDLE_TO_FD)
when we already have the fd).
v3: Fix kgsl_pipe.c, suggested by Thierry.
Cc: freedreno@lists.freedesktop.org
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
Linux seems to pick these up via another header, but Solaris needs them
explicitly included, or we get undefined symbol errors for major & minor.
v2: use headers documented in makedev(3C) man page instead of sysmacros.h
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
v3 [Emil Velikov]: include sys/mkdev.h only when available.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Add sys/sysctl.h to get sysctlbyname declaration on kFreeBSD
Updated by Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
to add autoconf check and only include <sys/sysctl.h> if it
is detected by configure as it’s unusable on Linux/x32 (and
others, e.g. other new architectures).
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
In case of YF/YS tiled buffers libdrm need not know about the tiling
format because these buffers don't have hardware support to be tiled
or detiled through a fenced region. But, libdrm still need to know
about buffer alignment restrictions because kernel uses it when
resolving the relocation.
Mesa uses drm_intel_gem_bo_alloc_for_render() to allocate Yf/Ys buffers.
So, use the passed alignment value in this function to initialize the
align variable in drm_intel_bo. Note that we continue ignoring the
alignment value passed to drm_intel_gem_bo_alloc() to follow the
previous behavior.
V2: Add a condition to avoid allocation from cache. (Ben)
V3: Make no changes in cache allocation strategy. Just update the alignment.
Update the aperture size estimate including the alignment. (Ben, Chris)
V4: Move aperture size adjustments inside drm_intel_bo_gem_set_in_aperture_size()
Don't split sentences across the one-line header and the changelog. (Chris)
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
This fixes a compiler warning about missing handling of enum
values in the switch statements.
Also remove the silent mapping to G2D_IMGBUF_GEM when an
unknown buffer type is encountered. We have full control
about the type here, and if it's unknown then we obviously
have a bug in the code.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
No test uses DRM planes at the moment so this function
is never called. Inspection of the git history shows
that DRM planes were also never used in these tests
in the past.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
We can just return 'ret' here, the goto serves no purpose.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
It doesn't make sense to keep this structure, since we
can just call all tests directly. An inspection of the
git history shows that no code ever used this
abstraction in the past.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
It doesn't make sense to limit the number of
test cases anyway.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
Remove all unused struct members. An inspection of the
git history shows that these members were also never
used in the past.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
free()ing a nullptr is a noop, so remove the check.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
The 'usage' function already does exit(0), so that this
'return -EINVAL' is never called. Just put a break there
to avoid confusion.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>