[Mesa-dev] [PATCH 00/10] Fix OpenGL 1.3 big-endian support in r600g

Oded Gabbay oded.gabbay at gmail.com
Mon Apr 11 14:34:03 UTC 2016


This patch-set aims to fix r600g's big-endian support, which was broken 
due to the big color formats rework that was done in mesa/gallium a few years 
ago. Because piglit run on BE crashes with upstream code (even in -1 mode),
I reduced the OpenGL version to the lowest possible - 1.3 - while developing
this patch-set.

At first, I tried to fix everything using the existing code and just adjust the 
swapping/format functions. Soon I found out it is not enough, as the same 
configuration fixed one use-case but broke another use-case and vice-versa. 

After some thinking, I came to the conclusion that I needed more information 
about the current operation being done on the resource (texture, 
pixels, etc.). I then added a new flag to struct pipe_resource that tells me in 
which format the resource is (if its a source) or should be (if its 
a destination). Then, in all the format/swapping functions, I check this flag 
and act accordingly. The flag is never checked/acted-upon in other layers except
the H/W driver (r600g), so there is zero impact on other drivers. See more 
detailed explanation in patch 3 commit msg.

Tests were done using piglit and by visual observance (I often looked at
the screen to verify the colors are correct).

For BE, I used a POWER7 machine with a CEDAR GL card (Evergreen).
For LE, I used a skylake machine with the same card.

I fixed most of the major tests (and some minor ones) - readpixsanity, 
draw-pixels, texwrap, copy-pixels and more. I started with 223 failed tests and
finished with 129 failed tests. Most of the tests I fixed were already working
in llvmpipe BE, so I knew that at least the core mesa code is working. In 
accordance to that, most of the remaining failed tests also don't work in 
llvmpipe BE, so there is probably something more fundamentaly wrong there.

Results of piglit tests are found in my fdo web folder:
https://people.freedesktop.org/~gabbayo/piglit_results/r600g-big-endian/

There are three comparisons, all of them done after reducing OpenGL version to 
1.3:

1. r600g-1.3-base-le-vs-be -
   Diff between LE and BE with upstream code to see the current status

2. r600g-1.3-le-vs-be -
   Diff between LE and BE with upstream + patch-set to see the remaining tests 
   to be fixed

3. r600g-be-1.3-all-fixes - 
   Diff between upstream code and upstream + patch-set, both running in BE. 
   This shows all the tests my patch-set fixed (and no regressions)

In addition, I of course checked for regressions on LE, without reducing OpenGL
version.

Thanks,

Oded

Oded Gabbay (10):
  r600g: fix code indentation
  r600g: Move R600_BIG_ENDIAN to r600_pipe_common.h
  mesa/st: add endian_format field to struct pipe_resource
  r600g: propagate endian_format to relevant functions
  radeonsi: fix calls to r600 functions that take endian_format
  r600g: update endian_format after operations
  r600g: set staging texture endianess
  r600g: set endianess of 16/32-bit buffers according to endian_format
  r600g: use endian_format in color swapping functions
  r600g: use endian_format in texture swapping function

 src/gallium/drivers/r600/evergreen_state.c    | 24 +++++-----
 src/gallium/drivers/r600/r600_blit.c          | 18 ++++----
 src/gallium/drivers/r600/r600_pipe.c          |  2 +-
 src/gallium/drivers/r600/r600_pipe.h          | 14 +++---
 src/gallium/drivers/r600/r600_state.c         | 18 ++++----
 src/gallium/drivers/r600/r600_state_common.c  | 64 ++++++++++++++++++++++-----
 src/gallium/drivers/radeon/r600_pipe_common.h |  8 +++-
 src/gallium/drivers/radeon/r600_texture.c     | 36 ++++++++++++---
 src/gallium/drivers/radeonsi/si_state.c       |  4 +-
 src/gallium/include/pipe/p_state.h            |  1 +
 src/mesa/state_tracker/st_cb_drawpixels.c     | 11 ++++-
 src/mesa/state_tracker/st_cb_fbo.c            | 16 ++++++-
 src/mesa/state_tracker/st_cb_readpixels.c     |  5 +++
 src/mesa/state_tracker/st_cb_texture.c        | 13 ++++++
 src/mesa/state_tracker/st_texture.c           | 48 ++++++++++++++++++++
 15 files changed, 222 insertions(+), 60 deletions(-)

-- 
2.5.5



More information about the mesa-dev mailing list