mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-21 18:40:42 +01:00
broadcom/vc4: Add support for YUV textures using unaccelerated blits.
Previously we would assertion fail about having no hardware format. This is enough to get kmscube -M nv12-2img working.
This commit is contained in:
parent
c824a045ea
commit
bc3d16e633
3 changed files with 35 additions and 3 deletions
|
|
@ -183,6 +183,32 @@ vc4_blitter_save(struct vc4_context *vc4)
|
|||
vc4->fragtex.num_textures, vc4->fragtex.textures);
|
||||
}
|
||||
|
||||
static bool
|
||||
vc4_yuv_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
|
||||
{
|
||||
struct vc4_resource *src = vc4_resource(info->src.resource);
|
||||
struct vc4_resource *dst = vc4_resource(info->dst.resource);
|
||||
bool ok;
|
||||
|
||||
if (src->tiled)
|
||||
return false;
|
||||
if (src->base.format != PIPE_FORMAT_R8_UNORM &&
|
||||
src->base.format != PIPE_FORMAT_R8G8_UNORM)
|
||||
return false;
|
||||
|
||||
/* YUV blits always turn raster-order to tiled */
|
||||
assert(dst->base.format == src->base.format);
|
||||
assert(dst->tiled);
|
||||
|
||||
/* Do an immediate SW fallback, since the render blit path
|
||||
* would just recurse.
|
||||
*/
|
||||
ok = util_try_blit_via_copy_region(pctx, info);
|
||||
assert(ok); (void)ok;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
vc4_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
|
||||
{
|
||||
|
|
@ -218,6 +244,9 @@ vc4_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
|
|||
{
|
||||
struct pipe_blit_info info = *blit_info;
|
||||
|
||||
if (vc4_yuv_blit(pctx, blit_info))
|
||||
return;
|
||||
|
||||
if (vc4_tile_blit(pctx, blit_info))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -564,8 +564,10 @@ get_resource_texture_format(struct pipe_resource *prsc)
|
|||
if (prsc->nr_samples > 1) {
|
||||
return ~0;
|
||||
} else {
|
||||
assert(format == VC4_TEXTURE_TYPE_RGBA8888);
|
||||
return VC4_TEXTURE_TYPE_RGBA32R;
|
||||
if (format == VC4_TEXTURE_TYPE_RGBA8888)
|
||||
return VC4_TEXTURE_TYPE_RGBA32R;
|
||||
else
|
||||
return ~0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -581,7 +581,8 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||
*/
|
||||
if ((cso->u.tex.first_level &&
|
||||
(cso->u.tex.first_level != cso->u.tex.last_level)) ||
|
||||
rsc->vc4_format == VC4_TEXTURE_TYPE_RGBA32R) {
|
||||
rsc->vc4_format == VC4_TEXTURE_TYPE_RGBA32R ||
|
||||
rsc->vc4_format == ~0) {
|
||||
struct vc4_resource *shadow_parent = rsc;
|
||||
struct pipe_resource tmpl = {
|
||||
.target = prsc->target,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue