[Mesa-dev] [PATCH] r600: port si_conv_prim_to_gs_out from radeonsi

Jonathan Gray jsg at jsg.id.au
Sun Aug 30 00:49:58 PDT 2015


On Sun, Aug 30, 2015 at 01:38:49AM -0400, Ilia Mirkin wrote:
> On Sun, Aug 30, 2015 at 1:27 AM, Jonathan Gray <jsg at jsg.id.au> wrote:
> > On Fri, Aug 28, 2015 at 10:47:44AM +1000, Dave Airlie wrote:
> >> From: Dave Airlie <airlied at redhat.com>
> >>
> >> This code we broken by the tess merge, and I totally missed it
> >> until now. I'm not sure this fixes anything but it stops the assert.
> >>
> >> Cc: "11.0" <mesa-stable at lists.freedesktop.org>
> >> Signed-off-by: Dave Airlie <airlied at redhat.com>
> >> ---
> >>  src/gallium/drivers/r600/r600_pipe.h | 31 ++++++++++++++++---------------
> >>  1 file changed, 16 insertions(+), 15 deletions(-)
> >>
> >> diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
> >> index 384ba80..3247aba 100644
> >> --- a/src/gallium/drivers/r600/r600_pipe.h
> >> +++ b/src/gallium/drivers/r600/r600_pipe.h
> >> @@ -939,21 +939,22 @@ static inline bool r600_can_read_depth(struct r600_texture *rtex)
> >>  static inline unsigned r600_conv_prim_to_gs_out(unsigned mode)
> >>  {
> >>       static const int prim_conv[] = {
> >> -             V_028A6C_OUTPRIM_TYPE_POINTLIST,
> >> -             V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> -             V_028A6C_OUTPRIM_TYPE_TRISTRIP
> >> +             [PIPE_PRIM_POINTS]                      = V_028A6C_OUTPRIM_TYPE_POINTLIST,
> >> +             [PIPE_PRIM_LINES]                       = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> +             [PIPE_PRIM_LINE_LOOP]                   = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> +             [PIPE_PRIM_LINE_STRIP]                  = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> +             [PIPE_PRIM_TRIANGLES]                   = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_TRIANGLE_STRIP]              = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_TRIANGLE_FAN]                = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_QUADS]                       = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_QUAD_STRIP]                  = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_POLYGON]                     = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_LINES_ADJACENCY]             = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> +             [PIPE_PRIM_LINE_STRIP_ADJACENCY]        = V_028A6C_OUTPRIM_TYPE_LINESTRIP,
> >> +             [PIPE_PRIM_TRIANGLES_ADJACENCY]         = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY]    = V_028A6C_OUTPRIM_TYPE_TRISTRIP,
> >> +             [PIPE_PRIM_PATCHES]                     = V_028A6C_OUTPRIM_TYPE_POINTLIST,
> >> +             [R600_PRIM_RECTANGLE_LIST]              = V_028A6C_OUTPRIM_TYPE_TRISTRIP
> >>       };
> >>       assert(mode < Elements(prim_conv));
> >
> > This seems to have broken the build on OpenBSD with gcc 4.2.1:
> >
> > In file included from sb/sb_bc_parser.cpp:35:
> > ./r600_pipe.h: In function 'unsigned int r600_conv_prim_to_gs_out(unsigned int)':
> > ./r600_pipe.h:942: error: expected primary-expression before '[' token
> > ./r600_pipe.h:943: error: expected primary-expression before '[' token
> > ./r600_pipe.h:944: error: expected primary-expression before '[' token
> > ./r600_pipe.h:945: error: expected primary-expression before '[' token
> > ./r600_pipe.h:946: error: expected primary-expression before '[' token
> > ./r600_pipe.h:947: error: expected primary-expression before '[' token
> > ./r600_pipe.h:948: error: expected primary-expression before '[' token
> > ./r600_pipe.h:949: error: expected primary-expression before '[' token
> > ./r600_pipe.h:950: error: expected primary-expression before '[' token
> > ./r600_pipe.h:951: error: expected primary-expression before '[' token
> > ./r600_pipe.h:952: error: expected primary-expression before '[' token
> > ./r600_pipe.h:953: error: expected primary-expression before '[' token
> > ./r600_pipe.h:954: error: expected primary-expression before '[' token
> > ./r600_pipe.h:955: error: expected primary-expression before '[' token
> > ./r600_pipe.h:956: error: expected primary-expression before '[' token
> > ./r600_pipe.h:957: error: expected primary-expression before '[' token
> > Makefile:801: recipe for target 'sb/sb_bc_parser.lo' failed
> 
> We definitely do this sort of thing elsewhere... does it work if you do
> 
> static const int prim_conv[PIPE_PRIM_MAX+1] = { ... }

Same error with that change.

clang++ with -pedantic warns about designated initialisers being a C99 extension.

The following compiles with gcc but not g++ with 4.2.1:

static inline unsigned r600_conv_prim_to_gs_out(unsigned mode)
{
 static const int prim_conv[] = {
  [0] = 0,
  [1] = 1,
  [2] = 1,
  [3] = 1,
  [4] = 2,
  [5] = 2,
  [6] = 2,
  [7] = 2,
  [8] = 2,
  [9] = 2,
  [10] = 1,
  [11] = 1,
  [12] = 2,
  [13] = 2,
  [14] = 0,
  [15] = 2
 };

 return prim_conv[mode];
}

It seems g++ behaviour may have changed around gcc 4.6/4.7 going by
https://gcc.gnu.org/ml/gcc/2014-09/msg00207.html so this maybe
broken on RHEL6 and elsewhere as well?


More information about the mesa-dev mailing list