Opening the device via X11 (DRI2/DRI3) rather than opening a DRM render node directly is only useful if you intend to use the legacy X11 interop functions. That's never true for the ffmpeg utility, and a library user who does want this will likely provide their own display instance rather than making a new one here.
Unified · Split
| @@ -1500,27 +1500,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, · 1499 unmodified lines | |||
| 1500 | try_x11 = HAVE_VAAPI_X11; | 1500 | try_x11 = HAVE_VAAPI_X11; |
| 1501 | } | 1501 | } |
| 1502 | 1502 | ||
| 1503 | #if HAVE_VAAPI_X11 | ||
| 1504 | if (!display && try_x11) { | ||
| 1505 | // Try to open the device as an X11 display. | ||
| 1506 | priv->x11_display = XOpenDisplay(device); | ||
| 1507 | if (!priv->x11_display) { | ||
| 1508 | av_log(ctx, AV_LOG_VERBOSE, "Cannot open X11 display " | ||
| 1509 | "%s.\n", XDisplayName(device)); | ||
| 1510 | } else { | ||
| 1511 | display = vaGetDisplay(priv->x11_display); | ||
| 1512 | if (!display) { | ||
| 1513 | av_log(ctx, AV_LOG_ERROR, "Cannot open a VA display " | ||
| 1514 | "from X11 display %s.\n", XDisplayName(device)); | ||
| 1515 | return AVERROR_UNKNOWN; | ||
| 1516 | } | ||
| 1517 | |||
| 1518 | av_log(ctx, AV_LOG_VERBOSE, "Opened VA display via " | ||
| 1519 | "X11 display %s.\n", XDisplayName(device)); | ||
| 1520 | } | ||
| 1521 | } | ||
| 1522 | #endif | ||
| 1523 | |||
| 1524 | #if HAVE_VAAPI_DRM | 1503 | #if HAVE_VAAPI_DRM |
| 1525 | while (!display && try_drm) { | 1504 | while (!display && try_drm) { |
| 1526 | // If the device is specified, try to open it as a DRM device node. | 1505 | // If the device is specified, try to open it as a DRM device node. |
| @@ -1588,6 +1567,27 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, · 61 unmodified lines | |||
| 1588 | } | 1567 | } |
| 1589 | #endif | 1568 | #endif |
| 1590 | 1569 | ||
| 1570 | #if HAVE_VAAPI_X11 | ||
| 1571 | if (!display && try_x11) { | ||
| 1572 | // Try to open the device as an X11 display. | ||
| 1573 | priv->x11_display = XOpenDisplay(device); | ||
| 1574 | if (!priv->x11_display) { | ||
| 1575 | av_log(ctx, AV_LOG_VERBOSE, "Cannot open X11 display " | ||
| 1576 | "%s.\n", XDisplayName(device)); | ||
| 1577 | } else { | ||
| 1578 | display = vaGetDisplay(priv->x11_display); | ||
| 1579 | if (!display) { | ||
| 1580 | av_log(ctx, AV_LOG_ERROR, "Cannot open a VA display " | ||
| 1581 | "from X11 display %s.\n", XDisplayName(device)); | ||
| 1582 | return AVERROR_UNKNOWN; | ||
| 1583 | } | ||
| 1584 | |||
| 1585 | av_log(ctx, AV_LOG_VERBOSE, "Opened VA display via " | ||
| 1586 | "X11 display %s.\n", XDisplayName(device)); | ||
| 1587 | } | ||
| 1588 | } | ||
| 1589 | #endif | ||
| 1590 | |||
| 1591 | if (!display) { | 1591 | if (!display) { |
| 1592 | if (device) | 1592 | if (device) |
| 1593 | av_log(ctx, AV_LOG_ERROR, "No VA display found for " | 1593 | av_log(ctx, AV_LOG_ERROR, "No VA display found for " |