From 556e47580ae6b496b90f674883ccf275ef76e3bc Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@posteo.de>
Date: Mon, 15 Jul 2024 12:44:52 +0200
Subject: [PATCH] va: Blocklist i965 driver for encoding

The driver - AKA intel-vaapi-driver - has been unmaintained for four years
now and encoding appears to be broken in various cases. As it's unlikely
that the situation will improve, blocklist the driver for encoding.
Decoding appears to be stable enough to keep it enabled.

The driver can still be used by setting the `GST_VA_ALL_DRIVERS` env
variable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7170>
---
 subprojects/gst-plugins-bad/sys/va/plugin.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/subprojects/gst-plugins-bad/sys/va/plugin.c b/subprojects/gst-plugins-bad/sys/va/plugin.c
index 4c307f6e81..5088880c07 100644
--- a/subprojects/gst-plugins-bad/sys/va/plugin.c
+++ b/subprojects/gst-plugins-bad/sys/va/plugin.c
@@ -175,6 +175,13 @@ plugin_register_encoders (GstPlugin * plugin, GstVaDevice * device,
   GHashTableIter iter;
   gpointer key, value;
 
+  if (GST_VA_DISPLAY_IS_IMPLEMENTATION (device->display, INTEL_I965)
+      && g_getenv ("GST_VA_ALL_DRIVERS") == NULL) {
+    gst_plugin_add_status_warning (plugin,
+        "The Intel i965 VA driver is blocklisted for encoding, use GST_VA_ALL_DRIVERS to overwrite.");
+    return;
+  }
+
   g_hash_table_iter_init (&iter, encoders);
   while (g_hash_table_iter_next (&iter, &key, &value)) {
     guint32 codec = *((gint64 *) key);