panvk: adopt PANVK_DEBUG(category)
This change also cleans up redundant local variables (mostly just panvk_instance), struct fields and function args. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37752>
This commit is contained in:
@@ -119,10 +119,8 @@ panvk_bind_queue_submit_init(struct panvk_bind_queue_submit *submit,
|
||||
{
|
||||
struct panvk_bind_queue *queue =
|
||||
container_of(vk_queue, struct panvk_bind_queue, vk);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(queue->vk.base.device->physical->base.instance);
|
||||
|
||||
bool force_sync = instance->debug_flags & PANVK_DEBUG_SYNC;
|
||||
const bool force_sync = PANVK_DEBUG(SYNC);
|
||||
|
||||
*submit = (struct panvk_bind_queue_submit){
|
||||
.queue = queue,
|
||||
|
||||
@@ -120,8 +120,6 @@ static void
|
||||
finish_cs(struct panvk_cmd_buffer *cmdbuf, uint32_t subqueue)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
struct cs_builder *b = panvk_get_cs_builder(cmdbuf, subqueue);
|
||||
|
||||
cs_wait_slots(b, dev->csf.sb.all_mask);
|
||||
@@ -172,7 +170,7 @@ finish_cs(struct panvk_cmd_buffer *cmdbuf, uint32_t subqueue)
|
||||
* last render pass was suspended. In practice we could preserve only the
|
||||
* registers that matter, but this is a debug feature so let's keep things
|
||||
* simple with this all-or-nothing approach. */
|
||||
if ((instance->debug_flags & PANVK_DEBUG_CS) &&
|
||||
if (PANVK_DEBUG(CS) &&
|
||||
cmdbuf->vk.level != VK_COMMAND_BUFFER_LEVEL_SECONDARY &&
|
||||
!cmdbuf->state.gfx.render.suspended) {
|
||||
cs_update_cmdbuf_regs(b) {
|
||||
@@ -866,8 +864,6 @@ static void
|
||||
init_cs_builders(struct panvk_cmd_buffer *cmdbuf)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
const reg_perm_cb_t base_reg_perms[PANVK_SUBQUEUE_COUNT] = {
|
||||
[PANVK_SUBQUEUE_VERTEX_TILER] = panvk_cs_vt_reg_perm,
|
||||
[PANVK_SUBQUEUE_FRAGMENT] = panvk_cs_frag_reg_perm,
|
||||
@@ -890,7 +886,7 @@ init_cs_builders(struct panvk_cmd_buffer *cmdbuf)
|
||||
.ls_sb_slot = SB_ID(LS),
|
||||
};
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_CS) {
|
||||
if (PANVK_DEBUG(CS)) {
|
||||
cmdbuf->state.cs[i].reg_access.upd_ctx_stack = NULL;
|
||||
cmdbuf->state.cs[i].reg_access.base_perm = base_reg_perms[i];
|
||||
conf.reg_perm = cs_reg_perm;
|
||||
@@ -898,7 +894,7 @@ init_cs_builders(struct panvk_cmd_buffer *cmdbuf)
|
||||
|
||||
cs_builder_init(b, &conf, root_cs);
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_TRACE) {
|
||||
if (PANVK_DEBUG(TRACE)) {
|
||||
cmdbuf->state.cs[i].tracing = (struct cs_tracing_ctx){
|
||||
.enabled = true,
|
||||
.ctx_reg = cs_subqueue_ctx_reg(b),
|
||||
@@ -1036,13 +1032,11 @@ panvk_per_arch(BeginCommandBuffer)(VkCommandBuffer commandBuffer,
|
||||
const VkCommandBufferBeginInfo *pBeginInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(cmdbuf->vk.base.device->physical->instance);
|
||||
|
||||
vk_command_buffer_begin(&cmdbuf->vk, pBeginInfo);
|
||||
cmdbuf->flags = pBeginInfo->flags;
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_FORCE_SIMULTANEOUS) {
|
||||
if (PANVK_DEBUG(FORCE_SIMULTANEOUS)) {
|
||||
cmdbuf->flags |= VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
|
||||
cmdbuf->flags &= ~VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
|
||||
}
|
||||
|
||||
@@ -997,9 +997,7 @@ get_tiler_desc(struct panvk_cmd_buffer *cmdbuf)
|
||||
panvk_get_cs_builder(cmdbuf, PANVK_SUBQUEUE_VERTEX_TILER);
|
||||
struct panvk_physical_device *phys_dev =
|
||||
to_panvk_physical_device(cmdbuf->vk.base.device->physical);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(phys_dev->vk.instance);
|
||||
bool tracing_enabled = instance->debug_flags & PANVK_DEBUG_TRACE;
|
||||
const bool tracing_enabled = PANVK_DEBUG(TRACE);
|
||||
struct pan_tiler_features tiler_features =
|
||||
pan_query_tiler_features(&phys_dev->kmod.props);
|
||||
bool simul_use =
|
||||
@@ -3060,8 +3058,6 @@ static VkResult
|
||||
issue_fragment_jobs(struct panvk_cmd_buffer *cmdbuf)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
const struct cs_tracing_ctx *tracing_ctx =
|
||||
&cmdbuf->state.cs[PANVK_SUBQUEUE_FRAGMENT].tracing;
|
||||
struct pan_fb_info *fbinfo = &cmdbuf->state.gfx.render.fb.info;
|
||||
@@ -3155,7 +3151,7 @@ issue_fragment_jobs(struct panvk_cmd_buffer *cmdbuf)
|
||||
* invalidation even became implicit (done as part of the RUN_FRAGMENT) on
|
||||
* v13+. We don't do that in panvk, but we provide a debug flag to help
|
||||
* identify those issues. */
|
||||
if (unlikely(instance->debug_flags & PANVK_DEBUG_IMPLICIT_OTHERS_INV)) {
|
||||
if (PANVK_DEBUG(IMPLICIT_OTHERS_INV)) {
|
||||
cs_flush_caches(b, MALI_CS_FLUSH_MODE_NONE, MALI_CS_FLUSH_MODE_NONE,
|
||||
MALI_CS_OTHER_FLUSH_MODE_INVALIDATE, length_reg,
|
||||
cs_defer(0x0, SB_ID(IMM_FLUSH)));
|
||||
|
||||
@@ -310,9 +310,7 @@ generate_tiler_oom_handler(struct panvk_device *dev,
|
||||
VkResult
|
||||
panvk_per_arch(init_tiler_oom)(struct panvk_device *device)
|
||||
{
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(device->vk.physical->instance);
|
||||
bool tracing_enabled = instance->debug_flags & PANVK_DEBUG_TRACE;
|
||||
const bool tracing_enabled = PANVK_DEBUG(TRACE);
|
||||
VkResult result = panvk_priv_bo_create(
|
||||
device, TILER_OOM_HANDLER_MAX_SIZE * 2 * MAX_RTS, 0,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE, &device->tiler_oom.handlers_bo);
|
||||
|
||||
@@ -29,9 +29,7 @@ static void
|
||||
finish_render_desc_ringbuf(struct panvk_gpu_queue *queue)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(queue->vk.base.device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
bool tracing_enabled = instance->debug_flags & PANVK_DEBUG_TRACE;
|
||||
const bool tracing_enabled = PANVK_DEBUG(TRACE);
|
||||
struct panvk_desc_ringbuf *ringbuf = &queue->render_desc_ringbuf;
|
||||
|
||||
panvk_pool_free_mem(&ringbuf->syncobj);
|
||||
@@ -74,9 +72,7 @@ static VkResult
|
||||
init_render_desc_ringbuf(struct panvk_gpu_queue *queue)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(queue->vk.base.device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
bool tracing_enabled = instance->debug_flags & PANVK_DEBUG_TRACE;
|
||||
const bool tracing_enabled = PANVK_DEBUG(TRACE);
|
||||
uint32_t flags = panvk_device_adjust_bo_flags(dev, PAN_KMOD_BO_FLAG_NO_MMAP);
|
||||
struct panvk_desc_ringbuf *ringbuf = &queue->render_desc_ringbuf;
|
||||
uint64_t dev_addr = 0;
|
||||
@@ -228,12 +224,9 @@ init_subqueue_tracing(struct panvk_gpu_queue *queue,
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(queue->vk.base.device);
|
||||
struct panvk_subqueue *subq = &queue->subqueues[subqueue];
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
unsigned debug = instance->debug_flags;
|
||||
uint64_t dev_addr;
|
||||
|
||||
if (!(debug & PANVK_DEBUG_TRACE))
|
||||
if (!PANVK_DEBUG(TRACE))
|
||||
return VK_SUCCESS;
|
||||
|
||||
subq->reg_file =
|
||||
@@ -342,9 +335,6 @@ init_subqueue(struct panvk_gpu_queue *queue, enum panvk_subqueue_id subqueue)
|
||||
struct panvk_subqueue *subq = &queue->subqueues[subqueue];
|
||||
const struct panvk_physical_device *phys_dev =
|
||||
to_panvk_physical_device(queue->vk.base.device->physical);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
unsigned debug = instance->debug_flags;
|
||||
struct panvk_cs_sync64 *syncobjs = panvk_priv_mem_host_addr(queue->syncobjs);
|
||||
|
||||
VkResult result = init_subqueue_tracing(queue, subqueue);
|
||||
@@ -369,7 +359,7 @@ init_subqueue(struct panvk_gpu_queue *queue, enum panvk_subqueue_id subqueue)
|
||||
/* When tracing is enabled, we want to use a non-cached pool, so can get
|
||||
* up-to-date context even if the CS crashed in the middle. */
|
||||
struct panvk_pool *mempool =
|
||||
(debug & PANVK_DEBUG_TRACE) ? &dev->mempools.rw_nc : &dev->mempools.rw;
|
||||
PANVK_DEBUG(TRACE) ? &dev->mempools.rw_nc : &dev->mempools.rw;
|
||||
|
||||
subq->context = panvk_pool_alloc_mem(mempool, alloc_info);
|
||||
if (!panvk_priv_mem_host_addr(subq->context))
|
||||
@@ -504,7 +494,7 @@ init_subqueue(struct panvk_gpu_queue *queue, enum panvk_subqueue_id subqueue)
|
||||
|
||||
drmSyncobjReset(dev->drm_fd, &queue->syncobj_handle, 1);
|
||||
|
||||
if (debug & PANVK_DEBUG_TRACE) {
|
||||
if (PANVK_DEBUG(TRACE)) {
|
||||
pandecode_user_msg(dev->debug.decode_ctx, "Init subqueue %d binary\n\n",
|
||||
subqueue);
|
||||
pandecode_cs_binary(dev->debug.decode_ctx, qsubmit.stream_addr,
|
||||
@@ -535,9 +525,6 @@ static VkResult
|
||||
init_queue(struct panvk_gpu_queue *queue)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(queue->vk.base.device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
unsigned debug = instance->debug_flags;
|
||||
VkResult result;
|
||||
|
||||
struct panvk_pool_alloc_info alloc_info = {
|
||||
@@ -565,7 +552,7 @@ init_queue(struct panvk_gpu_queue *queue)
|
||||
goto err_cleanup_queue;
|
||||
}
|
||||
|
||||
if (debug & PANVK_DEBUG_TRACE)
|
||||
if (PANVK_DEBUG(TRACE))
|
||||
pandecode_next_frame(dev->debug.decode_ctx);
|
||||
|
||||
return VK_SUCCESS;
|
||||
@@ -711,7 +698,6 @@ cleanup_tiler(struct panvk_gpu_queue *queue)
|
||||
}
|
||||
|
||||
struct panvk_queue_submit {
|
||||
const struct panvk_instance *instance;
|
||||
const struct panvk_physical_device *phys_dev;
|
||||
struct panvk_device *dev;
|
||||
struct panvk_gpu_queue *queue;
|
||||
@@ -754,7 +740,6 @@ panvk_queue_submit_init(struct panvk_queue_submit *submit,
|
||||
struct vk_device *vk_dev = vk_queue->base.device;
|
||||
|
||||
*submit = (struct panvk_queue_submit){
|
||||
.instance = to_panvk_instance(vk_dev->physical->instance),
|
||||
.phys_dev = to_panvk_physical_device(vk_dev->physical),
|
||||
.dev = to_panvk_device(vk_dev),
|
||||
.queue = container_of(vk_queue, struct panvk_gpu_queue, vk),
|
||||
@@ -764,8 +749,7 @@ panvk_queue_submit_init(struct panvk_queue_submit *submit,
|
||||
u_trace_should_process(&submit->dev->utrace.utctx) &&
|
||||
submit->phys_dev->kmod.props.timestamp_frequency;
|
||||
|
||||
submit->force_sync =
|
||||
submit->instance->debug_flags & (PANVK_DEBUG_TRACE | PANVK_DEBUG_SYNC);
|
||||
submit->force_sync = PANVK_DEBUG(TRACE) || PANVK_DEBUG(SYNC);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1042,11 +1026,10 @@ static VkResult
|
||||
panvk_queue_submit_ioctl(struct panvk_queue_submit *submit)
|
||||
{
|
||||
const struct panvk_device *dev = submit->dev;
|
||||
const struct panvk_instance *instance = submit->instance;
|
||||
struct panvk_gpu_queue *queue = submit->queue;
|
||||
int ret;
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_TRACE) {
|
||||
if (PANVK_DEBUG(TRACE)) {
|
||||
/* If we're tracing, we need to reset the desc ringbufs and the CS
|
||||
* tracebuf. */
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(queue->subqueues); i++) {
|
||||
@@ -1123,11 +1106,10 @@ panvk_queue_submit_process_signals(struct panvk_queue_submit *submit,
|
||||
static void
|
||||
panvk_queue_submit_process_debug(const struct panvk_queue_submit *submit)
|
||||
{
|
||||
const struct panvk_instance *instance = submit->instance;
|
||||
struct panvk_gpu_queue *queue = submit->queue;
|
||||
struct pandecode_context *decode_ctx = submit->dev->debug.decode_ctx;
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_TRACE) {
|
||||
if (PANVK_DEBUG(TRACE)) {
|
||||
const struct pan_kmod_dev_props *props = &submit->phys_dev->kmod.props;
|
||||
|
||||
for (uint32_t i = 0; i < submit->qsubmit_count; i++) {
|
||||
@@ -1168,10 +1150,10 @@ panvk_queue_submit_process_debug(const struct panvk_queue_submit *submit)
|
||||
}
|
||||
}
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_DUMP)
|
||||
if (PANVK_DEBUG(DUMP))
|
||||
pandecode_dump_mappings(decode_ctx);
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_TRACE)
|
||||
if (PANVK_DEBUG(TRACE))
|
||||
pandecode_next_frame(decode_ctx);
|
||||
|
||||
/* validate last after the command streams are dumped */
|
||||
|
||||
@@ -37,9 +37,6 @@ panvk_queue_submit_batch(struct panvk_gpu_queue *queue, struct panvk_batch *batc
|
||||
struct panvk_device *dev = to_panvk_device(queue->vk.base.device);
|
||||
struct panvk_physical_device *phys_dev =
|
||||
to_panvk_physical_device(dev->vk.physical);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
unsigned debug = instance->debug_flags;
|
||||
int ret;
|
||||
|
||||
/* Reset the batch if it's already been issued */
|
||||
@@ -72,21 +69,21 @@ panvk_queue_submit_batch(struct panvk_gpu_queue *queue, struct panvk_batch *batc
|
||||
ret = pan_kmod_ioctl(dev->drm_fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
||||
assert(!ret);
|
||||
|
||||
if (debug & (PANVK_DEBUG_TRACE | PANVK_DEBUG_SYNC)) {
|
||||
if (PANVK_DEBUG(TRACE) || PANVK_DEBUG(SYNC)) {
|
||||
ret = drmSyncobjWait(dev->drm_fd, &submit.out_sync, 1, INT64_MAX, 0,
|
||||
NULL);
|
||||
assert(!ret);
|
||||
}
|
||||
|
||||
if (debug & PANVK_DEBUG_TRACE) {
|
||||
if (PANVK_DEBUG(TRACE)) {
|
||||
pandecode_jc(dev->debug.decode_ctx, batch->vtc_jc.first_job,
|
||||
phys_dev->kmod.props.gpu_id);
|
||||
}
|
||||
|
||||
if (debug & PANVK_DEBUG_DUMP)
|
||||
if (PANVK_DEBUG(DUMP))
|
||||
pandecode_dump_mappings(dev->debug.decode_ctx);
|
||||
|
||||
if (debug & PANVK_DEBUG_SYNC)
|
||||
if (PANVK_DEBUG(SYNC))
|
||||
pandecode_abort_on_fault(dev->debug.decode_ctx, submit.jc,
|
||||
phys_dev->kmod.props.gpu_id);
|
||||
}
|
||||
@@ -110,25 +107,25 @@ panvk_queue_submit_batch(struct panvk_gpu_queue *queue, struct panvk_batch *batc
|
||||
|
||||
ret = pan_kmod_ioctl(dev->drm_fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
|
||||
assert(!ret);
|
||||
if (debug & (PANVK_DEBUG_TRACE | PANVK_DEBUG_SYNC)) {
|
||||
if (PANVK_DEBUG(TRACE) || PANVK_DEBUG(SYNC)) {
|
||||
ret = drmSyncobjWait(dev->drm_fd, &submit.out_sync, 1, INT64_MAX, 0,
|
||||
NULL);
|
||||
assert(!ret);
|
||||
}
|
||||
|
||||
if (debug & PANVK_DEBUG_TRACE)
|
||||
if (PANVK_DEBUG(TRACE))
|
||||
pandecode_jc(dev->debug.decode_ctx, batch->frag_jc.first_job,
|
||||
phys_dev->kmod.props.gpu_id);
|
||||
|
||||
if (debug & PANVK_DEBUG_DUMP)
|
||||
if (PANVK_DEBUG(DUMP))
|
||||
pandecode_dump_mappings(dev->debug.decode_ctx);
|
||||
|
||||
if (debug & PANVK_DEBUG_SYNC)
|
||||
if (PANVK_DEBUG(SYNC))
|
||||
pandecode_abort_on_fault(dev->debug.decode_ctx, submit.jc,
|
||||
phys_dev->kmod.props.gpu_id);
|
||||
}
|
||||
|
||||
if (debug & PANVK_DEBUG_TRACE)
|
||||
if (PANVK_DEBUG(TRACE))
|
||||
pandecode_next_frame(dev->debug.decode_ctx);
|
||||
|
||||
batch->issued = true;
|
||||
|
||||
@@ -95,8 +95,6 @@ panvk_CreateBuffer(VkDevice _device, const VkBufferCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_device, device, _device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(device->vk.physical->instance);
|
||||
struct panvk_buffer *buffer;
|
||||
VkResult result;
|
||||
|
||||
@@ -123,7 +121,7 @@ panvk_CreateBuffer(VkDevice _device, const VkBufferCreateInfo *pCreateInfo,
|
||||
}
|
||||
|
||||
if ((buffer->vk.create_flags & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) ||
|
||||
(instance->debug_flags & PANVK_DEBUG_FORCE_BLACKHOLE)) {
|
||||
PANVK_DEBUG(FORCE_BLACKHOLE)) {
|
||||
/* Map last so that we don't have a possibility of getting any more
|
||||
* errors, in which case we'd have to unmap.
|
||||
*/
|
||||
|
||||
@@ -148,10 +148,7 @@ static inline uint32_t
|
||||
panvk_device_adjust_bo_flags(const struct panvk_device *device,
|
||||
uint32_t bo_flags)
|
||||
{
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(device->vk.physical->instance);
|
||||
|
||||
if (instance->debug_flags & (PANVK_DEBUG_DUMP | PANVK_DEBUG_TRACE))
|
||||
if (PANVK_DEBUG(DUMP) || PANVK_DEBUG(TRACE))
|
||||
bo_flags &= ~PAN_KMOD_BO_FLAG_NO_MMAP;
|
||||
|
||||
return bo_flags;
|
||||
|
||||
@@ -55,8 +55,6 @@ panvk_AllocateMemory(VkDevice _device,
|
||||
}
|
||||
|
||||
VK_FROM_HANDLE(panvk_device, device, _device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(device->vk.physical->instance);
|
||||
struct panvk_device_memory *mem;
|
||||
bool can_be_exported = false;
|
||||
VkResult result;
|
||||
@@ -151,7 +149,7 @@ panvk_AllocateMemory(VkDevice _device,
|
||||
}
|
||||
|
||||
if (device->debug.decode_ctx) {
|
||||
if (instance->debug_flags & (PANVK_DEBUG_DUMP | PANVK_DEBUG_TRACE)) {
|
||||
if (PANVK_DEBUG(DUMP) || PANVK_DEBUG(TRACE)) {
|
||||
void *cpu = pan_kmod_bo_mmap(mem->bo, 0, pan_kmod_bo_size(mem->bo),
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, NULL);
|
||||
if (cpu != MAP_FAILED)
|
||||
|
||||
@@ -54,7 +54,6 @@ panvk_image_can_use_afbc(
|
||||
VkImageCreateFlags flags)
|
||||
{
|
||||
unsigned arch = pan_arch(phys_dev->kmod.props.gpu_id);
|
||||
struct panvk_instance *instance = to_panvk_instance(phys_dev->vk.instance);
|
||||
enum pipe_format pfmt = vk_format_to_pipe_format(fmt);
|
||||
|
||||
/* Disallow AFBC if either of these is true
|
||||
@@ -76,7 +75,7 @@ panvk_image_can_use_afbc(
|
||||
* GetPhysicalDeviceImageFormatProperties2() and we don't have enough
|
||||
* information to conduct a full image property check in this context.
|
||||
*/
|
||||
return !(instance->debug_flags & PANVK_DEBUG_NO_AFBC) &&
|
||||
return !PANVK_DEBUG(NO_AFBC) &&
|
||||
!(usage &
|
||||
(VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_HOST_TRANSFER_BIT)) &&
|
||||
pan_query_afbc(&phys_dev->kmod.props) &&
|
||||
@@ -208,11 +207,9 @@ panvk_image_can_use_mod(struct panvk_image *image,
|
||||
struct panvk_physical_device *phys_dev =
|
||||
to_panvk_physical_device(image->vk.base.device->physical);
|
||||
unsigned arch = pan_arch(phys_dev->kmod.props.gpu_id);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(image->vk.base.device->physical->instance);
|
||||
bool forced_linear = (instance->debug_flags & PANVK_DEBUG_LINEAR) ||
|
||||
image->vk.tiling == VK_IMAGE_TILING_LINEAR ||
|
||||
image->vk.image_type == VK_IMAGE_TYPE_1D;
|
||||
const bool forced_linear = PANVK_DEBUG(LINEAR) ||
|
||||
image->vk.tiling == VK_IMAGE_TILING_LINEAR ||
|
||||
image->vk.image_type == VK_IMAGE_TYPE_1D;
|
||||
|
||||
/* If the image is meant to be linear, don't bother testing the
|
||||
* other cases. */
|
||||
@@ -221,7 +218,7 @@ panvk_image_can_use_mod(struct panvk_image *image,
|
||||
|
||||
if (drm_is_afbc(mod)) {
|
||||
/* AFBC explicitly disabled. */
|
||||
if (instance->debug_flags & PANVK_DEBUG_NO_AFBC)
|
||||
if (PANVK_DEBUG(NO_AFBC))
|
||||
return false;
|
||||
|
||||
/* Non-optimal tiling requested. */
|
||||
@@ -578,8 +575,6 @@ panvk_CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
|
||||
VK_FROM_HANDLE(panvk_device, dev, device);
|
||||
struct panvk_physical_device *phys_dev =
|
||||
to_panvk_physical_device(dev->vk.physical);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(phys_dev->vk.instance);
|
||||
VkResult result;
|
||||
|
||||
if (panvk_android_is_gralloc_image(pCreateInfo)) {
|
||||
@@ -636,7 +631,7 @@ panvk_CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
|
||||
}
|
||||
|
||||
if ((image->vk.create_flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) ||
|
||||
(instance->debug_flags & PANVK_DEBUG_FORCE_BLACKHOLE)) {
|
||||
PANVK_DEBUG(FORCE_BLACKHOLE)) {
|
||||
/* Map last so that we don't have a possibility of getting any more
|
||||
* errors, in which case we'd have to unmap.
|
||||
*/
|
||||
|
||||
@@ -271,10 +271,7 @@ panvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
panvk_physical_device_try_create;
|
||||
instance->vk.physical_devices.destroy = panvk_destroy_physical_device;
|
||||
|
||||
instance->debug_flags =
|
||||
parse_debug_string(os_get_option("PANVK_DEBUG"), panvk_debug_options);
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_STARTUP)
|
||||
if (PANVK_DEBUG(STARTUP))
|
||||
vk_logi(VK_LOG_NO_OBJS(instance), "Created an instance");
|
||||
|
||||
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
|
||||
|
||||
@@ -45,8 +45,6 @@ struct panvk_instance {
|
||||
|
||||
uint32_t api_version;
|
||||
|
||||
enum panvk_debug_flags debug_flags;
|
||||
|
||||
struct driOptionCache dri_options;
|
||||
struct driOptionCache available_dri_options;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ create_kmod_dev(struct panvk_physical_device *device,
|
||||
|
||||
drmFreeVersion(version);
|
||||
|
||||
if (instance->debug_flags & PANVK_DEBUG_STARTUP)
|
||||
if (PANVK_DEBUG(STARTUP))
|
||||
vk_logi(VK_LOG_NO_OBJS(instance), "Found compatible device '%s'.", path);
|
||||
|
||||
device->kmod.dev = pan_kmod_dev_create(fd, PAN_KMOD_DEV_FLAG_OWNS_FD,
|
||||
|
||||
@@ -17,14 +17,10 @@
|
||||
#include "libpan_dgc.h"
|
||||
|
||||
static bool
|
||||
copy_to_image_use_gfx_pipeline(struct panvk_device *dev,
|
||||
struct panvk_image *dst_img)
|
||||
copy_to_image_use_gfx_pipeline(struct panvk_image *dst_img)
|
||||
{
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
|
||||
/* Don't force gfx-based copies if the format is bigger than 32-bit. */
|
||||
if ((instance->debug_flags & PANVK_DEBUG_COPY_GFX) &&
|
||||
if (PANVK_DEBUG(COPY_GFX) &&
|
||||
vk_format_get_blocksize(dst_img->vk.format) <= 4)
|
||||
return true;
|
||||
|
||||
@@ -398,7 +394,7 @@ panvk_per_arch(CmdCopyBufferToImage2)(
|
||||
if (lower_copy_buffer_to_image(commandBuffer, pCopyBufferToImageInfo))
|
||||
return;
|
||||
|
||||
bool use_gfx_pipeline = copy_to_image_use_gfx_pipeline(dev, img);
|
||||
const bool use_gfx_pipeline = copy_to_image_use_gfx_pipeline(img);
|
||||
struct vk_meta_copy_image_properties img_props =
|
||||
panvk_meta_copy_get_image_properties(img, use_gfx_pipeline, true);
|
||||
|
||||
@@ -555,7 +551,7 @@ panvk_per_arch(CmdCopyImage2)(VkCommandBuffer commandBuffer,
|
||||
if (lower_copy_image(commandBuffer, pCopyImageInfo))
|
||||
return;
|
||||
|
||||
bool use_gfx_pipeline = copy_to_image_use_gfx_pipeline(dev, dst_img);
|
||||
const bool use_gfx_pipeline = copy_to_image_use_gfx_pipeline(dst_img);
|
||||
struct vk_meta_copy_image_properties dst_img_props =
|
||||
panvk_meta_copy_get_image_properties(dst_img, use_gfx_pipeline, true);
|
||||
struct vk_meta_copy_image_properties src_img_props =
|
||||
|
||||
@@ -403,8 +403,7 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device,
|
||||
goto err_finish_dev;
|
||||
}
|
||||
|
||||
if (instance->debug_flags &
|
||||
(PANVK_DEBUG_TRACE | PANVK_DEBUG_SYNC | PANVK_DEBUG_DUMP))
|
||||
if (PANVK_DEBUG(TRACE) || PANVK_DEBUG(SYNC) || PANVK_DEBUG(DUMP))
|
||||
device->debug.decode_ctx = pandecode_create_context(false);
|
||||
|
||||
/* 32bit address space, with the lower 32MB reserved. We clamp
|
||||
|
||||
@@ -774,8 +774,6 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
|
||||
const struct pan_compile_inputs *compile_input,
|
||||
struct panvk_shader_variant *shader)
|
||||
{
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(dev->vk.physical->instance);
|
||||
mesa_shader_stage stage = nir->info.stage;
|
||||
|
||||
const nir_opt_access_options access_options = {
|
||||
@@ -914,7 +912,7 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
|
||||
NIR_PASS(_, nir, nir_lower_global_vars_to_local);
|
||||
|
||||
nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
|
||||
if (unlikely(instance->debug_flags & PANVK_DEBUG_NIR)) {
|
||||
if (PANVK_DEBUG(NIR)) {
|
||||
fprintf(stderr, "translated nir:\n");
|
||||
nir_print_shader(nir, stderr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user