Skip to content

Commit e462cf3

Browse files
committed
vo_gpu_next: use emulated formats only as fallback
Makes use of the query_format fallback logic introduced in the previous commit. Fallback formats are likely to be extraordinarily slow. Trigger for this issue was an Android device (of course) where there are no reasonable formats to map yuv420p10le and mpv would pick 32-bit float RGB as the next best format, forcing a slow path in both swscale and the GLES driver. With the new logic mpv will convert 8-bit YUV, which enables playback at a reasonable frame rate.
1 parent 02eda79 commit e462cf3

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

video/out/vo_gpu_next.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,20 +1176,23 @@ static int query_format(struct vo *vo, int format)
11761176
{
11771177
struct priv *p = vo->priv;
11781178
if (ra_hwdec_get(&p->hwdec_ctx, format))
1179-
return true;
1179+
return 2;
11801180

11811181
struct pl_bit_encoding bits;
11821182
struct pl_plane_data data[4] = {0};
11831183
int planes = plane_data_from_imgfmt(data, &bits, format);
11841184
if (!planes)
1185-
return false;
1185+
return 0;
11861186

1187+
bool only_fallback = false;
11871188
for (int i = 0; i < planes; i++) {
1188-
if (!pl_plane_find_fmt(p->gpu, NULL, &data[i]))
1189-
return false;
1189+
pl_fmt fmt = pl_plane_find_fmt(p->gpu, NULL, &data[i]);
1190+
if (!fmt)
1191+
return 0;
1192+
only_fallback |= fmt->emulated;
11901193
}
11911194

1192-
return true;
1195+
return only_fallback ? 1 : 2;
11931196
}
11941197

11951198
static void resize(struct vo *vo)

0 commit comments

Comments
 (0)