From 9130ec005fbc78a62420643414d8354d0929ca50 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 22 Jul 2021 10:50:50 +0000 Subject: Merge Mesa 21.1.5 --- lib/mesa/src/intel/isl/gen_format_layout.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/mesa/src/intel/isl/gen_format_layout.py') diff --git a/lib/mesa/src/intel/isl/gen_format_layout.py b/lib/mesa/src/intel/isl/gen_format_layout.py index c1f22707f..b1c4df257 100644 --- a/lib/mesa/src/intel/isl/gen_format_layout.py +++ b/lib/mesa/src/intel/isl/gen_format_layout.py @@ -81,6 +81,7 @@ isl_format_layouts[] = { % endif % endfor }, + .uniform_channel_type = ISL_${format.uniform_channel_type}, .colorspace = ISL_COLORSPACE_${format.colorspace}, .txc = ISL_TXC_${format.txc}, }, @@ -179,6 +180,23 @@ class Format(object): chan.start = bit bit = bit + chan.size + # Set the uniform channel type, if the format has one. + # + # Iterate over all channels, not just those in self.order, because + # some formats have an empty 'order' field in the CSV (such as + # YCRCB_NORMAL). + self.uniform_channel_type = 'VOID' + for chan in self.channels: + if chan.type in (None, 'VOID'): + pass + elif self.uniform_channel_type == 'VOID': + self.uniform_channel_type = chan.type + elif self.uniform_channel_type == chan.type: + pass + else: + self.uniform_channel_type = 'VOID' + break + # alpha doesn't have a colorspace of it's own. self.colorspace = line[13].strip().upper() if self.colorspace in ['']: @@ -188,6 +206,17 @@ class Format(object): self.txc = line[14].strip().upper() or 'NONE' + @property + def channels(self): + yield self.r + yield self.g + yield self.b + yield self.a + yield self.l + yield self.i + yield self.p + + def reader(csvfile): """Wrapper around csv.reader that skips comments and blanks.""" # csv.reader actually reads the file one line at a time (it was designed to -- cgit v1.2.3