From ce2c12be413dd843f98e632b7db83d54bf0bf4e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 27 Jan 2023 08:12:40 +0200 Subject: [PATCH] Trace: Convert qtopengl module to use tracepointgen tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I441455a4d49a559fb591ea5c8cffb97af66fb2b1 Reviewed-by: Hatem ElKharashy Reviewed-by: Tomi Korpipää Reviewed-by: Janne Koskinen (cherry picked from commit 4d359e2bec96507a1bc698525f4b5eda57b4a48f) Reviewed-by: Qt Cherry-pick Bot --- src/opengl/CMakeLists.txt | 8 ++++++-- src/opengl/qopenglframebufferobject.cpp | 18 ++++++++++++++---- src/opengl/qopenglpaintengine.cpp | 14 +++----------- src/opengl/qopengltexturecache.cpp | 3 +++ 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/opengl/CMakeLists.txt b/src/opengl/CMakeLists.txt index 8aec1c685bb..3f5e34e9d0e 100644 --- a/src/opengl/CMakeLists.txt +++ b/src/opengl/CMakeLists.txt @@ -105,8 +105,12 @@ qt_internal_extend_target(OpenGL CONDITION QT_FEATURE_egl qopenglcompositorbackingstore.cpp qopenglcompositorbackingstore_p.h ) - -qt_internal_create_tracepoints(OpenGL qtopengl.tracepoints) +qt_internal_generate_tracepoints(OpenGL opengl + SOURCES + qopenglframebufferobject.cpp + qopenglpaintengine.cpp + qopengltexturecache.cpp +) qt_internal_add_docs(OpenGL doc/qtopengl.qdocconf ) diff --git a/src/opengl/qopenglframebufferobject.cpp b/src/opengl/qopenglframebufferobject.cpp index 64b07e661fb..ccb4f7b0a86 100644 --- a/src/opengl/qopenglframebufferobject.cpp +++ b/src/opengl/qopenglframebufferobject.cpp @@ -18,6 +18,15 @@ QT_BEGIN_NAMESPACE +Q_TRACE_PREFIX(qtopengl, + "#include " \ + "#include " \ + "#include " +); +Q_TRACE_PARAM_REPLACE(GLenum, int); +Q_TRACE_PARAM_REPLACE(GLint, int); +Q_TRACE_METADATA(qtopengl, "ENUM { } QOpenGLFramebufferObject::Attachment; "); + #ifndef QT_NO_DEBUG #define QT_RESET_GLERROR() \ { \ @@ -452,10 +461,11 @@ namespace } } -void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *qfbo, const QSize &size, - QOpenGLFramebufferObject::Attachment attachment, - GLenum texture_target, GLenum internal_format, - GLint samples, bool mipmap) +void Q_TRACE_INSTRUMENT(qtopengl) QOpenGLFramebufferObjectPrivate::init( + QOpenGLFramebufferObject *qfbo, const QSize &size, + QOpenGLFramebufferObject::Attachment attachment, + GLenum texture_target, GLenum internal_format, + GLint samples, bool mipmap) { Q_TRACE_SCOPE(QOpenGLFramebufferObjectPrivate_init, qfbo, size, attachment, texture_target, internal_format, samples, mipmap); Q_UNUSED(qfbo); diff --git a/src/opengl/qopenglpaintengine.cpp b/src/opengl/qopenglpaintengine.cpp index 8cdf08bdefe..062eaa6a530 100644 --- a/src/opengl/qopenglpaintengine.cpp +++ b/src/opengl/qopenglpaintengine.cpp @@ -606,18 +606,10 @@ static inline void setCoords(GLfloat *coords, const QOpenGLRect &rect) coords[7] = rect.bottom; } -void QOpenGL2PaintEngineExPrivate::drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern) +void Q_TRACE_INSTRUMENT(qtopengl) QOpenGL2PaintEngineExPrivate::drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern) { - Q_TRACE_SCOPE(QOpenGL2PaintEngineExPrivate_drawTexture, - dest.left, - dest.top, - dest.right, - dest.bottom, - src.left, - src.top, - src.right, - src.bottom, - textureSize, opaque); + Q_TRACE_PARAM_REPLACE(QOpenGLRect, QRectF); + Q_TRACE_SCOPE(QOpenGL2PaintEngineExPrivate_drawTexture, dest, src, textureSize, opaque, pattern); // Setup for texture drawing currentBrush = noBrush; diff --git a/src/opengl/qopengltexturecache.cpp b/src/opengl/qopengltexturecache.cpp index 6d706325a5b..107380ff08c 100644 --- a/src/opengl/qopengltexturecache.cpp +++ b/src/opengl/qopengltexturecache.cpp @@ -121,6 +121,9 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i return id; } +Q_TRACE_POINT(qtopengl, QOpenGLTextureCache_bindTexture_entry, QOpenGLContext *context, qint64 key, const unsigned char *image, int options); +Q_TRACE_POINT(qtopengl, QOpenGLTextureCache_bindTexture_exit); + GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image, QOpenGLTextureUploader::BindOptions options) { Q_TRACE_SCOPE(QOpenGLTextureCache_bindTexture, context, key, image.bits(), options);