-
Notifications
You must be signed in to change notification settings - Fork 302
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
x11: don't do DRI3 with Intel drivers #727
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly believe that source code comments and commit messages should be kept technically focused. Per my opinion suggested commit violates this. Till this won't be addressed I can't approve this PR for the merge.
If you can provide a concrete example, I am happy to adjust. |
I would assume it's related to: and they seem uninterested in adding one - le sigh. Replace it by "as of 2023-07" and all is fine I would assume |
Yes, but not only. Basically the whole commit message is subject to the same. It can be formulated in much more neutral way, for example:
and non-neutral parts expressed elsewhere, for example in separate PR comments. |
f7101b6
to
5c92f27
Compare
Mellowed it down to include the facts... hope that's clean enough :-P |
va/x11/va_x11.c
Outdated
* support on said drivers - it scales better than having every user | ||
* to set the environment override listed above. | ||
*/ | ||
if (vaStatus == VA_STATUS_SUCCESS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to have a way for iHD/i965 to go via DRI3 for those users which don't use vaPutSurface. I suggest to allow LIBVA_DRI3_DISABLE=0|1
values:
- If user specified
LIBVA_DRI3_DISABLE=1
, then DRI3 gets disabled (regardless of the driver) - If user specified
LIBVA_DRI3_DISABLE=0
, then DRI3 is not disabled (regardless of the driver) - If user did not specify
LIBVA_DRI3_DISABLE
, then by default DRI3 is disabled for particular drivers (iHD and i965)
Something like this:
static VAStatus va_DisplayContextGetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers, unsigned *num_drivers
)
{
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
vaStatus = va_DRI3_GetDriverNames(pDisplayContext, drivers, num_drivers);
const char* dri3_disable = getenv("LIBVA_DRI3_DISABLE");
if (dri3_disable && atoi(dri3_disable)) {
vaStatus = VA_STATUS_ERROR_UNKNOWN;
}
else if (!dri3_disable) {
for (unsigned i = 0; i < *num_drivers; i++) {
if (drivers[i] && (!strcmp(drivers[i], "iHD") ||
!strcmp(drivers[i], "i965")))
vaStatus = VA_STATUS_ERROR_UNKNOWN;
}
}
if (vaStatus == VA_STATUS_ERROR_UNKNOWN) {
for (unsigned i = 0; i < *num_drivers; i++)
free(drivers[i]);
*num_drivers = old_num_drivers;
}
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_DRI2_GetDriverNames(pDisplayContext, drivers, num_drivers);
#ifdef HAVE_NVCTRL
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_NVCTRL_GetDriverNames(pDisplayContext, drivers, num_drivers);
#endif
#ifdef HAVE_FGLRX
if (vaStatus != VA_STATUS_SUCCESS)
vaStatus = va_FGLRX_GetDriverNames(pDisplayContext, drivers, num_drivers);
#endif
return vaStatus;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable - will respin in the upcoming days.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above example always calls va_DRI3_GetDriverNames and does not properly handle num_drivers. MR updated to handle that + the 3-state requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "iHD, i965" get from DRI3 should be valid, if people only use DRI to retrieve driver name, not use vaPutSurfaces, and there are no DRI2 at all like XWayland.
- from my personal understanding, I need comments change the try order of DRI2 and DRI3 #716 (comment) was addressed. I want to understand whether there are real case was impacted to try DRI2 connection firstly .
what I could image is: there are one backend driver which only implement dri3 based vaPutSurfaces, not dri2 based.
if no , why not try DRI2 firstly. even could work without "LIBVA_DRI3_DISABLED" --- actually , this env variable (and the issue it want fix) actually break backward compatibility from another perspective.
Unfortunately i965 and iHD drivers lack DRI3 support. It's unknown when/if they will gain support, so explicitly disable DRI3 for them - it's not perfect, alas better than asking every affected user to manually set the environment override. v2: - drop by default, can still use them with LIBVA_DISABLE_DRI3=0 Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
5c92f27
to
fdeca4c
Compare
@XinfengZhang struggling to understand that. Sorry to say this but the English in the above is quite poor. |
to be clear,
|
Making a xcb-dri3.pc in /usr/lib/x86_64-linux-gnu/pkgconfig can be effective Name: XCB DRI3 |
@kongxa I don't see how the pkg-config file contents are relevant here. |
I'm not sure in which context the LIBVA_DRI3_DISABLE is needed ? Probably when Xwayland is used ? I don't get why if no DRI3 aware backend are found, there is no attempt to use DRI2 automatically instead ? Also having "yet another" mapping to disable DRI3 by default with some backend won't help when(/if) the said backend later gains DRI3 support. So far, I expect the only supported DRI3 backend driver might be the mesa one, I don't expect any others ? (I don't expect nvidia-vaapi-backend to have DRI3) |
if (vaStatus == VA_STATUS_ERROR_UNKNOWN) { | ||
for (unsigned i = 0; i < *num_drivers; i++) | ||
free(drivers[i]); | ||
*num_drivers = old_num_drivers; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my testing the above does not seem to be enough.
va_DRI3_GetDriverNames()
will initialize drm_state and set drm_state->auth_type to VA_DRM_AUTH_CUSTOM, causing va_isDRI2Connected()
to then skip authentication, causing VA-API rendering to again not work.
As a hack, I added the following in the above if statement and then all seemed to work:
struct drm_state *drm_state = pDisplayContext->pDriverContext->drm_state;
/* also undo other initialization GetDriverNames() did: */
if (drm_state->fd != -1)
close(drm_state->fd);
drm_state->fd = -1;
drm_state->auth_type = VA_DRM_AUTH_NONE;
However, that feels like too much of a hack so some more refactoring is probably needed.
* | ||
* Omit them by default, set LIBVA_DRI3_DISABLE=0 to bypass. | ||
*/ | ||
if (vaStatus == VA_STATUS_SUCCESS && dri3_disable && !atoi(dri3_disable)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above condition skips the Intel check when LIBVA_DRI_DISABLE=0 is set, so the behavior is reverse from intended (intended: LIBVA_DRI_DISABLE=0 allows intel dri3, unset variable denies intel dri3).
The following would work as intended (tested), i.e. automatic intel skipping only done if the variable is unset:
if (vaStatus == VA_STATUS_SUCCESS && !dri3_disable) {
Unfortunately i965 and iHD drivers lack DRI3 support.
It's unknown when/if they will gain support, so explicitly disable DRI3
for them - it's not perfect, alas better than asking every affected user
to manually set the environment override.