From 76e72d63f04b92af9b92d49903fd45071fa1fda1 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Fri, 20 Jun 2025 17:09:13 -0400 Subject: [PATCH] nil: Match on gob types in the tiled image copy code This depends on GOB types but we really only support Turing for now. Add the match statement anyway so we panic if we see an unsupported GOB type instead of pretending it's TuringColor2D and copying anyway. Part-of: --- src/nouveau/nil/copy.rs | 44 +++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/nouveau/nil/copy.rs b/src/nouveau/nil/copy.rs index 804d35ddfce..7dc8483b8e0 100644 --- a/src/nouveau/nil/copy.rs +++ b/src/nouveau/nil/copy.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT use crate::extent::{units, Extent4D, Offset4D}; -use crate::tiling::Tiling; +use crate::tiling::{GOBType, Tiling}; use std::ffi::c_void; use std::ops::Range; @@ -551,14 +551,19 @@ pub unsafe extern "C" fn nil_copy_linear_to_tiled( linear_plane_stride_B, ); - copy_tiled::>( - *tiling, - level_extent_B, - tiled_dst, - linear_pointer, - offset_B, - end_B, - ); + match tiling.gob_type { + GOBType::TuringColor2D => { + copy_tiled::>( + *tiling, + level_extent_B, + tiled_dst, + linear_pointer, + offset_B, + end_B, + ); + } + _ => panic!("Unsupported GOB type"), + } } #[no_mangle] @@ -583,12 +588,17 @@ pub unsafe extern "C" fn nil_copy_tiled_to_linear( linear_plane_stride_B, ); - copy_tiled::>( - *tiling, - level_extent_B, - tiled_src, - linear_pointer, - offset_B, - end_B, - ); + match tiling.gob_type { + GOBType::TuringColor2D => { + copy_tiled::>( + *tiling, + level_extent_B, + tiled_src, + linear_pointer, + offset_B, + end_B, + ); + } + _ => panic!("Unsupported GOB type"), + } }