| 1 |
/* |
| 2 |
* Copyright © 2023 Imagination Technologies Ltd. |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 |
* of this software and associated documentation files (the "Software"), to deal |
| 6 |
* in the Software without restriction, including without limitation the rights |
| 7 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 |
* copies of the Software, and to permit persons to whom the Software is |
| 9 |
* furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice (including the next |
| 12 |
* paragraph) shall be included in all copies or substantial portions of the |
| 13 |
* Software. |
| 14 |
* |
| 15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 |
* SOFTWARE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "git_sha1.h" |
| 25 |
#include "pvr_dump_info.h" |
| 26 |
#include "pvr_dump.h" |
| 27 |
|
| 28 |
static inline void pvr_dump_field_bvnc(struct pvr_dump_ctx *ctx, |
| 29 |
const char *const name, |
| 30 |
const struct pvr_device_info *info) |
| 31 |
{ |
| 32 |
pvr_dump_field_computed(ctx, |
| 33 |
name, |
| 34 |
"%" PRIu16 ".%" PRIu16 ".%" PRIu16 ".%" PRIu16, |
| 35 |
"0x%08" PRIx64, |
| 36 |
info->ident.b, |
| 37 |
info->ident.v, |
| 38 |
info->ident.n, |
| 39 |
info->ident.c, |
| 40 |
pvr_get_packed_bvnc(info)); |
| 41 |
} |
| 42 |
|
| 43 |
static inline void pvr_dump_field_drm_version(struct pvr_dump_ctx *ctx, |
| 44 |
const char *const name, |
| 45 |
const char *const drm_name, |
| 46 |
int drm_version_major, |
| 47 |
int drm_version_minor, |
| 48 |
int drm_version_patchlevel, |
| 49 |
const char *const drm_date) |
| 50 |
{ |
| 51 |
pvr_dump_field(ctx, |
| 52 |
name, |
| 53 |
"%s %d.%d.%d (%s)", |
| 54 |
drm_name, |
| 55 |
drm_version_major, |
| 56 |
drm_version_minor, |
| 57 |
drm_version_patchlevel, |
| 58 |
drm_date); |
| 59 |
} |
| 60 |
|
| 61 |
static inline void pvr_dump_field_compatible_strings(struct pvr_dump_ctx *ctx, |
| 62 |
char *const *comp) |
| 63 |
{ |
| 64 |
char *const *temp_comp = comp; |
| 65 |
uint32_t count_log10; |
| 66 |
uint32_t index = 0; |
| 67 |
|
| 68 |
if (!*comp) { |
| 69 |
pvr_dump_println(ctx, "<empty>"); |
| 70 |
return; |
| 71 |
} |
| 72 |
|
| 73 |
while (*temp_comp++) |
| 74 |
index++; |
| 75 |
|
| 76 |
count_log10 = u32_dec_digits(index); |
| 77 |
index = 0; |
| 78 |
|
| 79 |
while (*comp) |
| 80 |
pvr_dump_println(ctx, "[%0*" PRIu32 "] %s", count_log10, index++, *comp++); |
| 81 |
} |
| 82 |
|
| 83 |
void pvr_dump_physical_device_info(const struct pvr_device_dump_info *dump_info) |
| 84 |
{ |
| 85 |
const struct pvr_device_runtime_info *run_info = |
| 86 |
dump_info->device_runtime_info; |
| 87 |
const struct pvr_device_info *dev_info = dump_info->device_info; |
| 88 |
struct pvr_dump_ctx ctx; |
| 89 |
|
| 90 |
pvr_dump_begin(&ctx, stderr, "DEBUG INFORMATION", 1); |
| 91 |
|
| 92 |
pvr_dump_mark_section(&ctx, "General Info"); |
| 93 |
pvr_dump_indent(&ctx); |
| 94 |
pvr_dump_field_string(&ctx, "Public Name", dev_info->ident.public_name); |
| 95 |
pvr_dump_field_string(&ctx, "Series Name", dev_info->ident.series_name); |
| 96 |
pvr_dump_field_bvnc(&ctx, "BVNC", dev_info); |
| 97 |
pvr_dump_field_drm_version(&ctx, |
| 98 |
"DRM Display Driver Version", |
| 99 |
dump_info->drm_display.name, |
| 100 |
dump_info->drm_display.major, |
| 101 |
dump_info->drm_display.minor, |
| 102 |
dump_info->drm_display.patchlevel, |
| 103 |
dump_info->drm_display.date); |
| 104 |
pvr_dump_field_drm_version(&ctx, |
| 105 |
"DRM Render Driver Version", |
| 106 |
dump_info->drm_render.name, |
| 107 |
dump_info->drm_render.major, |
| 108 |
dump_info->drm_render.minor, |
| 109 |
dump_info->drm_render.patchlevel, |
| 110 |
dump_info->drm_render.date); |
| 111 |
pvr_dump_field_string(&ctx, "MESA ", PACKAGE_VERSION MESA_GIT_SHA1); |
| 112 |
pvr_dump_dedent(&ctx); |
| 113 |
|
| 114 |
if (dump_info->drm_display.comp) { |
| 115 |
pvr_dump_mark_section(&ctx, "Display Platform Compatible Strings"); |
| 116 |
pvr_dump_indent(&ctx); |
| 117 |
pvr_dump_field_compatible_strings(&ctx, dump_info->drm_display.comp); |
| 118 |
pvr_dump_dedent(&ctx); |
| 119 |
} |
| 120 |
|
| 121 |
pvr_dump_mark_section(&ctx, "Render Platform Compatible Strings"); |
| 122 |
pvr_dump_indent(&ctx); |
| 123 |
pvr_dump_field_compatible_strings(&ctx, dump_info->drm_render.comp); |
| 124 |
pvr_dump_dedent(&ctx); |
| 125 |
pvr_dump_print_eol(&ctx); |
| 126 |
|
| 127 |
pvr_dump_mark_section(&ctx, "Runtime Info"); |
| 128 |
pvr_dump_indent(&ctx); |
| 129 |
pvr_dump_field_member_u64(&ctx, run_info, cdm_max_local_mem_size_regs); |
| 130 |
pvr_dump_field_member_u64_units(&ctx, run_info, max_free_list_size, "bytes"); |
| 131 |
pvr_dump_field_member_u64_units(&ctx, run_info, min_free_list_size, "bytes"); |
| 132 |
pvr_dump_field_member_u64_units(&ctx, |
| 133 |
run_info, |
| 134 |
reserved_shared_size, |
| 135 |
"bytes"); |
| 136 |
pvr_dump_field_member_u64_units(&ctx, |
| 137 |
run_info, |
| 138 |
total_reserved_partition_size, |
| 139 |
"bytes"); |
| 140 |
pvr_dump_field_member_u32(&ctx, run_info, core_count); |
| 141 |
pvr_dump_field_member_u64(&ctx, run_info, max_coeffs); |
| 142 |
pvr_dump_field_member_u64(&ctx, run_info, num_phantoms); |
| 143 |
pvr_dump_dedent(&ctx); |
| 144 |
pvr_dump_print_eol(&ctx); |
| 145 |
|
| 146 |
pvr_dump_end(&ctx); |
| 147 |
} |