Re: [Mesa-dev] [PATCH 07/10] radv/image: don't rescale width/height if the format isn't changing

2017-08-21 Thread Dave Airlie
On 21 August 2017 at 17:44, Bas Nieuwenhuizen  wrote:
> The old code would just do a * blocksize / blocksize , which is the
> identity (as long as we don't overflow).  Did this cause any issues?

Nope, just seemed like unnecessary cpu usage.

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/10] radv/image: don't rescale width/height if the format isn't changing

2017-08-21 Thread Bas Nieuwenhuizen
The old code would just do a * blocksize / blocksize , which is the
identity (as long as we don't overflow).  Did this cause any issues?

On Mon, Aug 21, 2017, at 09:34, Dave Airlie wrote:
> From: Dave Airlie 
> 
> If the image view has the same format, we don't need to rescale
> the w/h.
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/amd/vulkan/radv_image.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
> index 5e38041..ddf15bc 100644
> --- a/src/amd/vulkan/radv_image.c
> +++ b/src/amd/vulkan/radv_image.c
> @@ -947,10 +947,12 @@ radv_image_view_init(struct radv_image_view *iview,
>   .depth  = radv_minify(image->info.depth , range->baseMipLevel),
>   };
>  
> -   iview->extent.width = round_up_u32(iview->extent.width *
> vk_format_get_blockwidth(iview->vk_format),
> - 
> vk_format_get_blockwidth(image->vk_format));
> -   iview->extent.height = round_up_u32(iview->extent.height *
> vk_format_get_blockheight(iview->vk_format),
> -  
> vk_format_get_blockheight(image->vk_format));
> +   if (iview->vk_format != image->vk_format) {
> +   iview->extent.width = round_up_u32(iview->extent.width *
> vk_format_get_blockwidth(iview->vk_format),
> + 
> vk_format_get_blockwidth(image->vk_format));
> +   iview->extent.height = round_up_u32(iview->extent.height
> * vk_format_get_blockheight(iview->vk_format),
> +  
> vk_format_get_blockheight(image->vk_format));
> +   }
>  
>   iview->base_layer = range->baseArrayLayer;
>   iview->layer_count = radv_get_layerCount(image, range);
> -- 
> 2.9.4
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 07/10] radv/image: don't rescale width/height if the format isn't changing

2017-08-21 Thread Dave Airlie
From: Dave Airlie 

If the image view has the same format, we don't need to rescale
the w/h.

Signed-off-by: Dave Airlie 
---
 src/amd/vulkan/radv_image.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 5e38041..ddf15bc 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -947,10 +947,12 @@ radv_image_view_init(struct radv_image_view *iview,
.depth  = radv_minify(image->info.depth , range->baseMipLevel),
};
 
-   iview->extent.width = round_up_u32(iview->extent.width * 
vk_format_get_blockwidth(iview->vk_format),
-  
vk_format_get_blockwidth(image->vk_format));
-   iview->extent.height = round_up_u32(iview->extent.height * 
vk_format_get_blockheight(iview->vk_format),
-   
vk_format_get_blockheight(image->vk_format));
+   if (iview->vk_format != image->vk_format) {
+   iview->extent.width = round_up_u32(iview->extent.width * 
vk_format_get_blockwidth(iview->vk_format),
+  
vk_format_get_blockwidth(image->vk_format));
+   iview->extent.height = round_up_u32(iview->extent.height * 
vk_format_get_blockheight(iview->vk_format),
+   
vk_format_get_blockheight(image->vk_format));
+   }
 
iview->base_layer = range->baseArrayLayer;
iview->layer_count = radv_get_layerCount(image, range);
-- 
2.9.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev