Skip to content
Snippets Groups Projects
  1. Apr 28, 2020
    • Andreas Baierl's avatar
      WIP: lima: Split indexed draws for GL_ARRAY_BUFFER · 254fe84f
      Andreas Baierl authored
      
      It is possible to upload the index buffer with glBufferData and bind
      it to GL_ARRAY_BUFFER. The data needs to be accessed with
      PIPE_BIND_VERTEX_BUFFER then. Add the possibility to also split these
      draws.
      
      We don't create a shadow memory for that case in order to avoid creating
      this shadow buffer every time we map a vertex buffer resource.
      Instead, we map the GPU memory while preparing the draw directly before
      calculating the splitted draw data. This seems to be the solution
      with the least overhead.
      
      An example for that is dEQP-GLES2.functional.buffer.write.use.index_array.array
      
      Signed-off-by: default avatarAndreas Baierl <ichgeh@imkreisrum.de>
      254fe84f
    • Andreas Baierl's avatar
      WIP: lima: Use caching with splitted index buffer draws · a694c56c
      Andreas Baierl authored
      
      Use panfrosts index_cache mechanism to store the calculated min/max values
      for the splitted draws.
      
      Also do some small cleanups in the code.
      
      Signed-off-by: default avatarAndreas Baierl <ichgeh@imkreisrum.de>
      a694c56c
    • Andreas Baierl's avatar
      WIP: lima: Call lima_get_minmax with pipe_draw_info · 0b13783f
      Andreas Baierl authored
      
      No need to pass the single values
      
      Signed-off-by: default avatarAndreas Baierl <ichgeh@imkreisrum.de>
      0b13783f
    • Andreas Baierl's avatar
      WIP: lima: Move minmax struct from context to resource · c29dd0c2
      Andreas Baierl authored
      
      The min/max indices belong to the resource, not to the context,
      so move them.
      
      Signed-off-by: default avatarAndreas Baierl <ichgeh@imkreisrum.de>
      c29dd0c2
    • Andreas Baierl's avatar
      WIP: lima: Split indexed draws · 55d7ede6
      Andreas Baierl authored
      
      The blob splits indexed draws in cases when the index buffer is not
      contiguous. This is done as soon as we have a gap > 8 in the index buffer.
      Example:
      index_buffer = [0, 10, 2] -> results in a single draw (0~10)
      index_buffer = [0, 11, 2] -> results in two draws (0~2), (10)
      
      So it seems, that the blob uses a gap of 11 - 2 = 9, from which on draws
      are splitted.
      
      This effort tries to implement this behaviour.
      
      What it mainly does, is:
      1) Allocate shadow CPU memory when a buffer for indices is created.
          This is currently only done, if the buffer is bound with
          PIPE_BIND_BUFFER_INDEX.
          There is a deqp test (functional.buffer.write.use.index_array.array),
          which uses PIPE_BIND_BUFFER_VERTEX to upload the indices. This case isn't
          handled in this MR, the blob does that split though.
      2) Copy the dirty part of the shadow buffer back to GPU mem during unmapping
      3) Within the indexed draw we do some more or less magic things :)
          We memcpy that shadow memory to a temporary one,
          do a quick sort on it and see how many draws we need, when splitting the draws,
          if the gap between the used indices is > 8.
          This can still be improved. We can use a better algorithm, to find the gaps
          and we should probably think about how to avoid the memcpy and qsort with each draw.
      4) Fill an array of struct (ctx->minmax) with corresponding min/ max values
          depending on the number of draws we calculated for usage in
          VS CMD stream creation.
      5) Use correct addresses for varyings and attributes including the right offset
      6) Use the ctx->minmax array and create VS CMDS while iteration through the array
      
      The main issue on this effort is, that we need to get benchmarks, if this really is
      an optimization and if so, what the best value of the gap is.
      
      We have to get some benchmarks first to drop the WIP.
      
      Signed-off-by: default avatarAndreas Baierl <ichgeh@imkreisrum.de>
      55d7ede6
    • Andreas Baierl's avatar
      WIP: panfrost: lima: Add void pointer to index cache · 75f900c1
      Andreas Baierl authored
      
      Prepare panfrosts index cache to take a pointer.
      We need this for the follow-up lima commits, which can split an indexed draw
      based on the index buffer. The information we need for the splitting will be
      saved in an array. The index cache will keep a pointer to that array.
      
      If we call _get and _add with a NULL-pointer, nothing new is done.
      
      Signed-off-by: default avatarAndreas Baierl <ichgeh@imkreisrum.de>
      75f900c1
  2. Apr 22, 2020
  3. Apr 21, 2020
Loading