[Mesa-dev] [PATCH] gallium/pipebuffer: change pb_cache_manager_create() size_factor to float

Brian Paul brianp at vmware.com
Fri Feb 14 06:47:24 PST 2014


Requested by Marek.

Cc: "10.1" <mesa-stable at lists.freedesktop.org>
---
 src/gallium/auxiliary/pipebuffer/pb_bufmgr.h       |    4 ++--
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |    8 ++++----
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c  |    2 +-
 src/gallium/winsys/svga/drm/vmw_screen_pools.c     |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
index 3044ec8..d5b0ee2 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
@@ -161,8 +161,8 @@ pb_slab_range_manager_create(struct pb_manager *provider,
  */
 struct pb_manager *
 pb_cache_manager_create(struct pb_manager *provider, 
-                     	unsigned usecs,
-			unsigned size_factor,
+                        unsigned usecs,
+                        float size_factor,
                         unsigned bypass_usage);
 
 
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 0469146..32a8875 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -82,7 +82,7 @@ struct pb_cache_manager
    
    struct list_head delayed;
    pb_size numDelayed;
-   unsigned size_factor;
+   float size_factor;
    unsigned bypass_usage;
 };
 
@@ -236,7 +236,7 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
       return 0;
 
    /* be lenient with size */
-   if(buf->base.size > buf->mgr->size_factor*size)
+   if(buf->base.size > (unsigned) (buf->mgr->size_factor * size))
       return 0;
    
    if(!pb_check_alignment(desc->alignment, buf->base.alignment))
@@ -403,8 +403,8 @@ pb_cache_manager_destroy(struct pb_manager *mgr)
  */
 struct pb_manager *
 pb_cache_manager_create(struct pb_manager *provider, 
-                     	unsigned usecs,
-			unsigned size_factor,
+                        unsigned usecs,
+                        float size_factor,
                         unsigned bypass_usage)
 {
    struct pb_cache_manager *mgr;
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 6f0e2a5..44cd0d1 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -645,7 +645,7 @@ PUBLIC struct radeon_winsys *radeon_drm_winsys_create(int fd)
     ws->kman = radeon_bomgr_create(ws);
     if (!ws->kman)
         goto fail;
-    ws->cman = pb_cache_manager_create(ws->kman, 1000000, 2, 0);
+    ws->cman = pb_cache_manager_create(ws->kman, 1000000, 2.0f, 0);
     if (!ws->cman)
         goto fail;
 
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_pools.c b/src/gallium/winsys/svga/drm/vmw_screen_pools.c
index 7f7b779..c97b71f 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_pools.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_pools.c
@@ -115,7 +115,7 @@ vmw_mob_pools_init(struct vmw_winsys_screen *vws)
    struct pb_desc desc;
 
    vws->pools.mob_cache = 
-      pb_cache_manager_create(vws->pools.gmr, 100000, 2,
+      pb_cache_manager_create(vws->pools.gmr, 100000, 2.0f,
                               VMW_BUFFER_USAGE_SHARED);
    if (!vws->pools.mob_cache)
       return FALSE;
-- 
1.7.10.4



More information about the mesa-dev mailing list