dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] drm/arm/malidp: remove set but not used variable 'afbc_superblock_size'
@ 2018-10-05 11:03 YueHaibing
  2018-10-05 12:38 ` Liviu Dudau
  2018-10-05 12:38 ` [PATCH] drm: malidp: Add the size of the superblocks when calculating total size for AFBC buffers Liviu Dudau
  0 siblings, 2 replies; 4+ messages in thread
From: YueHaibing @ 2018-10-05 11:03 UTC (permalink / raw)
  To: Liviu Dudau, Brian Starkey, Mali DP Maintainers, David Airlie
  Cc: YueHaibing, dri-devel, linux-kernel, kernel-janitors

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/arm/malidp_drv.c: In function 'malidp_verify_afbc_framebuffer_size':
drivers/gpu/drm/arm/malidp_drv.c:318:6: warning:
 variable 'afbc_superblock_size' set but not used [-Wunused-but-set-variable]
  u32 afbc_superblock_size = 0, afbc_superblock_height = 0;

It never used since be introduced in
commit 3dae1c0919d8 ("drm/arm/malidp: Implemented the size validation for AFBC framebuffers")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/gpu/drm/arm/malidp_drv.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 9021485..1b0ede6 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -315,7 +315,7 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
 	int n_superblocks = 0;
 	const struct drm_format_info *info;
 	struct drm_gem_object *objs = NULL;
-	u32 afbc_superblock_size = 0, afbc_superblock_height = 0;
+	u32 afbc_superblock_height = 0;
 	u32 afbc_superblock_width = 0, afbc_size = 0;
 
 	switch (mode_cmd->modifier[0] & AFBC_FORMAT_MOD_BLOCK_SIZE_MASK) {
@@ -333,9 +333,6 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
 	n_superblocks = (mode_cmd->width / afbc_superblock_width) *
 		(mode_cmd->height / afbc_superblock_height);
 
-	afbc_superblock_size = info->cpp[0] * afbc_superblock_width *
-		afbc_superblock_height;
-
 	afbc_size = ALIGN(n_superblocks * AFBC_HEADER_SIZE, 128);
 
 	if (mode_cmd->width * info->cpp[0] != mode_cmd->pitches[0]) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] drm/arm/malidp: remove set but not used variable 'afbc_superblock_size'
  2018-10-05 11:03 [PATCH -next] drm/arm/malidp: remove set but not used variable 'afbc_superblock_size' YueHaibing
@ 2018-10-05 12:38 ` Liviu Dudau
  2018-10-05 12:38 ` [PATCH] drm: malidp: Add the size of the superblocks when calculating total size for AFBC buffers Liviu Dudau
  1 sibling, 0 replies; 4+ messages in thread
From: Liviu Dudau @ 2018-10-05 12:38 UTC (permalink / raw)
  To: YueHaibing
  Cc: David Airlie, kernel-janitors, linux-kernel, dri-devel,
	Mali DP Maintainers

On Fri, Oct 05, 2018 at 11:03:13AM +0000, YueHaibing wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/gpu/drm/arm/malidp_drv.c: In function 'malidp_verify_afbc_framebuffer_size':
> drivers/gpu/drm/arm/malidp_drv.c:318:6: warning:
>  variable 'afbc_superblock_size' set but not used [-Wunused-but-set-variable]
>   u32 afbc_superblock_size = 0, afbc_superblock_height = 0;
> 
> It never used since be introduced in
> commit 3dae1c0919d8 ("drm/arm/malidp: Implemented the size validation for AFBC framebuffers")
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/gpu/drm/arm/malidp_drv.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 9021485..1b0ede6 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -315,7 +315,7 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
>  	int n_superblocks = 0;
>  	const struct drm_format_info *info;
>  	struct drm_gem_object *objs = NULL;
> -	u32 afbc_superblock_size = 0, afbc_superblock_height = 0;
> +	u32 afbc_superblock_height = 0;
>  	u32 afbc_superblock_width = 0, afbc_size = 0;
>  
>  	switch (mode_cmd->modifier[0] & AFBC_FORMAT_MOD_BLOCK_SIZE_MASK) {
> @@ -333,9 +333,6 @@ static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
>  	n_superblocks = (mode_cmd->width / afbc_superblock_width) *
>  		(mode_cmd->height / afbc_superblock_height);
>  
> -	afbc_superblock_size = info->cpp[0] * afbc_superblock_width *
> -		afbc_superblock_height;
> -

Ah, that doesn't look right, it seems some code was dropped out of the
upstream patch. I will send a fix for it now.

Best regards,
Liviu

>  	afbc_size = ALIGN(n_superblocks * AFBC_HEADER_SIZE, 128);
>  
>  	if (mode_cmd->width * info->cpp[0] != mode_cmd->pitches[0]) {
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] drm: malidp: Add the size of the superblocks when calculating total size for AFBC buffers
  2018-10-05 11:03 [PATCH -next] drm/arm/malidp: remove set but not used variable 'afbc_superblock_size' YueHaibing
  2018-10-05 12:38 ` Liviu Dudau
@ 2018-10-05 12:38 ` Liviu Dudau
  2018-10-05 14:19   ` Ayan Halder
  1 sibling, 1 reply; 4+ messages in thread
From: Liviu Dudau @ 2018-10-05 12:38 UTC (permalink / raw)
  To: Ayan Kumar Halder; +Cc: Mali DP Maintainers, Liviu Dudau, YueHaibing, dri-devel

The size of the superblocks being added to the total AFBC buffer size
got lost in the upstreaming process. Add it back.

Cc: Ayan Kumar Halder <ayan.halder@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
---
 drivers/gpu/drm/arm/malidp_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 90214851637f4..505f316a192ec 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -38,6 +38,7 @@
 
 #define MALIDP_CONF_VALID_TIMEOUT	250
 #define AFBC_HEADER_SIZE		16
+#define AFBC_SUPERBLK_ALIGNMENT		128
 
 static void malidp_write_gamma_table(struct malidp_hw_device *hwdev,
 				     u32 data[MALIDP_COEFFTAB_NUM_COEFFS])
@@ -336,7 +337,8 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
 	afbc_superblock_size = info->cpp[0] * afbc_superblock_width *
 		afbc_superblock_height;
 
-	afbc_size = ALIGN(n_superblocks * AFBC_HEADER_SIZE, 128);
+	afbc_size = ALIGN(n_superblocks * AFBC_HEADER_SIZE, AFBC_SUPERBLK_ALIGNMENT);
+	afbc_size += n_superblocks * ALIGN(afbc_superblock_size, AFBC_SUPERBLK_ALIGNMENT);
 
 	if (mode_cmd->width * info->cpp[0] != mode_cmd->pitches[0]) {
 		DRM_DEBUG_KMS("Invalid value of pitch (=%u) should be same as width (=%u) * cpp (=%u)\n",
-- 
2.18.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm: malidp: Add the size of the superblocks when calculating total size for AFBC buffers
  2018-10-05 12:38 ` [PATCH] drm: malidp: Add the size of the superblocks when calculating total size for AFBC buffers Liviu Dudau
@ 2018-10-05 14:19   ` Ayan Halder
  0 siblings, 0 replies; 4+ messages in thread
From: Ayan Halder @ 2018-10-05 14:19 UTC (permalink / raw)
  To: Liviu Dudau; +Cc: Mali DP Maintainers, nd, YueHaibing, dri-devel

Hi Liviu,

On Fri, Oct 05, 2018 at 01:38:19PM +0100, Liviu Dudau wrote:
> The size of the superblocks being added to the total AFBC buffer size
> got lost in the upstreaming process. Add it back.
> 
> Cc: Ayan Kumar Halder <ayan.halder@arm.com>
> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
> ---
>  drivers/gpu/drm/arm/malidp_drv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 90214851637f4..505f316a192ec 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -38,6 +38,7 @@
>  
>  #define MALIDP_CONF_VALID_TIMEOUT	250
>  #define AFBC_HEADER_SIZE		16
> +#define AFBC_SUPERBLK_ALIGNMENT		128
>  
>  static void malidp_write_gamma_table(struct malidp_hw_device *hwdev,
>  				     u32 data[MALIDP_COEFFTAB_NUM_COEFFS])
> @@ -336,7 +337,8 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
>  	afbc_superblock_size = info->cpp[0] * afbc_superblock_width *
>  		afbc_superblock_height;
>  
> -	afbc_size = ALIGN(n_superblocks * AFBC_HEADER_SIZE, 128);
> +	afbc_size = ALIGN(n_superblocks * AFBC_HEADER_SIZE, AFBC_SUPERBLK_ALIGNMENT);
> +	afbc_size += n_superblocks * ALIGN(afbc_superblock_size, AFBC_SUPERBLK_ALIGNMENT);
>  
>  	if (mode_cmd->width * info->cpp[0] != mode_cmd->pitches[0]) {
>  		DRM_DEBUG_KMS("Invalid value of pitch (=%u) should be same as width (=%u) * cpp (=%u)\n",
> --
 
Looks correct to me.
Reviewed-by: Ayan Kumar Halder <ayan.halder@arm.com>
> 2.18.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-05 14:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-05 11:03 [PATCH -next] drm/arm/malidp: remove set but not used variable 'afbc_superblock_size' YueHaibing
2018-10-05 12:38 ` Liviu Dudau
2018-10-05 12:38 ` [PATCH] drm: malidp: Add the size of the superblocks when calculating total size for AFBC buffers Liviu Dudau
2018-10-05 14:19   ` Ayan Halder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox