forked from FFmpeg/FFmpeg
hwcontext_vaapi: Try to support the VDPAU wrapper
The driver is somewhat bitrotten (not updated for years) but is still usable for decoding with this change. To support it, this adds a new driver quirk to indicate no support at all for surface attributes. Based on a patch by wm4 <nfxjfg@googlemail.com>.
This commit is contained in:
parent
5dd9a4b88b
commit
e791b915c7
2 changed files with 52 additions and 34 deletions
|
@ -153,7 +153,8 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev,
|
||||||
unsigned int fourcc;
|
unsigned int fourcc;
|
||||||
int err, i, j, attr_count, pix_fmt_count;
|
int err, i, j, attr_count, pix_fmt_count;
|
||||||
|
|
||||||
if (config) {
|
if (config &&
|
||||||
|
!(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) {
|
||||||
attr_count = 0;
|
attr_count = 0;
|
||||||
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
|
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
|
||||||
0, &attr_count);
|
0, &attr_count);
|
||||||
|
@ -271,6 +272,11 @@ static const struct {
|
||||||
"ubit",
|
"ubit",
|
||||||
AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE,
|
AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"VDPAU wrapper",
|
||||||
|
"Splitted-Desktop Systems VDPAU backend for VA-API",
|
||||||
|
AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int vaapi_device_init(AVHWDeviceContext *hwdev)
|
static int vaapi_device_init(AVHWDeviceContext *hwdev)
|
||||||
|
@ -449,6 +455,7 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hwfc->pool) {
|
if (!hwfc->pool) {
|
||||||
|
if (!(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) {
|
||||||
int need_memory_type = !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE);
|
int need_memory_type = !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE);
|
||||||
int need_pixel_format = 1;
|
int need_pixel_format = 1;
|
||||||
for (i = 0; i < avfc->nb_attributes; i++) {
|
for (i = 0; i < avfc->nb_attributes; i++) {
|
||||||
|
@ -486,6 +493,10 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
av_assert0(i == ctx->nb_attributes);
|
av_assert0(i == ctx->nb_attributes);
|
||||||
|
} else {
|
||||||
|
ctx->attributes = NULL;
|
||||||
|
ctx->nb_attributes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->rt_format = rt_format;
|
ctx->rt_format = rt_format;
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,13 @@ enum {
|
||||||
* so the surface allocation code will not try to use it.
|
* so the surface allocation code will not try to use it.
|
||||||
*/
|
*/
|
||||||
AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2),
|
AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The driver does not support surface attributes at all.
|
||||||
|
* The surface allocation code will never pass them to surface allocation,
|
||||||
|
* and the results of the vaQuerySurfaceAttributes() call will be faked.
|
||||||
|
*/
|
||||||
|
AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue