您如何知道所显示的内容已完全绘制在屏幕上? [英] How do you know what you've displayed is completely drawn on screen?

查看:96
本文介绍了您如何知道所显示的内容已完全绘制在屏幕上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在计算机监视器上显示图像涉及图形API的使用,该API调度一系列异步调用...并在给定的时间将所需的东西放到计算机屏幕上.

Displaying images on a computer monitor involves the usage of a graphic API, which dispatches a series of asynchronous calls... and at some given time, put the wanted stuff on the computer screen.

但是,如果您有兴趣在完全绘制所需图像(用户可见)时知道 确切 的CPU时间怎么办?

But, what if you are interested in knowing the exact CPU time at the point where the required image is fully drawn (and visible to the user)?

在显示所有内容时,我真的需要获取CPU时间戳,以将该时间点与我进行的其他测量相关联.

I really need to grab a CPU timestamp when everything is displayed to relate this point in time to other measurements I take.

在不考虑图形堆栈的异步行为的情况下,很多事情都会使图形调用的长度发生抖动:

Without taking account of the asynchronous behavior of the graphic stack, many things can get the length of the graphic calls to jitter:

  • 多线程;
  • 与V-BLANK同步(不幸的是,为了避免撕裂,需要这样做);
  • 我还忘记了什么? :P

我的目标是Linux上的解决方案,但是我可以使用任何其他操作系统.我已经研究了X.org服务器和OpenGL API的 xvideo扩展的一部分,但是我还没有找到有效的解决方案.

I target a solution on Linux, but I'm open to any other OS. I've already studied parts of the xvideo extension for X.org server and the OpenGL API but I havent found an effective solution yet.

我只希望解决方案不涉及破解视频驱动程序/硬件!

I only hope the solution doesn't involve hacking into video drivers / hardware!

注意:我将无法在所需的硬件上使用最新的Nvidia G-SYNC.尽管此技术可以消除一些不可预测的抖动,但我认为它不能完全解决此问题.

Note: I won't be able to use the recent Nvidia G-SYNC thing on the required hardware. Although, this technology would get rid of some of the unpredictable jitter, I think it wouldn't completely solve this issue.

OpenGL Wiki 建议以下内容:如果需要GPU <-> CPU同步,您应该使用高精度/多媒体计时器,而不要在缓冲区交换后使用glFinish."

OpenGL Wiki suggests the following: "If GPU<->CPU synchronization is desired, you should use a high-precision/multimedia timer rather than glFinish after a buffer swap."

有人知道在GPU队列中的swapBuffer调用完成之后,如何正确捕获这样的高精度/多媒体计时器值吗?

Does somebody knows how properly grab such a high-precision/multimedia timer value just after the swapBuffer call is completed in the GPU queue?

推荐答案

最近的OpenGL提供了同步/栅栏对象.您可以将同步对象放置在OpenGL命令流中,然后等待它们通过.参见 http://www.opengl.org/wiki/Sync_Object

Recent OpenGL provides sync/fence objects. You can place sync objects in the OpenGL command stream and later wait for them to get passed. See http://www.opengl.org/wiki/Sync_Object

这篇关于您如何知道所显示的内容已完全绘制在屏幕上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆