[Mesa-dev] [PATCH 20/29] intel/isl/format: Add field locations informations to channel_layout

Jason Ekstrand jason at jlekstrand.net
Tue Mar 6 17:11:18 UTC 2018


On Tue, Mar 6, 2018 at 1:54 AM, Pohjolainen, Topi <
topi.pohjolainen at gmail.com> wrote:

> On Fri, Jan 26, 2018 at 05:59:49PM -0800, Jason Ekstrand wrote:
> > ---
> >  src/intel/isl/gen_format_layout.py | 16 +++++++++++++---
> >  src/intel/isl/isl.h                |  1 +
> >  2 files changed, 14 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/intel/isl/gen_format_layout.py
> b/src/intel/isl/gen_format_layout.py
> > index 535f38c..633498b 100644
> > --- a/src/intel/isl/gen_format_layout.py
> > +++ b/src/intel/isl/gen_format_layout.py
> > @@ -76,7 +76,7 @@ isl_format_layouts[] = {
> >      % for mask in ['r', 'g', 'b', 'a', 'l', 'i', 'p']:
> >        <% channel = getattr(format, mask, None) %>\\
> >        % if channel.type is not None:
> > -        .${mask} = { ISL_${channel.type}, ${channel.size} },
> > +        .${mask} = { ISL_${channel.type}, ${channel.start},
> ${channel.size} },
> >        % else:
> >          .${mask} = {},
> >        % endif
> > @@ -139,7 +139,10 @@ class Channel(object):
> >          else:
> >              grouped = self._splitter.match(line)
> >              self.type = self._types[grouped.group('type')].upper()
> > -            self.size = grouped.group('size')
> > +            self.size = int(grouped.group('size'))
> > +
> > +        # Default the start big to -1
>
>                                bit
>
> > +        self.start = -1;
> >
> >
> >  class Format(object):
> > @@ -160,7 +163,14 @@ class Format(object):
> >          self.l = Channel(line[9])
> >          self.i = Channel(line[10])
> >          self.p = Channel(line[11])
> > -        self.order = line[12]
> > +
> > +        # Set the start bit value for each channel
> > +        order = line[12].strip()
>
> You aren't setting "self.order" anymore?
>

No.  Nothing was using it.  It doesn't really matter to me whether we store
it in the Format object or not.


> > +        bit = 0
> > +        for c in order:
> > +            chan = getattr(self, c)
> > +            chan.start = bit;
> > +            bit = bit + chan.size
> >
> >          # alpha doesn't have a colorspace of it's own.
> >          self.colorspace = line[13].strip().upper()
> > diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
> > index 277998f..04d0f0b 100644
> > --- a/src/intel/isl/isl.h
> > +++ b/src/intel/isl/isl.h
> > @@ -975,6 +975,7 @@ struct isl_extent4d {
> >
> >  struct isl_channel_layout {
> >     enum isl_base_type type;
> > +   uint8_t start_bit; /**< Bit at which this channel starts */
> >     uint8_t bits; /**< Size in bits */
> >  };
> >
> > --
> > 2.5.0.400.gff86faf
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180306/cb316b13/attachment.html>


More information about the mesa-dev mailing list