From 7188e3e948c60f78f5e2cd8756337f716de06d99 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 2 Dec 2018 00:40:54 +0100 Subject: [PATCH] Combine ref_counted_gl_sync.h from Nageru and Futatabi. (Only whitespace differences.) --- futatabi/main.cpp | 2 +- futatabi/video_stream.h | 2 +- nageru/decklink_output.h | 2 +- nageru/glwidget.cpp | 2 +- nageru/mixer.cpp | 2 +- nageru/mixer.h | 2 +- nageru/quicksync_encoder.h | 2 +- nageru/quicksync_encoder_impl.h | 2 +- nageru/ref_counted_gl_sync.h | 39 ---------------------- nageru/video_encoder.h | 2 +- {futatabi => shared}/ref_counted_gl_sync.h | 0 11 files changed, 9 insertions(+), 48 deletions(-) delete mode 100644 nageru/ref_counted_gl_sync.h rename {futatabi => shared}/ref_counted_gl_sync.h (100%) diff --git a/futatabi/main.cpp b/futatabi/main.cpp index 41bbb82..58a131a 100644 --- a/futatabi/main.cpp +++ b/futatabi/main.cpp @@ -31,7 +31,7 @@ extern "C" { #include "mainwindow.h" #include "player.h" #include "shared/post_to_main_thread.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" #include "shared/timebase.h" #include "ui_mainwindow.h" #include "vaapi_jpeg_decoder.h" diff --git a/futatabi/video_stream.h b/futatabi/video_stream.h index 736a20f..d0634e0 100644 --- a/futatabi/video_stream.h +++ b/futatabi/video_stream.h @@ -10,7 +10,7 @@ extern "C" { #include "frame_on_disk.h" #include "jpeg_frame_view.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" #include "queue_spot_holder.h" #include diff --git a/nageru/decklink_output.h b/nageru/decklink_output.h index 44eb86d..29ea29c 100644 --- a/nageru/decklink_output.h +++ b/nageru/decklink_output.h @@ -21,7 +21,7 @@ #include "print_latency.h" #include "quittable_sleeper.h" #include "ref_counted_frame.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" namespace movit { diff --git a/nageru/glwidget.cpp b/nageru/glwidget.cpp index bf537de..8316824 100644 --- a/nageru/glwidget.cpp +++ b/nageru/glwidget.cpp @@ -25,7 +25,7 @@ #include "flags.h" #include "mainwindow.h" #include "mixer.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" class QMouseEvent; diff --git a/nageru/mixer.cpp b/nageru/mixer.cpp index 79966b5..fa94494 100644 --- a/nageru/mixer.cpp +++ b/nageru/mixer.cpp @@ -47,7 +47,7 @@ #include "input_mapping.h" #include "metrics.h" #include "pbo_frame_allocator.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" #include "resampling_queue.h" #include "shared/timebase.h" #include "timecode_renderer.h" diff --git a/nageru/mixer.h b/nageru/mixer.h index 992bcb9..2c39449 100644 --- a/nageru/mixer.h +++ b/nageru/mixer.h @@ -33,7 +33,7 @@ #include "libusb.h" #include "pbo_frame_allocator.h" #include "ref_counted_frame.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" #include "theme.h" #include "shared/timebase.h" #include "video_encoder.h" diff --git a/nageru/quicksync_encoder.h b/nageru/quicksync_encoder.h index 110d615..4f71f90 100644 --- a/nageru/quicksync_encoder.h +++ b/nageru/quicksync_encoder.h @@ -43,7 +43,7 @@ extern "C" { #include } -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" class DiskSpaceEstimator; class Mux; diff --git a/nageru/quicksync_encoder_impl.h b/nageru/quicksync_encoder_impl.h index 6e6e759..e0da15d 100644 --- a/nageru/quicksync_encoder_impl.h +++ b/nageru/quicksync_encoder_impl.h @@ -19,7 +19,7 @@ #include "defs.h" #include "shared/timebase.h" #include "print_latency.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" #define SURFACE_NUM 16 /* 16 surfaces for source YUV */ #define MAX_NUM_REF1 16 // Seemingly a hardware-fixed value, not related to SURFACE_NUM diff --git a/nageru/ref_counted_gl_sync.h b/nageru/ref_counted_gl_sync.h deleted file mode 100644 index 8b6db68..0000000 --- a/nageru/ref_counted_gl_sync.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _REF_COUNTED_GL_SYNC_H -#define _REF_COUNTED_GL_SYNC_H 1 - -// A wrapper around GLsync (OpenGL fences) that is automatically refcounted. -// Useful since we sometimes want to use the same fence two entirely different -// places. (We could set two fences at the same time, but they are not an -// unlimited hardware resource, so it would be a bit wasteful.) - -#include -#include -#include - -typedef std::shared_ptr<__GLsync> RefCountedGLsyncBase; - -class RefCountedGLsync : public RefCountedGLsyncBase { -public: - RefCountedGLsync() {} - - RefCountedGLsync(GLenum condition, GLbitfield flags) - : RefCountedGLsyncBase(locked_glFenceSync(condition, flags), glDeleteSync) {} - -private: - // These are to work around apitrace bug #446. - static GLsync locked_glFenceSync(GLenum condition, GLbitfield flags) - { - std::lock_guard lock(fence_lock); - return glFenceSync(condition, flags); - } - - static void locked_glDeleteSync(GLsync sync) - { - std::lock_guard lock(fence_lock); - glDeleteSync(sync); - } - - static std::mutex fence_lock; -}; - -#endif // !defined(_REF_COUNTED_GL_SYNC_H) diff --git a/nageru/video_encoder.h b/nageru/video_encoder.h index 21595a3..5c42ef8 100644 --- a/nageru/video_encoder.h +++ b/nageru/video_encoder.h @@ -21,7 +21,7 @@ extern "C" { } #include "mux.h" -#include "ref_counted_gl_sync.h" +#include "shared/ref_counted_gl_sync.h" class AudioEncoder; class DiskSpaceEstimator; diff --git a/futatabi/ref_counted_gl_sync.h b/shared/ref_counted_gl_sync.h similarity index 100% rename from futatabi/ref_counted_gl_sync.h rename to shared/ref_counted_gl_sync.h -- 2.39.2