aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/isl
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-06-22 17:12:36 -0700
committerJason Ekstrand <[email protected]>2018-05-09 11:16:33 -0700
commit8ab73790efbce705c84c5fd6e598d91ffe02b579 (patch)
tree0defbabeefb61979a34d806d34c0205aecd4a378 /src/intel/isl
parent96598fbc02d2277a923d10aad168a7a3be0fb08b (diff)
intel/isl/format: Add field locations informations to channel_layout
Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/isl')
-rw-r--r--src/intel/isl/gen_format_layout.py14
-rw-r--r--src/intel/isl/isl.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/src/intel/isl/gen_format_layout.py b/src/intel/isl/gen_format_layout.py
index b5d506b9f9f..a78f9506b3f 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
@@ -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()
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 7c9a41e09b3..b6fd7edeb18 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -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 */
};