nil: Add NIL_FORMAT_SUPPORTS_2D_ENGINE_BIT

This commit is contained in:
Mel Henning 2025-11-25 16:09:56 -05:00
parent 5aab36b32e
commit f8f0d6ce0d
2 changed files with 28 additions and 1 deletions

View file

@ -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()

View file

@ -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]