1. 08 Aug, 2018 2 commits
  2. 30 Jul, 2018 4 commits
  3. 20 Mar, 2018 1 commit
  4. 26 Feb, 2018 1 commit
    • Rob Clark's avatar
      freedreno: add interface to get buffer address · 1384c081
      Rob Clark authored
      
      
      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: default avatarRob Clark <robclark@freedesktop.org>
      1384c081
  5. 26 Jan, 2018 1 commit
    • Rob Clark's avatar
      freedreno: clamp priority based on # of rings · 6f0f6cee
      Rob Clark authored
      
      
      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: default avatarRob Clark <robclark@freedesktop.org>
      6f0f6cee
  6. 04 Nov, 2017 2 commits
  7. 07 Aug, 2017 1 commit
  8. 23 Mar, 2017 1 commit
  9. 21 Mar, 2017 1 commit
    • Rob Clark's avatar
      freedreno: fix potential use-after-free on a5xx+ · 2b7453f4
      Rob Clark authored
      
      
      Something that valgrind spotted:
      
      ==8441== Invalid read of size 4
      ==8441==    at 0x5DEE168: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:506)
      ==8441==    by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241)
      ==8441==    by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131)
      ==8441==    by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450)
      ==8441==    by 0x5B4910F: fd5_emit_tile_gmem2mem (fd5_gmem.c:477)
      ==8441==    by 0x5B14943: render_tiles (freedreno_gmem.c:342)
      ==8441==    by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416)
      ==8441==    by 0x5B0FBA7: batch_flush (freedreno_batch.c:281)
      ==8441==    by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306)
      ==8441==    by 0x5B11FE7: fd_context_flush (freedreno_context.c:52)
      ==8441==    by 0x58AD783: st_glFlush (st_cb_flush.c:121)
      ==8441==    by 0x5751EE7: _mesa_make_current (context.c:1652)
      ==8441==    by 0x58E6A97: st_api_make_current (st_manager.c:811)
      ==8441==    by 0x5A2CE43: dri_unbind_context (dri_context.c:207)
      ==8441==    by 0x5A2C77F: driUnbindContext (dri_util.c:589)
      ==8441==    by 0x4AC8A67: MakeContextCurrent (glxcurrent.c:214)
      ==8441==  Address 0x6f5eb1c is 204 bytes inside a block of size 240 free'd
      ==8441==    at 0x4868F44: realloc (vg_replace_malloc.c:785)
      ==8441==    by 0x5DEE143: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:502)
      ==8441==    by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241)
      ==8441==    by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131)
      ==8441==    by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450)
      ==8441==    by 0x5B4910F: fd5_emit_tile_gmem2mem (fd5_gmem.c:477)
      ==8441==    by 0x5B14943: render_tiles (freedreno_gmem.c:342)
      ==8441==    by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416)
      ==8441==    by 0x5B0FBA7: batch_flush (freedreno_batch.c:281)
      ==8441==    by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306)
      ==8441==    by 0x5B11FE7: fd_context_flush (freedreno_context.c:52)
      ==8441==    by 0x58AD783: st_glFlush (st_cb_flush.c:121)
      ==8441==    by 0x5751EE7: _mesa_make_current (context.c:1652)
      ==8441==    by 0x58E6A97: st_api_make_current (st_manager.c:811)
      ==8441==    by 0x5A2CE43: dri_unbind_context (dri_context.c:207)
      ==8441==    by 0x5A2C77F: driUnbindContext (dri_util.c:589)
      ==8441==  Block was alloc'd at
      ==8441==    at 0x4868F44: realloc (vg_replace_malloc.c:785)
      ==8441==    by 0x5DEE08B: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:481)
      ==8441==    by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241)
      ==8441==    by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131)
      ==8441==    by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450)
      ==8441==    by 0x5B4909F: fd5_emit_tile_gmem2mem (fd5_gmem.c:465)
      ==8441==    by 0x5B14943: render_tiles (freedreno_gmem.c:342)
      ==8441==    by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416)
      ==8441==    by 0x5B0FBA7: batch_flush (freedreno_batch.c:281)
      ==8441==    by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306)
      ==8441==    by 0x5B11FE7: fd_context_flush (freedreno_context.c:52)
      ==8441==    by 0x58AD783: st_glFlush (st_cb_flush.c:121)
      ==8441==    by 0x5751EE7: _mesa_make_current (context.c:1652)
      ==8441==    by 0x58E6A97: st_api_make_current (st_manager.c:811)
      ==8441==    by 0x5A2CE43: dri_unbind_context (dri_context.c:207)
      ==8441==    by 0x5A2C77F: driUnbindContext (dri_util.c:589)
      Signed-off-by: default avatarRob Clark <robclark@freedesktop.org>
      2b7453f4
  10. 26 Nov, 2016 1 commit
  11. 05 Nov, 2016 2 commits
  12. 21 Jul, 2016 1 commit
  13. 20 Jul, 2016 11 commits
    • Rob Clark's avatar
      freedreno/msm: use hashtable to track bo idx · 6a23bd4b
      Rob Clark authored
      
      
      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: default avatarRob Clark <robclark@freedesktop.org>
      6a23bd4b
    • Rob Clark's avatar
      freedreno: support growable cmdstream buffers · 419a154d
      Rob Clark authored
      
      
      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: default avatarRob Clark <robclark@freedesktop.org>
      419a154d
    • Rob Clark's avatar
      d93d697d
    • Rob Clark's avatar
      freedreno/msm: split out cmd buffer tracking from ring · dd1f3720
      Rob Clark authored
      
      
      First step towards supporting a single logical ringbuffer mapping to
      multiple physical cmd buffers, which will enable dynamically growing
      ringbuffers.
      Signed-off-by: default avatarRob Clark <robclark@freedesktop.org>
      dd1f3720
    • Rob Clark's avatar
      freedreno/msm: drop return from get_cmd() · 0d615291
      Rob Clark authored
      
      
      Not actually needed.  It just needs to ensure that there is a
      corresponding entry in the submit's cmds table.
      Signed-off-by: default avatarRob Clark <robclark@freedesktop.org>
      0d615291
    • Rob Clark's avatar
      freedreno/msm: use private bo-cache for ringbuffer bo's · 892141a3
      Rob Clark authored
      
      
      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: default avatarRob Clark <robclark@freedesktop.org>
      892141a3
    • Rob Clark's avatar
      freedreno: fix potential leak at free · 19b82b98
      Rob Clark authored
      
      
      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: default avatarRob Clark <robclark@freedesktop.org>
      19b82b98
    • Rob Clark's avatar
      freedreno: expose kernel driver version · 904f1361
      Rob Clark authored
      
      
      gallium needs to know if the kernel is new enough to support explicit
      fencing, dynamically grown ringbuffers, etc.
      Signed-off-by: default avatarRob Clark <robclark@freedesktop.org>
      904f1361
    • Rob Clark's avatar
      freedreno: add madvise support · eb846d46
      Rob Clark authored
      
      
      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: default avatarRob Clark <robclark@freedesktop.org>
      eb846d46
    • Rob Clark's avatar
      freedreno: sync uapi · 0c270df8
      Rob Clark authored
      
      
      (from drm-next for 4.8)
      Signed-off-by: default avatarRob Clark <robclark@freedesktop.org>
      0c270df8
    • Rob Clark's avatar
      freedreno: rework internal ring->emit_reloc_ring() · 73db0a04
      Rob Clark authored
      
      
      No need for it to deal with ringmarkers.
      Signed-off-by: default avatarRob Clark <robclark@freedesktop.org>
      73db0a04
  14. 13 Jun, 2016 1 commit
  15. 13 Mar, 2016 2 commits
  16. 12 Feb, 2016 3 commits
  17. 19 Sep, 2015 2 commits
  18. 04 Sep, 2015 1 commit
  19. 17 Aug, 2015 2 commits