Mesa (main): llvmpipe: Add a linear rasterizer optimized for 2D rendering.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 21 21:59:10 UTC 2021


Module: Mesa
Branch: main
Commit: 5a1d3bcf26df5b303fbfdc34584c982efb020ade
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a1d3bcf26df5b303fbfdc34584c982efb020ade

Author: Jose Fonseca <jfonseca at vmware.com>
Date:   Fri May  7 13:49:07 2021 +0100

llvmpipe: Add a linear rasterizer optimized for 2D rendering.

This change adds:

- an alternative rasterizer, which rasterizes bins in a left->right &
  top->bottom linear fashion;

- triangle -> rectangle detection;

- 1:1 blit detection;

- a special TGSI -> LLVM IR code generation that uses 8-bit SSE integers
  in AoS fashion (as opposed to 32bits floats.)

Altogether these changes yield a 2x to 3x performance improvement for 2D
workloads.  It was designed to render Windows 7 Aero and other Windows
built-in 3D applications (like Windows Media Player, Internet Explorer
11, UWP applications) with minimum CPU utilization, but it should be
generally applicable to other 2D-on-3D applications, like desktop
compositors, HTML browsers, 3D based UI toolkits, etc.

This was mostly the brainchild of Keith Whitwell back in 2010.  I wrote
TGSI -> AoS translation.  And many others added bug-fixes and
enhancements over the years: Roland Scheidegger, Brian Paul, and James
Benton.

Known issues:

- piglit spec@!opengl 1.1 at quad-invariance will warn that "left and right
half should match" due to rounding error difference

- These optimized paths to kick in is that depth-buffer must not be
used, so some applications which want to benefit from these improvements
might need to be modified to ensure they use painter's algorithm instead
of depth-buffers.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Acked-by: Keith Whitwell <keithw at vmware.com>

v2: Incorporate Dave Airlie feedback: cleanup LP_DEBUG_xx; shrink 3+
empty lines.
v3: silence unused var warning, adapt to new upstream code (point setup)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11969>

---

 src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c  |    4 +-
 src/gallium/auxiliary/util/u_sse.h                 |  406 +++++++-
 src/gallium/auxiliary/util/u_tests.c               |    4 +-
 src/gallium/drivers/llvmpipe/lp_clear.c            |    3 +
 src/gallium/drivers/llvmpipe/lp_context.c          |    3 +
 src/gallium/drivers/llvmpipe/lp_context.h          |    3 +
 src/gallium/drivers/llvmpipe/lp_debug.h            |    7 +
 src/gallium/drivers/llvmpipe/lp_jit.c              |   70 ++
 src/gallium/drivers/llvmpipe/lp_jit.h              |   88 ++
 src/gallium/drivers/llvmpipe/lp_limits.h           |    5 -
 src/gallium/drivers/llvmpipe/lp_linear.c           |  363 +++++++
 src/gallium/drivers/llvmpipe/lp_linear_fastpath.c  |  237 +++++
 src/gallium/drivers/llvmpipe/lp_linear_interp.c    |  243 +++++
 src/gallium/drivers/llvmpipe/lp_linear_priv.h      |  169 ++++
 src/gallium/drivers/llvmpipe/lp_linear_sampler.c   | 1009 ++++++++++++++++++++
 src/gallium/drivers/llvmpipe/lp_perf.c             |   16 +
 src/gallium/drivers/llvmpipe/lp_perf.h             |    6 +
 src/gallium/drivers/llvmpipe/lp_rast.c             |  374 +++++++-
 src/gallium/drivers/llvmpipe/lp_rast.h             |   67 +-
 src/gallium/drivers/llvmpipe/lp_rast_debug.c       |  141 ++-
 src/gallium/drivers/llvmpipe/lp_rast_linear.c      |  263 +++++
 .../drivers/llvmpipe/lp_rast_linear_fallback.c     |  303 ++++++
 src/gallium/drivers/llvmpipe/lp_rast_priv.h        |   14 +
 src/gallium/drivers/llvmpipe/lp_rast_rect.c        |  255 +++++
 src/gallium/drivers/llvmpipe/lp_rast_tri.c         |   25 +
 src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h     |   10 +
 src/gallium/drivers/llvmpipe/lp_scene.c            |   34 +-
 src/gallium/drivers/llvmpipe/lp_scene.h            |   20 +-
 src/gallium/drivers/llvmpipe/lp_screen.c           |    8 +-
 src/gallium/drivers/llvmpipe/lp_setup.c            |  101 +-
 src/gallium/drivers/llvmpipe/lp_setup.h            |    7 +-
 src/gallium/drivers/llvmpipe/lp_setup_analysis.c   |  398 ++++++++
 src/gallium/drivers/llvmpipe/lp_setup_context.h    |   69 +-
 src/gallium/drivers/llvmpipe/lp_setup_line.c       |   17 +-
 src/gallium/drivers/llvmpipe/lp_setup_point.c      |  134 ++-
 src/gallium/drivers/llvmpipe/lp_setup_rect.c       |  900 +++++++++++++++++
 src/gallium/drivers/llvmpipe/lp_setup_tri.c        |  177 ++--
 src/gallium/drivers/llvmpipe/lp_setup_vbuf.c       |  150 ++-
 src/gallium/drivers/llvmpipe/lp_state.h            |    3 +
 src/gallium/drivers/llvmpipe/lp_state_blend.c      |    2 +
 src/gallium/drivers/llvmpipe/lp_state_derived.c    |   69 ++
 src/gallium/drivers/llvmpipe/lp_state_fs.c         |  157 ++-
 src/gallium/drivers/llvmpipe/lp_state_fs.h         |   57 ++
 .../drivers/llvmpipe/lp_state_fs_analysis.c        |  204 ++++
 .../drivers/llvmpipe/lp_state_fs_fastpath.c        |  238 +++++
 src/gallium/drivers/llvmpipe/lp_state_fs_linear.c  |  713 ++++++++++++++
 .../drivers/llvmpipe/lp_state_fs_linear_llvm.c     |  522 ++++++++++
 src/gallium/drivers/llvmpipe/lp_state_rasterizer.c |    9 +-
 src/gallium/drivers/llvmpipe/lp_state_sampler.c    |    6 +-
 src/gallium/drivers/llvmpipe/lp_state_setup.c      |   11 +-
 src/gallium/drivers/llvmpipe/lp_state_setup.h      |    4 +-
 src/gallium/drivers/llvmpipe/lp_texture.h          |    2 -
 src/gallium/drivers/llvmpipe/meson.build           |   13 +
 53 files changed, 7894 insertions(+), 219 deletions(-)

Diff:   http://cgit.freedesktop.org/mesa/mesa/diff/?id=5a1d3bcf26df5b303fbfdc34584c982efb020ade


More information about the mesa-commit mailing list