Commit Graph

34 Commits (15b7fbf3e7f111140457dadc55a723cb84f0dec4)

Author SHA1 Message Date
Eric Engestrom 360292c7ab fix various typos
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>
2019-04-17 18:23:25 +01:00
Rob Clark b730f5c8c5 freedreno/kgsl: fix build
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2018-10-14 11:23:03 -04:00
Rob Clark 5c4722e907 freedreno/msm: simplify emit_reloc_ring() vfunc
Now that it doesn't have to deal with the ringmarker case, we can make
some simplifications.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2018-10-13 17:23:12 -04:00
Rob Clark a8a0061926 freedreno: expose refcnt'ing on ringbuffers
Move this out of msm_ringbuffer backend so that the gallium driver can
refcnt rb's

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2018-10-13 17:18:43 -04:00
Eric Engestrom 4ec31fc31a freedreno: add missing drm_public
Fixes: 9a1470fb41 "freedreno: annotate public functions"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2018-09-20 19:28:56 +01:00
Rob Clark fcbf206aa2 freedreno: add fd_ringbuffer_new_object()
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>
2018-07-30 12:18:58 -04:00
Eric Engestrom 0926f0af54 meson,configure: include config.h automatically
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>
2018-03-20 18:19:26 +00:00
Rob Clark 7064b2eae9 freedreno: submit-queue context priority
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-04 17:23:20 -04:00
Eric Engestrom 76418c244d freedreno/kgsl: fix pointer-to-int cast
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-09-15 17:06:29 +01:00
Rob Clark d0dae26ca4 freedreno: valgrind support
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2017-03-23 15:22:30 -04:00
Rob Clark 23d10b8244 freedreno: 64bit support
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-26 12:51:38 -05:00
Rob Clark e9eb44b45b freedreno: add fence fd support
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-11-05 10:18:44 -04:00
Rob Clark b59ed18818 freedreno: move legacy kgsl related README
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark 419a154dbe freedreno: support growable cmdstream buffers
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-20 19:42:21 -04:00
Rob Clark eb846d46bc freedreno: add madvise support
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-20 19:42:21 -04:00
Rob Clark 73db0a0421 freedreno: rework internal ring->emit_reloc_ring()
No need for it to deal with ringmarkers.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Eric Engestrom 7b356f4b5e freedreno: Fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-04-07 18:15:54 +01:00
Rob Clark 49041c3613 freedreno: add support for FD_TIMESTAMP
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-03-13 12:27:30 -04:00
Rob Clark 9b77443f63 freedreno: add support for FD_MAX_FREQ
Only msm backend supports this.  Sorry, if you are using kgsl, no
time-elapsed query for you.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-02-12 18:32:22 -05:00
Rob Clark 76a1e97eae freedreno: drop exported dmabuf fd tracking
There is really no reason to keep around the fd, it just consumes an
extra file handle.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-19 12:12:04 -04:00
Emil Velikov 6a6d668fad freedreno: annotate the device/bo/pipe/ringbuffer funcs as const data
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-09-04 21:39:06 +01:00
Rob Clark 15ba8768f7 freedreno: add fd_pipe_wait_timeout()
We need to pass through a timeout parameter to implement
pipe->fence_finish() properly.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 14:23:03 -04:00
Emil Velikov ea1786416c freedreno: zero is a valid fd number, treat it as such
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>
2015-07-16 16:41:38 +01:00
Emil Velikov 0f8da82500 drm: remove drm_public macro
Some compilers (like the Oracle Studio), require that the function
declaration must be annotated with the same visibility attribute as the
definition. As annotating functions with drm_public is no longer
required just remove the macro.

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-04-28 11:19:15 +01:00
Emil Velikov 44e9a0258a freedreno: annotate the private symbols
They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-04-28 11:18:43 +01:00
Rob Clark c09dcbc736 fix compile error on 32bit systems
4c2766b (drm_mmap/drm_unmap) brought this error for every .c file that
was not #including config.h:

  In file included from private.h:4:0,
                   from abi16.c:29:
  ../libdrm.h: In function 'drm_munmap':
  ../libdrm.h:81:4: error: size of unnamed array is negative

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-09-28 14:30:07 -04:00
Emil Velikov 84badffe5e freedreno: use drm_mmap/drm_munmap wrappers
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-09-28 17:09:34 +01:00
Maarten Lankhorst 479b6cef70 freedreno: Use symbol visibility.
Hiding fd_device_del_locked, and fd_cleanup_bo_cache.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2014-08-14 21:59:19 +02:00
Rob Clark 56d170bc06 freedreno: add chip-id property
Userspace needs to know the patch-revision in addition to just the
gpu-id (ie. 320, 305, etc).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-06-18 10:42:07 -04:00
Rob Clark ee8c9a1383 freedreno/kgsl: don't even bother trying CREATE_FD
Don't even bother trying DRM_KGSL_GEM_CREATE_FD.  It hasn't worked since
(afaict) 2.6.35 kernels.  And in some cases seems to cause some
problems.  Instead just allocate a minimum size dummy object (just for
purposes of having a handle) and then mmap the framebuffer as user-mem
(which is deprecated, but seems to still work.. and as far as I can tell
is the best option for now).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-03-05 10:35:41 -05:00
Rob Clark 5a3324638b freedreno: simplify device creation
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-03-05 09:39:35 -05:00
Rob Clark b6caecfa90 freedreno/kgsl: fix crash introduced w/ bo-cache
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-01-07 11:33:54 -05:00
Rob Clark 068ea68b3f freedreno: add bo cache
Workloads which create many transient buffers cause significant CPU
overhead in buffer allocation, zeroing, cache maint, and mmap setup.
By caching and re-using existing buffers, the CPU overhead drops
significantly.  See:

http://bloggingthemonkey.blogspot.com/2013/09/freedreno-update-moar-fps.html

A simple time based policy is used for purging the cache.  Once the
kernel supports it, we could use madvise style API to handle memory
pressure scenarios a bit better.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-12-13 15:48:10 -05:00
Rob Clark b2b1885dfc freedreno: support either kgsl or msm
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>
2013-08-28 15:50:15 -04:00