winsys/radeon: don't use BIND flags, add a flag for the cache bufmgr instead
authorMarek Olšák <maraeo@gmail.com>
Sat, 8 Dec 2012 23:02:46 +0000 (00:02 +0100)
committerMarek Olšák <maraeo@gmail.com>
Wed, 12 Dec 2012 12:09:54 +0000 (13:09 +0100)
12 files changed:
src/gallium/drivers/r300/r300_flush.c
src/gallium/drivers/r300/r300_query.c
src/gallium/drivers/r300/r300_screen_buffer.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r600/r600_buffer.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_texture.c
src/gallium/drivers/radeonsi/r600_buffer.c
src/gallium/drivers/radeonsi/r600_texture.c
src/gallium/drivers/radeonsi/radeonsi_pipe.h
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index 732529a317e79b73150e89db60a608f30a59793a..2170c591f99465092876844e828211a3f2008343 100644 (file)
@@ -79,8 +79,7 @@ void r300_flush(struct pipe_context *pipe,
 
     if (rfence) {
         /* Create a fence, which is a dummy BO. */
-        *rfence = r300->rws->buffer_create(r300->rws, 1, 1,
-                                           PIPE_BIND_CUSTOM,
+        *rfence = r300->rws->buffer_create(r300->rws, 1, 1, TRUE,
                                            RADEON_DOMAIN_GTT);
         /* Add the fence as a dummy relocation. */
         r300->rws->cs_add_reloc(r300->cs,
index 3ea6be7ef5730130c46ec388717a34809b237005..4443362d10288c5cbc2495a26c71a2ccf66d8b99 100644 (file)
@@ -57,8 +57,8 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
     else
         q->num_pipes = r300screen->info.r300_num_gb_pipes;
 
-    q->buf = r300->rws->buffer_create(r300->rws, 4096, 4096,
-                                      PIPE_BIND_CUSTOM, RADEON_DOMAIN_GTT);
+    q->buf = r300->rws->buffer_create(r300->rws, 4096, 4096, TRUE,
+                                      RADEON_DOMAIN_GTT);
     if (!q->buf) {
         FREE(q);
         return NULL;
index c92ec56507c2f679b7951ce59a4eeaa3d4c22652..0c1e69b7a4c01085edbfd9d3cf7987fc80d0dee8 100644 (file)
@@ -101,9 +101,9 @@ r300_buffer_transfer_map( struct pipe_context *context,
             struct pb_buffer *new_buf;
 
             /* Create a new one in the same pipe_resource. */
-            new_buf = r300->rws->buffer_create(r300->rws,
-                                               rbuf->b.b.width0, R300_BUFFER_ALIGNMENT,
-                                               rbuf->b.b.bind, rbuf->domain);
+            new_buf = r300->rws->buffer_create(r300->rws, rbuf->b.b.width0,
+                                               R300_BUFFER_ALIGNMENT, TRUE,
+                                               rbuf->domain);
             if (new_buf) {
                 /* Discard the old buffer. */
                 pb_reference(&rbuf->buf, NULL);
@@ -181,9 +181,9 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
     }
 
     rbuf->buf =
-        r300screen->rws->buffer_create(r300screen->rws,
-                                       rbuf->b.b.width0, R300_BUFFER_ALIGNMENT,
-                                       rbuf->b.b.bind, rbuf->domain);
+        r300screen->rws->buffer_create(r300screen->rws, rbuf->b.b.width0,
+                                       R300_BUFFER_ALIGNMENT, TRUE,
+                                       rbuf->domain);
     if (!rbuf->buf) {
         FREE(rbuf);
         return NULL;
index 6197cf719ef6335071458abf1e017d31fd6ae7e6..568558f0adb34da435dab165dcf7e0d57ec4413a 100644 (file)
@@ -997,8 +997,8 @@ r300_texture_create_object(struct r300_screen *rscreen,
 
     /* Create the backing buffer if needed. */
     if (!tex->buf) {
-        tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048,
-                                      base->bind, tex->domain);
+        tex->buf = rws->buffer_create(rws, tex->tex.size_in_bytes, 2048, TRUE,
+                                      tex->domain);
 
         if (!tex->buf) {
             goto fail;
index 3b8d227bd386f5a488fa4d372d67476c6603d602..9e2cf6650ad6f4e360e7d6176078a9906c88db5c 100644 (file)
@@ -112,7 +112,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
                        /* Create a new one in the same pipe_resource. */
                        /* XXX We probably want a different alignment for buffers and textures. */
                        r600_init_resource(rctx->screen, rbuffer, rbuffer->b.b.width0, 4096,
-                                          rbuffer->b.b.bind, rbuffer->b.b.usage);
+                                          TRUE, rbuffer->b.b.usage);
 
                        /* We changed the buffer, now we need to bind it where the old one was bound. */
                        /* Vertex buffers. */
@@ -203,7 +203,7 @@ static const struct u_resource_vtbl r600_buffer_vtbl =
 bool r600_init_resource(struct r600_screen *rscreen,
                        struct r600_resource *res,
                        unsigned size, unsigned alignment,
-                       unsigned bind, unsigned usage)
+                       bool use_reusable_pool, unsigned usage)
 {
        uint32_t initial_domain, domains;
 
@@ -234,7 +234,9 @@ bool r600_init_resource(struct r600_screen *rscreen,
                break;
        }
 
-       res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment, bind, initial_domain);
+       res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment,
+                                              use_reusable_pool,
+                                              initial_domain);
        if (!res->buf) {
                return false;
        }
@@ -258,7 +260,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
        rbuffer->b.b.screen = screen;
        rbuffer->b.vtbl = &r600_buffer_vtbl;
 
-       if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) {
+       if (!r600_init_resource(rscreen, rbuffer, templ->width0, alignment, TRUE, templ->usage)) {
                FREE(rbuffer);
                return NULL;
        }
index 219bd54304a923eacc5579919df6e8f80061b289..a61a6e8c08260f495f3bbd560bcafb59b332dd69 100644 (file)
@@ -591,7 +591,7 @@ void r600_decompress_color_textures(struct r600_context *rctx,
 bool r600_init_resource(struct r600_screen *rscreen,
                        struct r600_resource *res,
                        unsigned size, unsigned alignment,
-                       unsigned bind, unsigned usage);
+                       bool use_reusable_pool, unsigned usage);
 struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
                                         const struct pipe_resource *templ,
                                         unsigned alignment);
index efff2c3629729867496288f89d961af300fb321d..56e9b64fc473dd16880a79557662ac2f61dabfb8 100644 (file)
@@ -443,7 +443,7 @@ r600_texture_create_object(struct pipe_screen *screen,
                unsigned base_align = rtex->surface.bo_alignment;
                unsigned usage = R600_TEX_IS_TILED(rtex, 0) ? PIPE_USAGE_STATIC : base->usage;
 
-               if (!r600_init_resource(rscreen, resource, rtex->size, base_align, base->bind, usage)) {
+               if (!r600_init_resource(rscreen, resource, rtex->size, base_align, FALSE, usage)) {
                        FREE(rtex);
                        return NULL;
                }
index 66bb4d5d914c03af9907bf1cdd4c4deec0551570..0c33c1e162f837e7bb92f464d5a6cae5a9eb65c9 100644 (file)
@@ -100,7 +100,7 @@ static const struct u_resource_vtbl r600_buffer_vtbl =
 bool si_init_resource(struct r600_screen *rscreen,
                        struct si_resource *res,
                        unsigned size, unsigned alignment,
-                       unsigned bind, unsigned usage)
+                       boolean use_reusable_pool, unsigned usage)
 {
        uint32_t initial_domain, domains;
 
@@ -129,7 +129,9 @@ bool si_init_resource(struct r600_screen *rscreen,
                }
        }
 
-       res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment, bind, initial_domain);
+       res->buf = rscreen->ws->buffer_create(rscreen->ws, size, alignment,
+                                              use_reusable_pool,
+                                              initial_domain);
        if (!res->buf) {
                return false;
        }
@@ -154,7 +156,7 @@ struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
        rbuffer->b.b.screen = screen;
        rbuffer->b.vtbl = &r600_buffer_vtbl;
 
-       if (!si_init_resource(rscreen, rbuffer, templ->width0, alignment, templ->bind, templ->usage)) {
+       if (!si_init_resource(rscreen, rbuffer, templ->width0, alignment, TRUE, templ->usage)) {
                FREE(rbuffer);
                return NULL;
        }
index fdfc8f3fa28e5866add4442d80f0dd86b9846273..de46640d7e495741f5e5468ff52bc90a8de78e9e 100644 (file)
@@ -500,7 +500,7 @@ r600_texture_create_object(struct pipe_screen *screen,
                unsigned size = rtex->surface.bo_size;
 
                base_align = rtex->surface.bo_alignment;
-               if (!si_init_resource(rscreen, resource, size, base_align, base->bind, base->usage)) {
+               if (!si_init_resource(rscreen, resource, size, base_align, FALSE, base->usage)) {
                        FREE(rtex);
                        return NULL;
                }
index 1ccf95274dc127d8ff88461541cd7a684cae097b..29e8960c9b13044a588a5ff3a029d8e15293c644 100644 (file)
@@ -194,7 +194,7 @@ void si_flush_depth_textures(struct r600_context *rctx);
 bool si_init_resource(struct r600_screen *rscreen,
                      struct si_resource *res,
                      unsigned size, unsigned alignment,
-                     unsigned bind, unsigned usage);
+                     boolean use_reusable_pool, unsigned usage);
 struct pipe_resource *si_buffer_create(struct pipe_screen *screen,
                                       const struct pipe_resource *templ);
 void r600_upload_index_buffer(struct r600_context *rctx,
index 090a6faf50db93838dd60291e0ac63b5650091cb..07e92c591b595c646e491a6b26bda8c84192d234 100644 (file)
@@ -813,7 +813,7 @@ static struct pb_buffer *
 radeon_winsys_bo_create(struct radeon_winsys *rws,
                         unsigned size,
                         unsigned alignment,
-                        unsigned bind,
+                        boolean use_reusable_pool,
                         enum radeon_bo_domain domain)
 {
     struct radeon_drm_winsys *ws = radeon_drm_winsys(rws);
@@ -829,8 +829,7 @@ radeon_winsys_bo_create(struct radeon_winsys *rws,
     desc.initial_domains = domain;
 
     /* Assign a buffer manager. */
-    if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER |
-                PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_CUSTOM))
+    if (use_reusable_pool)
         provider = ws->cman;
     else
         provider = ws->kman;
index 8e4693be92abc54ff2f04d13035b0d5f8c33050f..b7eac3cfc1bb29609345df29baaa65cb2d12eaf4 100644 (file)
@@ -142,14 +142,14 @@ struct radeon_winsys {
      * \param ws        The winsys this function is called from.
      * \param size      The size to allocate.
      * \param alignment An alignment of the buffer in memory.
-     * \param bind      A bitmask of the PIPE_BIND_* flags.
+     * \param use_reusable_pool Whether the cache buffer manager should be used.
      * \param domain    A bitmask of the RADEON_DOMAIN_* flags.
      * \return          The created buffer object.
      */
     struct pb_buffer *(*buffer_create)(struct radeon_winsys *ws,
                                        unsigned size,
                                        unsigned alignment,
-                                       unsigned bind,
+                                       boolean use_reusable_pool,
                                        enum radeon_bo_domain domain);
 
     struct radeon_winsys_cs_handle *(*buffer_get_cs_handle)(