Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 602a811b7599
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c823682efdb9
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on May 9, 2021

  1. Updated submodules

    azonenberg committed May 9, 2021
    Copy the full SHA
    a3021dd View commit details
  2. WaveformArea: don't waste time mapping/unmapping unused buffers on de…

    …nse packed waveforms. Fixes #340.
    azonenberg committed May 9, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c823682 View commit details
Showing with 21 additions and 7 deletions.
  1. +1 −1 lib
  2. +3 −0 src/glscopeclient/WaveformArea.h
  3. +17 −6 src/glscopeclient/WaveformArea_rendering.cpp
3 changes: 3 additions & 0 deletions src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -66,6 +66,9 @@ class WaveformRenderData
, m_persistence(false)
{}

bool IsAnalog()
{ return m_channel.m_channel->GetType() == OscilloscopeChannel::CHANNEL_TYPE_ANALOG; }

bool IsDigital()
{ return m_channel.m_channel->GetType() == OscilloscopeChannel::CHANNEL_TYPE_DIGITAL; }

23 changes: 17 additions & 6 deletions src/glscopeclient/WaveformArea_rendering.cpp
Original file line number Diff line number Diff line change
@@ -54,8 +54,7 @@ template size_t WaveformArea::BinarySearchForGequal<int64_t>(int64_t* buf, size_
void WaveformRenderData::MapBuffers(size_t width, bool update_waveform)
{
//Calculate the number of points we'll need to draw. Default to 1 if no data
if( (m_channel.m_channel->GetType() != OscilloscopeChannel::CHANNEL_TYPE_DIGITAL) &&
(m_channel.m_channel->GetType() != OscilloscopeChannel::CHANNEL_TYPE_ANALOG))
if(!IsAnalog() && !IsDigital() )
{
m_count = 1;
}
@@ -72,7 +71,12 @@ void WaveformRenderData::MapBuffers(size_t width, bool update_waveform)

if(update_waveform)
{
m_mappedXBuffer = (int64_t*)m_waveformXBuffer.Map(m_count*sizeof(int64_t));
//Skip mapping X buffer if dense packed analog
if(IsDensePacked() && IsAnalog() )
m_mappedXBuffer = NULL;
else
m_mappedXBuffer = (int64_t*)m_waveformXBuffer.Map(m_count*sizeof(int64_t));

if(IsDigital())
{
//round up to next multiple of 4 since buffer is actually made of int32's
@@ -86,7 +90,12 @@ void WaveformRenderData::MapBuffers(size_t width, bool update_waveform)
}
}

m_mappedIndexBuffer = (uint32_t*)m_waveformIndexBuffer.Map(width*sizeof(uint32_t));
//Skip mapping index buffer if dense packed analog
if(IsDensePacked() && IsAnalog())
m_mappedIndexBuffer = NULL;
else
m_mappedIndexBuffer = (uint32_t*)m_waveformIndexBuffer.Map(width*sizeof(uint32_t));

m_mappedConfigBuffer = (uint32_t*)m_waveformConfigBuffer.Map(sizeof(float)*13);
//We're writing to different offsets in the buffer, not reinterpreting, so this is safe.
//A struct is probably the better long term solution...
@@ -99,10 +108,12 @@ void WaveformRenderData::UnmapBuffers(bool update_waveform)
{
if(update_waveform)
{
m_waveformXBuffer.Unmap();
if(m_mappedXBuffer != NULL)
m_waveformXBuffer.Unmap();
m_waveformYBuffer.Unmap();
}
m_waveformIndexBuffer.Unmap();
if(m_mappedIndexBuffer != NULL)
m_waveformIndexBuffer.Unmap();
m_waveformConfigBuffer.Unmap();
}