[Mesa-dev] [PATCH 20/29] intel/isl/format: Add field locations informations to channel_layout
Jason Ekstrand
jason at jlekstrand.net
Sat Jan 27 01:59:49 UTC 2018
---
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
+ 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()
+ 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
More information about the mesa-dev
mailing list