diff options
author | Chia-I Wu <[email protected]> | 2014-07-28 23:52:54 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-07-28 23:55:55 +0800 |
commit | fb1820355b0178f04622201688449cf2154feb42 (patch) | |
tree | 591958ad2ff9ff8714f6db30e1d20db3f13e127a /src/gallium | |
parent | 6f0c1f2b5f8f1895878fcbf0b8d1b1ebcb719d70 (diff) |
ilo: add ilo_resource_get_bo() helper
We will need it in the following commit.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_resource.h | 10 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_transfer.c | 25 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h index 5af9cc1b440..b0eab5b9c0e 100644 --- a/src/gallium/drivers/ilo/ilo_resource.h +++ b/src/gallium/drivers/ilo/ilo_resource.h @@ -160,6 +160,16 @@ ilo_buffer_rename_bo(struct ilo_buffer *buf); bool ilo_texture_rename_bo(struct ilo_texture *tex); +/** + * Return the bo of the resource. + */ +static inline struct intel_bo * +ilo_resource_get_bo(struct pipe_resource *res) +{ + return (res->target == PIPE_BUFFER) ? + ilo_buffer(res)->bo : ilo_texture(res)->bo; +} + static inline struct ilo_texture_slice * ilo_texture_get_slice(const struct ilo_texture *tex, unsigned level, unsigned slice) diff --git a/src/gallium/drivers/ilo/ilo_transfer.c b/src/gallium/drivers/ilo/ilo_transfer.c index 0170bb1ff91..59e06b21a53 100644 --- a/src/gallium/drivers/ilo/ilo_transfer.c +++ b/src/gallium/drivers/ilo/ilo_transfer.c @@ -127,16 +127,6 @@ resource_get_transfer_method(struct pipe_resource *res, unsigned usage, } /** - * Return the bo of the resource. - */ -static struct intel_bo * -resource_get_bo(struct pipe_resource *res) -{ - return (res->target == PIPE_BUFFER) ? - ilo_buffer(res)->bo : ilo_texture(res)->bo; -} - -/** * Rename the bo of the resource. */ static bool @@ -285,19 +275,20 @@ xfer_map(struct ilo_transfer *xfer) switch (xfer->method) { case ILO_TRANSFER_MAP_CPU: - ptr = intel_bo_map(resource_get_bo(xfer->base.resource), + ptr = intel_bo_map(ilo_resource_get_bo(xfer->base.resource), xfer->base.usage & PIPE_TRANSFER_WRITE); break; case ILO_TRANSFER_MAP_GTT: - ptr = intel_bo_map_gtt(resource_get_bo(xfer->base.resource)); + ptr = intel_bo_map_gtt(ilo_resource_get_bo(xfer->base.resource)); break; case ILO_TRANSFER_MAP_GTT_UNSYNC: - ptr = intel_bo_map_unsynchronized(resource_get_bo(xfer->base.resource)); + ptr = intel_bo_map_unsynchronized( + ilo_resource_get_bo(xfer->base.resource)); break; case ILO_TRANSFER_MAP_STAGING: { const struct ilo_screen *is = ilo_screen(xfer->staging.res->screen); - struct intel_bo *bo = resource_get_bo(xfer->staging.res); + struct intel_bo *bo = ilo_resource_get_bo(xfer->staging.res); /* * We want a writable, optionally persistent and coherent, mapping @@ -337,10 +328,10 @@ xfer_unmap(struct ilo_transfer *xfer) case ILO_TRANSFER_MAP_CPU: case ILO_TRANSFER_MAP_GTT: case ILO_TRANSFER_MAP_GTT_UNSYNC: - intel_bo_unmap(resource_get_bo(xfer->base.resource)); + intel_bo_unmap(ilo_resource_get_bo(xfer->base.resource)); break; case ILO_TRANSFER_MAP_STAGING: - intel_bo_unmap(resource_get_bo(xfer->staging.res)); + intel_bo_unmap(ilo_resource_get_bo(xfer->staging.res)); break; default: break; @@ -1096,7 +1087,7 @@ choose_transfer_method(struct ilo_context *ilo, struct ilo_transfer *xfer) return false; /* see if we can avoid blocking */ - if (is_bo_busy(ilo, resource_get_bo(res), &need_flush)) { + if (is_bo_busy(ilo, ilo_resource_get_bo(res), &need_flush)) { bool resource_renamed; if (!xfer_unblock(xfer, &resource_renamed)) { |