Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add VAAPI options and pass them to ffmpeg #6667

Closed
wants to merge 1 commit into from

Conversation

vredez
Copy link

@vredez vredez commented Dec 14, 2020

TLDR: Simple way of getting hardware acceleration working (again) with NVIDIA graphics cards.

FreeRDP uses FFmpeg for VAAPI hardware acceleration. If not specified, the FFmpeg API internally prefers the DRM connection type over the X11 one. Unfortunately, the VAAPI driver for NVIDIA users (libva-vdpau-driver), which seems to be unmaintained since 2012, only supports the X11 connection type.

Two new options are added:

/vaapi-connection-type
/vaapi-device

both of which are passed to ffmpeg, where parameter validation is handled

@freerdp-bot
Copy link

Can one of the admins verify this patch?

Copy link
Member

@akallabeth akallabeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this addition, but a few changes will be required so we can merge it.

@@ -2371,6 +2371,16 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
return rc;
}
}
CommandLineSwitchCase(arg, "vaapi-connection-type")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this will get messy.
Please unify all options into a single one with parameters, e.g. /vaapi:type:foo,device:bar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe even better, add parameters to /gdi:hw as that already switches between different backend implementations

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but wouldn't this belong to the /gfx switch, which affects h264 decoding?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, as /video channel also utilizes the backend.

@@ -78,6 +78,8 @@ struct _H264_CONTEXT

void* lumaData;
wLog* log;

const rdpSettings* settings;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really required, is it? Just passing the arguments to Init should be sufficient.

@@ -108,6 +110,8 @@ extern "C"
FREERDP_API BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height);

FREERDP_API H264_CONTEXT* h264_context_new(BOOL Compressor);
FREERDP_API H264_CONTEXT* h264_context_new_settings(BOOL Compressor,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better change to FREERDP_API H264_CONTEXT* h264_context_new(BOOL Compressor, ...); and let the backend interpret the arguments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also remove h264_context_new_settings there must only be one way to initialize the context, otherwise you´ll end up with different decoding settings.

@@ -1562,6 +1562,9 @@ struct rdp_settings
ALIGN64 char* ActionScript;
ALIGN64 DWORD Floatbar;
ALIGN64 char* XSelectionAtom;

ALIGN64 char* VAAPIConnectionType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unify to a single string, let the backend interpret it.
Also add it to public API

@@ -973,6 +973,12 @@ static BOOL freerdp_settings_int_buffer_copy(rdpSettings* _settings, const rdpSe
_settings->ActionScript = _strdup(settings->ActionScript);
if (settings->XSelectionAtom)
_settings->XSelectionAtom = _strdup(settings->XSelectionAtom);

if (settings->VAAPIConnectionType)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required if part of public API

@Conan-Kudo
Copy link
Contributor

@vredez There's a new VA-API driver module backed by NVDEC now: https://github.com/elFarto/nvidia-vaapi-driver

@hardening
Copy link
Contributor

Let's close this PR

@hardening hardening closed this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants