Avoid steady-state v210 double copy
This commit is contained in:
@@ -836,6 +836,7 @@ int main(int argc, char* argv[])
|
||||
std::vector<const VideoFrame*> pendingFrames(feedCount);
|
||||
std::vector<uint64_t> pendingVersions(feedCount);
|
||||
std::vector<bool> pendingUploadNeeded(feedCount);
|
||||
std::vector<bool> postFenceDirectV210Read(feedCount);
|
||||
std::vector<double> feedUploadCredits(feedCount, 1.0);
|
||||
uint64_t lastUploadPaceTicks = SDL_GetPerformanceCounter();
|
||||
|
||||
@@ -1353,6 +1354,11 @@ int main(int argc, char* argv[])
|
||||
pendingUploadNeeded.end(),
|
||||
false
|
||||
);
|
||||
std::fill(
|
||||
postFenceDirectV210Read.begin(),
|
||||
postFenceDirectV210Read.end(),
|
||||
false
|
||||
);
|
||||
|
||||
const uint64_t uploadPaceTicks =
|
||||
SDL_GetPerformanceCounter();
|
||||
@@ -1385,8 +1391,52 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
auto recordFeedVersionStats =
|
||||
[&](uint32_t feedIndex, bool uploadNeeded)
|
||||
{
|
||||
if (!config.logPerf)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (uploadNeeded)
|
||||
{
|
||||
++feedPerfStats[feedIndex].updates;
|
||||
|
||||
if (feeds[feedIndex]->hasGrainIndex())
|
||||
{
|
||||
const uint64_t grain =
|
||||
feeds[feedIndex]->grainIndex();
|
||||
|
||||
if (feedPerfStats[feedIndex].hasLastGrain &&
|
||||
grain >
|
||||
feedPerfStats[feedIndex].lastGrain + 1)
|
||||
{
|
||||
feedPerfStats[feedIndex].skippedGrains +=
|
||||
grain -
|
||||
feedPerfStats[feedIndex].lastGrain -
|
||||
1;
|
||||
}
|
||||
|
||||
feedPerfStats[feedIndex].lastGrain = grain;
|
||||
feedPerfStats[feedIndex].hasLastGrain = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++feedPerfStats[feedIndex].repeats;
|
||||
}
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < feedCount; ++i)
|
||||
{
|
||||
if (v210FeedReady[i] &&
|
||||
feeds[i]->supportsDirectV210Read())
|
||||
{
|
||||
postFenceDirectV210Read[i] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
perfSectionStartTicks =
|
||||
SDL_GetPerformanceCounter();
|
||||
|
||||
@@ -1405,33 +1455,7 @@ int main(int argc, char* argv[])
|
||||
perfStats.feedReadTicks += elapsed;
|
||||
framePerf.feedReadTicks += elapsed;
|
||||
|
||||
if (uploadNeeded)
|
||||
{
|
||||
++feedPerfStats[i].updates;
|
||||
|
||||
if (feeds[i]->hasGrainIndex())
|
||||
{
|
||||
const uint64_t grain =
|
||||
feeds[i]->grainIndex();
|
||||
|
||||
if (feedPerfStats[i].hasLastGrain &&
|
||||
grain >
|
||||
feedPerfStats[i].lastGrain + 1)
|
||||
{
|
||||
feedPerfStats[i].skippedGrains +=
|
||||
grain -
|
||||
feedPerfStats[i].lastGrain -
|
||||
1;
|
||||
}
|
||||
|
||||
feedPerfStats[i].lastGrain = grain;
|
||||
feedPerfStats[i].hasLastGrain = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++feedPerfStats[i].repeats;
|
||||
}
|
||||
recordFeedVersionStats(i, uploadNeeded);
|
||||
}
|
||||
|
||||
if (!uploadNeeded)
|
||||
@@ -1511,12 +1535,16 @@ int main(int argc, char* argv[])
|
||||
const uint32_t i =
|
||||
(uploadStart + offset) % feedCount;
|
||||
|
||||
if (!pendingUploadNeeded[i])
|
||||
const bool directV210Read =
|
||||
postFenceDirectV210Read[i];
|
||||
|
||||
if (!directV210Read && !pendingUploadNeeded[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const bool isV210 = feeds[i]->hasV210();
|
||||
const bool isV210 =
|
||||
directV210Read || feeds[i]->hasV210();
|
||||
if (config.paceUploads &&
|
||||
isV210 &&
|
||||
feeds[i]->hasFrameRate() &&
|
||||
@@ -1543,7 +1571,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (isV210)
|
||||
{
|
||||
if (!v210FeedReady[i])
|
||||
if (!directV210Read && !v210FeedReady[i])
|
||||
{
|
||||
v210Decoder.createFeedResources(
|
||||
ctx.physicalDevice(),
|
||||
@@ -1580,13 +1608,47 @@ int main(int argc, char* argv[])
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::memcpy(
|
||||
v210Feeds[i].v210MappedData,
|
||||
feeds[i]->v210Data(),
|
||||
static_cast<size_t>(
|
||||
feeds[i]->v210Stride()
|
||||
) * feeds[i]->v210Height()
|
||||
);
|
||||
if (directV210Read)
|
||||
{
|
||||
const size_t v210Bytes =
|
||||
static_cast<size_t>(
|
||||
feeds[i]->v210Stride()
|
||||
) *
|
||||
static_cast<size_t>(
|
||||
feeds[i]->v210Height()
|
||||
);
|
||||
|
||||
const bool copied =
|
||||
feeds[i]->readV210FrameInto(
|
||||
frameCounter,
|
||||
v210Feeds[i].v210MappedData,
|
||||
v210Bytes
|
||||
);
|
||||
const uint64_t version =
|
||||
feeds[i]->frameVersion();
|
||||
const bool uploadNeeded =
|
||||
copied &&
|
||||
uploadedVersions[i] != version;
|
||||
|
||||
recordFeedVersionStats(i, uploadNeeded);
|
||||
|
||||
if (!uploadNeeded)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pendingVersions[i] = version;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::memcpy(
|
||||
v210Feeds[i].v210MappedData,
|
||||
feeds[i]->v210Data(),
|
||||
static_cast<size_t>(
|
||||
feeds[i]->v210Stride()
|
||||
) * feeds[i]->v210Height()
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user