nouveau/nil: Take an nv_device_info for image functions
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:

committed by
Marge Bot

parent
433e742682
commit
f23b892a9d
@@ -364,20 +364,20 @@ nvc0_choose_pte_kind(enum pipe_format format,
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
nil_choose_pte_kind(struct nouveau_ws_device *dev,
|
||||
nil_choose_pte_kind(struct nv_device_info *dev,
|
||||
enum pipe_format format,
|
||||
uint32_t samples, bool compressed)
|
||||
{
|
||||
if (dev->info.cls_eng3d >= TURING_A)
|
||||
if (dev->cls_eng3d >= TURING_A)
|
||||
return tu102_choose_pte_kind(format, compressed);
|
||||
else if (dev->info.cls_eng3d >= FERMI_A)
|
||||
else if (dev->cls_eng3d >= FERMI_A)
|
||||
return nvc0_choose_pte_kind(format, samples, compressed);
|
||||
else
|
||||
unreachable("Unsupported 3D engine class");
|
||||
}
|
||||
|
||||
bool
|
||||
nil_image_init(struct nouveau_ws_device *dev,
|
||||
nil_image_init(struct nv_device_info *dev,
|
||||
struct nil_image *image,
|
||||
const struct nil_image_init_info *restrict info)
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include "util/macros.h"
|
||||
#include "util/format/u_format.h"
|
||||
|
||||
struct nouveau_ws_device;
|
||||
struct nv_device_info;
|
||||
|
||||
enum PACKED nil_image_dim {
|
||||
NIL_IMAGE_DIM_1D = 1,
|
||||
@@ -180,7 +180,7 @@ struct nil_view {
|
||||
enum pipe_swizzle swizzle[4];
|
||||
};
|
||||
|
||||
bool nil_image_init(struct nouveau_ws_device *dev,
|
||||
bool nil_image_init(struct nv_device_info *dev,
|
||||
struct nil_image *image,
|
||||
const struct nil_image_init_info *restrict info);
|
||||
|
||||
@@ -205,13 +205,13 @@ void nil_image_3d_level_as_2d_array(const struct nil_image *image_3d,
|
||||
struct nil_image *image_2d_out,
|
||||
uint64_t *offset_B_out);
|
||||
|
||||
void nil_image_fill_tic(struct nouveau_ws_device *dev,
|
||||
void nil_image_fill_tic(struct nv_device_info *dev,
|
||||
const struct nil_image *image,
|
||||
const struct nil_view *view,
|
||||
uint64_t base_address,
|
||||
void *desc_out);
|
||||
|
||||
void nil_buffer_fill_tic(struct nouveau_ws_device *dev,
|
||||
void nil_buffer_fill_tic(struct nv_device_info *dev,
|
||||
uint64_t base_address,
|
||||
enum pipe_format format,
|
||||
uint32_t num_elements,
|
||||
|
@@ -281,8 +281,7 @@ nil_normalize_extent(const struct nil_image *image,
|
||||
}
|
||||
|
||||
static void
|
||||
nv9097_nil_image_fill_tic(struct nouveau_ws_device *dev,
|
||||
const struct nil_image *image,
|
||||
nv9097_nil_image_fill_tic(const struct nil_image *image,
|
||||
const struct nil_view *view,
|
||||
uint64_t base_address,
|
||||
void *desc_out)
|
||||
@@ -357,8 +356,7 @@ nv9097_nil_image_fill_tic(struct nouveau_ws_device *dev,
|
||||
}
|
||||
|
||||
static void
|
||||
nvb097_nil_image_fill_tic(struct nouveau_ws_device *dev,
|
||||
const struct nil_image *image,
|
||||
nvb097_nil_image_fill_tic(const struct nil_image *image,
|
||||
const struct nil_view *view,
|
||||
uint64_t base_address,
|
||||
void *desc_out)
|
||||
@@ -439,8 +437,7 @@ static const enum pipe_swizzle IDENTITY_SWIZZLE[4] = {
|
||||
};
|
||||
|
||||
static void
|
||||
nv9097_nil_buffer_fill_tic(struct nouveau_ws_device *dev,
|
||||
uint64_t base_address,
|
||||
nv9097_nil_buffer_fill_tic(uint64_t base_address,
|
||||
enum pipe_format format,
|
||||
uint32_t num_elements,
|
||||
void *desc_out)
|
||||
@@ -464,8 +461,7 @@ nv9097_nil_buffer_fill_tic(struct nouveau_ws_device *dev,
|
||||
}
|
||||
|
||||
static void
|
||||
nvb097_nil_buffer_fill_tic(struct nouveau_ws_device *dev,
|
||||
uint64_t base_address,
|
||||
nvb097_nil_buffer_fill_tic(uint64_t base_address,
|
||||
enum pipe_format format,
|
||||
uint32_t num_elements,
|
||||
void *desc_out)
|
||||
@@ -493,32 +489,32 @@ nvb097_nil_buffer_fill_tic(struct nouveau_ws_device *dev,
|
||||
}
|
||||
|
||||
void
|
||||
nil_image_fill_tic(struct nouveau_ws_device *dev,
|
||||
nil_image_fill_tic(struct nv_device_info *dev,
|
||||
const struct nil_image *image,
|
||||
const struct nil_view *view,
|
||||
uint64_t base_address,
|
||||
void *desc_out)
|
||||
{
|
||||
if (dev->info.cls_eng3d >= MAXWELL_A) {
|
||||
nvb097_nil_image_fill_tic(dev, image, view, base_address, desc_out);
|
||||
} else if (dev->info.cls_eng3d >= FERMI_A) {
|
||||
nv9097_nil_image_fill_tic(dev, image, view, base_address, desc_out);
|
||||
if (dev->cls_eng3d >= MAXWELL_A) {
|
||||
nvb097_nil_image_fill_tic(image, view, base_address, desc_out);
|
||||
} else if (dev->cls_eng3d >= FERMI_A) {
|
||||
nv9097_nil_image_fill_tic(image, view, base_address, desc_out);
|
||||
} else {
|
||||
unreachable("Tesla and older not supported");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nil_buffer_fill_tic(struct nouveau_ws_device *dev,
|
||||
nil_buffer_fill_tic(struct nv_device_info *dev,
|
||||
uint64_t base_address,
|
||||
enum pipe_format format,
|
||||
uint32_t num_elements,
|
||||
void *desc_out)
|
||||
{
|
||||
if (dev->info.cls_eng3d >= MAXWELL_A) {
|
||||
nvb097_nil_buffer_fill_tic(dev, base_address, format, num_elements, desc_out);
|
||||
} else if (dev->info.cls_eng3d >= FERMI_A) {
|
||||
nv9097_nil_buffer_fill_tic(dev, base_address, format, num_elements, desc_out);
|
||||
if (dev->cls_eng3d >= MAXWELL_A) {
|
||||
nvb097_nil_buffer_fill_tic(base_address, format, num_elements, desc_out);
|
||||
} else if (dev->cls_eng3d >= FERMI_A) {
|
||||
nv9097_nil_buffer_fill_tic(base_address, format, num_elements, desc_out);
|
||||
} else {
|
||||
unreachable("Tesla and older not supported");
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ nvk_CreateBufferView(VkDevice _device,
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
uint32_t desc[8];
|
||||
nil_buffer_fill_tic(nvk_device_physical(device)->dev,
|
||||
nil_buffer_fill_tic(&nvk_device_physical(device)->info,
|
||||
nvk_buffer_address(buffer, view->vk.offset),
|
||||
vk_format_to_pipe_format(view->vk.format),
|
||||
view->vk.elements, desc);
|
||||
|
@@ -262,7 +262,7 @@ nvk_image_init(struct nvk_device *device,
|
||||
.usage = usage,
|
||||
};
|
||||
|
||||
ASSERTED bool ok = nil_image_init(nvk_device_physical(device)->dev,
|
||||
ASSERTED bool ok = nil_image_init(&nvk_device_physical(device)->info,
|
||||
&image->nil, &nil_info);
|
||||
assert(ok);
|
||||
|
||||
|
@@ -106,7 +106,7 @@ nvk_image_view_init(struct nvk_device *device,
|
||||
if (view->vk.usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) {
|
||||
uint32_t tic[8];
|
||||
nil_image_fill_tic(nvk_device_physical(device)->dev,
|
||||
nil_image_fill_tic(&nvk_device_physical(device)->info,
|
||||
&nil_image, &nil_view, base_addr, tic);
|
||||
|
||||
result = nvk_descriptor_table_add(device, &device->images,
|
||||
@@ -138,7 +138,7 @@ nvk_image_view_init(struct nvk_device *device,
|
||||
}
|
||||
|
||||
uint32_t tic[8];
|
||||
nil_image_fill_tic(nvk_device_physical(device)->dev,
|
||||
nil_image_fill_tic(&nvk_device_physical(device)->info,
|
||||
&nil_image, &nil_view, base_addr, tic);
|
||||
|
||||
result = nvk_descriptor_table_add(device, &device->images,
|
||||
|
Reference in New Issue
Block a user