pvr: break out image to separate header

Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37432>
This commit is contained in:
Erik Faye-Lund
2025-09-02 16:27:09 +02:00
committed by Marge Bot
parent 0cf8839a3d
commit e0d9effa7a
7 changed files with 99 additions and 68 deletions
+1
View File
@@ -32,6 +32,7 @@
#include "pvr_csb.h"
#include "pvr_device.h"
#include "pvr_formats.h"
#include "pvr_image.h"
#include "pvr_job_transfer.h"
#include "pvr_private.h"
#include "pvr_types.h"
+1
View File
@@ -41,6 +41,7 @@
#include "pvr_device_info.h"
#include "pvr_formats.h"
#include "pvr_hw_pass.h"
#include "pvr_image.h"
#include "pvr_job_common.h"
#include "pvr_job_render.h"
#include "pvr_limits.h"
@@ -32,6 +32,7 @@
#include "pvr_bo.h"
#include "pvr_debug.h"
#include "pvr_device.h"
#include "pvr_image.h"
#include "pvr_private.h"
#include "pvr_types.h"
#include "util/compiler.h"
+1
View File
@@ -55,6 +55,7 @@
#include "pvr_debug.h"
#include "pvr_device_info.h"
#include "pvr_dump_info.h"
#include "pvr_image.h"
#include "pvr_job_render.h"
#include "pvr_limits.h"
#include "pvr_pds.h"
+2
View File
@@ -21,6 +21,8 @@
* SOFTWARE.
*/
#include "pvr_image.h"
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
+93
View File
@@ -0,0 +1,93 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* based in part on anv driver which is:
* Copyright © 2015 Intel Corporation
*
* based in part on radv driver which is:
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* SPDX-License-Identifier: MIT
*/
#ifndef PVR_IMAGE_H
#define PVR_IMAGE_H
#include <stdint.h>
#include "vk_image.h"
#include "pvr_common.h"
#include "pvr_types.h"
struct pvr_mip_level {
/* Offset of the mip level in bytes */
uint32_t offset;
/* Aligned mip level size in bytes */
uint32_t size;
/* Aligned row length in bytes */
uint32_t pitch;
/* Aligned height in bytes */
uint32_t height_pitch;
};
struct pvr_image {
struct vk_image vk;
/* vma this image is bound to */
struct pvr_winsys_vma *vma;
/* Device address the image is mapped to in device virtual address space */
pvr_dev_addr_t dev_addr;
/* Derived and other state */
VkExtent3D physical_extent;
enum pvr_memlayout memlayout;
VkDeviceSize layer_size;
VkDeviceSize size;
VkDeviceSize alignment;
struct pvr_mip_level mip_levels[14];
};
struct pvr_image_view {
struct vk_image_view vk;
/* Prepacked Texture Image dword 0 and 1. It will be copied to the
* descriptor info during pvr_UpdateDescriptorSets().
*
* We create separate texture states for sampling, storage and input
* attachment cases.
*/
struct pvr_image_descriptor image_state[PVR_TEXTURE_STATE_MAX_ENUM];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_image_view,
vk.base,
VkImageView,
VK_OBJECT_TYPE_IMAGE_VIEW)
static inline const struct pvr_image *
vk_to_pvr_image(const struct vk_image *image)
{
return container_of(image, const struct pvr_image, vk);
}
static inline const struct pvr_image *
pvr_image_view_get_image(const struct pvr_image_view *const iview)
{
return vk_to_pvr_image(iview->vk.image);
}
void pvr_get_image_subresource_layout(const struct pvr_image *image,
const VkImageSubresource *subresource,
VkSubresourceLayout *layout);
#endif /* PVR_IMAGE_H */
-68
View File
@@ -66,7 +66,6 @@
#include "vk_command_buffer.h"
#include "vk_enum_to_str.h"
#include "vk_graphics_state.h"
#include "vk_image.h"
#include "vk_log.h"
#include "vk_sync.h"
#include "wsi_common.h"
@@ -91,40 +90,6 @@ struct pvr_vertex_binding {
VkDeviceSize size;
};
struct pvr_mip_level {
/* Offset of the mip level in bytes */
uint32_t offset;
/* Aligned mip level size in bytes */
uint32_t size;
/* Aligned row length in bytes */
uint32_t pitch;
/* Aligned height in bytes */
uint32_t height_pitch;
};
struct pvr_image {
struct vk_image vk;
/* vma this image is bound to */
struct pvr_winsys_vma *vma;
/* Device address the image is mapped to in device virtual address space */
pvr_dev_addr_t dev_addr;
/* Derived and other state */
VkExtent3D physical_extent;
enum pvr_memlayout memlayout;
VkDeviceSize layer_size;
VkDeviceSize size;
VkDeviceSize alignment;
struct pvr_mip_level mip_levels[14];
};
struct pvr_buffer {
struct vk_buffer vk;
@@ -136,18 +101,6 @@ struct pvr_buffer {
pvr_dev_addr_t dev_addr;
};
struct pvr_image_view {
struct vk_image_view vk;
/* Prepacked Texture Image dword 0 and 1. It will be copied to the
* descriptor info during pvr_UpdateDescriptorSets().
*
* We create separate texture states for sampling, storage and input
* attachment cases.
*/
struct pvr_image_descriptor image_state[PVR_TEXTURE_STATE_MAX_ENUM];
};
#define PVR_BUFFER_VIEW_WIDTH 8192U
struct pvr_buffer_view {
@@ -1030,10 +983,6 @@ void pvr_calculate_vertex_cam_size(const struct pvr_device_info *dev_info,
uint32_t *const cam_size_out,
uint32_t *const vs_max_instances_out);
void pvr_get_image_subresource_layout(const struct pvr_image *image,
const VkImageSubresource *subresource,
VkSubresourceLayout *layout);
static inline struct pvr_compute_pipeline *
to_pvr_compute_pipeline(struct pvr_pipeline *pipeline)
{
@@ -1054,18 +1003,6 @@ vk_to_pvr_descriptor_set_layout(struct vk_descriptor_set_layout *layout)
return container_of(layout, struct pvr_descriptor_set_layout, vk);
}
static inline const struct pvr_image *
vk_to_pvr_image(const struct vk_image *image)
{
return container_of(image, const struct pvr_image, vk);
}
static inline const struct pvr_image *
pvr_image_view_get_image(const struct pvr_image_view *const iview)
{
return vk_to_pvr_image(iview->vk.image);
}
static enum pvr_pipeline_stage_bits
pvr_stage_mask(VkPipelineStageFlags2 stage_mask)
{
@@ -1222,15 +1159,10 @@ VK_DEFINE_HANDLE_CASTS(pvr_cmd_buffer,
VkCommandBuffer,
VK_OBJECT_TYPE_COMMAND_BUFFER)
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_buffer,
vk.base,
VkBuffer,
VK_OBJECT_TYPE_BUFFER)
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_image_view,
vk.base,
VkImageView,
VK_OBJECT_TYPE_IMAGE_VIEW)
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_buffer_view,
vk.base,
VkBufferView,