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

video/out/gpu/context: convert --gpu-api to object settings list #14261

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guidocella
Copy link
Contributor

This follows up 96e1f1d which converted --gpu-context, and has the same advantages as listed there.

Unlike with --gpu-context auto can be used anywhere in the list, e.g. --gpu-api=d3d11,auto works.

I wanted to use the list of GPU contexts as the description in get_type_desc(), but there is no talloc context to allocate it to, so I set a print_help_list to print them. The printed lines don't being with spaces because otherwise they are added to the completions by etc/_mpv.zsh.

@@ -6448,7 +6448,7 @@ them.
``--gpu-sw``
Continue even if a software renderer is detected.

``--gpu-context=<context1,context2,...[,]>``
``--gpu-context=<context1,context2,...>``
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the problem? Blank string isn't intended to be a valid value.

Copy link
Contributor Author

@guidocella guidocella May 30, 2024

Choose a reason for hiding this comment

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

Only --vo and --ao where the blank string is a valid value have , at the end in the docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see the value of disallowing it. It simplifies programmatic generation of context list string. If no contexts can be created it just fails like without the trailer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could be misinterpreted as allowing an auto fallback, but fine.

@@ -152,69 +152,85 @@ static bool get_desc(struct m_obj_desc *dst, int index)
return true;
}

static bool check_unknown_entry(const char *name)
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be deleted. It's used for early rejection of invalid context name, which was also done when it was a string list option with the string validate function. Deleting it causes invalid context to just fail to create and plays only audio.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah that's what it was for. But it seems to work with just return false; as the function body without re-checking known entries.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just return false is fine.

This function is used to reject invalid context names early, and without
it the context fails to create and only audio is played, but it doesn't
need to check for known entries again.
@guidocella guidocella force-pushed the gpu-api-settingslist branch 2 times, most recently from 11d7fc2 to 8f3ba38 Compare May 30, 2024 09:19
Copy link

github-actions bot commented May 30, 2024

Download the artifacts for this pull request:

Windows
macOS

static struct ra_ctx *create_in_contexts(struct vo *vo, const char *name, char *api_name,
const struct ra_ctx_fns *ctxs[], size_t size,
struct ra_ctx_opts opts,
struct m_obj_settings *context_type_list)
Copy link
Contributor

Choose a reason for hiding this comment

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

A NULL context_type_list is essentially a list of one element of api_name. Lots of logic can be simplified by deleting the api_name parameter and making context_type_list not nullable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm having trouble getting this to work without ASan failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out I get the same memory leak on master so there is no issue with this PR. And I don't get it at all on Nvidia.

@guidocella guidocella force-pushed the gpu-api-settingslist branch 2 times, most recently from 5f84719 to aa4b881 Compare May 30, 2024 12:29
This follows up 96e1f1d which converted --gpu-context, and has the
same advantages as listed there.

Unlike with --gpu-context auto can be used anywhere in the list, e.g.
--gpu-api=d3d11,auto works.

I wanted to use the list of GPU contexts as the description in
get_type_desc(), but there is no talloc context to allocate it to, so I
set a print_help_list to print them. The printed lines don't being with
spaces because otherwise they are added to the completions by
etc/_mpv.zsh.
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

2 participants