Skip to content

Commit

Permalink
vo_gpu/vo_gpu_next: add some more query format debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Dudemanguy committed Sep 15, 2024
1 parent d02f03b commit 64aff5b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
14 changes: 11 additions & 3 deletions video/out/gpu/ra.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,23 +300,30 @@ bool ra_get_imgfmt_desc(struct ra *ra, int imgfmt, struct ra_imgfmt_desc *out)
res.num_planes = regfmt.num_planes;
res.component_bits = regfmt.component_size * 8;
res.component_pad = regfmt.component_pad;
MP_DBG(ra, "Found %d planes for format %s.\n", res.num_planes, mp_imgfmt_to_name(imgfmt));
for (int n = 0; n < regfmt.num_planes; n++) {
struct mp_regular_imgfmt_plane *plane = &regfmt.planes[n];
res.planes[n] = find_plane_format(ra, regfmt.component_size,
plane->num_components,
regfmt.component_type);
if (!res.planes[n])
if (!res.planes[n]) {
MP_DBG(ra, "No planes found for format: %s\n", mp_imgfmt_to_name(imgfmt));
return false;
}
for (int i = 0; i < plane->num_components; i++)
res.components[n][i] = plane->components[i];
// Dropping LSBs when shifting will lead to dropped MSBs.
if (res.component_bits > res.planes[n]->component_depth[0] &&
res.component_pad < 0)
res.component_pad < 0) {
MP_DBG(ra, "Bad LSB/MSB shifting for format: %s\n", mp_imgfmt_to_name(imgfmt));
return false;
}
// Renderer restriction, but actually an unwanted corner case.
if (res.component_type != RA_CTYPE_UNKNOWN &&
res.component_type != res.planes[n]->ctype)
res.component_type != res.planes[n]->ctype) {
MP_DBG(ra, "RA_CTYPE_UNKNOWN edgecase for format: %s\n", mp_imgfmt_to_name(imgfmt));
return false;
}
res.component_type = res.planes[n]->ctype;
}
res.chroma_w = 1 << regfmt.chroma_xs;
Expand All @@ -332,6 +339,7 @@ bool ra_get_imgfmt_desc(struct ra *ra, int imgfmt, struct ra_imgfmt_desc *out)
}

// Unsupported format
MP_DBG(ra, "Format, %s\n, is not supported.", mp_imgfmt_to_name(imgfmt));
return false;

supported:
Expand Down
12 changes: 8 additions & 4 deletions video/out/gpu/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -4093,14 +4093,18 @@ bool gl_video_showing_interpolated_frame(struct gl_video *p)
return p->is_interpolated;
}

static bool is_imgfmt_desc_supported(struct gl_video *p,
static bool is_imgfmt_desc_supported(struct gl_video *p, int mp_format,
const struct ra_imgfmt_desc *desc)
{
if (!desc->num_planes)
if (!desc->num_planes) {
MP_DBG(p, "No planes found for format: %s\n", mp_imgfmt_to_name(mp_format));
return false;
}

if (desc->planes[0]->ctype == RA_CTYPE_UINT && p->forced_dumb_mode)
if (desc->planes[0]->ctype == RA_CTYPE_UINT && p->forced_dumb_mode) {
MP_DBG(p, "RA_CTYPE_UNIT and dumb mode for: %s\n", mp_imgfmt_to_name(mp_format));
return false;
}

return true;
}
Expand All @@ -4109,7 +4113,7 @@ bool gl_video_check_format(struct gl_video *p, int mp_format)
{
struct ra_imgfmt_desc desc;
if (ra_get_imgfmt_desc(p->ra, mp_format, &desc) &&
is_imgfmt_desc_supported(p, &desc))
is_imgfmt_desc_supported(p, mp_format, &desc))
return true;
if (ra_hwdec_get(&p->hwdec_ctx, mp_format))
return true;
Expand Down
1 change: 1 addition & 0 deletions video/out/vo_gpu_next.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@ static int query_format(struct vo *vo, int format)
if (!planes)
return false;

MP_DBG(vo, "Found %d planes for format %s.\n", planes, mp_imgfmt_to_name(format));
for (int i = 0; i < planes; i++) {
if (!pl_plane_find_fmt(p->gpu, NULL, &data[i]))
return false;
Expand Down

0 comments on commit 64aff5b

Please sign in to comment.