<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk" -->

---
title: Trimming apitrace workload captures for better Mesa testing
description: gltrim is a new tool added to apitrace that trims OpenGL trace files to user-selected target frames, making them more suitable for Mesa CI testing and...
canonical: https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Trimming apitrace workload captures for better Mesa testing | daily.dev
og:description: gltrim is a new tool added to apitrace that trims OpenGL trace files to user-selected target frames, making them more suitable for Mesa CI testing and...
og:url: https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk
og:image: https://api.daily.dev/og/posts/kMmzwy2tK.png
og:image:alt: Trimming apitrace workload captures for better Mesa testing
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Trimming apitrace workload captures for better Mesa testing

**[Collabora Blog](https://daily.dev/sources/collabora)** · 9 min read · 0 upvotes · 0 comments

## Summary

gltrim is a new tool added to apitrace that trims OpenGL trace files to user-selected target frames, making them more suitable for Mesa CI testing and performance analysis. Rather than exhaustive dependency tracking (which is slow and memory-intensive), gltrim uses lightweight object tracking and lets users iteratively add setup frames when the naive trim produces incorrect rendering. The tool can reduce trace file sizes to as low as 10% of the original and cut runtime roughly in half. Practical examples with Doom3, Alien Isolation, Unturned, Civilization V, and SOMA illustrate common trimming scenarios and how to resolve missing geometry or incorrect brightness by keeping state changes or adding extra setup frames.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.collabora.com/news-and-blog/blog/2021/02/01/trimming-apitrace-workload-captures-for-better-mesa-testing>

## Questions this post answers

### How do I trim an apitrace trace file to a single frame using gltrim?

Run `apitrace gltrim -f <frame_number> -o output.trace input.trace` to trim to a target frame. If textures appear with wrong brightness, add the `-k` flag to keep all state changes. If geometry is missing, use `-t` to list frames with the most OpenGL calls and specify those high-call-count frames near your target as additional setup frames. Trimmed traces can reach as low as 10% of the original file size.

_Developers optimizing Mesa CI pipelines track gltrim techniques and apitrace workflows on daily.dev._

### What is the difference between gltrim and RenderDoc for capturing a single OpenGL frame?

RenderDoc captures a single frame by executing OpenGL and storing intermediate textures and buffer data, so the captured frame may only contain texture uploads and blits rather than the full draw call sequence. gltrim instead reconstructs the frame from scratch using tracked draw calls and state changes, but does not support compatibility contexts — a feature many games require — whereas RenderDoc also lacks compatibility context support.

_Choosing between graphics capture tools for your test suite? Developers compare options like these on daily.dev._

## Similar posts on daily.dev

- [Investigating Linux graphics](https://daily.dev/posts/investigating-linux-graphics-pt8vvc5hu) · Lobsters · 0 upvotes · 0 comments
- [Valve Creates The Ray-Tracing Inspector "RTI" To Help Further Optimize Linux GPU Drivers](https://daily.dev/posts/valve-creates-the-ray-tracing-inspector-rti-to-help-further-optimize-linux-gpu-drivers-7gu3nkkw8) · Phoronix · 0 upvotes · 0 comments
- [Tools to tell if your game is broken](https://daily.dev/posts/tools-to-tell-if-your-game-is-broken-u1zl2dc5a) · GamesIndustry.biz · 0 upvotes · 0 comments

---

Tags: [#mesa](https://daily.dev/tags/mesa)

[View this post on daily.dev](https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Trimming apitrace workload captures for better Mesa testing","url":"https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk"},"datePublished":"2026-08-11T08:55:09.304Z","dateModified":"2026-08-11T09:34:03.994Z","description":"gltrim is a new tool added to apitrace that trims OpenGL trace files to user-selected target frames, making them more suitable for Mesa CI testing and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/021595fa028f0e514a7b4135a917653b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/021595fa028f0e514a7b4135a917653b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Collabora Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Collabora Blog","logo":"https://media.daily.dev/image/upload/s--ZGZ0FjqS--/f_auto,q_auto/v1786438306/logos/collabora?_a=BAMAMicg0","url":"https://daily.dev/sources/collabora"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"mesa","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Collabora Blog","item":"https://daily.dev/sources/collabora"},{"@type":"ListItem","position":3,"name":"Trimming apitrace workload captures for better Mesa testing"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/trimming-apitrace-workload-captures-for-better-mesa-testing-kmmzwy2tk#faq","mainEntity":[{"@type":"Question","name":"How do I trim an apitrace trace file to a single frame using gltrim?","acceptedAnswer":{"@type":"Answer","text":"Run `apitrace gltrim -f <frame_number> -o output.trace input.trace` to trim to a target frame. If textures appear with wrong brightness, add the `-k` flag to keep all state changes. If geometry is missing, use `-t` to list frames with the most OpenGL calls and specify those high-call-count frames near your target as additional setup frames. Trimmed traces can reach as low as 10% of the original file size. Developers optimizing Mesa CI pipelines track gltrim techniques and apitrace workflows on daily.dev."}},{"@type":"Question","name":"What is the difference between gltrim and RenderDoc for capturing a single OpenGL frame?","acceptedAnswer":{"@type":"Answer","text":"RenderDoc captures a single frame by executing OpenGL and storing intermediate textures and buffer data, so the captured frame may only contain texture uploads and blits rather than the full draw call sequence. gltrim instead reconstructs the frame from scratch using tracked draw calls and state changes, but does not support compatibility contexts — a feature many games require — whereas RenderDoc also lacks compatibility context support. Choosing between graphics capture tools for your test suite? Developers compare options like these on daily.dev."}}]}
```

