r600g: optimize r600_resource_va
authorMarek Olšák <maraeo@gmail.com>
Fri, 30 Mar 2012 23:31:47 +0000 (01:31 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sun, 1 Apr 2012 21:57:50 +0000 (23:57 +0200)
Avoid calling get_radeon_bo and inline it.

src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_resource.c
src/gallium/drivers/r600/r600_resource.h
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index c5ea55eba32d253d4875d2fceb577f31643ac95d..9139b61ed69333b8885e8cd400a389b2e790a47c 100644 (file)
@@ -696,4 +696,12 @@ static INLINE unsigned r600_pack_float_12p4(float x)
               x >= 4096 ? 0xffff : x * 16;
 }
 
+static INLINE uint64_t r600_resource_va(struct pipe_screen *screen, struct pipe_resource *resource)
+{
+       struct r600_screen *rscreen = (struct r600_screen*)screen;
+       struct r600_resource *rresource = (struct r600_resource*)resource;
+
+       return rscreen->ws->buffer_get_virtual_address(rresource->cs_buf);
+}
+
 #endif
index 0689d91a2995abaff1f1ac2883b59cba98791251..de339e035123ba7cfbbb10413c0e36351ccec6ce 100644 (file)
@@ -62,14 +62,3 @@ void r600_init_context_resource_functions(struct r600_context *r600)
        r600->context.transfer_destroy = u_transfer_destroy_vtbl;
        r600->context.transfer_inline_write = u_default_transfer_inline_write;
 }
-
-uint64_t r600_resource_va(struct pipe_screen *screen, struct pipe_resource *resource)
-{
-       struct r600_screen *rscreen = (struct r600_screen*)screen;
-       struct r600_resource *rresource = (struct r600_resource*)resource;
-
-       if (rresource->buf) {
-               return rscreen->ws->buffer_get_virtual_address(rresource->buf);
-       }
-       return 0;
-}
index 15b706dc3b8a5f6303bfe3515e804f0fc5dde395..5bb5e577ee649339ed8c8b8d2cc972551e5edc3f 100644 (file)
@@ -98,6 +98,4 @@ struct r600_context;
 
 void r600_upload_const_buffer(struct r600_context *rctx, struct r600_resource **rbuffer, uint32_t *offset);
 
-uint64_t r600_resource_va(struct pipe_screen *screen, struct pipe_resource *resource);
-
 #endif
index 31a47c6f14c5c1a2b871a82ed1ffb748243a7059..47bbcb87513f8cfd60e724740ee636f34296bced 100644 (file)
@@ -898,11 +898,9 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
     return TRUE;
 }
 
-static uint64_t radeon_winsys_bo_va(struct pb_buffer *buffer)
+static uint64_t radeon_winsys_bo_va(struct radeon_winsys_cs_handle *buf)
 {
-    struct radeon_bo *bo = get_radeon_bo(buffer);
-
-    return bo->va;
+    return ((struct radeon_bo*)buf)->va;
 }
 
 void radeon_bomgr_init_functions(struct radeon_drm_winsys *ws)
index 7d5259ad11fc910502ad144fe26b1e478e5ec5b6..6eef6b16200f96980218f631f9efdff136153331 100644 (file)
@@ -255,7 +255,7 @@ struct radeon_winsys {
      * \param buf       A winsys buffer object
      * \return          virtual address
      */
-    uint64_t (*buffer_get_virtual_address)(struct pb_buffer *buf);
+    uint64_t (*buffer_get_virtual_address)(struct radeon_winsys_cs_handle *buf);
 
     /**************************************************************************
      * Command submission.