Commit Graph

103 Commits (eebefaf72c55fd2116f4c983ec6724a4d66ab413)

Author SHA1 Message Date
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
Matt Turner b91bcbf6ab freedreno: Add fd_ringbuffer_flush2 to symbol check. 2016-11-14 10:40:59 -08: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 9270d984cd freedreno: sync uapi header
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-11-05 10:17:54 -04:00
Andreas Boll a5446775f2 automake: Don't include Android Makefiles in the release tarball
Currently only some Android Makefiles are included in the release tarball.
To be more consistent one could either add the remaining files or don't
ship Android Makefiles altogether.

According to Emil the Android folk doesn't use our release tarballs.
Thus it makes sense to remove those files from distribution which also
means less work for maintenance in the future.

Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-07-23 09:45:53 +02:00
Rob Clark feb1b39be1 freedreno: fix warnings
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Tested-by: Rob Herring <robh@kernel.org>
2016-07-21 14:11:05 -04:00
Rob Clark 1f1b61d491 freedreno: fix android build break
The 'deprecated' #define was causing problems with bionic system headers
which used __attribute__((deprecated)).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Tested-by: Rob Herring <robh@kernel.org>
2016-07-21 14:10:45 -04:00
Rob Clark 1af780cc27 freedreno: fix distcheck errors
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-21 10:54:49 -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 6a23bd4b3c freedreno/msm: use hashtable to track bo idx
Note: cache the last ring the bo was emitted on, to avoid excess
hashtable lookups.  We do this by tracking ring seqno to avoid
problems with dangling pointers.

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 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 9e697c7499 freedreno: ocd
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark 8a6a8512d4 freedreno: support either coarse or fine-grained bucket sizes
The normal bo cache uses some intermediate steps between power of two
jumps to reduce memory wastage.  But for a ringbuffer bo cache, we do
not need this.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark 904f1361ae freedreno: expose kernel driver version
gallium needs to know if the kernel is new enough to support explicit
fencing, dynamically grown ringbuffers, etc.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark fe07584e05 freedreno: fix potential fd leak in error path
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 0c270df8df freedreno: sync uapi
(from drm-next for 4.8)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark 82780c87f9 freedreno: move bo-cache to it's own file
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark 0b34b68307 freedreno: refactor bo-cache API
Split out interface to allocate from and release to bo-cache, and get
rid of direct usage of bucket level API from fd_bo/etc.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark b18b6e21fc freedreno: split out fd_bo_cache
Eventually we'll want a separate bo-cache for ringbuffer bo's, since
ringbuffer bo's get vmap'd on the kernel side, it is preferrable to
re-use them as ringbuffers rather than something else.  Plus should
help to add madvise support if it is a bit better decoupled from bo
allocation (next patch).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-07-20 19:42:21 -04:00
Rob Clark 2ca73c666a freedreno: add simpler ring-reloc
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>
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 Herring d342cd34ac Android: strip out header files from sources list
AOSP master now errors if LOCAL_SRC_FILES contains headers, so filter
out header files from the source lists.

Signed-off-by: Rob Herring <robh@kernel.org>
2016-07-06 16:58:38 +01: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
Nicolas Dechesne 739b888602 freedreno: add dummy fd_bo_from_fbdev implementation when KGSL is disabled
Make sure that this function is defined (even empty/dummy) when KGSL support is
disabled, since it's part of the driver i/f and it was reported to cause symbols
issues when building against musl libc implementation.

Reported-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-04-21 09:40:32 -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 67e7103cdb freedreno: update uapi
In drm-next.. needed for timestamp queries in mesa.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-03-13 12:27:06 -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 bc5497d061 freedreno: small refactor for get_param
Will simplify next commit.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-02-12 18:32:22 -05:00
Rob Clark c47385ccda freedreno: update uapi
In drm-next.. needed for time-elapsed (and future perf ctrs) in mesa.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-02-12 18:32:22 -05:00
Rob Clark 14968e4cf6 freedreno: debug msg cleanup
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-19 12:12:27 -04: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
Rob Clark 691d14c9a8 freedreno: don't reuse exported buffers
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-19 12:11:38 -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 51b5ca9457 freedreno: add API to get drm fd from fd_device
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-04 11:08:04 -04:00
Rob Clark 7d98a93cec freedreno: don't take ownership of the dmabuf fd on import
EGL_EXT_image_dma_buf_import specifies that the importer retains
ownership of the fd, rather then the importee.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-09-03 14:56:02 -04:00
Varad Gautam c3301d0134 freedreno: serialize drmPrimeFDToHandle under table_lock
fixes the prime sharing race condition described by
"intel: Serialize drmPrimeFDToHandle with struct_mutex".

we inline fd_bo_from_handle() into fd_bo_from_dmabuf() and allow locking.

Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-31 11:54:23 -04:00
Varad Gautam cc7db673fa freedreno: use drmPrime wrappers to import/export prime bo's
don't call drmIoctl() directly for prime bo's, use the wrappers instead.

v3: remove struct drm_prime_handle and split locking

Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-31 11:53:53 -04:00
Varad Gautam 1eba47a763 freedreno: get bo size for imported dma-buf
Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-23 12:33:45 -04:00
Varad Gautam 425c8e5af7 freedreno: fill bo->fd when importing
Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-23 12:33:24 -04:00
Varad Gautam 857c22e5ec freedreno: fix a bo cache segfault with imported bo's
Importing a bo whose handle is still in the bo cache crashes during cleanup.
Remove bo from cache when importing.

Signed-off-by: Varad Gautam <varadgautam@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-23 12:33:09 -04:00
Rob Clark 04a118d800 freedreno: update freedreno-symbol-check
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-08-18 10:53:56 -04: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
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