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

va: fix the fd leak issue caused by vaInitialize failure #753

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

XinfengZhang
Copy link
Contributor

Fixes #741

Signed-off-by: Carl Zhang <carl.zhang@intel.com>
@@ -742,6 +742,11 @@ VAStatus vaInitialize(

vaStatus = va_new_opendriver(dpy);

if (VA_STATUS_SUCCESS != vaStatus) {
VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
pDisplayContext->vaDestroy(pDisplayContext);
Copy link
Contributor

@evelikov evelikov Sep 18, 2023

Choose a reason for hiding this comment

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

I'm not sure this is a good idea for a few of reasons:

  • on error we should not be touching out variables
  • on error we're leaking the state setup via va_TraceInit - pre-existing issue
  • as-is on vaInitialize() failure, state set in vaGetDisplay*() will be removed, which is fairly assummetrical and off IMHO

@evelikov
Copy link
Contributor

Instead, the display specifics should be moved from vaInitialize to vaGetDisplay* time, although that's not particularly clear and easy with the current vaGetDisplay API. Ideally VAAPI will evolve an https://registry.khronos.org/EGL/sdk/docs/man/html/eglGetPlatformDisplay.xhtml like API - adding the other "Platform" APIs from EGL_EXT_platform_base (or similar extensions) would be a wise move IMHO.

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.

Leaking DRI fds when vaInitialize() is called again on same VADisplay after failure
2 participants