Commit Graph

19 Commits (419a154dbef839b920689bea72aa9af41b2b114f)

Author SHA1 Message Date
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 d93d697deb freedreno/msm: split out dump_submit() helper
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark dd1f372001 freedreno/msm: split out cmd buffer tracking from ring
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-20 19:42:21 -04:00
Rob Clark 0d61529130 freedreno/msm: drop return from get_cmd()
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-20 19:42:21 -04:00
Rob Clark 892141a321 freedreno/msm: use private bo-cache for ringbuffer bo's
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-20 19:42:21 -04:00
Rob Clark 19b82b9817 freedreno: fix potential leak at free
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-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
Rob Clark 09bfd5c716 freedreno/msm: fix memory leak on ringbuffer free
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-06-13 09:49:54 -04:00
Rob Clark 14968e4cf6 freedreno: debug msg cleanup
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-19 12:12:27 -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 4413f191a0 freedreno/msm: dump out submit info on error
User should only see these with LIBGL_DEBUG=verbose.  But in case you
are hitting issues like "handle X at index Y already on submit list"
errors from the kernel, this gives some useful visibility for debug.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 10:35:08 -04:00
Rob Clark 9e34ee4f75 freedreno/msm: fix issue where same bo is on multiple rings
It should be a less common case, but it is possible for a single bo to
be on multiple rings, for example when sharing a buffer across multiple
pipe_context's created from same pipe_screen.

So rather than completely fall over in this case, fallback to slow-path
of looping over all bo's in the ring's bo-table (but retain the fast-
path of constant-lookup for the first ring the buffer is on).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 10:35:08 -04:00
Rob Clark 2fa58ef8f4 freedreno/msm: reorg ringbuffer struct
Group the parts related to building out submit ioctl into their own
sub-struct.  Split out from next commit since it is just boring churn.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-17 10:10:34 -04: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
Rob Clark 1cb5fc706c freedreno: zero out unused field
Since realloc() doesn't zero-init.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-03-19 10:12:18 -04:00
Rob Clark c5de5abbd9 freedreno: some msm-ring reset/flush fixes
Need to update timestamp on all ring's associated with a submit (ie.
both the binning pass and main ring).  Also, make sure nr_reloc's
in particular gets cleared if the rb is reset.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-02-19 11:47:40 -05:00
Rob Clark 9fa22a845b freedreno: allow IB to different ringbuffer
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>
2014-01-07 11:33:54 -05:00
Rob Clark f17d417e28 freedreno: add support for msm drm
This adds support for the "msm" backend, using the upstream msm drm/kms
driver.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-08-28 15:51:04 -04:00