virgl: support emulating planar image sampling

Mesa emulates planar format sampling with per-plane samplers. Virgl now
supports this by allowing the plane index to be passed when creating a
sampler view from a planar image. With this change, mesa now passes that
information to virgl.

Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Lepton Wu <lepton@chromium.org>
This commit is contained in:
David Stevens 2019-10-23 11:06:17 +09:00 committed by Gert Wollny
parent 084431ce45
commit 0466239aae
1 changed files with 6 additions and 1 deletions

View File

@ -879,7 +879,12 @@ int virgl_encode_sampler_view(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, state->u.buf.offset / elem_size);
virgl_encoder_write_dword(ctx->cbuf, (state->u.buf.offset + state->u.buf.size) / elem_size - 1);
} else {
virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_layer | state->u.tex.last_layer << 16);
if (res->metadata.plane) {
debug_assert(state->u.tex.first_layer == 0 && state->u.tex.last_layer == 0);
virgl_encoder_write_dword(ctx->cbuf, res->metadata.plane);
} else {
virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_layer | state->u.tex.last_layer << 16);
}
virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_level | state->u.tex.last_level << 8);
}
tmp = VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_R(state->swizzle_r) |