lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190726130822.GO15612@e110455-lin.cambridge.arm.com>
Date:   Fri, 26 Jul 2019 14:08:22 +0100
From:   Liviu Dudau <Liviu.Dudau@....com>
To:     "Lowry Li (Arm Technology China)" <Lowry.Li@....com>
Cc:     "james qian wang (Arm Technology China)" <james.qian.wang@....com>,
        "maarten.lankhorst@...ux.intel.com" 
        <maarten.lankhorst@...ux.intel.com>,
        "seanpaul@...omium.org" <seanpaul@...omium.org>,
        "airlied@...ux.ie" <airlied@...ux.ie>,
        Brian Starkey <Brian.Starkey@....com>,
        "Julien Yin (Arm Technology China)" <Julien.Yin@....com>,
        "Jonathan Chai (Arm Technology China)" <Jonathan.Chai@....com>,
        Ayan Halder <Ayan.Halder@....com>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        nd <nd@....com>
Subject: Re: [PATCH] drm/komeda: Adds internal bpp computing for arm afbc
 only format YU08 YU10

Hi Lowry,

On Fri, Jul 26, 2019 at 07:51:02AM +0000, Lowry Li (Arm Technology China) wrote:
> The drm_format_info doesn't have any cpp or block_size (both are zero)
> information for arm only afbc format YU08/YU10. we need to compute it
> by ourselves.
> 
> Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@....com>
> ---
>  .../drm/arm/display/komeda/komeda_format_caps.c    | 23 ++++++++++++++++++++++
>  .../drm/arm/display/komeda/komeda_format_caps.h    |  3 +++
>  .../drm/arm/display/komeda/komeda_framebuffer.c    |  6 ++++--
>  3 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c
> index cd4d9f5..3c9e060 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c
> @@ -35,6 +35,29 @@
>  	return NULL;
>  }
>  
> +u32 komeda_get_afbc_format_bpp(const struct drm_format_info *info, u64 modifier)
> +{
> +	u32 bpp;
> +
> +	WARN_ON(modifier == DRM_FORMAT_MOD_LINEAR);

Is it not better to return the value from info->char_per_block if modifier is
DRM_FORMAT_MOD_LINEAR? Or return 0?

> +
> +	switch (info->format) {
> +	case DRM_FORMAT_YUV420_8BIT:
> +		bpp = 12;
> +		break;
> +	case DRM_FORMAT_YUV420_10BIT:
> +		bpp = 15;
> +		break;
> +	default:
> +		bpp = info->cpp[0] * 8;
> +		break;
> +	}
> +
> +	WARN_ON(bpp == 0);
> +
> +	return bpp;
> +}
> +
>  /* Two assumptions
>   * 1. RGB always has YTR
>   * 2. Tiled RGB always has SC
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h
> index 3631910..32273cf 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h
> @@ -97,6 +97,9 @@ static inline const char *komeda_get_format_name(u32 fourcc, u64 modifier)
>  komeda_get_format_caps(struct komeda_format_caps_table *table,
>  		       u32 fourcc, u64 modifier);
>  
> +u32 komeda_get_afbc_format_bpp(const struct drm_format_info *info,
> +			       u64 modifier);
> +
>  u32 *komeda_get_layer_fourcc_list(struct komeda_format_caps_table *table,
>  				  u32 layer_type, u32 *n_fmts);
>  
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> index 10bf63e..966d0c7 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c
> @@ -44,7 +44,7 @@ static int komeda_fb_create_handle(struct drm_framebuffer *fb,
>  	const struct drm_format_info *info = fb->format;
>  	struct drm_gem_object *obj;
>  	u32 alignment_w = 0, alignment_h = 0, alignment_header;
> -	u32 n_blocks = 0, min_size = 0;
> +	u32 n_blocks = 0, min_size = 0, bpp;
>  
>  	obj = drm_gem_object_lookup(file, mode_cmd->handles[0]);
>  	if (!obj) {
> @@ -86,10 +86,12 @@ static int komeda_fb_create_handle(struct drm_framebuffer *fb,
>  	kfb->offset_payload = ALIGN(n_blocks * AFBC_HEADER_SIZE,
>  				    alignment_header);
>  
> +	bpp = komeda_get_afbc_format_bpp(info, fb->modifier);
>  	kfb->afbc_size = kfb->offset_payload + n_blocks *
> -			 ALIGN(info->cpp[0] * AFBC_SUPERBLK_PIXELS,
> +			 ALIGN(bpp * AFBC_SUPERBLK_PIXELS / 8,
>  			       AFBC_SUPERBLK_ALIGNMENT);
>  	min_size = kfb->afbc_size + fb->offsets[0];
> +
>  	if (min_size > obj->size) {
>  		DRM_DEBUG_KMS("afbc size check failed, obj_size: 0x%lx. min_size 0x%x.\n",
>  			      obj->size, min_size);

Patch doesn't apply to tip of drm-misc-next. What is this patch depending on?

Best regards,
Liviu

> -- 
> 1.9.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ