[virglrenderer-devel] [PATCH] vrend: Nop sends to backing iovs for readonly textures.
Jakob Bornecrantz
jakob at collabora.com
Tue Mar 27 13:00:03 UTC 2018
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.
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 | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 0d0dbd9..e544386 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -5385,6 +5385,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 vrend_transfer_send_getteximage(ctx, res, iov, num_iovs, info);
+}
+
static int vrend_renderer_transfer_send_iov(struct vrend_context *ctx,
struct vrend_resource *res,
struct iovec *iov, int num_iovs,
@@ -5419,6 +5452,8 @@ static int vrend_renderer_transfer_send_iov(struct vrend_context *ctx,
if (can_readpixels) {
return vrend_transfer_send_readpixels(ctx, res,
iov, num_iovs, info);
+ } else if (vrend_state.use_gles) {
+ return vrend_transfer_send_readonly(ctx, res, iov, num_iovs, info);
}
return vrend_transfer_send_getteximage(ctx, res,
--
2.14.1
More information about the virglrenderer-devel
mailing list