intel/isl/format: Add field locations informations to channel_layout
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 23 Jun 2017 00:12:36 +0000 (17:12 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 9 May 2018 18:16:33 +0000 (11:16 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/isl/gen_format_layout.py
src/intel/isl/isl.h

index b5d506b9f9fccbd3ec45af605b9e320ad50f399a..a78f9506b3f98a9c2ca70dddcaa36d942b0966aa 100644 (file)
@@ -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
@@ -147,7 +147,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 bit to -1
+        self.start = -1;
 
 
 class Format(object):
@@ -168,7 +171,14 @@ class Format(object):
         self.l = Channel(line[9])
         self.i = Channel(line[10])
         self.p = Channel(line[11])
+
+        # Set the start bit value for each channel
         self.order = line[12].strip()
+        bit = 0
+        for c in self.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()
index 7c9a41e09b3d658822a068c2e7fa412532dd211a..b6fd7edeb18eb7ef61dbc19d04346aae536a614c 100644 (file)
@@ -1005,6 +1005,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 */
 };