i965: use pack/unpackDouble lowering
[mesa.git] / src / gallium / drivers / virgl / virgl_context.c
index 32dde06ae7d4f52acc563f874ec5797e01b54f23..c322503d81630141c9b13ed1de8f98e83a14c768 100644 (file)
 #include "util/u_upload_mgr.h"
 #include "util/u_blitter.h"
 #include "tgsi/tgsi_text.h"
+#include "indices/u_primconvert.h"
 
 #include "pipebuffer/pb_buffer.h"
 #include "state_tracker/graw.h"
-#include "state_tracker/drm_driver.h"
 
 #include "virgl_encode.h"
-
 #include "virgl_context.h"
-
+#include "virgl_protocol.h"
 #include "virgl_resource.h"
 #include "virgl_screen.h"
-#include "state_tracker/sw_winsys.h"
- struct pipe_screen encscreen;
 
 static uint32_t next_handle;
 uint32_t virgl_object_assign_handle(void)
@@ -201,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;
@@ -608,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;
            }
@@ -668,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);
@@ -947,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;