From 526b0e9721578e321bd8bf31478fe848b826ade7 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 26 Jan 2017 10:17:53 +0200 Subject: Profile write_frame and map_buffer separately --- glcapture.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/glcapture.c b/glcapture.c index 4338550..19c7756 100644 --- a/glcapture.c +++ b/glcapture.c @@ -44,8 +44,8 @@ // XXX: Make these configurable // Use any amount you want as long as you have the vram for it -// If you get warning of write_frame taking time, even when not reading the pipe, increase this -#define NUM_PBOS 20 +// If you get warning of map_buffer taking time, try increasing this +#define NUM_PBOS 32 // Target framerate for the video stream static uint32_t FPS = 60; @@ -431,15 +431,20 @@ capture_frame_pbo(struct gl *gl, const GLint view[4], const uint64_t ts) void *buf; const size_t size = info.video.width * info.video.height * frame.components; + PROFILE( glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo[gl->active].obj); - if ((buf = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT))) { + buf = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT); + , 2.0, "map_buffer"); + + if (buf) { + PROFILE( flip_pixels_if_needed(view, buf, info.video.width, info.video.height, frame.components); write_data(&info, buf, size); glUnmapBuffer(GL_PIXEL_PACK_BUFFER); gl->pbo[gl->active].written = false; + , 2.0, "write_frame"); } - , 2.0, "write_frame"); } } -- cgit v1.2.3-70-g09d2