mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 09:30:11 +01:00
pvr: Add 'info' PVR_DEBUG flag
This commit will add a new PVR_DEBUG flag that, when used, it will display information about the display and render devices in the common code (without adding dependencies) Signed-off-by: Vlad Schiller <vlad-radu.schiller@imgtec.com> Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24931>
This commit is contained in:
parent
d01a60e8a3
commit
326080428e
7 changed files with 278 additions and 0 deletions
|
|
@ -25,7 +25,9 @@ libpowervr_common = static_library(
|
|||
'pvr_debug.c',
|
||||
'pvr_device_info.c',
|
||||
'pvr_dump.c',
|
||||
'pvr_dump_info.c',
|
||||
'pvr_util.c',
|
||||
sha1_h,
|
||||
],
|
||||
include_directories : [
|
||||
inc_include,
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ static const struct debug_named_value debug_control[] = {
|
|||
"Zero all buffer objects at allocation to make them deterministic." },
|
||||
{ "vk_desc", PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT,
|
||||
"Dump descriptor set and pipeline layouts." },
|
||||
{ "info", PVR_DEBUG_INFO,
|
||||
"Display information about the driver and device." },
|
||||
DEBUG_NAMED_VALUE_END
|
||||
};
|
||||
/* clang-format on */
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ extern uint32_t PVR_DEBUG;
|
|||
#define PVR_DEBUG_TRACK_BOS BITFIELD_BIT(1)
|
||||
#define PVR_DEBUG_ZERO_BOS BITFIELD_BIT(2)
|
||||
#define PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT BITFIELD_BIT(3)
|
||||
#define PVR_DEBUG_INFO BITFIELD_BIT(4)
|
||||
|
||||
void pvr_process_debug_variable(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -498,6 +498,21 @@ static inline void pvr_dump_field_x32(struct pvr_dump_ctx *const ctx,
|
|||
value & BITFIELD_MASK(chars * 4));
|
||||
}
|
||||
|
||||
static inline void pvr_dump_field_u64(struct pvr_dump_ctx *const ctx,
|
||||
const char *const name,
|
||||
const uint64_t value)
|
||||
{
|
||||
pvr_dump_field(ctx, name, "%" PRIu64, value);
|
||||
}
|
||||
|
||||
static inline void pvr_dump_field_u64_units(struct pvr_dump_ctx *const ctx,
|
||||
const char *const name,
|
||||
const uint64_t value,
|
||||
const char *const units)
|
||||
{
|
||||
pvr_dump_field(ctx, name, "%" PRIu64 " %s", value, units);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Field printers: floating point
|
||||
*****************************************************************************/
|
||||
|
|
@ -630,6 +645,17 @@ static inline void pvr_dump_field_bool(struct pvr_dump_ctx *const ctx,
|
|||
pvr_dump_field_enum(ctx, name, value, __bool_to_str);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Field printers: string
|
||||
*****************************************************************************/
|
||||
|
||||
static inline void pvr_dump_field_string(struct pvr_dump_ctx *const ctx,
|
||||
const char *const name,
|
||||
const char *const value)
|
||||
{
|
||||
pvr_dump_field(ctx, name, "%s", value);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Field printers: not present
|
||||
*****************************************************************************/
|
||||
|
|
@ -672,6 +698,12 @@ static inline void pvr_dump_field_not_present(struct pvr_dump_ctx *const ctx,
|
|||
#define pvr_dump_field_member_x32(ctx, compound, member, chars) \
|
||||
pvr_dump_field_x32(ctx, #member, (compound)->member, chars)
|
||||
|
||||
#define pvr_dump_field_member_u64(ctx, compound, member) \
|
||||
pvr_dump_field_u64(ctx, #member, (compound)->member)
|
||||
|
||||
#define pvr_dump_field_member_u64_units(ctx, compound, member, units) \
|
||||
pvr_dump_field_u64_units(ctx, #member, (compound)->member, units)
|
||||
|
||||
#define pvr_dump_field_member_f32(ctx, compound, member) \
|
||||
pvr_dump_field_f32(ctx, #member, (compound)->member)
|
||||
|
||||
|
|
@ -693,6 +725,9 @@ static inline void pvr_dump_field_not_present(struct pvr_dump_ctx *const ctx,
|
|||
#define pvr_dump_field_member_bool(ctx, compound, member) \
|
||||
pvr_dump_field_bool(ctx, #member, (compound)->member)
|
||||
|
||||
#define pvr_dump_field_member_string(ctx, compound, member) \
|
||||
pvr_dump_field_string(ctx, #member, (compound)->member)
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
#define pvr_dump_field_member_not_present(ctx, compound, member) \
|
||||
|
|
|
|||
145
src/imagination/common/pvr_dump_info.c
Normal file
145
src/imagination/common/pvr_dump_info.c
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Copyright © 2023 Imagination Technologies Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "git_sha1.h"
|
||||
#include "pvr_dump_info.h"
|
||||
#include "pvr_dump.h"
|
||||
|
||||
static inline void pvr_dump_field_bvnc(struct pvr_dump_ctx *ctx,
|
||||
const char *const name,
|
||||
const struct pvr_device_info *info)
|
||||
{
|
||||
pvr_dump_field_computed(ctx,
|
||||
name,
|
||||
"%" PRIu16 ".%" PRIu16 ".%" PRIu16 ".%" PRIu16,
|
||||
"0x%08" PRIx64,
|
||||
info->ident.b,
|
||||
info->ident.v,
|
||||
info->ident.n,
|
||||
info->ident.c,
|
||||
pvr_get_packed_bvnc(info));
|
||||
}
|
||||
|
||||
static inline void pvr_dump_field_drm_version(struct pvr_dump_ctx *ctx,
|
||||
const char *const name,
|
||||
const char *const drm_name,
|
||||
int drm_version_major,
|
||||
int drm_version_minor,
|
||||
int drm_version_patchlevel,
|
||||
const char *const drm_date)
|
||||
{
|
||||
pvr_dump_field(ctx,
|
||||
name,
|
||||
"%s %d.%d.%d (%s)",
|
||||
drm_name,
|
||||
drm_version_major,
|
||||
drm_version_minor,
|
||||
drm_version_patchlevel,
|
||||
drm_date);
|
||||
}
|
||||
|
||||
static inline void pvr_dump_field_compatible_strings(struct pvr_dump_ctx *ctx,
|
||||
char *const *comp)
|
||||
{
|
||||
char *const *temp_comp = comp;
|
||||
uint32_t count_log10;
|
||||
uint32_t index = 0;
|
||||
|
||||
if (!*comp) {
|
||||
pvr_dump_println(ctx, "<empty>");
|
||||
return;
|
||||
}
|
||||
|
||||
while (*temp_comp++)
|
||||
index++;
|
||||
|
||||
count_log10 = u32_dec_digits(index);
|
||||
index = 0;
|
||||
|
||||
while (*comp)
|
||||
pvr_dump_println(ctx, "[%0*" PRIu32 "] %s", count_log10, index++, *comp++);
|
||||
}
|
||||
|
||||
void pvr_dump_physical_device_info(const struct pvr_device_dump_info *dump_info)
|
||||
{
|
||||
const struct pvr_device_runtime_info *run_info =
|
||||
dump_info->device_runtime_info;
|
||||
const struct pvr_device_info *dev_info = dump_info->device_info;
|
||||
struct pvr_dump_ctx ctx;
|
||||
|
||||
pvr_dump_begin(&ctx, stderr, "DEBUG INFORMATION", 1);
|
||||
|
||||
pvr_dump_mark_section(&ctx, "General Info");
|
||||
pvr_dump_indent(&ctx);
|
||||
pvr_dump_field_string(&ctx, "Public Name", dev_info->ident.public_name);
|
||||
pvr_dump_field_string(&ctx, "Series Name", dev_info->ident.series_name);
|
||||
pvr_dump_field_bvnc(&ctx, "BVNC", dev_info);
|
||||
pvr_dump_field_drm_version(&ctx,
|
||||
"DRM Display Driver Version",
|
||||
dump_info->drm_display.name,
|
||||
dump_info->drm_display.major,
|
||||
dump_info->drm_display.minor,
|
||||
dump_info->drm_display.patchlevel,
|
||||
dump_info->drm_display.date);
|
||||
pvr_dump_field_drm_version(&ctx,
|
||||
"DRM Render Driver Version",
|
||||
dump_info->drm_render.name,
|
||||
dump_info->drm_render.major,
|
||||
dump_info->drm_render.minor,
|
||||
dump_info->drm_render.patchlevel,
|
||||
dump_info->drm_render.date);
|
||||
pvr_dump_field_string(&ctx, "MESA ", PACKAGE_VERSION MESA_GIT_SHA1);
|
||||
pvr_dump_dedent(&ctx);
|
||||
|
||||
pvr_dump_mark_section(&ctx, "Display Platform Compatible Strings");
|
||||
pvr_dump_indent(&ctx);
|
||||
pvr_dump_field_compatible_strings(&ctx, dump_info->drm_display.comp);
|
||||
pvr_dump_dedent(&ctx);
|
||||
|
||||
pvr_dump_mark_section(&ctx, "Render Platform Compatible Strings");
|
||||
pvr_dump_indent(&ctx);
|
||||
pvr_dump_field_compatible_strings(&ctx, dump_info->drm_render.comp);
|
||||
pvr_dump_dedent(&ctx);
|
||||
pvr_dump_print_eol(&ctx);
|
||||
|
||||
pvr_dump_mark_section(&ctx, "Runtime Info");
|
||||
pvr_dump_indent(&ctx);
|
||||
pvr_dump_field_member_u64(&ctx, run_info, cdm_max_local_mem_size_regs);
|
||||
pvr_dump_field_member_u64_units(&ctx, run_info, max_free_list_size, "bytes");
|
||||
pvr_dump_field_member_u64_units(&ctx, run_info, min_free_list_size, "bytes");
|
||||
pvr_dump_field_member_u64_units(&ctx,
|
||||
run_info,
|
||||
reserved_shared_size,
|
||||
"bytes");
|
||||
pvr_dump_field_member_u64_units(&ctx,
|
||||
run_info,
|
||||
total_reserved_partition_size,
|
||||
"bytes");
|
||||
pvr_dump_field_member_u32(&ctx, run_info, core_count);
|
||||
pvr_dump_field_member_u64(&ctx, run_info, max_coeffs);
|
||||
pvr_dump_field_member_u64(&ctx, run_info, num_phantoms);
|
||||
pvr_dump_dedent(&ctx);
|
||||
pvr_dump_print_eol(&ctx);
|
||||
|
||||
pvr_dump_end(&ctx);
|
||||
}
|
||||
44
src/imagination/common/pvr_dump_info.h
Normal file
44
src/imagination/common/pvr_dump_info.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright © 2023 Imagination Technologies Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PVR_DUMP_INFO_H
|
||||
#define PVR_DUMP_INFO_H
|
||||
|
||||
#include "pvr_device_info.h"
|
||||
|
||||
struct pvr_device_dump_info {
|
||||
const struct pvr_device_info *device_info;
|
||||
const struct pvr_device_runtime_info *device_runtime_info;
|
||||
struct {
|
||||
int patchlevel;
|
||||
int major;
|
||||
int minor;
|
||||
const char *name;
|
||||
const char *date;
|
||||
char *const *comp;
|
||||
} drm_display, drm_render;
|
||||
};
|
||||
|
||||
void pvr_dump_physical_device_info(const struct pvr_device_dump_info *dump_info);
|
||||
|
||||
#endif
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
|
@ -46,6 +47,7 @@
|
|||
#include "pvr_csb_enum_helpers.h"
|
||||
#include "pvr_debug.h"
|
||||
#include "pvr_device_info.h"
|
||||
#include "pvr_dump_info.h"
|
||||
#include "pvr_hardcode.h"
|
||||
#include "pvr_job_render.h"
|
||||
#include "pvr_limits.h"
|
||||
|
|
@ -55,6 +57,7 @@
|
|||
#include "pvr_tex_state.h"
|
||||
#include "pvr_types.h"
|
||||
#include "pvr_uscgen.h"
|
||||
#include "pvr_util.h"
|
||||
#include "pvr_winsys.h"
|
||||
#include "rogue/rogue.h"
|
||||
#include "util/build_id.h"
|
||||
|
|
@ -544,6 +547,45 @@ pvr_drm_device_get_config(drmDevice *const drm_dev)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
pvr_physical_device_dump_info(const struct pvr_physical_device *pdevice,
|
||||
char *const *comp_display,
|
||||
char *const *comp_render)
|
||||
{
|
||||
drmVersionPtr version_display, version_render;
|
||||
struct pvr_device_dump_info info;
|
||||
|
||||
version_display = drmGetVersion(pdevice->ws->display_fd);
|
||||
if (!version_display)
|
||||
return;
|
||||
|
||||
version_render = drmGetVersion(pdevice->ws->render_fd);
|
||||
if (!version_render) {
|
||||
drmFreeVersion(version_display);
|
||||
return;
|
||||
}
|
||||
|
||||
info.device_info = &pdevice->dev_info;
|
||||
info.device_runtime_info = &pdevice->dev_runtime_info;
|
||||
info.drm_display.patchlevel = version_display->version_patchlevel;
|
||||
info.drm_display.major = version_display->version_major;
|
||||
info.drm_display.minor = version_display->version_minor;
|
||||
info.drm_display.name = version_display->name;
|
||||
info.drm_display.date = version_display->date;
|
||||
info.drm_display.comp = comp_display;
|
||||
info.drm_render.patchlevel = version_render->version_patchlevel;
|
||||
info.drm_render.major = version_render->version_major;
|
||||
info.drm_render.minor = version_render->version_minor;
|
||||
info.drm_render.name = version_render->name;
|
||||
info.drm_render.date = version_render->date;
|
||||
info.drm_render.comp = comp_render;
|
||||
|
||||
pvr_dump_physical_device_info(&info);
|
||||
|
||||
drmFreeVersion(version_display);
|
||||
drmFreeVersion(version_render);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
pvr_physical_device_enumerate(struct vk_instance *const vk_instance)
|
||||
{
|
||||
|
|
@ -649,6 +691,13 @@ pvr_physical_device_enumerate(struct vk_instance *const vk_instance)
|
|||
goto err_free_pdevice;
|
||||
}
|
||||
|
||||
if (PVR_IS_DEBUG_SET(INFO)) {
|
||||
pvr_physical_device_dump_info(
|
||||
pdevice,
|
||||
drm_display_device->deviceinfo.platform->compatible,
|
||||
drm_render_device->deviceinfo.platform->compatible);
|
||||
}
|
||||
|
||||
list_add(&pdevice->vk.link, &vk_instance->physical_devices.list);
|
||||
|
||||
result = VK_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue