debug: Add debugging for features

Two flags are added: one to trace the features that are identified
as supported on the host, and another one that is then used to trace
the use of features. The latter one is only enabled after the
inititalization phase to avoid that the tests used for setting the caps
clobber the log.

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Gert Wollny 6 years ago committed by Jakob Bornecrantz
parent 97f2b21d66
commit 40db85e7ee
  1. 6
      src/vrend_debug.c
  2. 4
      src/vrend_debug.h
  3. 18
      src/vrend_renderer.c

@ -110,6 +110,7 @@ static const struct debug_named_value vrend_debug_options[] = {
{"obj", dbg_object, "Print object creation"},
{"blit", dbg_blit, "Debug blit code path"},
{"copyres", dbg_copy_resource, "Debug copy resource code path"},
{"feat", dbg_features, "Log features found"},
DEBUG_NAMED_VALUE_END
};
@ -128,3 +129,8 @@ unsigned vrend_debug(struct vrend_context *ctx, enum virgl_debug_flags flag)
{
return (vrend_debug_flags & flag) || vrend_context_has_debug_flag(ctx, flag);
}
void vrend_debug_add_flag(enum virgl_debug_flags flag)
{
vrend_debug_flags |= flag;
}

@ -39,6 +39,8 @@ enum virgl_debug_flags {
dbg_object = 1 << 4,
dbg_blit = 1 << 5,
dbg_copy_resource = 1 << 6,
dbg_features = 1 << 7,
dbg_feature_use = 1 << 17,
};
const char *vrend_get_comand_name(enum virgl_context_cmd cmd);
@ -50,6 +52,8 @@ void vrend_init_debug_flags(void);
unsigned vrend_debug(struct vrend_context *ctx, enum virgl_debug_flags flag);
void vrend_debug_add_flag(enum virgl_debug_flags flag);
#ifndef NDEBUG
#define VREND_DEBUG(flag, ctx, ...) \
if (vrend_debug(ctx, flag)) \

@ -253,6 +253,9 @@ static struct global_renderer_state vrend_state;
static inline bool has_feature(enum features_id feature_id)
{
VREND_DEBUG(dbg_feature_use, NULL, "Try using feature %s:%d\n",
feature_list[feature_id].log_name,
vrend_state.features[feature_id]);
return vrend_state.features[feature_id];
}
@ -723,14 +726,20 @@ static void init_features(int gl_ver, int gles_ver)
{
for (enum features_id id = 0; id < feat_last; id++) {
if (gl_ver >= feature_list[id].gl_ver ||
gles_ver >= feature_list[id].gles_ver)
gles_ver >= feature_list[id].gles_ver) {
set_feature(id);
else {
VREND_DEBUG(dbg_features, NULL, "Host feature %s provided by %s %3.1f\n",
feature_list[id].log_name, (gl_ver > 0 ? "GL" : "GLES"),
0.1f * (gl_ver > 0 ? gl_ver : gles_ver));
} else {
for (uint32_t i = 0; i < FEAT_MAX_EXTS; i++) {
if (!feature_list[id].gl_ext[i])
break;
if (epoxy_has_gl_extension(feature_list[id].gl_ext[i])) {
set_feature(id);
VREND_DEBUG(dbg_features, NULL,
"Host feature %s provide by %s\n", feature_list[id].log_name,
feature_list[id].gl_ext[i]);
break;
}
}
@ -8355,6 +8364,11 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c
caps->v2.capability_bits |= VIRGL_CAP_TEXTURE_BARRIER;
/* always enable this since it doesn't require an ext to pass tests */
caps->v2.capability_bits |= VIRGL_CAP_TGSI_COMPONENTS;
/* Enable feature use just now otherwise we just get a lot noise because
* of the caps setting */
if (vrend_debug(NULL, dbg_features))
vrend_debug_add_flag(dbg_feature_use);
}
void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,

Loading…
Cancel
Save