From f8f0d6ce0dec81616f1ddd8161a42edf6a7f7052 Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Tue, 25 Nov 2025 16:09:56 -0500 Subject: [PATCH] nil: Add NIL_FORMAT_SUPPORTS_2D_ENGINE_BIT --- src/nouveau/nil/format.rs | 12 ++++++++++++ src/nouveau/nil/nil_format_table_gen.py | 17 ++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/nouveau/nil/format.rs b/src/nouveau/nil/format.rs index c742136fb53..25da0b895a2 100644 --- a/src/nouveau/nil/format.rs +++ b/src/nouveau/nil/format.rs @@ -122,6 +122,10 @@ impl Format { } self.info().support() & NIL_FORMAT_SUPPORTS_DEPTH_STENCIL_BIT != 0 } + + pub fn supports_2d_engine(&self, _dev: &nv_device_info) -> bool { + self.info().support() & NIL_FORMAT_SUPPORTS_2D_ENGINE_BIT != 0 + } } #[no_mangle] @@ -180,6 +184,14 @@ pub extern "C" fn nil_format_supports_depth_stencil( Format::try_from(p_format).is_ok_and(|f| f.supports_depth_stencil(dev)) } +#[no_mangle] +pub extern "C" fn nil_format_supports_2d_engine( + dev: &nv_device_info, + p_format: pipe_format, +) -> bool { + Format::try_from(p_format).is_ok_and(|f| f.supports_2d_engine(dev)) +} + #[no_mangle] pub extern "C" fn nil_format_to_color_target(p_format: pipe_format) -> u32 { Format::try_from(p_format).unwrap().info().czt() diff --git a/src/nouveau/nil/nil_format_table_gen.py b/src/nouveau/nil/nil_format_table_gen.py index ba8b64d968b..469e06c5841 100644 --- a/src/nouveau/nil/nil_format_table_gen.py +++ b/src/nouveau/nil/nil_format_table_gen.py @@ -27,6 +27,7 @@ enum nil_format_support_flags { NIL_FORMAT_SUPPORTS_ALPHA_BLEND_BIT = BITFIELD_BIT(4), NIL_FORMAT_SUPPORTS_DEPTH_STENCIL_BIT = BITFIELD_BIT(5), NIL_FORMAT_SUPPORTS_SCANOUT_BIT = BITFIELD_BIT(6), + NIL_FORMAT_SUPPORTS_2D_ENGINE_BIT = BITFIELD_BIT(7), }; struct nil_tic_format { @@ -62,6 +63,9 @@ TEMPLATE_C = template.Template(text="""\ #include "nil_format_table.h" +#include "nvtypes.h" + +#include "cl902d.h" #include "cl9097.h" #include "cl9097tex.h" #include "clb097.h" @@ -75,7 +79,13 @@ const struct nil_format_info nil_format_table[PIPE_FORMAT_COUNT] = { % for f in formats: [PIPE_FORMAT_${f.pipe}] = { .czt = ${f.czt()}, - .support = ${f.support()}, + .support = ${f.support()} | + #if defined(${f.twod()}) && ${f.twod()} == ${f.czt()} + NIL_FORMAT_SUPPORTS_2D_ENGINE_BIT + #else + 0 + #endif + , .tic_v2_data_type = ${f.v2_data_type()}, .tic = { .comp_sizes = ${f.tcs()}, @@ -106,6 +116,8 @@ ZT_FORMAT_PREFIX = { 'tk1' : 'NVB097_SET_ZT_FORMAT_V_', } +TWOD_FORMAT_PREFIX = "NV902D_SET_DST_FORMAT_V_" + TCS_PREFIX = { None : 'NV9097_TEXHEADV2_0_COMPONENT_SIZES_', 'maxwella' : 'NVB097_TEXHEAD_BL_COMPONENTS_SIZES_', @@ -188,6 +200,9 @@ class Format(object): else: return DATA_TYPES[self._types[0]] + def twod(self): + return TWOD_FORMAT_PREFIX + self._czt + def v2_data_type(self): return V2_DATA_TYPES[self._data_type]