]> git.sesse.net Git - casparcg/blobdiff - core/mixer/gpu/ogl_device.cpp
- Increased consumer timeout to 10 seconds.
[casparcg] / core / mixer / gpu / ogl_device.cpp
index 1ea4a74d121ab3e50a542b9365eac6ac23ff177a..0ea77fbb4641b625975a0eeca14650045352f734 100644 (file)
@@ -32,6 +32,7 @@
 #include <common/gl/gl_check.h>\r
 \r
 #include <boost/foreach.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
 \r
 #include <gl/glew.h>\r
 \r
@@ -237,6 +238,97 @@ void ogl_device::yield()
        executor_.yield();\r
 }\r
 \r
+boost::property_tree::wptree ogl_device::info() const\r
+{\r
+       boost::property_tree::wptree info;\r
+\r
+       boost::property_tree::wptree pooled_device_buffers;\r
+       size_t total_pooled_device_buffer_size = 0;\r
+       size_t total_pooled_device_buffer_count = 0;\r
+\r
+       for (size_t i = 0; i < device_pools_.size(); ++i)\r
+       {\r
+               auto& pools = device_pools_.at(i);\r
+               bool mipmapping = i > 3;\r
+               int stride = mipmapping ? i - 3 : i + 1;\r
+\r
+               BOOST_FOREACH(auto& pool, pools)\r
+               {\r
+                       auto width = pool.first >> 16;\r
+                       auto height = pool.first & 0x0000FFFF;\r
+                       auto size = width * height * stride;\r
+                       auto count = pool.second->items.size();\r
+\r
+                       if (count == 0)\r
+                               continue;\r
+\r
+                       boost::property_tree::wptree pool_info;\r
+\r
+                       pool_info.add(L"stride", stride);\r
+                       pool_info.add(L"mipmapping", mipmapping);\r
+                       pool_info.add(L"width", width);\r
+                       pool_info.add(L"height", height);\r
+                       pool_info.add(L"size", size);\r
+                       pool_info.add(L"count", count);\r
+\r
+                       total_pooled_device_buffer_size += size * count;\r
+                       total_pooled_device_buffer_count += count;\r
+\r
+                       pooled_device_buffers.add_child(L"device_buffer_pool", pool_info);\r
+               }\r
+       }\r
+\r
+       info.add_child(L"gl.details.pooled_device_buffers", pooled_device_buffers);\r
+\r
+       boost::property_tree::wptree pooled_host_buffers;\r
+       size_t total_read_size = 0;\r
+       size_t total_write_size = 0;\r
+       size_t total_read_count = 0;\r
+       size_t total_write_count = 0;\r
+\r
+       for (size_t i = 0; i < host_pools_.size(); ++i)\r
+       {\r
+               auto& pools = host_pools_.at(i);\r
+               host_buffer::usage_t usage = static_cast<host_buffer::usage_t>(i);\r
+\r
+               BOOST_FOREACH(auto& pool, pools)\r
+               {\r
+                       auto size = pool.first;\r
+                       auto count = pool.second->items.size();\r
+\r
+                       if (count == 0)\r
+                               continue;\r
+\r
+                       boost::property_tree::wptree pool_info;\r
+\r
+                       pool_info.add(L"usage", usage == host_buffer::read_only\r
+                               ? L"read_only" : L"write_only");\r
+                       pool_info.add(L"size", size);\r
+                       pool_info.add(L"count", count);\r
+\r
+                       pooled_host_buffers.add_child(L"host_buffer_pool", pool_info);\r
+\r
+                       (usage == host_buffer::read_only\r
+                                       ? total_read_count : total_write_count) += count;\r
+                       (usage == host_buffer::read_only\r
+                                       ? total_read_size : total_write_size) += size * count;\r
+               }\r
+       }\r
+\r
+       info.add_child(L"gl.details.pooled_host_buffers", pooled_host_buffers);\r
+\r
+       info.add(L"gl.summary.pooled_device_buffers.total_count", total_pooled_device_buffer_count);\r
+       info.add(L"gl.summary.pooled_device_buffers.total_size", total_pooled_device_buffer_size);\r
+       info.add_child(L"gl.summary.all_device_buffers", device_buffer::info());\r
+       info.add(L"gl.summary.pooled_host_buffers.total_read_count", total_read_count);\r
+       info.add(L"gl.summary.pooled_host_buffers.total_write_count", total_write_count);\r
+       info.add(L"gl.summary.pooled_host_buffers.total_read_size", total_read_size);\r
+       info.add(L"gl.summary.pooled_host_buffers.total_write_size", total_write_size);\r
+       info.add_child(L"gl.summary.all_host_buffers", host_buffer::info());\r
+\r
+       return info;\r
+}\r
+\r
 boost::unique_future<void> ogl_device::gc()\r
 {      \r
        return begin_invoke([=]\r