Skip to content

Commit 160e802

Browse files
llandwerlin-intelmikesart
authored andcommitted
Rework GPU generated bars color matching
A simple thing to color our bars is to use the same color as the process that generated them. We do this after process colors have been allocated and use a default color when there is no associated process. Signed-off-by: Lionel Landwerlin <[email protected]>
1 parent 30eba58 commit 160e802

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/gpuvis.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -2142,20 +2142,26 @@ void TraceEvents::init_i915_perf_event( trace_event_t &event )
21422142
}
21432143
}
21442144

2145-
m_i915.perf_hw_context_ids.insert( event.pid );
21462145
m_i915.perf_locs.push_back( event.id );
21472146
}
21482147

21492148
void TraceEvents::update_i915_perf_colors()
21502149
{
2151-
uint32_t n_colors = m_i915.perf_hw_context_ids.size();
2152-
uint32_t idx = 0;
2150+
for ( const uint32_t event_id : m_i915.perf_locs )
2151+
{
2152+
trace_event_t &i915_perf_event = m_events[ event_id ];
21532153

2154-
for ( const uint32_t hw_id : m_i915.perf_hw_context_ids ) {
2155-
m_i915.perf_hw_context_colors.insert(
2156-
std::make_pair( hw_id,
2157-
ImColor::HSV( (float) idx / n_colors, 0.8f, 0.8f ) ) );
2158-
idx++;
2154+
if ( m_i915.perf_to_req_in.m_map.find( i915_perf_event.id ) == m_i915.perf_to_req_in.m_map.end() )
2155+
{
2156+
i915_perf_event.color = s_clrs().get( col_Graph_Bari915Execute );
2157+
}
2158+
else
2159+
{
2160+
uint32_t tg_event_id = m_i915.perf_to_req_in.m_map[ i915_perf_event.id ];
2161+
const trace_event_t &tg_event = m_events[ tg_event_id ];
2162+
2163+
i915_perf_event.color = tg_event.color;
2164+
}
21592165
}
21602166
}
21612167

src/gpuvis.h

-2
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,6 @@ class TraceEvents
535535
std::vector< uint32_t > perf_locs;
536536
// i915-perf-begin event to i915_request_in
537537
util_umap< uint32_t, uint32_t > perf_to_req_in;
538-
// i915-perf HW context ID
539-
std::unordered_set< uint32_t > perf_hw_context_ids;
540538
// Maps a HW context ID to its color
541539
std::map< uint32_t, ImU32 > perf_hw_context_colors;
542540
} m_i915;

0 commit comments

Comments
 (0)