mesa: Add CPU traces

A few function scope traces are added to texture management entry
points, shader compilation, draw and 2D rect copy to give better
context to driver traces.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Benjamin Lee <benjamin.lee@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34385>
This commit is contained in:
Loïc Molinari 2025-03-08 17:12:34 +01:00 committed by Marge Bot
parent 2bf9b9b73d
commit 9205212d2e
6 changed files with 23 additions and 0 deletions

View file

@ -23,6 +23,7 @@
*/
#include "util/glheader.h"
#include "util/perf/cpu_trace.h"
#include "blend.h"
#include "bufferobj.h"
@ -1046,6 +1047,8 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
struct gl_renderbuffer *rb;
struct gl_pixelstore_attrib clippedPacking;
MESA_TRACE_FUNC();
GET_CURRENT_CONTEXT(ctx);
FLUSH_VERTICES(ctx, 0, 0);

View file

@ -1225,6 +1225,8 @@ _mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh)
_mesa_log_direct(sh->Source);
}
MESA_TRACE_FUNC();
ensure_builtin_types(ctx);
/* this call will set the shader->CompileStatus field to indicate if

View file

@ -31,6 +31,7 @@
#include <stdbool.h>
#include "util/glheader.h"
#include "util/perf/cpu_trace.h"
#include "bufferobj.h"
#include "context.h"
#include "enums.h"
@ -3164,6 +3165,8 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
mesa_format texFormat;
bool dimensionsOK = true, sizeOK = true;
MESA_TRACE_FUNC();
FLUSH_VERTICES(ctx, 0, 0);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) {
@ -3828,6 +3831,8 @@ texture_sub_image(struct gl_context *ctx, GLuint dims,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid *pixels)
{
MESA_TRACE_FUNC();
FLUSH_VERTICES(ctx, 0, 0);
_mesa_update_pixel(ctx);
@ -4460,6 +4465,8 @@ copy_texture_sub_image(struct gl_context *ctx, GLuint dims,
{
struct gl_texture_image *texImage;
MESA_TRACE_FUNC();
_mesa_lock_texture(ctx, texObj);
texImage = _mesa_select_tex_image(texObj, target, level);
@ -4560,6 +4567,8 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO
struct gl_texture_image *texImage;
mesa_format texFormat;
MESA_TRACE_FUNC();
FLUSH_VERTICES(ctx, 0, 0);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))

View file

@ -28,6 +28,7 @@
*/
#include "util/glheader.h"
#include "util/perf/cpu_trace.h"
#include "context.h"
#include "enums.h"
@ -535,6 +536,8 @@ texture_storage(struct gl_context *ctx, GLuint dims,
(memObj ? "Mem" : "");
const char* suffix2 = attribs ? "Attribs" : "";
MESA_TRACE_FUNC();
assert(texObj);
if (!no_error) {

View file

@ -62,6 +62,7 @@
#include "util/u_draw.h"
#include "util/u_upload_mgr.h"
#include "util/u_threaded_context.h"
#include "util/perf/cpu_trace.h"
#include "draw/draw_context.h"
#include "cso_cache/cso_context.h"
@ -117,6 +118,8 @@ st_draw_gallium(struct gl_context *ctx,
const struct pipe_draw_start_count_bias *draws,
unsigned num_draws)
{
MESA_TRACE_FUNC();
struct st_context *st = st_context(ctx);
cso_draw_vbo(st->cso_context, info, drawid_offset, indirect, draws, num_draws);

View file

@ -37,6 +37,7 @@
#include "util/format/u_format.h"
#include "util/format/u_format_s3tc.h"
#include "util/u_math.h"
#include "util/perf/cpu_trace.h"
/**
* Copy 2D rect from one place to another.
@ -56,6 +57,8 @@ util_copy_rect(void * dst_in,
unsigned src_x,
unsigned src_y)
{
MESA_TRACE_SCOPE("%s width=%u height=%u", __func__, width, height);
uint8_t *dst = dst_in;
const uint8_t *src = src_in;
unsigned i;