Add intel codec runner

Bug: 78281
Change-Id: Idd646a24d4815190a7b7dd69eaf0981d3c10ed92
diff --git a/fuchsia/BUILD.gn b/fuchsia/BUILD.gn
index 174f74a..eab441b 100644
--- a/fuchsia/BUILD.gn
+++ b/fuchsia/BUILD.gn
@@ -134,3 +134,22 @@
     ":out-of-tree-build",
   ]
 }
+
+executable("codec_runner_intel_gen_exe") {
+  output_name = "codec_runner_intel_gen"
+  sources = [ "main.cc" ]
+  deps = [
+    "//src/media/codec/codecs/vaapi:codec_runner_vaapi",
+    ":va-intel",
+    "//src/graphics/lib/magma/src/libmagma",
+  ]
+}
+
+fuchsia_package_with_single_component("codec_runner_intel_gen") {
+  manifest = "meta/codec_runner_intel_gen.cml"
+  deps = [ ":codec_runner_intel_gen_exe" ]
+}
+
+fuchsia_package_archive("codec_runner_intel_gen_archive") {
+  package = ":codec_runner_intel_gen"
+}
diff --git a/fuchsia/main.cc b/fuchsia/main.cc
new file mode 100644
index 0000000..32aa7ea
--- /dev/null
+++ b/fuchsia/main.cc
@@ -0,0 +1,25 @@
+// Copyright 2022 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "codec_adapter_vaapi_decoder.h"
+#include "codec_runner_app.h"
+#include "vaapi_utils.h"
+
+int main(int argc, char* argv[]) {
+  ZX_DEBUG_ASSERT(argc == 1);
+
+  constexpr uint64_t kIntelVendorId = 0x8086;
+
+  if (!VADisplayWrapper::InitializeSingleton(kIntelVendorId)) {
+    fprintf(stderr, "Failed to initialize VADisplay\n");
+    return -1;
+  }
+
+  CodecRunnerApp<CodecAdapterVaApiDecoder, NoAdapter> codec_runner;
+  codec_runner.Init();
+  codec_runner.Serve();
+  codec_runner.Run();
+
+  return 0;
+}
diff --git a/fuchsia/meta/codec_runner_intel_gen.cml b/fuchsia/meta/codec_runner_intel_gen.cml
new file mode 100644
index 0000000..cdc10cf
--- /dev/null
+++ b/fuchsia/meta/codec_runner_intel_gen.cml
@@ -0,0 +1,36 @@
+// Copyright 2022 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+{
+    include: [
+        "inspect/client.shard.cml",
+        "syslog/client.shard.cml",
+        "syslog/elf_stdio.shard.cml",
+    ],
+    program: {
+        runner: "elf",
+        binary: "bin/codec_runner_intel_gen",
+    },
+    capabilities: [
+        { protocol: "fuchsia.mediacodec.CodecFactory" },
+    ],
+    use: [
+        {
+            directory: "dev-gpu",
+            rights: [ "rw*" ],
+            path: "/dev/class/gpu",
+        },
+        {
+            protocol: [
+                "fuchsia.sysmem.Allocator",
+                "fuchsia.tracing.provider.Registry",
+            ],
+        },
+    ],
+    expose: [
+        {
+            protocol: "fuchsia.mediacodec.CodecFactory",
+            from: "self",
+        },
+    ],
+}