nouveau/nil: Use nv_device_info for format queries

There's no reason why any of this needs access to the fd or the context.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand
2023-01-30 20:12:05 -06:00
committed by Marge Bot
parent f23b892a9d
commit 6fd6baa989
5 changed files with 29 additions and 30 deletions
+8 -9
View File
@@ -357,7 +357,7 @@ static const struct nil_format_info nil_format_infos[PIPE_FORMAT_COUNT] =
};
bool
nil_format_supports_texturing(struct nouveau_ws_device *dev,
nil_format_supports_texturing(struct nv_device_info *dev,
enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
@@ -377,15 +377,14 @@ nil_format_supports_texturing(struct nouveau_ws_device *dev,
const struct util_format_description *desc = util_format_description(format);
if (desc->layout == UTIL_FORMAT_LAYOUT_ETC ||
desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
return dev->info.type == NV_DEVICE_TYPE_SOC &&
dev->info.cls_eng3d >= KEPLER_C;
return dev->type == NV_DEVICE_TYPE_SOC && dev->cls_eng3d >= KEPLER_C;
}
return true;
}
bool
nil_format_supports_filtering(struct nouveau_ws_device *dev,
nil_format_supports_filtering(struct nv_device_info *dev,
enum pipe_format format)
{
return nil_format_supports_texturing(dev, format) &&
@@ -393,7 +392,7 @@ nil_format_supports_filtering(struct nouveau_ws_device *dev,
}
bool
nil_format_supports_buffer(struct nouveau_ws_device *dev,
nil_format_supports_buffer(struct nv_device_info *dev,
enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
@@ -402,7 +401,7 @@ nil_format_supports_buffer(struct nouveau_ws_device *dev,
}
bool
nil_format_supports_storage(struct nouveau_ws_device *dev,
nil_format_supports_storage(struct nv_device_info *dev,
enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
@@ -411,7 +410,7 @@ nil_format_supports_storage(struct nouveau_ws_device *dev,
}
bool
nil_format_supports_color_targets(struct nouveau_ws_device *dev,
nil_format_supports_color_targets(struct nv_device_info *dev,
enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
@@ -420,7 +419,7 @@ nil_format_supports_color_targets(struct nouveau_ws_device *dev,
}
bool
nil_format_supports_blending(struct nouveau_ws_device *dev,
nil_format_supports_blending(struct nv_device_info *dev,
enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
@@ -429,7 +428,7 @@ nil_format_supports_blending(struct nouveau_ws_device *dev,
}
bool
nil_format_supports_depth_stencil(struct nouveau_ws_device *dev,
nil_format_supports_depth_stencil(struct nv_device_info *dev,
enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
+8 -8
View File
@@ -7,29 +7,29 @@
#include "util/format/u_format.h"
struct nouveau_ws_device;
struct nv_device_info;
/* We don't have our own format enum; we use PIPE_FORMAT for everything */
bool nil_format_supports_texturing(struct nouveau_ws_device *dev,
bool nil_format_supports_texturing(struct nv_device_info *dev,
enum pipe_format format);
bool nil_format_supports_filtering(struct nouveau_ws_device *dev,
bool nil_format_supports_filtering(struct nv_device_info *dev,
enum pipe_format format);
bool nil_format_supports_buffer(struct nouveau_ws_device *dev,
bool nil_format_supports_buffer(struct nv_device_info *dev,
enum pipe_format format);
bool nil_format_supports_storage(struct nouveau_ws_device *dev,
bool nil_format_supports_storage(struct nv_device_info *dev,
enum pipe_format format);
bool nil_format_supports_color_targets(struct nouveau_ws_device *dev,
bool nil_format_supports_color_targets(struct nv_device_info *dev,
enum pipe_format format);
bool nil_format_supports_blending(struct nouveau_ws_device *dev,
bool nil_format_supports_blending(struct nv_device_info *dev,
enum pipe_format format);
bool nil_format_supports_depth_stencil(struct nouveau_ws_device *dev,
bool nil_format_supports_depth_stencil(struct nv_device_info *dev,
enum pipe_format format);
uint8_t nil_format_to_color_target(enum pipe_format format);
+4 -4
View File
@@ -9,19 +9,19 @@
#include "vulkan/util/vk_format.h"
VkFormatFeatureFlags2
nvk_get_buffer_format_features(struct nvk_physical_device *pdevice,
nvk_get_buffer_format_features(struct nvk_physical_device *pdev,
VkFormat vk_format)
{
VkFormatFeatureFlags2 features = 0;
if (nvk_get_va_format(pdevice, vk_format))
if (nvk_get_va_format(pdev, vk_format))
features |= VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT;
enum pipe_format p_format = vk_format_to_pipe_format(vk_format);
if (nil_format_supports_buffer(pdevice->dev, p_format)) {
if (nil_format_supports_buffer(&pdev->info, p_format)) {
features |= VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT;
if (nil_format_supports_storage(pdevice->dev, p_format)) {
if (nil_format_supports_storage(&pdev->info, p_format)) {
features |= VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT |
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
}
+1 -1
View File
@@ -309,7 +309,7 @@ nvk_CmdClearColorImage(VkCommandBuffer commandBuffer,
enum pipe_format p_format = vk_format_to_pipe_format(vk_format);
assert(p_format != PIPE_FORMAT_NONE);
if (!nil_format_supports_color_targets(dev->pdev->dev, p_format)) {
if (!nil_format_supports_color_targets(&dev->pdev->info, p_format)) {
memset(&clear_value, 0, sizeof(clear_value));
util_format_pack_rgba(p_format, clear_value.color.uint32,
pColor->uint32, 1);
+8 -8
View File
@@ -11,7 +11,7 @@
#include "clb197.h"
VkFormatFeatureFlags2
nvk_get_image_format_features(struct nvk_physical_device *pdevice,
nvk_get_image_format_features(struct nvk_physical_device *pdev,
VkFormat vk_format, VkImageTiling tiling)
{
VkFormatFeatureFlags2 features = 0;
@@ -23,7 +23,7 @@ nvk_get_image_format_features(struct nvk_physical_device *pdevice,
if (p_format == PIPE_FORMAT_NONE)
return 0;
if (!nil_format_supports_texturing(pdevice->dev, p_format))
if (!nil_format_supports_texturing(&pdev->info, p_format))
return 0;
/* You can't tile a non-power-of-two */
@@ -35,9 +35,9 @@ nvk_get_image_format_features(struct nvk_physical_device *pdevice,
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT;
features |= VK_FORMAT_FEATURE_2_BLIT_SRC_BIT;
if (nil_format_supports_filtering(pdevice->dev, p_format)) {
if (nil_format_supports_filtering(&pdev->info, p_format)) {
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
if (pdevice->info.cls_eng3d >= MAXWELL_B)
if (pdev->info.cls_eng3d >= MAXWELL_B)
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT;
}
@@ -46,9 +46,9 @@ nvk_get_image_format_features(struct nvk_physical_device *pdevice,
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT;
}
if (nil_format_supports_color_targets(pdevice->dev, p_format)) {
if (nil_format_supports_color_targets(&pdev->info, p_format)) {
features |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT;
if (nil_format_supports_blending(pdevice->dev, p_format))
if (nil_format_supports_blending(&pdev->info, p_format))
features |= VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT;
features |= VK_FORMAT_FEATURE_2_BLIT_DST_BIT;
}
@@ -57,13 +57,13 @@ nvk_get_image_format_features(struct nvk_physical_device *pdevice,
if (vk_format == VK_FORMAT_D32_SFLOAT_S8_UINT)
return 0; /* TODO */
if (!nil_format_supports_depth_stencil(pdevice->dev, p_format))
if (!nil_format_supports_depth_stencil(&pdev->info, p_format))
return 0;
features |= VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT;
}
if (nil_format_supports_storage(pdevice->dev, p_format)) {
if (nil_format_supports_storage(&pdev->info, p_format)) {
features |= VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT |
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT;
}