libva: Uprev to 2.7.1.

This CL uprevs libva to the upstream release. cros_portage_upgrade
--unstable-ok is used to perform a pristine upgrade on portage-stable
and then the x11-libs/libva folder is copied to chromiumos-overlay.

After that, the following changes are made:

- We remove 9999 stuff from the ebuild because we don't expect to use
  cros_workon with this package.

- We force the use of libva over DRM because we don't expect to use it
  over X or Wayland. This involves explicitly disabling the platforms
  other than DRM according to the flags in [1].

- We only use the intel, amdgpu, and iHD video cards. Surprisingly, we
  don't seem to use i965 in Chrome OS (we use intel instead). We handle
  these video cards in the same way the old ebuild did. Note that we add
  a REQUIRED_USE to ensure that one of the video cards is being used.

See the diff since PS1 for these changes.

Also, note that we temporarily depend on iHD 19.4.0 so that this CL can
be built independently of the iHD uprev which will happen in a follow
up.

The 0001-Return-error-when-no-va-devices-available.patch file is removed
because it's included upstream on libva 2.7.1 [2].

[1] https://github.com/intel/libva/blob/2.7.1/configure.ac#L127-L155
[2] https://github.com/intel/libva/commit/48f446b32a4fe76d542c56c87f9427e8d14e073d

BUG=b:159825228
TEST=emerge-eve x11-libs/libva

Cq-Depend: chromium:2275495
Change-Id: Icdd5c2bb12a00e46042c4c1d9cfd034a15b7ea60
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2270741
Tested-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
diff --git a/x11-libs/libva/Manifest b/x11-libs/libva/Manifest
index 63dee73..625ee4c 100644
--- a/x11-libs/libva/Manifest
+++ b/x11-libs/libva/Manifest
@@ -1 +1 @@
-DIST libva-2.6.0.tar.gz 228808 SHA256 5566755739503ef53beafad7fd7e155e68039e9af78e051e27f1715a420a0952 SHA512 190fd9875d8ec91e94d42c41b770bb51ef9f430534f99d22fa394d6e4cf8dd308ffac61a37171855e4b499982c3cc59925d238b131dd2261a3beaae03e4937d0 WHIRLPOOL 0b1b6cd76d5b439d395c1db4b1ce3679199b6417ff3c859c2c5e8b77a0e23a4ea11ad37e97b5ed1a4ea37ab915fabc2b51d83f625e9fc7de0337b22d1fd44b95
+DIST libva-2.7.1.tar.bz2 477933 BLAKE2B 261e608af3f1427bed0244d4ebbc0d3ffe5681669ecb3583a8910568bc96817b8da079ffe80915ecf1002f9ac247eea5e44f8f7ce305313719fc1a4f1c5892b3 SHA512 f4b88ca0216f0ea4d934edcd322b8f741833b5a50ee2f34a3ecf60d635082b29e2dd032734c2f9d2a680e3b9c98e61a8b9432ea639a9fd5389761e04782c1126
diff --git a/x11-libs/libva/files/0001-Return-error-when-no-va-devices-available.patch b/x11-libs/libva/files/0001-Return-error-when-no-va-devices-available.patch
deleted file mode 100644
index 4480fca..0000000
--- a/x11-libs/libva/files/0001-Return-error-when-no-va-devices-available.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 140394579dacfa4334d2aa2deb30cffc5fee609f Mon Sep 17 00:00:00 2001
-From: Lepton Wu <ytht.net@gmail.com>
-Date: Mon, 10 Feb 2020 15:27:31 -0800
-Subject: [PATCH] Return error when no va devices available.
-
-Signed-off-by: Lepton Wu <ytht.net@gmail.com>
----
- va/drm/va_drm_utils.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/va/drm/va_drm_utils.c b/va/drm/va_drm_utils.c
-index 905ccdd..ac96fa2 100644
---- a/va/drm/va_drm_utils.c
-+++ b/va/drm/va_drm_utils.c
-@@ -69,7 +69,7 @@ VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates)
-     }
-     drmFreeVersion(drm_version);
-     *num_candidates = num_of_candidate;
--    return VA_STATUS_SUCCESS;
-+    return num_of_candidate ? VA_STATUS_SUCCESS : VA_STATUS_ERROR_UNKNOWN;
- }
- 
- /* Returns the VA driver name for the active display */
--- 
-2.25.0.225.g125e21ebc7-goog
-
diff --git a/x11-libs/libva/libva-2.6.0-r4.ebuild b/x11-libs/libva/libva-2.6.0-r4.ebuild
deleted file mode 120000
index 111f1ca..0000000
--- a/x11-libs/libva/libva-2.6.0-r4.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-libva-2.6.0.ebuild
\ No newline at end of file
diff --git a/x11-libs/libva/libva-2.6.0.ebuild b/x11-libs/libva/libva-2.6.0.ebuild
deleted file mode 100644
index f61243a..0000000
--- a/x11-libs/libva/libva-2.6.0.ebuild
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-SCM=""
-if [ "${PV%9999}" != "${PV}" ] ; then # Live ebuild
-	SCM=git-r3
-	EGIT_BRANCH=master
-	EGIT_REPO_URI="https://github.com/intel/libva"
-fi
-
-AUTOTOOLS_AUTORECONF="yes"
-inherit autotools-multilib ${SCM} multilib
-
-DESCRIPTION="Video Acceleration (VA) API for Linux"
-HOMEPAGE="https://01.org/linuxmedia/vaapi"
-if [ "${PV%9999}" != "${PV}" ] ; then # Live ebuild
-	SRC_URI=""
-	S="${WORKDIR}/${PN}"
-else
-	SRC_URI="https://github.com/intel/libva/archive/${PV}.tar.gz -> ${P}.tar.gz"
-fi
-
-LICENSE="MIT"
-SLOT="0"
-if [ "${PV%9999}" = "${PV}" ] ; then
-	KEYWORDS="*"
-else
-	KEYWORDS=""
-fi
-IUSE="+drm egl opengl vdpau wayland X utils"
-REQUIRED_USE="|| ( drm wayland X )"
-
-VIDEO_CARDS="amdgpu fglrx intel i965 iHD nouveau nvidia"
-for x in ${VIDEO_CARDS}; do
-	IUSE+=" video_cards_${x}"
-done
-
-# Chromium: remove versions in X dependencies to accomodate older ones
-RDEPEND=">=x11-libs/libdrm-2.4.46
-	X? (
-		x11-libs/libX11
-		x11-libs/libXext
-		x11-libs/libXfixes
-	)
-	opengl? ( >=virtual/opengl-7.0-r1 )
-	wayland? ( >=dev-libs/wayland-1.0.6 )
-	"
-
-DEPEND="${RDEPEND}
-	virtual/pkgconfig"
-
-# Chromium: remove video_cards_nouveau to libva-vdpau-driver dependency
-# as this library is not present in Chromium OS.
-PDEPEND="video_cards_nvidia? ( >=x11-libs/libva-vdpau-driver-0.7.4-r1 )
-	vdpau? ( >=x11-libs/libva-vdpau-driver-0.7.4-r1 )
-	video_cards_amdgpu? ( virtual/opengles )
-	video_cards_fglrx? (
-		|| ( >=x11-drivers/ati-drivers-14.12-r3
-			>=x11-libs/xvba-video-0.8.0-r1 )
-		)
-	video_cards_iHD? ( ~x11-libs/libva-intel-media-driver-19.4.0 )
-	video_cards_intel? ( !video_cards_iHD? ( ~x11-libs/libva-intel-driver-2.3.0 ) )
-	video_cards_i965? ( ~x11-libs/libva-intel-driver-2.3.0 )
-	utils? ( media-video/libva-utils )"
-
-REQUIRED_USE="|| ( drm wayland X )
-		opengl? ( X )"
-
-DOCS=( NEWS )
-
-MULTILIB_WRAPPED_HEADERS=(
-/usr/include/va/va_backend_glx.h
-/usr/include/va/va_x11.h
-/usr/include/va/va_dri2.h
-/usr/include/va/va_dricommon.h
-/usr/include/va/va_glx.h
-)
-
-src_prepare() {
-	# After this https://github.com/intel/libva/pull/369 is merged
-	# below patch will not be needed
-	epatch "${FILESDIR}"/0001-Return-error-when-no-va-devices-available.patch
-
-	autotools-utils_src_prepare
-}
-
-multilib_src_configure() {
-	local myeconfargs=(
-		--with-drivers-path="${EPREFIX}/usr/$(get_libdir)/va/drivers"
-		--includedir="${EPREFIX}/usr/include"
-		$(use_enable opengl glx)
-		$(use_enable X x11)
-		$(use_enable wayland)
-		$(use_enable drm)
-	)
-	autotools-utils_src_configure
-}
diff --git a/x11-libs/libva/libva-2.7.1-r1.ebuild b/x11-libs/libva/libva-2.7.1-r1.ebuild
new file mode 120000
index 0000000..e34e41c
--- /dev/null
+++ b/x11-libs/libva/libva-2.7.1-r1.ebuild
@@ -0,0 +1 @@
+libva-2.7.1.ebuild
\ No newline at end of file
diff --git a/x11-libs/libva/libva-2.7.1.ebuild b/x11-libs/libva/libva-2.7.1.ebuild
new file mode 100644
index 0000000..472a823
--- /dev/null
+++ b/x11-libs/libva/libva-2.7.1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-minimal
+
+DESCRIPTION="Video Acceleration (VA) API for Linux"
+HOMEPAGE="https://01.org/linuxmedia/vaapi"
+SRC_URI="https://github.com/intel/libva/releases/download/${PV}/${P}.tar.bz2"
+KEYWORDS="*"
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1)"
+IUSE="utils"
+
+VIDEO_CARDS="intel amdgpu iHD"
+for x in ${VIDEO_CARDS}; do
+	IUSE+=" video_cards_${x}"
+done
+
+RDEPEND="
+	>=x11-libs/libdrm-2.4.46[${MULTILIB_USEDEP}]
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	virtual/pkgconfig
+"
+
+# TODO(b/159825228): depend on libva-intel-media-driver-20.1.1 once that
+# package is upreved.
+PDEPEND="
+	video_cards_intel? ( !video_cards_iHD? ( >=x11-libs/libva-intel-driver-2.0.0[${MULTILIB_USEDEP}] ) )
+	video_cards_iHD? ( ~x11-libs/libva-intel-media-driver-19.4.0[${MULTILIB_USEDEP}] )
+	video_cards_amdgpu? ( virtual/opengles[${MULTILIB_USEDEP}] )
+	utils? ( media-video/libva-utils )
+"
+
+DOCS=( NEWS )
+
+MULTILIB_WRAPPED_HEADERS=(
+/usr/include/va/va_backend_glx.h
+/usr/include/va/va_x11.h
+/usr/include/va/va_dri2.h
+/usr/include/va/va_dricommon.h
+/usr/include/va/va_glx.h
+)
+
+multilib_src_configure() {
+	local myeconfargs=(
+		--with-drivers-path="${EPREFIX}/usr/$(get_libdir)/va/drivers"
+		--enable-drm
+		--disable-x11
+		--disable-glx
+		--disable-wayland
+	)
+	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+}
+
+multilib_src_install_all() {
+	find "${ED}" -type f -name "*.la" -delete || die
+}
diff --git a/x11-libs/libva/metadata.xml b/x11-libs/libva/metadata.xml
index af702ea..7f3149f 100644
--- a/x11-libs/libva/metadata.xml
+++ b/x11-libs/libva/metadata.xml
@@ -1,11 +1,15 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding='UTF-8'?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-  <maintainer>
+  <maintainer type="person">
     <email>aballier@gentoo.org</email>
     <name>Alexis Ballier</name>
   </maintainer>
-	<use>
-		<flag name='egl'>Enables EGL support.</flag>
-    </use>
+  <use>
+    <flag name="drm">Enables VA/DRM API support.</flag>
+    <flag name="utils">Install VA-API utility programs.</flag>
+  </use>
+  <upstream>
+  <remote-id type="github">intel/libva</remote-id>
+  </upstream>
 </pkgmetadata>