Problems with Xv and latest xf86-video-intel driver

From: Alexey Dokuchaev <danfe_at_freebsd.org>
Date: Tue, 09 Nov 2021 09:32:30 UTC
Hi there,

Several days ago I've updated this L470 laptop I'm using to the latest
-CURRENT and graphics ports.  It only has iGPU which is Intel HD 620.
What I ended up having installed after a few portupgrade(1) runs:

  xorg-server-1.20.7_1,1
  mesa-dri-21.1.8
  mesa-libs-21.1.8

  libva-2.6.1
  libva-intel-driver-2.4.1_1		<-- per the advice at [1]
  libvdpau-va-gl-0.4.2_5

The problem is that with xf86-video-intel-2.99.917.916_1,1 installed,
xvinfo(1) gives me:

  X-Video Extension version 2.2
  screen #0
   no adaptors present

That's all.  In the /var/log/Xorg.0.log, I can see this line:

  (WW) intel(0): Disabling Xv because no adaptors could be initialized.

Interestingly though, MPlayer consumes ~13% of CPU decoding some random
H264 640x360 YouTube clip, which means that 2D gfx hw accell is working
despite that evidently Xv support is missing or broken.

If I ``pkg delete -x xf86-video-intel'' so that modesetting driver is
used instead, zap and startx(1) again, xvinfo(1) would yield:

  Adaptor #0: "GLAMOR Textured Video"
    number of ports: 16
    port base: 131
    operations supported: PutImage
    ... (30 more lines) ...

CPU utilization with MPlayer remains the same ~13%.

Since I've got used to have the xf86-video-intel driver, I wanted to
have normal xvinfo(1) output with it installed.  So I've repeatedly
tried every version mentioned in the ``git log .'' until I'd hit the
commit 4b9c697c260c (xf86-video-intel-2.99.917.20181203_1) which did
not fix xvinfo(1) with default UXA option, but with SNA it finally
did, to much relief:

  Adaptor #0: "Intel(R) Textured Video"
    number of ports: 64
    port base: 75
    operations supported: PutImage
    ... (93 more lines) ...

It had also produced considerably more output and now there are two
adaptors: "Intel(R) Textured Video" and "Intel(R) Video Sprite".

I guess with SNA, better performance should be expected [2], albeit
UXA is still the default, so I'm wondering if non-working xvinfo(1)
with UXA is a bug (that's question #1).  It's also a bit odd that
UXA is the port's default option while per their NEWS file, SNA is
default upstream since snapshot 2.99.901 (2013-09-04).

Bigger question #2 is why Xv/xvinfo(1) is botched with newish Intel
drivers?  Anything I can do to help fix this bug, or it is expected
and documented anywhere?  Thanks,

./danfe

[1] https://wiki.freebsd.org/Graphics
[2] http://cynic.cc/blog/posts/sna_acceleration_vs_uxa/