[virglrenderer-devel] [PATCH 1/3] vrend: Nop sends to backing iovs for readonly textures v2.
Gurchetan Singh
gurchetansingh at chromium.org
Sat May 5 01:59:38 UTC 2018
Robert just tested this patch-set and found no regressions. He
removed "else if vrend_state.use_gles" from this patch and just made
it an else statement (since we tested on desktop GL). So we should
probably do that when committing. With that, this series is:
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
On Mon, Apr 30, 2018 at 1:02 PM, Jakob Bornecrantz <jakob at collabora.com> wrote:
> As I have only done testing on the gles-backend with this patch
> the code is only enabled on it. Further testing might show that
> it is possible to run this code on all backends.
>
> v2: Try getteximage path on failure.
>
> Fixes:
> dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_fastest
> dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_nicest
> dEQP-GLES2.functional.texture.mipmap.2d.generate.l8_fastest
> dEQP-GLES2.functional.texture.mipmap.2d.generate.l8_nicest
> dEQP-GLES2.functional.texture.mipmap.2d.generate.la88_fastest
> dEQP-GLES2.functional.texture.mipmap.2d.generate.la88_nicest
> dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_fastest
> dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_nicest
> dEQP-GLES2.functional.texture.mipmap.cube.generate.l8_fastest
> dEQP-GLES2.functional.texture.mipmap.cube.generate.l8_nicest
> dEQP-GLES2.functional.texture.mipmap.cube.generate.la88_fastest
> dEQP-GLES2.functional.texture.mipmap.cube.generate.la88_nicest
>
> Signed-off-by: Jakob Bornecrantz <jakob at collabora.com>
> ---
> src/vrend_renderer.c | 47 ++++++++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 42 insertions(+), 5 deletions(-)
>
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index 8e55f63..43e9ab2 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -5388,6 +5388,39 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
> return 0;
> }
>
> +static int vrend_transfer_send_readonly(struct vrend_context *ctx,
> + struct vrend_resource *res,
> + struct iovec *iov, int num_iovs,
> + const struct vrend_transfer_info *info)
> +{
> + bool same_iov = true;
> + int i;
> +
> + if (res->num_iovs == num_iovs) {
> + for (i = 0; i < res->num_iovs; i++) {
> + if (res->iov[i].iov_len != iov[i].iov_len ||
> + res->iov[i].iov_base != iov[i].iov_base) {
> + same_iov = false;
> + }
> + }
> + } else {
> + same_iov = false;
> + }
> +
> + /*
> + * When we detect that we are reading back to the same iovs that are
> + * attached to the resource and we know that the resource can not
> + * be rendered to (as this function is only called then), we do not
> + * need to do anything more.
> + */
> + if (same_iov) {
> + return 0;
> + }
> +
> + /* Fallback to getteximage, will probably fail on GLES. */
> + return -1;
> +}
> +
> static int vrend_renderer_transfer_send_iov(struct vrend_context *ctx,
> struct vrend_resource *res,
> struct iovec *iov, int num_iovs,
> @@ -5415,18 +5448,22 @@ static int vrend_renderer_transfer_send_iov(struct vrend_context *ctx,
> vrend_write_to_iovec(iov, num_iovs, info->offset, data, send_size);
> glUnmapBuffer(res->target);
> } else {
> + int ret = -1;
> bool can_readpixels = true;
>
> can_readpixels = vrend_format_can_render(res->base.format) || vrend_format_is_ds(res->base.format);
>
> if (can_readpixels) {
> - return vrend_transfer_send_readpixels(ctx, res,
> - iov, num_iovs, info);
> + ret = vrend_transfer_send_readpixels(ctx, res, iov, num_iovs, info);
> + } else if (vrend_state.use_gles) {
> + ret = vrend_transfer_send_readonly(ctx, res, iov, num_iovs, info);
> }
>
> - return vrend_transfer_send_getteximage(ctx, res,
> - iov, num_iovs, info);
> -
> + /* Can hit this on a non-error path as well. */
> + if (ret != 0) {
> + ret = vrend_transfer_send_getteximage(ctx, res, iov, num_iovs, info);
> + }
> + return ret;
> }
> return 0;
> }
> --
> 2.14.1
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
More information about the virglrenderer-devel
mailing list