]> git.sesse.net Git - nageru/blobdiff - shared/va_display.cpp
Move VADisplayWithCleanup into its own header file, in shared/.
[nageru] / shared / va_display.cpp
diff --git a/shared/va_display.cpp b/shared/va_display.cpp
new file mode 100644 (file)
index 0000000..36c8f17
--- /dev/null
@@ -0,0 +1,16 @@
+#include "shared/va_display.h"
+#include <unistd.h>
+
+VADisplayWithCleanup::~VADisplayWithCleanup()
+{
+       if (va_dpy != nullptr) {
+               vaTerminate(va_dpy);
+       }
+       if (x11_display != nullptr) {
+               XCloseDisplay(x11_display);
+       }
+       if (drm_fd != -1) {
+               close(drm_fd);
+       }
+}
+