aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2019-05-13 10:42:08 -0700
committerChia-I Wu <[email protected]>2019-05-22 09:28:19 -0700
commit440982cdd6e50797853eb78b6edf9401ba5a93b8 (patch)
treeb0f24a09ba622b5816b1b43acbb73601dc76109c /src/gallium/drivers
parentfa9afb9de0379d47892eca2ec826c1bdb5caacd2 (diff)
virgl: remove support for buffer surfaces
st/mesa does not need it and virglrenderer does not really support it. Remove the support so that we are sure pipe_surface never refers to a buffer resource. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Alexandros Frantzis <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/virgl/virgl_context.c23
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.c11
2 files changed, 15 insertions, 19 deletions
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 24775930d86..25f841a2b51 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -229,6 +229,10 @@ static struct pipe_surface *virgl_create_surface(struct pipe_context *ctx,
struct virgl_resource *res = virgl_resource(resource);
uint32_t handle;
+ /* no support for buffer surfaces */
+ if (resource->target == PIPE_BUFFER)
+ return NULL;
+
surf = CALLOC_STRUCT(virgl_surface);
if (!surf)
return NULL;
@@ -244,18 +248,13 @@ static struct pipe_surface *virgl_create_surface(struct pipe_context *ctx,
pipe_resource_reference(&surf->base.texture, resource);
surf->base.context = ctx;
surf->base.format = templ->format;
- if (resource->target != PIPE_BUFFER) {
- surf->base.width = u_minify(resource->width0, templ->u.tex.level);
- surf->base.height = u_minify(resource->height0, templ->u.tex.level);
- surf->base.u.tex.level = templ->u.tex.level;
- surf->base.u.tex.first_layer = templ->u.tex.first_layer;
- surf->base.u.tex.last_layer = templ->u.tex.last_layer;
- } else {
- surf->base.width = templ->u.buf.last_element - templ->u.buf.first_element + 1;
- surf->base.height = resource->height0;
- surf->base.u.buf.first_element = templ->u.buf.first_element;
- surf->base.u.buf.last_element = templ->u.buf.last_element;
- }
+
+ surf->base.width = u_minify(resource->width0, templ->u.tex.level);
+ surf->base.height = u_minify(resource->height0, templ->u.tex.level);
+ surf->base.u.tex.level = templ->u.tex.level;
+ surf->base.u.tex.first_layer = templ->u.tex.first_layer;
+ surf->base.u.tex.last_layer = templ->u.tex.last_layer;
+
virgl_encoder_create_surface(vctx, handle, res, &surf->base);
surf->handle = handle;
return &surf->base;
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index 72fecf43d02..ee524c883d9 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -489,14 +489,11 @@ int virgl_encoder_create_surface(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, handle);
virgl_encoder_write_res(ctx, res);
virgl_encoder_write_dword(ctx->cbuf, templat->format);
- if (templat->texture->target == PIPE_BUFFER) {
- virgl_encoder_write_dword(ctx->cbuf, templat->u.buf.first_element);
- virgl_encoder_write_dword(ctx->cbuf, templat->u.buf.last_element);
- } else {
- virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.level);
- virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.first_layer | (templat->u.tex.last_layer << 16));
- }
+ assert(templat->texture->target != PIPE_BUFFER);
+ virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.level);
+ virgl_encoder_write_dword(ctx->cbuf, templat->u.tex.first_layer | (templat->u.tex.last_layer << 16));
+
return 0;
}