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

Oded Gabbay oded.gabbay at gmail.com
Thu Apr 14 12:18:43 UTC 2016


Changes in v2:

I removed all the places in mesa/st code where I directly set the pipe_resource's 
endian_format. Instead, the initialization of this field is now done *only* 
at creation time of the pipe_resource object.

To make that work, I had to change the interface of st_create_texture to accept 
the endian_format parameter, so certain calling functions can send in 
hard-coded values instead of the value that derives from the pipe_format.

An added bonus was solving additional 3 more tests over the previous version.

I also squashed two patches according to marek's remark.

Original cover-letter:

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 4 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 219 failed tests and
finished with 125 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 (11):
  r600g: fix code indentation
  r600g: Move R600_BIG_ENDIAN to r600_pipe_common.h
  mesa/st: add helper to return pipe_endian based on pipe_format
  gallium: add endian_format field to struct pipe_resource
  r600g/radeonsi: propagate endian_format to relevant functions
  r600g: override endian when mapping to read
  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     | 48 +++++++++++++++++---
 src/gallium/drivers/radeonsi/si_state.c       |  4 +-
 src/gallium/include/pipe/p_state.h            |  1 +
 src/mesa/state_tracker/st_cb_bitmap.c         |  7 ++-
 src/mesa/state_tracker/st_cb_drawpixels.c     | 15 ++++---
 src/mesa/state_tracker/st_cb_readpixels.c     |  4 ++
 src/mesa/state_tracker/st_cb_texture.c        | 18 ++++++--
 src/mesa/state_tracker/st_format.c            | 51 +++++++++++++++++++++
 src/mesa/state_tracker/st_format.h            |  3 ++
 src/mesa/state_tracker/st_texture.c           |  7 ++-
 src/mesa/state_tracker/st_texture.h           |  3 +-
 18 files changed, 236 insertions(+), 73 deletions(-)

-- 
2.5.5



More information about the mesa-dev mailing list