]> git.sesse.net Git - nageru/blob - shared/va_display.h
Unify VA-API initialization.
[nageru] / shared / va_display.h
1 #ifndef _VA_DISPLAY_H
2 #define _VA_DISPLAY _H1
3
4 #include <va/va.h>
5 #include <X11/Xlib.h>
6
7 #include <memory>
8 #include <string>
9 #include <vector>
10
11 struct VADisplayWithCleanup {
12         ~VADisplayWithCleanup();
13
14         VADisplay va_dpy;
15         Display *x11_display = nullptr;
16         bool can_use_zerocopy = true;  // For H.264 encoding in Nageru.
17         int drm_fd = -1;
18 };
19
20 struct ConfigRequest {
21         std::string name;  // For error texts only.
22         uint32_t rt_format, fourcc;
23
24         // Output.
25         VAConfigID *config_id;
26         VAImageFormat *image_format;
27 };
28 std::unique_ptr<VADisplayWithCleanup> try_open_va(
29         const std::string &va_display, const std::vector<VAProfile> &desired_profiles, VAEntrypoint entrypoint,
30         const std::vector<ConfigRequest> &desired_configs, VAProfile *chosen_profile, std::string *error);  // Can return nullptr on failure.
31
32 #endif  // !defined(_VA_DISPLAY_H)