i965: use pack/unpackDouble lowering
[mesa.git] / src / gallium / drivers / virgl / virgl_context.c
index cae6352c0feded3c159b75a4885281d57ce02c07..c322503d81630141c9b13ed1de8f98e83a14c768 100644 (file)
@@ -198,7 +198,7 @@ static struct pipe_surface *virgl_create_surface(struct pipe_context *ctx,
    uint32_t handle;
 
    surf = CALLOC_STRUCT(virgl_surface);
-   if (surf == NULL)
+   if (!surf)
       return NULL;
 
    res->clean = FALSE;
@@ -605,7 +605,7 @@ static void virgl_draw_vbo(struct pipe_context *ctx,
            ib.offset = vctx->index_buffer.offset + info.start * ib.index_size;
 
            if (ib.user_buffer) {
-                   u_upload_data(vctx->uploader, 0, info.count * ib.index_size,
+                   u_upload_data(vctx->uploader, 0, info.count * ib.index_size, 256,
                                  ib.user_buffer, &ib.offset, &ib.buffer);
                    ib.user_buffer = NULL;
            }
@@ -665,11 +665,15 @@ static struct pipe_sampler_view *virgl_create_sampler_view(struct pipe_context *
                                       const struct pipe_sampler_view *state)
 {
    struct virgl_context *vctx = virgl_context(ctx);
-   struct virgl_sampler_view *grview = CALLOC_STRUCT(virgl_sampler_view);
+   struct virgl_sampler_view *grview;
    uint32_t handle;
    struct virgl_resource *res;
 
-   if (state == NULL)
+   if (!state)
+      return NULL;
+
+   grview = CALLOC_STRUCT(virgl_sampler_view);
+   if (!grview)
       return NULL;
 
    res = virgl_resource(texture);
@@ -944,8 +948,8 @@ struct pipe_context *virgl_context_create(struct pipe_screen *pscreen,
                     16, UTIL_SLAB_SINGLETHREADED);
 
    vctx->primconvert = util_primconvert_create(&vctx->base, rs->caps.caps.v1.prim_mask);
-   vctx->uploader = u_upload_create(&vctx->base, 1024 * 1024, 256,
-                                     PIPE_BIND_INDEX_BUFFER);
+   vctx->uploader = u_upload_create(&vctx->base, 1024 * 1024,
+                                     PIPE_BIND_INDEX_BUFFER, PIPE_USAGE_STREAM);
    if (!vctx->uploader)
            goto fail;