All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ayan Halder <ayan.halder@arm.com>
To: Liviu Dudau <Liviu.Dudau@foss.arm.com>
Cc: airlied@linux.ie, liviu.dudau@arm.com,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	malidp@foss.arm.com, nd@arm.com
Subject: Re: [RFC PATCH 4/4] drm/arm/malidp: Added support for AFBC modifiers for all layers except DE_SMART
Date: Thu, 5 Jul 2018 14:45:12 +0100	[thread overview]
Message-ID: <20180705134512.GB31243@arm.com> (raw)
In-Reply-To: <20180626132158.GB14974@e110455-lin.cambridge.arm.com>

On Tue, Jun 26, 2018 at 02:21:58PM +0100, Liviu Dudau wrote:
> On Fri, Jun 15, 2018 at 02:51:34PM +0100, Ayan Kumar Halder wrote:
> > On planes which support AFBC, expose an AFBC modifier for use with BGR888.
> > 
> > Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
> > Reviewed-by: Brian Starkey <brian.starkey@arm.com>
> > 
> > Change-Id: I4739ff55c0f6d5715b268cb3947ed133a9ee7c2e
> 
> Please remove the Change-Id
> 
> > ---
> >  drivers/gpu/drm/arm/malidp_drv.c    |  1 +
> >  drivers/gpu/drm/arm/malidp_planes.c | 46 +++++++++++++++++++++++++++++++++++--
> >  2 files changed, 45 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> > index 7b6a848..7bcd679 100644
> > --- a/drivers/gpu/drm/arm/malidp_drv.c
> > +++ b/drivers/gpu/drm/arm/malidp_drv.c
> > @@ -392,6 +392,7 @@ static int malidp_init(struct drm_device *drm)
> >  	drm->mode_config.max_height = hwdev->max_line_size;
> >  	drm->mode_config.funcs = &malidp_mode_config_funcs;
> >  	drm->mode_config.helper_private = &malidp_mode_config_helpers;
> > +	drm->mode_config.allow_fb_modifiers = true;
> >  
> >  	ret = malidp_crtc_init(drm);
> >  	if (ret) {
> > diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> > index 3950504..55c9a1f6 100644
> > --- a/drivers/gpu/drm/arm/malidp_planes.c
> > +++ b/drivers/gpu/drm/arm/malidp_planes.c
> > @@ -124,6 +124,35 @@ static void malidp_plane_atomic_print_state(struct drm_printer *p,
> >  	drm_printf(p, "\tn_planes=%u\n", ms->n_planes);
> >  }
> >  
> > +static bool malidp_format_mod_supported(struct drm_plane *plane,
> > +					u32 format, u64 modifier)
> > +{
> > +	if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID))
> > +		return false;
> > +
> > +	/* All the pixel formats are supported without any modifier */
> > +	if (modifier == DRM_FORMAT_MOD_LINEAR)
> > +		return true;
> > +
> > +	if ((modifier >> 56) != DRM_FORMAT_MOD_VENDOR_ARM)
> > +		return false;
> > +
> > +	if (modifier &
> > +	    ~DRM_FORMAT_MOD_ARM_AFBC(AFBC_MOD_VALID_BITS)) {
> > +		DRM_ERROR("Unsupported modifiers\n");
> 
> I don't think we should polute the kernel log buffers with this. Maybe a
> DRM_DEBUG() if you really want to get some notification?

I agree with you completely. I think we should use DRM_DEBUG_KMS()
like intel_framebuffer_init() uses to log unsupported formats and
modifiers.
I will send a v2 patch for this.
> 
> With those changes added:
> 
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> 
> Best regards,
> Liviu
> 
> > +		return false;
> > +	}
> > +
> > +	switch (modifier) {
> > +	case DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
> > +				AFBC_FORMAT_MOD_YTR |
> > +				AFBC_FORMAT_MOD_SPARSE):
> > +		if (format == DRM_FORMAT_BGR888)
> > +			return true;
> > +	}
> > +	return false;
> > +}
> > +
> >  static const struct drm_plane_funcs malidp_de_plane_funcs = {
> >  	.update_plane = drm_atomic_helper_update_plane,
> >  	.disable_plane = drm_atomic_helper_disable_plane,
> > @@ -132,6 +161,7 @@ static const struct drm_plane_funcs malidp_de_plane_funcs = {
> >  	.atomic_duplicate_state = malidp_duplicate_plane_state,
> >  	.atomic_destroy_state = malidp_destroy_plane_state,
> >  	.atomic_print_state = malidp_plane_atomic_print_state,
> > +	.format_mod_supported = malidp_format_mod_supported,
> >  };
> >  
> >  static int malidp_se_check_scaling(struct malidp_plane *mp,
> > @@ -524,6 +554,13 @@ int malidp_de_planes_init(struct drm_device *drm)
> >  	u32 *formats;
> >  	int ret, i, j, n;
> >  
> > +	static const u64 modifiers[] = {
> > +		DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
> > +			AFBC_FORMAT_MOD_YTR | AFBC_FORMAT_MOD_SPARSE),
> > +		DRM_FORMAT_MOD_LINEAR,
> > +		DRM_FORMAT_MOD_INVALID
> > +	};
> > +
> >  	formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL);
> >  	if (!formats) {
> >  		ret = -ENOMEM;
> > @@ -547,9 +584,14 @@ int malidp_de_planes_init(struct drm_device *drm)
> >  
> >  		plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY :
> >  					DRM_PLANE_TYPE_OVERLAY;
> > +
> > +		/*
> > +		 * All the layers except smart layer supports AFBC modifiers.
> > +		 */
> >  		ret = drm_universal_plane_init(drm, &plane->base, crtcs,
> > -					       &malidp_de_plane_funcs, formats,
> > -					       n, NULL, plane_type, NULL);
> > +				&malidp_de_plane_funcs, formats, n,
> > +				(id == DE_SMART) ? NULL : modifiers, plane_type, NULL);
> > +
> >  		if (ret < 0)
> >  			goto cleanup;
> >  
> > -- 
> > 2.7.4
> > 
> 
> -- 
> ====================
> | 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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Ayan Halder <ayan.halder@arm.com>
To: Liviu Dudau <Liviu.Dudau@foss.arm.com>
Cc: airlied@linux.ie, liviu.dudau@arm.com,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	malidp@foss.arm.com, nd@arm.com
Subject: Re: [RFC PATCH 4/4] drm/arm/malidp: Added support for AFBC modifiers for all layers except DE_SMART
Date: Thu, 5 Jul 2018 14:45:12 +0100	[thread overview]
Message-ID: <20180705134512.GB31243@arm.com> (raw)
In-Reply-To: <20180626132158.GB14974@e110455-lin.cambridge.arm.com>

On Tue, Jun 26, 2018 at 02:21:58PM +0100, Liviu Dudau wrote:
> On Fri, Jun 15, 2018 at 02:51:34PM +0100, Ayan Kumar Halder wrote:
> > On planes which support AFBC, expose an AFBC modifier for use with BGR888.
> > 
> > Signed-off-by: Ayan Kumar halder <ayan.halder@arm.com>
> > Reviewed-by: Brian Starkey <brian.starkey@arm.com>
> > 
> > Change-Id: I4739ff55c0f6d5715b268cb3947ed133a9ee7c2e
> 
> Please remove the Change-Id
> 
> > ---
> >  drivers/gpu/drm/arm/malidp_drv.c    |  1 +
> >  drivers/gpu/drm/arm/malidp_planes.c | 46 +++++++++++++++++++++++++++++++++++--
> >  2 files changed, 45 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> > index 7b6a848..7bcd679 100644
> > --- a/drivers/gpu/drm/arm/malidp_drv.c
> > +++ b/drivers/gpu/drm/arm/malidp_drv.c
> > @@ -392,6 +392,7 @@ static int malidp_init(struct drm_device *drm)
> >  	drm->mode_config.max_height = hwdev->max_line_size;
> >  	drm->mode_config.funcs = &malidp_mode_config_funcs;
> >  	drm->mode_config.helper_private = &malidp_mode_config_helpers;
> > +	drm->mode_config.allow_fb_modifiers = true;
> >  
> >  	ret = malidp_crtc_init(drm);
> >  	if (ret) {
> > diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> > index 3950504..55c9a1f6 100644
> > --- a/drivers/gpu/drm/arm/malidp_planes.c
> > +++ b/drivers/gpu/drm/arm/malidp_planes.c
> > @@ -124,6 +124,35 @@ static void malidp_plane_atomic_print_state(struct drm_printer *p,
> >  	drm_printf(p, "\tn_planes=%u\n", ms->n_planes);
> >  }
> >  
> > +static bool malidp_format_mod_supported(struct drm_plane *plane,
> > +					u32 format, u64 modifier)
> > +{
> > +	if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID))
> > +		return false;
> > +
> > +	/* All the pixel formats are supported without any modifier */
> > +	if (modifier == DRM_FORMAT_MOD_LINEAR)
> > +		return true;
> > +
> > +	if ((modifier >> 56) != DRM_FORMAT_MOD_VENDOR_ARM)
> > +		return false;
> > +
> > +	if (modifier &
> > +	    ~DRM_FORMAT_MOD_ARM_AFBC(AFBC_MOD_VALID_BITS)) {
> > +		DRM_ERROR("Unsupported modifiers\n");
> 
> I don't think we should polute the kernel log buffers with this. Maybe a
> DRM_DEBUG() if you really want to get some notification?

I agree with you completely. I think we should use DRM_DEBUG_KMS()
like intel_framebuffer_init() uses to log unsupported formats and
modifiers.
I will send a v2 patch for this.
> 
> With those changes added:
> 
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> 
> Best regards,
> Liviu
> 
> > +		return false;
> > +	}
> > +
> > +	switch (modifier) {
> > +	case DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
> > +				AFBC_FORMAT_MOD_YTR |
> > +				AFBC_FORMAT_MOD_SPARSE):
> > +		if (format == DRM_FORMAT_BGR888)
> > +			return true;
> > +	}
> > +	return false;
> > +}
> > +
> >  static const struct drm_plane_funcs malidp_de_plane_funcs = {
> >  	.update_plane = drm_atomic_helper_update_plane,
> >  	.disable_plane = drm_atomic_helper_disable_plane,
> > @@ -132,6 +161,7 @@ static const struct drm_plane_funcs malidp_de_plane_funcs = {
> >  	.atomic_duplicate_state = malidp_duplicate_plane_state,
> >  	.atomic_destroy_state = malidp_destroy_plane_state,
> >  	.atomic_print_state = malidp_plane_atomic_print_state,
> > +	.format_mod_supported = malidp_format_mod_supported,
> >  };
> >  
> >  static int malidp_se_check_scaling(struct malidp_plane *mp,
> > @@ -524,6 +554,13 @@ int malidp_de_planes_init(struct drm_device *drm)
> >  	u32 *formats;
> >  	int ret, i, j, n;
> >  
> > +	static const u64 modifiers[] = {
> > +		DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
> > +			AFBC_FORMAT_MOD_YTR | AFBC_FORMAT_MOD_SPARSE),
> > +		DRM_FORMAT_MOD_LINEAR,
> > +		DRM_FORMAT_MOD_INVALID
> > +	};
> > +
> >  	formats = kcalloc(map->n_pixel_formats, sizeof(*formats), GFP_KERNEL);
> >  	if (!formats) {
> >  		ret = -ENOMEM;
> > @@ -547,9 +584,14 @@ int malidp_de_planes_init(struct drm_device *drm)
> >  
> >  		plane_type = (i == 0) ? DRM_PLANE_TYPE_PRIMARY :
> >  					DRM_PLANE_TYPE_OVERLAY;
> > +
> > +		/*
> > +		 * All the layers except smart layer supports AFBC modifiers.
> > +		 */
> >  		ret = drm_universal_plane_init(drm, &plane->base, crtcs,
> > -					       &malidp_de_plane_funcs, formats,
> > -					       n, NULL, plane_type, NULL);
> > +				&malidp_de_plane_funcs, formats, n,
> > +				(id == DE_SMART) ? NULL : modifiers, plane_type, NULL);
> > +
> >  		if (ret < 0)
> >  			goto cleanup;
> >  
> > -- 
> > 2.7.4
> > 
> 
> -- 
> ====================
> | 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

  reply	other threads:[~2018-07-05 13:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15 13:51 [RFC PATCH 0/4] Add support for Arm Framebuffer Compression(AFBC) Ayan Kumar Halder
2018-06-15 13:51 ` [RFC PATCH 1/4] drm/arm/malidp: Add modifier definitions for describing Arm Framebuffer Compression (AFBC) Ayan Kumar Halder
2018-06-15 13:51   ` Ayan Kumar Halder
2018-06-15 13:51 ` [RFC PATCH 2/4] drm/arm/malidp: Implemented the size validation for AFBC framebuffers Ayan Kumar Halder
2018-06-15 13:51   ` Ayan Kumar Halder
2018-06-15 13:51 ` [RFC PATCH 3/4] drm/arm/malidp: Set the AFBC register bits if the framebuffer has AFBC modifier Ayan Kumar Halder
2018-06-15 13:51   ` Ayan Kumar Halder
2018-06-26 13:17   ` Liviu Dudau
2018-07-05 13:31     ` Ayan Halder
2018-07-05 13:31       ` Ayan Halder
2018-07-05 17:38       ` Liviu Dudau
2018-07-05 17:38         ` Liviu Dudau
2018-07-10 12:39         ` Ayan Halder
2018-06-15 13:51 ` [RFC PATCH 4/4] drm/arm/malidp: Added support for AFBC modifiers for all layers except DE_SMART Ayan Kumar Halder
2018-06-15 13:51   ` Ayan Kumar Halder
2018-06-26 13:21   ` Liviu Dudau
2018-07-05 13:45     ` Ayan Halder [this message]
2018-07-05 13:45       ` Ayan Halder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180705134512.GB31243@arm.com \
    --to=ayan.halder@arm.com \
    --cc=Liviu.Dudau@foss.arm.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=malidp@foss.arm.com \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.