Bug 242849 - multimedia/handbrake: enable Intel Quick Sync Video
Summary: multimedia/handbrake: enable Intel Quick Sync Video
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-12-24 05:43 UTC by Jan Beich
Modified: 2020-01-13 01:59 UTC (History)
2 users (show)

See Also:
naito.yuichiro: maintainer-feedback+


Attachments
v1 (13.17 KB, patch)
2019-12-24 05:43 UTC, Jan Beich
no flags Details | Diff
v1.1 (13.08 KB, patch)
2019-12-24 05:57 UTC, Jan Beich
no flags Details | Diff
future (13.57 KB, patch)
2020-01-03 18:51 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2019-12-24 05:43:10 UTC
Created attachment 210189 [details]
v1

Let's enable hardware acceleration on Intel GPUs. QSV adds more features on top of VAAPI, using CM runtime to offload more work to GPU. For encoding iHD driver is required, see https://github.com/ffmpeg/ffmpeg/commit/468f00384338

Disclaimer: I don't use Handbrake. Only build was tested but h264_qsv works fine in *system* FFmpeg.
Comment 1 Jan Beich freebsd_committer 2019-12-24 05:57:47 UTC
Created attachment 210190 [details]
v1.1

(In reply to Jan Beich from comment #0)
> For encoding iHD driver is required, see https://github.com/ffmpeg/ffmpeg/commit/468f00384338

Looks like "H.264 (Intel QSV)" shows up even with only i965 driver. During encoding intel_gpu_top shows 30% usage on Skylake but, like with iHD, CPU usage is abnormally high compared to ffmpeg.

Let's not force iHD dependency as it only works on Broadwell or later.
Comment 2 Yuichiro NAITO 2019-12-24 08:21:25 UTC
Thanks for the patch. It's a nice Christmas present to me.

But unfortunately my FreeBSD machine has crashed by accident.
All of my zfs pools have gone...
I'm installing FreeBSD and setting up my PC now.

So please wait for my recovering the development environment.
I will check your patch as soon as possible.
My PC has Skylake processor that is enough to check QSV, I think.
Comment 3 Jan Beich freebsd_committer 2019-12-28 19:34:11 UTC
If you want the feature on /quarterly (default package set on -RELEASEs) to get widest exposure try to review/test before 2020-01-01 (UTC) when 2020Q1 is planned to branch. Otherwise, it'd bake on /latest (default on -CURRENT and -STABLE) until 2020Q2.
Comment 4 Yuichiro NAITO 2020-01-02 15:18:59 UTC
Sorry for my late response.
v1.1 works fine with the latest intel-media-sdk.
It looks good to me.

I don't mind about quarterly branch.
I can't help because my test was not in time.

pkubaj@ 
  Please check that v1.1 patch can be built and works as same as before on your powerpc64 machine.
  I think v1.1 has no functional change for powerpc64.
Comment 5 Jan Beich freebsd_committer 2020-01-02 17:06:58 UTC
(In reply to Yuichiro NAITO from comment #4)
> I don't mind about quarterly branch.
> I can't help because my test was not in time.

If you want I can add MFH tag to commit message in order to ask for approval from ports-secteam@. No guarantee they're going to reply at all due to being understaffed and not very good at assessing risk. Most MFHs land via blanket approval as bustage/security/reliability/regression fixes.
Comment 6 Piotr Kubaj freebsd_committer 2020-01-02 21:36:29 UTC
(In reply to Yuichiro NAITO from comment #4)
Looks ok on both 12.1 and CURRENT.
Comment 7 Yuichiro NAITO 2020-01-03 08:43:46 UTC
(In reply to Jan Beich from comment #5)
>If you want I can add MFH tag to commit message in order to ask for approval
>from ports-secteam@. No guarantee they're going to reply at all due to being
>understaffed and not very good at assessing risk. Most MFHs land via blanket
>approval as bustage/security/reliability/regression fixes.

Thanks for the information.
QSV support is very important to HandBrake users, I want to add MFH tag for them.
(Of course I understand there is no guarantee.)

And for me, I want to make a presentation of this patch in FreeBSD workshop in Tokyo (the organizer is hrs@) on Jan, 16th.
If it would be MFHed, I could introduce this feature more easy way.

Any way, please commit v1.1 patch. Thank you!
Comment 8 commit-hook freebsd_committer 2020-01-03 09:02:03 UTC
A commit references this bug:

Author: jbeich
Date: Fri Jan  3 09:01:26 UTC 2020
New revision: 521913
URL: https://svnweb.freebsd.org/changeset/ports/521913

Log:
  multimedia/handbrake: enable Intel Quick Sync Video

  PR:		242849
  Approved by:	Yuichiro NAITO (maintainer)
  Tested by:	Yuichiro NAITO, pkubaj (powerpc64)
  MFH:		2020Q1 (opt-in at runtime, requested by maintainer)

Changes:
  head/multimedia/handbrake/Makefile
  head/multimedia/handbrake/files/patch-contrib_ffmpeg_module.defs
  head/multimedia/handbrake/files/patch-gtk_configure.ac
  head/multimedia/handbrake/files/patch-libhb_handbrake_ports.h
  head/multimedia/handbrake/files/patch-libhb_module.defs
  head/multimedia/handbrake/files/patch-libhb_ports.c
  head/multimedia/handbrake/files/patch-libhb_qsv__common.c
  head/multimedia/handbrake/files/patch-make_configure.py
  head/multimedia/handbrake/files/patch-make_include_main.defs
  head/multimedia/handbrake/files/patch-test_module.defs
Comment 9 commit-hook freebsd_committer 2020-01-03 18:45:52 UTC
A commit references this bug:

Author: jbeich
Date: Fri Jan  3 18:45:04 UTC 2020
New revision: 521951
URL: https://svnweb.freebsd.org/changeset/ports/521951

Log:
  multimedia/handbrake: fix r521913 upstreaming issues

  - Unbreak QSV build on non-FreeBSD
  - LIBHB.dll is only used on MinGW
  - No need to touch __deps__, just exclude MODULE

  PR:		242849

Changes:
  head/multimedia/handbrake/files/patch-contrib_ffmpeg_module.defs
  head/multimedia/handbrake/files/patch-libhb_module.defs
  head/multimedia/handbrake/files/patch-make_include_main.defs
Comment 10 Jan Beich freebsd_committer 2020-01-03 18:51:18 UTC
Created attachment 210422 [details]
future

Here's the diff I've used when upstreaming. It may help you to prepare for the next release when the patches from here are integrated.
Comment 11 Yuichiro NAITO 2020-01-04 22:43:42 UTC
(In reply to Jan Beich from comment #10)
Thank you very much!
As HandBrake-1.3.1 has been released, I start to update HandBrake port.