From 6d323c0b221a3b127d80e338a42306cc34bc4d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Dapena=20Paz?= Date: Fri, 13 Jun 2014 18:48:49 +0200 Subject: Add more LTTNG tracing points * QImage and QPixmap copy and transform operations. * OpenGL paint engine texture cache texture upload * OpenGL paint engine draw texture Task-number: QTBUG-83347 Pick-to: 5.15 Change-Id: I03150d6ff80cbbcd787133d75854715cb81b5571 Reviewed-by: Laszlo Agocs Reviewed-by: Eirik Aavitsland --- src/gui/image/qimage.cpp | 15 +++++++++++++++ src/gui/image/qpixmap.cpp | 8 ++++++++ src/gui/qtgui.tracepoints | 22 ++++++++++++++++++++++ src/opengl/CMakeLists.txt | 3 +++ src/opengl/opengl.pro | 3 +++ src/opengl/qopenglframebufferobject.cpp | 7 ++++++- src/opengl/qopenglpaintengine.cpp | 4 ++++ src/opengl/qopengltexturecache.cpp | 4 ++++ src/opengl/qtopengl.tracepoints | 3 +++ 9 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/opengl/qtopengl.tracepoints diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 1dc260246c..27969cabb6 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -73,6 +73,8 @@ #include "qthreadpool.h" #endif +#include + QT_BEGIN_NAMESPACE static inline bool isLocked(QImageData *data) @@ -127,6 +129,8 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format) if (size.isEmpty() || format == QImage::Format_Invalid) return nullptr; // invalid parameter(s) + Q_TRACE_SCOPE(QImageData_create, size, format); + int width = size.width(); int height = size.height(); int depth = qt_depthForFormat(format); @@ -1166,6 +1170,7 @@ static void copyMetadata(QImage *dst, const QImage &src) */ QImage QImage::copy(const QRect& r) const { + Q_TRACE_SCOPE(QImage_copy, r); if (!d) return QImage(); @@ -2794,6 +2799,8 @@ QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Transf if (newSize == size()) return *this; + Q_TRACE_SCOPE(QImage_scaled, s, aspectMode, mode); + QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), (qreal)newSize.height() / height()); QImage img = transformed(wm, mode); return img; @@ -2822,6 +2829,8 @@ QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode) const if (w <= 0) return QImage(); + Q_TRACE_SCOPE(QImage_scaledToWidth, w, mode); + qreal factor = (qreal) w / width(); QTransform wm = QTransform::fromScale(factor, factor); return transformed(wm, mode); @@ -2850,6 +2859,8 @@ QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const if (h <= 0) return QImage(); + Q_TRACE_SCOPE(QImage_scaledToHeight, h, mode); + qreal factor = (qreal) h / height(); QTransform wm = QTransform::fromScale(factor, factor); return transformed(wm, mode); @@ -3304,6 +3315,8 @@ QImage QImage::rgbSwapped_helper() const if (isNull()) return *this; + Q_TRACE_SCOPE(QImage_rgbSwapped_helper); + QImage res; switch (d->format) { @@ -4507,6 +4520,8 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode if (!d) return QImage(); + Q_TRACE_SCOPE(QImage_transformed, matrix, mode); + // source image data int ws = width(); int hs = height(); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index bf20a9066b..3b9b98d58f 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -66,6 +66,8 @@ #include "qpixmap_raster_p.h" #include "private/qhexstring_p.h" +#include + QT_BEGIN_NAMESPACE static bool qt_pixmap_thread_test() @@ -1053,6 +1055,8 @@ QPixmap QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Tran if (newSize == size()) return *this; + Q_TRACE_SCOPE(QPixmap_scaled, s, aspectMode, mode); + QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), (qreal)newSize.height() / height()); QPixmap pix = transformed(wm, mode); @@ -1082,6 +1086,8 @@ QPixmap QPixmap::scaledToWidth(int w, Qt::TransformationMode mode) const if (w <= 0) return QPixmap(); + Q_TRACE_SCOPE(QPixmap_scaledToWidth, w, mode); + qreal factor = (qreal) w / width(); QTransform wm = QTransform::fromScale(factor, factor); return transformed(wm, mode); @@ -1110,6 +1116,8 @@ QPixmap QPixmap::scaledToHeight(int h, Qt::TransformationMode mode) const if (h <= 0) return QPixmap(); + Q_TRACE_SCOPE(QPixmap_scaledToHeight, h, mode); + qreal factor = (qreal) h / height(); QTransform wm = QTransform::fromScale(factor, factor); return transformed(wm, mode); diff --git a/src/gui/qtgui.tracepoints b/src/gui/qtgui.tracepoints index 52916a3aa2..2b09c6a1e2 100644 --- a/src/gui/qtgui.tracepoints +++ b/src/gui/qtgui.tracepoints @@ -15,5 +15,27 @@ QFontDatabase_load(const QString &family, int pointSize) QFontDatabase_loadEngine(const QString &family, int pointSize) QFontDatabasePrivate_addAppFont(const QString &fileName) +QImageData_create_entry(const QSize &size, QImage::Format format) +QImageData_create_exit() +QImage_copy_entry(const QRect& r) +QImage_copy_exit() +QImage_scaled_entry(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) +QImage_scaled_exit() +QImage_scaledToWidth_entry(int w, Qt::TransformationMode mode) +QImage_scaledToWidth_exit() +QImage_scaledToHeight_entry(int h, Qt::TransformationMode mode) +QImage_scaledToHeight_exit() +QImage_rgbSwapped_helper_entry() +QImage_rgbSwapped_helper_exit() +QImage_transformed_entry(const QTransform &matrix, Qt::TransformationMode mode ) +QImage_transformed_exit() + +QPixmap_scaled_entry(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::TransformationMode mode) +QPixmap_scaled_exit() +QPixmap_scaledToWidth_entry(int w, Qt::TransformationMode mode) +QPixmap_scaledToWidth_exit() +QPixmap_scaledToHeight_entry(int h, Qt::TransformationMode mode) +QPixmap_scaledToHeight_exit() + QImageReader_read_before_reading(QImageReader *reader, const QString &filename) QImageReader_read_after_reading(QImageReader *reader, bool result) diff --git a/src/opengl/CMakeLists.txt b/src/opengl/CMakeLists.txt index 7fac433205..1d8544ab8e 100644 --- a/src/opengl/CMakeLists.txt +++ b/src/opengl/CMakeLists.txt @@ -98,6 +98,9 @@ qt_extend_target(OpenGL CONDITION QT_FEATURE_egl qopenglcompositor.cpp qopenglcompositor_p.h qopenglcompositorbackingstore.cpp qopenglcompositorbackingstore_p.h ) + + +qt_create_tracepoints(OpenGL qtopengl.tracepoints) qt_add_docs(OpenGL doc/qtopengl.qdocconf ) diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index f190616ca8..0dd3d33552 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -152,3 +152,6 @@ qtConfig(egl) { } load(qt_module) + +TRACEPOINT_PROVIDER = $$PWD/qtopengl.tracepoints +CONFIG += qt_tracepoints diff --git a/src/opengl/qopenglframebufferobject.cpp b/src/opengl/qopenglframebufferobject.cpp index ba18647387..813c01b0a5 100644 --- a/src/opengl/qopenglframebufferobject.cpp +++ b/src/opengl/qopenglframebufferobject.cpp @@ -50,6 +50,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE #ifndef QT_NO_DEBUG @@ -467,11 +469,14 @@ namespace } } -void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSize &size, +void 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); + QOpenGLContext *ctx = QOpenGLContext::currentContext(); funcs.initializeOpenGLFunctions(); diff --git a/src/opengl/qopenglpaintengine.cpp b/src/opengl/qopenglpaintengine.cpp index d1e8cabf28..51d2a48682 100644 --- a/src/opengl/qopenglpaintengine.cpp +++ b/src/opengl/qopenglpaintengine.cpp @@ -87,6 +87,8 @@ #include +#include + #ifndef GL_KHR_blend_equation_advanced #define GL_KHR_blend_equation_advanced 1 #define GL_MULTIPLY_KHR 0x9294 @@ -635,6 +637,8 @@ static inline void setCoords(GLfloat *coords, const QOpenGLRect &rect) void QOpenGL2PaintEngineExPrivate::drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern) { + 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 5256c429e0..a58570dbc4 100644 --- a/src/opengl/qopengltexturecache.cpp +++ b/src/opengl/qopengltexturecache.cpp @@ -44,6 +44,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE class QOpenGLTextureCacheWrapper @@ -157,6 +159,8 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image, QOpenGLTextureUploader::BindOptions options) { + Q_TRACE_SCOPE(QOpenGLTextureCache_bindTexture, context, key, image, options); + GLuint id; QOpenGLFunctions *funcs = context->functions(); funcs->glGenTextures(1, &id); diff --git a/src/opengl/qtopengl.tracepoints b/src/opengl/qtopengl.tracepoints new file mode 100644 index 0000000000..3c3043d3d4 --- /dev/null +++ b/src/opengl/qtopengl.tracepoints @@ -0,0 +1,3 @@ +QOpenGLFramebufferObjectPrivate_init(QOpenGLFramebufferObject *qfbo, const QSize &size, QOpenGLFramebufferObject::Attachment attachment, GLenum texture_target, GLenum internal_format, GLint samples, bool mipmap) +QOpenGL2PaintEngineExPrivate_drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern) +QOpenGLTextureCache_bindTexture(QOpenGLContext *context, qint64 key, const QImage &image, QOpenGLTextureUploader::BindOptions options) -- cgit v1.2.3