Skip to content

mesa,gallium: use pipe_draw_info in mesa/main and vbo (unification with gallium), perf++

Marek Olšák requested to merge mareko/mesa:draw-interface2 into master

This change:

  • reduces CPU overhead for gallium by eliminating the intermediate _mesa_prim structure, exceptions:
    • display lists still use _mesa_prim
  • passes multi draws into gallium drivers as-is, exceptions:
    • glBegin/End multi draws are split into sub-multi draws in st/mesa where the primitive type changes
    • glMultiDrawElementsBaseVertex is split into sub-multi draws in st/mesa where the base vertex changes

There are 2 new driver callbacks that replace Draw: DrawGallium and DrawGalliumComplex

New frontend behavior / possible driver breakage

  • If !index_size, index_bias and has_user_indices are uninitialized.
  • If !index_bounds_valid, min_index and max_index are uninitialized.
  • Drivers aren't allowed to ignore start with user index buffers anymore.

Drivers known to handle the new behavior correctly:

  • d3d12
  • etnaviv
  • freedreno
  • i915
  • iris
  • lima
  • llvmpipe
  • nv30
  • nv50
  • nvc0
  • panfrost
  • r300
  • r600
  • radeonsi
  • softpipe
  • svga
  • swr
  • tegra
  • v3d
  • vc4
  • virgl
  • zink

Performance difference

Command: taskset 0x7007 piglit/bin/drawoverhead (taskset is for predictable Zen CCX scheduling)

Before:

   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                21286, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                21360, 100.3%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                21503, 101.0%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                21489, 101.0%
   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                21415, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                21382, 99.8%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                21622, 101.0%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                21611, 100.9%
   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                21016, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                21425, 101.9%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                21386, 101.8%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                21407, 101.9%
   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                21324, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                21416, 100.4%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                21389, 100.3%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                21457, 100.6%

After:

   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                24449, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                24781, 101.4%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                24483, 100.1%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                24629, 100.7%
   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                24246, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                24103, 99.4%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                24003, 99.0%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                24345, 100.4%
   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                23841, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                23943, 100.4%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                23878, 100.2%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                23881, 100.2%
   1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change,                23639, 100.0%
   2, DrawElements ( 4 VBO| 0 UBO|  0    ) w/ no state change,                23292, 98.5%
   3, DrawElements (16 VBO| 0 UBO|  0    ) w/ no state change,                23640, 100.0%
   4, DrawElements ( 1 VBO| 0 UBO| 16 Tex) w/ no state change,                23538, 99.6%

I can see more than 10% improvement in the noisy data.

Edited by Marek Olšák

Merge request reports