anv/android: Set the BO flags in bo_cache_import (v2)

Submitted by Mauro Rossi on June 4, 2018, 12:48 a.m.

Details

Message ID 20180604004809.27713-1-issor.oruam@gmail.com
State New
Headers show
Series "anv/android: Set the BO flags in bo_cache_import (v2)" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Mauro Rossi June 4, 2018, 12:48 a.m.
Changes to avoid building error:

external/mesa/src/intel/vulkan/anv_android.c:131:72:
error: too few arguments to function call, expected 5, have 4
   result = anv_bo_cache_import(device, &device->bo_cache, dma_buf, &bo);
            ~~~~~~~~~~~~~~~~~~~                                        ^
1 error generated.

(v2) Set the correct bo_flags based on support of 48bit addresses and soft-pin

Fixes: b0d50247a7 ("anv/allocator: Set the BO flags in bo_cache_alloc/import")
Fixes: e7d0378bd9 ("anv: Soft-pin client-allocated memory")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
---
 src/intel/vulkan/anv_android.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c
index 7e07dbaaa4..6e4d5a6d27 100644
--- a/src/intel/vulkan/anv_android.c
+++ b/src/intel/vulkan/anv_android.c
@@ -128,7 +128,13 @@  anv_image_from_gralloc(VkDevice device_h,
     */
    int dma_buf = gralloc_info->handle->data[0];
 
-   result = anv_bo_cache_import(device, &device->bo_cache, dma_buf, &bo);
+   uint64_t bo_flags = 0;
+   if (device->instance->physicalDevice.supports_48bit_addresses)
+      bo_flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+   if (device->instance->physicalDevice.use_softpin)
+      bo_flags |= EXEC_OBJECT_PINNED;
+
+   result = anv_bo_cache_import(device, &device->bo_cache, dma_buf, bo_flags, &bo);
    if (result != VK_SUCCESS) {
       return vk_errorf(device->instance, device, result,
                        "failed to import dma-buf from VkNativeBufferANDROID");

Comments

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

On 04/06/18 01:48, Mauro Rossi wrote:
> Changes to avoid building error:
>
> external/mesa/src/intel/vulkan/anv_android.c:131:72:
> error: too few arguments to function call, expected 5, have 4
>     result = anv_bo_cache_import(device, &device->bo_cache, dma_buf, &bo);
>              ~~~~~~~~~~~~~~~~~~~                                        ^
> 1 error generated.
>
> (v2) Set the correct bo_flags based on support of 48bit addresses and soft-pin
>
> Fixes: b0d50247a7 ("anv/allocator: Set the BO flags in bo_cache_alloc/import")
> Fixes: e7d0378bd9 ("anv: Soft-pin client-allocated memory")
> Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
> ---
>   src/intel/vulkan/anv_android.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c
> index 7e07dbaaa4..6e4d5a6d27 100644
> --- a/src/intel/vulkan/anv_android.c
> +++ b/src/intel/vulkan/anv_android.c
> @@ -128,7 +128,13 @@ anv_image_from_gralloc(VkDevice device_h,
>       */
>      int dma_buf = gralloc_info->handle->data[0];
>   
> -   result = anv_bo_cache_import(device, &device->bo_cache, dma_buf, &bo);
> +   uint64_t bo_flags = 0;
> +   if (device->instance->physicalDevice.supports_48bit_addresses)
> +      bo_flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
> +   if (device->instance->physicalDevice.use_softpin)
> +      bo_flags |= EXEC_OBJECT_PINNED;
> +
> +   result = anv_bo_cache_import(device, &device->bo_cache, dma_buf, bo_flags, &bo);
>      if (result != VK_SUCCESS) {
>         return vk_errorf(device->instance, device, result,
>                          "failed to import dma-buf from VkNativeBufferANDROID");