1. 07 Aug, 2017 1 commit
  2. 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
  3. 26 Nov, 2016 1 commit
  4. 05 Nov, 2016 2 commits
  5. 21 Jul, 2016 1 commit
  6. 20 Jul, 2016 8 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: 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
  7. 13 Jun, 2016 1 commit
  8. 19 Sep, 2015 1 commit
  9. 04 Sep, 2015 1 commit
  10. 17 Aug, 2015 3 commits
  11. 28 Apr, 2015 1 commit
  12. 28 Sep, 2014 1 commit
  13. 19 Mar, 2014 1 commit
  14. 19 Feb, 2014 1 commit
  15. 07 Jan, 2014 1 commit
  16. 28 Aug, 2013 1 commit