mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
panvk: Store various physical device properties at the physical_device level
This allows us to get rid of some panvk_physical_device::pdev accesses. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Constantine Shablya <constantine.shablya@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26698>
This commit is contained in:
parent
2e65d7347e
commit
92fa7468a1
12 changed files with 97 additions and 58 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include "panvk_private.h"
|
||||
|
||||
#include "pan_encoder.h"
|
||||
#include "pan_props.h"
|
||||
|
||||
#include "util/rounding.h"
|
||||
#include "vk_format.h"
|
||||
|
|
@ -482,7 +483,8 @@ panvk_cmd_fb_info_init(struct panvk_cmd_buffer *cmdbuf)
|
|||
memset(cmdbuf->state.fb.crc_valid, 0, sizeof(cmdbuf->state.fb.crc_valid));
|
||||
|
||||
*fbinfo = (struct pan_fb_info){
|
||||
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||
.tile_buf_budget = panfrost_query_optimal_tib_size(
|
||||
cmdbuf->device->physical_device->model),
|
||||
.width = fb->width,
|
||||
.height = fb->height,
|
||||
.extent.maxx = fb->width - 1,
|
||||
|
|
|
|||
|
|
@ -297,7 +297,8 @@ panvk_physical_device_finish(struct panvk_physical_device *device)
|
|||
{
|
||||
panvk_wsi_finish(device);
|
||||
|
||||
panvk_arch_dispatch(device->pdev.arch, meta_cleanup, device);
|
||||
panvk_arch_dispatch(pan_arch(device->kmod.props.gpu_prod_id), meta_cleanup,
|
||||
device);
|
||||
panfrost_close_device(&device->pdev);
|
||||
if (device->master_fd != -1)
|
||||
close(device->master_fd);
|
||||
|
|
@ -454,18 +455,26 @@ panvk_physical_device_init(struct panvk_physical_device *device,
|
|||
panfrost_open_device(NULL, fd, &device->pdev);
|
||||
fd = -1;
|
||||
|
||||
if (device->pdev.arch <= 5 || device->pdev.arch >= 8) {
|
||||
pan_kmod_dev_query_props(device->pdev.kmod.dev, &device->kmod.props);
|
||||
|
||||
unsigned arch = pan_arch(device->kmod.props.gpu_prod_id);
|
||||
|
||||
device->model = panfrost_get_model(device->kmod.props.gpu_prod_id);
|
||||
device->formats.all = panfrost_format_table(arch);
|
||||
device->formats.blendable = panfrost_blendable_format_table(arch);
|
||||
|
||||
if (arch <= 5 || arch >= 8) {
|
||||
result = vk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER,
|
||||
"%s not supported", device->pdev.model->name);
|
||||
"%s not supported", device->model->name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
panvk_arch_dispatch(device->pdev.arch, meta_init, device);
|
||||
panvk_arch_dispatch(arch, meta_init, device);
|
||||
|
||||
memset(device->name, 0, sizeof(device->name));
|
||||
sprintf(device->name, "%s", device->pdev.model->name);
|
||||
sprintf(device->name, "%s", device->model->name);
|
||||
|
||||
if (panvk_device_get_cache_uuid(panfrost_device_gpu_id(&device->pdev),
|
||||
if (panvk_device_get_cache_uuid(device->kmod.props.gpu_prod_id,
|
||||
device->cache_uuid)) {
|
||||
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"cannot generate UUID");
|
||||
|
|
@ -814,7 +823,9 @@ panvk_queue_init(struct panvk_device *device, struct panvk_queue *queue,
|
|||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
switch (pdev->arch) {
|
||||
unsigned arch = pan_arch(device->physical_device->kmod.props.gpu_prod_id);
|
||||
|
||||
switch (arch) {
|
||||
case 6:
|
||||
queue->vk.driver_submit = panvk_v6_queue_submit;
|
||||
break;
|
||||
|
|
@ -852,8 +863,9 @@ panvk_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||
const struct vk_device_entrypoint_table *dev_entrypoints;
|
||||
const struct vk_command_buffer_ops *cmd_buffer_ops;
|
||||
struct vk_device_dispatch_table dispatch_table;
|
||||
unsigned arch = pan_arch(physical_device->kmod.props.gpu_prod_id);
|
||||
|
||||
switch (physical_device->pdev.arch) {
|
||||
switch (arch) {
|
||||
case 6:
|
||||
dev_entrypoints = &panvk_v6_device_entrypoints;
|
||||
cmd_buffer_ops = &panvk_v6_cmd_buffer_ops;
|
||||
|
|
|
|||
|
|
@ -39,10 +39,9 @@ static void
|
|||
get_format_properties(struct panvk_physical_device *physical_device,
|
||||
VkFormat format, VkFormatProperties *out_properties)
|
||||
{
|
||||
struct panfrost_device *pdev = &physical_device->pdev;
|
||||
VkFormatFeatureFlags tex = 0, buffer = 0;
|
||||
enum pipe_format pfmt = vk_format_to_pipe_format(format);
|
||||
const struct panfrost_format fmt = pdev->formats[pfmt];
|
||||
const struct panfrost_format fmt = physical_device->formats.all[pfmt];
|
||||
|
||||
if (!pfmt || !fmt.hw)
|
||||
goto end;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "pan_props.h"
|
||||
|
||||
#include "panvk_private.h"
|
||||
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
|
|
@ -70,7 +72,6 @@ panvk_image_create(VkDevice _device, const VkImageCreateInfo *pCreateInfo,
|
|||
uint64_t modifier, const VkSubresourceLayout *plane_layouts)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_device, device, _device);
|
||||
const struct panfrost_device *pdev = &device->physical_device->pdev;
|
||||
struct panvk_image *image = NULL;
|
||||
|
||||
image = vk_image_create(&device->vk, pCreateInfo, alloc, sizeof(*image));
|
||||
|
|
@ -89,7 +90,8 @@ panvk_image_create(VkDevice _device, const VkImageCreateInfo *pCreateInfo,
|
|||
.nr_slices = image->vk.mip_levels,
|
||||
};
|
||||
|
||||
pan_image_layout_init(pdev->arch, &image->pimage.layout, NULL);
|
||||
unsigned arch = pan_arch(device->physical_device->kmod.props.gpu_prod_id);
|
||||
pan_image_layout_init(arch, &image->pimage.layout, NULL);
|
||||
|
||||
*pImage = panvk_image_to_handle(image);
|
||||
return VK_SUCCESS;
|
||||
|
|
@ -100,7 +102,6 @@ panvk_image_select_mod(VkDevice _device, const VkImageCreateInfo *pCreateInfo,
|
|||
const VkSubresourceLayout **plane_layouts)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_device, device, _device);
|
||||
const struct panfrost_device *pdev = &device->physical_device->pdev;
|
||||
enum pipe_format fmt = vk_format_to_pipe_format(pCreateInfo->format);
|
||||
bool noafbc =
|
||||
!(device->physical_device->instance->debug_flags & PANVK_DEBUG_AFBC);
|
||||
|
|
@ -162,17 +163,18 @@ panvk_image_select_mod(VkDevice _device, const VkImageCreateInfo *pCreateInfo,
|
|||
if (pCreateInfo->samples > 1)
|
||||
return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
|
||||
|
||||
if (!pdev->has_afbc)
|
||||
if (!panfrost_query_afbc(&device->physical_device->kmod.props))
|
||||
return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
|
||||
|
||||
/* Only a small selection of formats are AFBC'able */
|
||||
if (!panfrost_format_supports_afbc(pdev->arch, fmt))
|
||||
unsigned arch = pan_arch(device->physical_device->kmod.props.gpu_prod_id);
|
||||
if (!panfrost_format_supports_afbc(arch, fmt))
|
||||
return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
|
||||
|
||||
/* 3D AFBC is only supported on Bifrost v7+. It's supposed to
|
||||
* be supported on Midgard but it doesn't seem to work.
|
||||
*/
|
||||
if (pCreateInfo->imageType == VK_IMAGE_TYPE_3D && pdev->arch < 7)
|
||||
if (pCreateInfo->imageType == VK_IMAGE_TYPE_3D && arch < 7)
|
||||
return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
|
||||
|
||||
/* For one tile, AFBC is a loss compared to u-interleaved */
|
||||
|
|
|
|||
|
|
@ -175,6 +175,16 @@ struct panvk_physical_device {
|
|||
/* The API agnostic device object. */
|
||||
struct panfrost_device pdev;
|
||||
|
||||
struct {
|
||||
struct pan_kmod_dev_props props;
|
||||
} kmod;
|
||||
|
||||
const struct panfrost_model *model;
|
||||
struct {
|
||||
const struct pan_blendable_format *blendable;
|
||||
const struct panfrost_format *all;
|
||||
} formats;
|
||||
|
||||
struct panvk_instance *instance;
|
||||
|
||||
char name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
|
||||
|
|
@ -1095,7 +1105,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(panvk_sampler, base, VkSampler,
|
|||
#endif
|
||||
|
||||
#ifdef PAN_ARCH
|
||||
bool panvk_per_arch(blend_needs_lowering)(const struct panfrost_device *dev,
|
||||
bool panvk_per_arch(blend_needs_lowering)(const struct panvk_device *dev,
|
||||
const struct pan_blend_state *state,
|
||||
unsigned rt);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "pan_blitter.h"
|
||||
#include "pan_desc.h"
|
||||
#include "pan_encoder.h"
|
||||
#include "pan_props.h"
|
||||
#include "pan_samples.h"
|
||||
|
||||
#include "util/rounding.h"
|
||||
|
|
@ -101,6 +102,7 @@ panvk_per_arch(cmd_close_batch)(struct panvk_cmd_buffer *cmdbuf)
|
|||
return;
|
||||
}
|
||||
|
||||
struct panvk_device *dev = cmdbuf->device;
|
||||
struct panfrost_device *pdev = &cmdbuf->device->physical_device->pdev;
|
||||
|
||||
list_addtail(&batch->node, &cmdbuf->batches);
|
||||
|
|
@ -115,8 +117,15 @@ panvk_per_arch(cmd_close_batch)(struct panvk_cmd_buffer *cmdbuf)
|
|||
}
|
||||
|
||||
if (batch->tlsinfo.tls.size) {
|
||||
unsigned thread_tls_alloc =
|
||||
panfrost_query_thread_tls_alloc(&dev->physical_device->kmod.props);
|
||||
unsigned core_id_range;
|
||||
|
||||
panfrost_query_core_count(&dev->physical_device->kmod.props,
|
||||
&core_id_range);
|
||||
|
||||
unsigned size = panfrost_get_total_stack_size(
|
||||
batch->tlsinfo.tls.size, pdev->thread_tls_alloc, pdev->core_id_range);
|
||||
batch->tlsinfo.tls.size, thread_tls_alloc, core_id_range);
|
||||
batch->tlsinfo.tls.ptr =
|
||||
pan_pool_alloc_aligned(&cmdbuf->tls_pool.base, size, 4096).gpu;
|
||||
}
|
||||
|
|
@ -1169,13 +1178,13 @@ panvk_per_arch(CmdDispatch)(VkCommandBuffer commandBuffer, uint32_t x,
|
|||
uint32_t y, uint32_t z)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer);
|
||||
const struct panfrost_device *pdev = &cmdbuf->device->physical_device->pdev;
|
||||
struct panvk_dispatch_info dispatch = {
|
||||
.wg_count = {x, y, z},
|
||||
};
|
||||
|
||||
panvk_per_arch(cmd_close_batch)(cmdbuf);
|
||||
struct panvk_batch *batch = panvk_cmd_open_batch(cmdbuf);
|
||||
struct panvk_device *dev = cmdbuf->device;
|
||||
|
||||
struct panvk_cmd_bind_point_state *bind_point_state =
|
||||
panvk_cmd_get_bind_point_state(cmdbuf, COMPUTE);
|
||||
|
|
@ -1216,9 +1225,13 @@ panvk_per_arch(CmdDispatch)(VkCommandBuffer commandBuffer, uint32_t x,
|
|||
batch->tlsinfo.tls.size = pipeline->tls_size;
|
||||
batch->tlsinfo.wls.size = pipeline->wls_size;
|
||||
if (batch->tlsinfo.wls.size) {
|
||||
unsigned core_id_range;
|
||||
|
||||
panfrost_query_core_count(&dev->physical_device->kmod.props,
|
||||
&core_id_range);
|
||||
batch->wls_total_size = pan_wls_adjust_size(batch->tlsinfo.wls.size) *
|
||||
pan_wls_instances(&dispatch.wg_count) *
|
||||
pdev->core_id_range;
|
||||
core_id_range;
|
||||
}
|
||||
|
||||
panvk_per_arch(cmd_close_batch)(cmdbuf);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ panvk_queue_submit_batch(struct panvk_queue *queue, struct panvk_batch *batch,
|
|||
|
||||
if (debug & PANVK_DEBUG_TRACE) {
|
||||
pandecode_jc(pdev->decode_ctx, batch->jc.first_job,
|
||||
panfrost_device_gpu_id(pdev));
|
||||
dev->physical_device->kmod.props.gpu_prod_id);
|
||||
}
|
||||
|
||||
if (debug & PANVK_DEBUG_DUMP)
|
||||
|
|
@ -114,7 +114,7 @@ panvk_queue_submit_batch(struct panvk_queue *queue, struct panvk_batch *batch,
|
|||
|
||||
if (debug & PANVK_DEBUG_TRACE)
|
||||
pandecode_jc(pdev->decode_ctx, batch->fragment_job,
|
||||
panfrost_device_gpu_id(pdev));
|
||||
dev->physical_device->kmod.props.gpu_prod_id);
|
||||
|
||||
if (debug & PANVK_DEBUG_DUMP)
|
||||
pandecode_dump_mappings(pdev->decode_ctx);
|
||||
|
|
|
|||
|
|
@ -24,13 +24,14 @@
|
|||
#include "gen_macros.h"
|
||||
|
||||
#include "pan_blitter.h"
|
||||
#include "pan_props.h"
|
||||
|
||||
#include "panvk_private.h"
|
||||
|
||||
static void
|
||||
panvk_meta_blit(struct panvk_cmd_buffer *cmdbuf,
|
||||
const struct pan_blit_info *blitinfo,
|
||||
const struct panvk_image *src_img,
|
||||
const struct panvk_image *src_img,
|
||||
const struct panvk_image *dst_img)
|
||||
{
|
||||
struct panfrost_device *pdev = &cmdbuf->device->physical_device->pdev;
|
||||
|
|
@ -55,7 +56,8 @@ panvk_meta_blit(struct panvk_cmd_buffer *cmdbuf,
|
|||
};
|
||||
|
||||
*fbinfo = (struct pan_fb_info){
|
||||
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||
.tile_buf_budget = panfrost_query_optimal_tib_size(
|
||||
cmdbuf->device->physical_device->model),
|
||||
.width = u_minify(blitinfo->dst.planes[0].image->layout.width,
|
||||
blitinfo->dst.level),
|
||||
.height = u_minify(blitinfo->dst.planes[0].image->layout.height,
|
||||
|
|
@ -114,7 +116,8 @@ panvk_meta_blit(struct panvk_cmd_buffer *cmdbuf,
|
|||
|
||||
panvk_per_arch(cmd_close_batch)(cmdbuf);
|
||||
|
||||
GENX(pan_blit_ctx_init)(&pdev->blitter, blitinfo, &cmdbuf->desc_pool.base, &ctx);
|
||||
GENX(pan_blit_ctx_init)
|
||||
(&pdev->blitter, blitinfo, &cmdbuf->desc_pool.base, &ctx);
|
||||
do {
|
||||
if (ctx.dst.cur_layer < 0)
|
||||
continue;
|
||||
|
|
@ -230,11 +233,10 @@ panvk_per_arch(meta_blit_init)(struct panvk_physical_device *dev)
|
|||
panvk_pool_init(&dev->meta.blitter.desc_pool, &dev->pdev, NULL, 0, 16 * 1024,
|
||||
"panvk_meta blitter descriptor pool", false);
|
||||
pan_blend_shader_cache_init(&dev->pdev.blend_shaders,
|
||||
panfrost_device_gpu_id(&dev->pdev));
|
||||
dev->kmod.props.gpu_prod_id);
|
||||
GENX(pan_blitter_cache_init)
|
||||
(&dev->pdev.blitter, panfrost_device_gpu_id(&dev->pdev),
|
||||
&dev->pdev.blend_shaders, &dev->meta.blitter.bin_pool.base,
|
||||
&dev->meta.blitter.desc_pool.base);
|
||||
(&dev->pdev.blitter, dev->kmod.props.gpu_prod_id, &dev->pdev.blend_shaders,
|
||||
&dev->meta.blitter.bin_pool.base, &dev->meta.blitter.desc_pool.base);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "nir/nir_builder.h"
|
||||
#include "pan_blitter.h"
|
||||
#include "pan_encoder.h"
|
||||
#include "pan_props.h"
|
||||
#include "pan_shader.h"
|
||||
|
||||
#include "panvk_private.h"
|
||||
|
|
@ -37,7 +38,6 @@ panvk_meta_clear_color_attachment_shader(struct panvk_physical_device *dev,
|
|||
struct pan_shader_info *shader_info)
|
||||
{
|
||||
struct pan_pool *bin_pool = &dev->meta.bin_pool.base;
|
||||
struct panfrost_device *pdev = &dev->pdev;
|
||||
|
||||
nir_builder b = nir_builder_init_simple_shader(
|
||||
MESA_SHADER_FRAGMENT, GENX(pan_shader_get_compiler_options)(),
|
||||
|
|
@ -53,7 +53,7 @@ panvk_meta_clear_color_attachment_shader(struct panvk_physical_device *dev,
|
|||
nir_store_var(&b, out, clear_values, 0xff);
|
||||
|
||||
struct panfrost_compile_inputs inputs = {
|
||||
.gpu_id = panfrost_device_gpu_id(pdev),
|
||||
.gpu_id = dev->kmod.props.gpu_prod_id,
|
||||
.is_blit = true,
|
||||
.no_ubo_to_push = true,
|
||||
};
|
||||
|
|
@ -330,7 +330,8 @@ panvk_meta_clear_color_img(struct panvk_cmd_buffer *cmdbuf,
|
|||
|
||||
cmdbuf->state.fb.crc_valid[0] = false;
|
||||
*fbinfo = (struct pan_fb_info){
|
||||
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||
.tile_buf_budget = panfrost_query_optimal_tib_size(
|
||||
cmdbuf->device->physical_device->model),
|
||||
.nr_samples = img->pimage.layout.nr_samples,
|
||||
.rt_count = 1,
|
||||
.rts[0].view = &view,
|
||||
|
|
@ -400,7 +401,8 @@ panvk_meta_clear_zs_img(struct panvk_cmd_buffer *cmdbuf,
|
|||
|
||||
cmdbuf->state.fb.crc_valid[0] = false;
|
||||
*fbinfo = (struct pan_fb_info){
|
||||
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||
.tile_buf_budget = panfrost_query_optimal_tib_size(
|
||||
cmdbuf->device->physical_device->model),
|
||||
.nr_samples = img->pimage.layout.nr_samples,
|
||||
.rt_count = 1,
|
||||
.zs.clear_value.depth = value->depth,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "nir/nir_builder.h"
|
||||
#include "pan_encoder.h"
|
||||
#include "pan_props.h"
|
||||
#include "pan_shader.h"
|
||||
|
||||
#include "panvk_private.h"
|
||||
|
|
@ -289,7 +290,6 @@ panvk_meta_copy_img2img_shader(struct panvk_physical_device *dev,
|
|||
struct pan_shader_info *shader_info)
|
||||
{
|
||||
struct pan_pool *bin_pool = &dev->meta.bin_pool.base;
|
||||
struct panfrost_device *pdev = &dev->pdev;
|
||||
|
||||
nir_builder b = nir_builder_init_simple_shader(
|
||||
MESA_SHADER_FRAGMENT, GENX(pan_shader_get_compiler_options)(),
|
||||
|
|
@ -416,7 +416,7 @@ panvk_meta_copy_img2img_shader(struct panvk_physical_device *dev,
|
|||
nir_store_var(&b, out, texel, 0xff);
|
||||
|
||||
struct panfrost_compile_inputs inputs = {
|
||||
.gpu_id = panfrost_device_gpu_id(pdev),
|
||||
.gpu_id = dev->kmod.props.gpu_prod_id,
|
||||
.is_blit = true,
|
||||
.no_ubo_to_push = true,
|
||||
};
|
||||
|
|
@ -624,7 +624,8 @@ panvk_meta_copy_img2img(struct panvk_cmd_buffer *cmdbuf,
|
|||
u_minify(dst->pimage.layout.height, region->dstSubresource.mipLevel);
|
||||
cmdbuf->state.fb.crc_valid[0] = false;
|
||||
*fbinfo = (struct pan_fb_info){
|
||||
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||
.tile_buf_budget = panfrost_query_optimal_tib_size(
|
||||
cmdbuf->device->physical_device->model),
|
||||
.width = width,
|
||||
.height = height,
|
||||
.extent.minx = minx & ~31,
|
||||
|
|
@ -853,7 +854,6 @@ panvk_meta_copy_buf2img_shader(struct panvk_physical_device *dev,
|
|||
struct pan_shader_info *shader_info)
|
||||
{
|
||||
struct pan_pool *bin_pool = &dev->meta.bin_pool.base;
|
||||
struct panfrost_device *pdev = &dev->pdev;
|
||||
|
||||
nir_builder b = nir_builder_init_simple_shader(
|
||||
MESA_SHADER_FRAGMENT, GENX(pan_shader_get_compiler_options)(),
|
||||
|
|
@ -957,7 +957,7 @@ panvk_meta_copy_buf2img_shader(struct panvk_physical_device *dev,
|
|||
nir_store_var(&b, out, texel, 0xff);
|
||||
|
||||
struct panfrost_compile_inputs inputs = {
|
||||
.gpu_id = panfrost_device_gpu_id(pdev),
|
||||
.gpu_id = dev->kmod.props.gpu_prod_id,
|
||||
.is_blit = true,
|
||||
.no_ubo_to_push = true,
|
||||
};
|
||||
|
|
@ -1054,7 +1054,8 @@ panvk_meta_copy_buf2img(struct panvk_cmd_buffer *cmdbuf,
|
|||
/* TODO: don't force preloads of dst resources if unneeded */
|
||||
cmdbuf->state.fb.crc_valid[0] = false;
|
||||
*fbinfo = (struct pan_fb_info){
|
||||
.tile_buf_budget = cmdbuf->device->physical_device->pdev.optimal_tib_size,
|
||||
.tile_buf_budget = panfrost_query_optimal_tib_size(
|
||||
cmdbuf->device->physical_device->model),
|
||||
.width =
|
||||
u_minify(img->pimage.layout.width, region->imageSubresource.mipLevel),
|
||||
.height =
|
||||
|
|
@ -1244,7 +1245,6 @@ panvk_meta_copy_img2buf_shader(struct panvk_physical_device *dev,
|
|||
unsigned imgtexelsz = util_format_get_blocksize(key.imgfmt);
|
||||
unsigned buftexelsz = panvk_meta_copy_buf_texelsize(key.imgfmt, key.mask);
|
||||
struct pan_pool *bin_pool = &dev->meta.bin_pool.base;
|
||||
struct panfrost_device *pdev = &dev->pdev;
|
||||
|
||||
/* FIXME: Won't work on compute queues, but we can't do that with
|
||||
* a compute shader if the destination is an AFBC surface.
|
||||
|
|
@ -1416,7 +1416,7 @@ panvk_meta_copy_img2buf_shader(struct panvk_physical_device *dev,
|
|||
nir_pop_if(&b, NULL);
|
||||
|
||||
struct panfrost_compile_inputs inputs = {
|
||||
.gpu_id = panfrost_device_gpu_id(pdev),
|
||||
.gpu_id = dev->kmod.props.gpu_prod_id,
|
||||
.is_blit = true,
|
||||
.no_ubo_to_push = true,
|
||||
};
|
||||
|
|
@ -1620,7 +1620,6 @@ panvk_meta_copy_buf2buf_shader(struct panvk_physical_device *dev,
|
|||
struct pan_shader_info *shader_info)
|
||||
{
|
||||
struct pan_pool *bin_pool = &dev->meta.bin_pool.base;
|
||||
struct panfrost_device *pdev = &dev->pdev;
|
||||
|
||||
/* FIXME: Won't work on compute queues, but we can't do that with
|
||||
* a compute shader if the destination is an AFBC surface.
|
||||
|
|
@ -1645,7 +1644,7 @@ panvk_meta_copy_buf2buf_shader(struct panvk_physical_device *dev,
|
|||
(1 << ncomps) - 1);
|
||||
|
||||
struct panfrost_compile_inputs inputs = {
|
||||
.gpu_id = panfrost_device_gpu_id(pdev),
|
||||
.gpu_id = dev->kmod.props.gpu_prod_id,
|
||||
.is_blit = true,
|
||||
.no_ubo_to_push = true,
|
||||
};
|
||||
|
|
@ -1753,7 +1752,6 @@ panvk_meta_fill_buf_shader(struct panvk_physical_device *dev,
|
|||
struct pan_shader_info *shader_info)
|
||||
{
|
||||
struct pan_pool *bin_pool = &dev->meta.bin_pool.base;
|
||||
struct panfrost_device *pdev = &dev->pdev;
|
||||
|
||||
/* FIXME: Won't work on compute queues, but we can't do that with
|
||||
* a compute shader if the destination is an AFBC surface.
|
||||
|
|
@ -1773,7 +1771,7 @@ panvk_meta_fill_buf_shader(struct panvk_physical_device *dev,
|
|||
nir_store_global(&b, ptr, sizeof(uint32_t), val, 1);
|
||||
|
||||
struct panfrost_compile_inputs inputs = {
|
||||
.gpu_id = panfrost_device_gpu_id(pdev),
|
||||
.gpu_id = dev->kmod.props.gpu_prod_id,
|
||||
.is_blit = true,
|
||||
.no_ubo_to_push = true,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ panvk_pipeline_builder_parse_input_assembly(
|
|||
}
|
||||
|
||||
bool
|
||||
panvk_per_arch(blend_needs_lowering)(const struct panfrost_device *dev,
|
||||
panvk_per_arch(blend_needs_lowering)(const struct panvk_device *dev,
|
||||
const struct pan_blend_state *state,
|
||||
unsigned rt)
|
||||
{
|
||||
|
|
@ -418,7 +418,8 @@ panvk_per_arch(blend_needs_lowering)(const struct panfrost_device *dev,
|
|||
if (!pan_blend_is_homogenous_constant(constant_mask, state->constants))
|
||||
return true;
|
||||
|
||||
bool supports_2src = pan_blend_supports_2src(dev->arch);
|
||||
unsigned arch = pan_arch(dev->physical_device->kmod.props.gpu_prod_id);
|
||||
bool supports_2src = pan_blend_supports_2src(arch);
|
||||
return !pan_blend_can_fixed_function(state->rts[rt].equation, supports_2src);
|
||||
}
|
||||
|
||||
|
|
@ -426,7 +427,6 @@ static void
|
|||
panvk_pipeline_builder_parse_color_blend(struct panvk_pipeline_builder *builder,
|
||||
struct panvk_pipeline *pipeline)
|
||||
{
|
||||
struct panfrost_device *pdev = &builder->device->physical_device->pdev;
|
||||
pipeline->blend.state.logicop_enable =
|
||||
builder->create_info.gfx->pColorBlendState->logicOpEnable;
|
||||
pipeline->blend.state.logicop_func =
|
||||
|
|
@ -475,10 +475,10 @@ panvk_pipeline_builder_parse_color_blend(struct panvk_pipeline_builder *builder,
|
|||
|
||||
pipeline->blend.reads_dest |= pan_blend_reads_dest(out->equation);
|
||||
|
||||
unsigned constant_mask =
|
||||
panvk_per_arch(blend_needs_lowering)(pdev, &pipeline->blend.state, i)
|
||||
? 0
|
||||
: pan_blend_constant_mask(out->equation);
|
||||
unsigned constant_mask = panvk_per_arch(blend_needs_lowering)(
|
||||
builder->device, &pipeline->blend.state, i)
|
||||
? 0
|
||||
: pan_blend_constant_mask(out->equation);
|
||||
pipeline->blend.constant[i].index = ffs(constant_mask) - 1;
|
||||
if (constant_mask) {
|
||||
/* On Bifrost, the blend constant is expressed with a UNORM of the
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ panvk_lower_sysvals(nir_builder *b, nir_instr *instr, void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
panvk_lower_blend(struct panfrost_device *pdev, nir_shader *nir,
|
||||
panvk_lower_blend(struct panvk_device *dev, nir_shader *nir,
|
||||
struct panfrost_compile_inputs *inputs,
|
||||
struct pan_blend_state *blend_state)
|
||||
{
|
||||
|
|
@ -135,7 +135,7 @@ panvk_lower_blend(struct panfrost_device *pdev, nir_shader *nir,
|
|||
for (unsigned rt = 0; rt < blend_state->rt_count; rt++) {
|
||||
struct pan_blend_rt_state *rt_state = &blend_state->rts[rt];
|
||||
|
||||
if (!panvk_per_arch(blend_needs_lowering)(pdev, blend_state, rt))
|
||||
if (!panvk_per_arch(blend_needs_lowering)(dev, blend_state, rt))
|
||||
continue;
|
||||
|
||||
enum pipe_format fmt = rt_state->format;
|
||||
|
|
@ -218,7 +218,6 @@ panvk_per_arch(shader_create)(struct panvk_device *dev, gl_shader_stage stage,
|
|||
const VkAllocationCallbacks *alloc)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_shader_module, module, stage_info->module);
|
||||
struct panfrost_device *pdev = &dev->physical_device->pdev;
|
||||
struct panvk_shader *shader;
|
||||
|
||||
shader = vk_zalloc2(&dev->vk.alloc, alloc, sizeof(*shader), 8,
|
||||
|
|
@ -254,7 +253,7 @@ panvk_per_arch(shader_create)(struct panvk_device *dev, gl_shader_stage stage,
|
|||
true, true);
|
||||
|
||||
struct panfrost_compile_inputs inputs = {
|
||||
.gpu_id = panfrost_device_gpu_id(pdev),
|
||||
.gpu_id = dev->physical_device->kmod.props.gpu_prod_id,
|
||||
.no_ubo_to_push = true,
|
||||
.no_idvs = true, /* TODO */
|
||||
};
|
||||
|
|
@ -347,7 +346,7 @@ panvk_per_arch(shader_create)(struct panvk_device *dev, gl_shader_stage stage,
|
|||
pan_shader_preprocess(nir, inputs.gpu_id);
|
||||
|
||||
if (stage == MESA_SHADER_FRAGMENT) {
|
||||
panvk_lower_blend(pdev, nir, &inputs, blend_state);
|
||||
panvk_lower_blend(dev, nir, &inputs, blend_state);
|
||||
}
|
||||
|
||||
struct sysval_options sysval_options = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue