All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Stone <daniels@collabora.com>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
	dri-devel@lists.freedesktop.org
Cc: Ayan Halder <Ayan.Halder@arm.com>,
	kernel@collabora.com, David Airlie <airlied@linux.ie>,
	Liviu Dudau <liviu.dudau@arm.com>,
	linux-rockchip@lists.infradead.org,
	James Wang <james.qian.wang@arm.com>,
	Mihail Atanassov <mihail.atanassov@arm.com>,
	Sean Paul <sean@poorly.run>, Mark Yao <mark.yao@rock-chips.com>
Subject: Re: [PATCHv2 4/4] drm/rockchip: Add support for afbc
Date: Tue, 05 Nov 2019 23:34:28 +0000	[thread overview]
Message-ID: <13a5d60f0262ea2505f95d139e04da7fa710fe7c.camel@collabora.com> (raw)
In-Reply-To: <20191104221228.3588-5-andrzej.p@collabora.com>

Hi Andrzej,

On Mon, 2019-11-04 at 23:12 +0100, Andrzej Pietrasiewicz wrote:
> +	if (mode_cmd->modifier[0]) {

I believe this can still be DRM_FORMAT_MOD_INVALID, which != 0. You
probably want to explicitly check if it's an AFBC modifier.

> +		const struct drm_format_info *info;
> +		int bpp;
> +
> +		if (!drm_afbc_check_offset(dev, mode_cmd))
> +			return ERR_PTR(-EINVAL);
> +
> +		if (!drm_afbc_get_superblk_wh(mode_cmd->modifier[0],
> &w, &h))
> +			return ERR_PTR(-EINVAL);
> +
> +		if (w != 16 || h != 16) {
> +			DRM_DEV_ERROR(dev->dev,
> +				"Unsupported afbc tile w/h [%d/%d]\n",
> w, h);

This can just be a WARN_ONCE() or something, since it indicates an
impossible condition - the DRM core should've already rejected this
modifier as unsupported.

> +		if (mode_cmd->width > ROCKCHIP_MAX_AFBC_WIDTH) {
> +			DRM_DEV_ERROR(dev->dev,
> +				      "Unsupported width %d>%d\n",
> +				      mode_cmd->width,
> +				      ROCKCHIP_MAX_AFBC_WIDTH
> +			);

Userspace shouldn't be allowed to spam the log by triggering error
messages; please make this debug instead. Whilst you're there, adding
logs to the other error returns here might be useful.

> @@ -166,6 +179,7 @@ struct vop {
>  	/* optional internal rgb encoder */
>  	struct rockchip_rgb *rgb;
>  
> +	struct vop_win *afbc_win;

It seems like everywhere afbc_win is used, it's not actually used for
the window value, but rather just used as an is_afbc_enabled bool. In
that case, it would be better as a real bool, and living in either the
output or plane state.

This would eliminate the need to unset the variable as well.

Relatedly, can one VOP support multiple simultaneous windows using
AFBC? If not, the check that only one window is using AFBC is missing
from this patch.

> +static int vop_convert_afbc_format(uint32_t format)
> +{
> +	switch (format) {
> +	case DRM_FORMAT_XRGB8888:
> +	case DRM_FORMAT_ARGB8888:
> +	case DRM_FORMAT_XBGR8888:
> +	case DRM_FORMAT_ABGR8888:
> +		return AFBC_FMT_U8U8U8U8;
> +	case DRM_FORMAT_RGB888:
> +	case DRM_FORMAT_BGR888:
> +		return AFBC_FMT_U8U8U8;
> +	case DRM_FORMAT_RGB565:
> +	case DRM_FORMAT_BGR565:
> +		return AFBC_FMT_RGB565;
> +	/* either of the below should not be reachable */

Unreachable can be WARN_ONCE() rather than a silent return.

Other than that, this is looking a _lot_ nicer than v1 though!

Cheers,
Daniel

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

  reply	other threads:[~2019-11-05 23:34 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 11:18 [PATCH 0/2] AFBC for Rockchip Andrzej Pietrasiewicz
2019-10-11 11:18 ` Andrzej Pietrasiewicz
2019-10-11 11:18 ` [PATCH 1/2] drm/arm: Factor out generic afbc helpers Andrzej Pietrasiewicz
2019-10-11 11:18   ` Andrzej Pietrasiewicz
2019-10-21 13:50   ` Ayan Halder
2019-10-21 13:50     ` Ayan Halder
2019-10-21 13:50     ` Ayan Halder
2019-10-21 14:41     ` Mihail Atanassov
2019-10-21 14:41       ` Mihail Atanassov
2019-10-21 14:41       ` Mihail Atanassov
2019-11-04 22:12       ` [PATCHv2 0/4] AFBC support for Rockchip Andrzej Pietrasiewicz
2019-11-04 22:12         ` [PATCHv2 1/4] drm/arm: Factor out generic afbc helpers Andrzej Pietrasiewicz
2019-11-05  9:22           ` Daniel Vetter
2019-11-06 12:45             ` Andrzej Pietrasiewicz
2019-11-07  8:27               ` Daniel Vetter
2019-11-05 23:26           ` Daniel Stone
2019-11-05 23:26             ` Daniel Stone
2019-11-06 10:28             ` Liviu Dudau
2019-11-07 17:20             ` Brian Starkey
2019-11-07 17:20               ` Brian Starkey
2019-11-07 17:32               ` Daniel Vetter
2019-11-07 17:32                 ` Daniel Vetter
2019-11-07 17:49                 ` Brian Starkey
2019-11-07 17:49                   ` Brian Starkey
2019-11-07 19:28                   ` Daniel Vetter
2019-11-07 19:28                     ` Daniel Vetter
2019-11-08  9:46                     ` Brian Starkey
2019-11-08  9:46                       ` Brian Starkey
2019-11-04 22:12         ` [PATCHv2 2/4] drm/malidp: use " Andrzej Pietrasiewicz
2019-11-06 11:09           ` Liviu Dudau
2019-11-04 22:12         ` [PATCHv2 3/4] drm/komeda: " Andrzej Pietrasiewicz
2019-11-08 16:09           ` Ayan Halder
2019-11-08 16:09             ` Ayan Halder
2019-11-13  2:01             ` james qian wang (Arm Technology China)
2019-11-13 11:39               ` Daniel Vetter
2019-11-14  1:52                 ` james qian wang (Arm Technology China)
2019-11-14 10:12                   ` Daniel Vetter
2019-11-18  7:09                     ` james qian wang (Arm Technology China)
2019-11-18  9:51                       ` Daniel Vetter
     [not found]                         ` <20191118095136.GC23790-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-11-19  8:34                           ` james qian wang (Arm Technology China)
2019-11-19  8:34                             ` james qian wang (Arm Technology China)
2019-11-21 17:22                             ` [PATCHv3/RFC 0/4] AFBC rework and support for Rockchip Andrzej Pietrasiewicz
2019-11-21 17:22                               ` [PATCHv3/RFC 1/4] drm/arm: Factor out generic afbc helpers Andrzej Pietrasiewicz
2019-11-23  7:13                                 ` Ezequiel Garcia
2019-11-23  7:13                                   ` Ezequiel Garcia
2019-11-24 10:11                                 ` kbuild test robot
2019-11-25  8:55                                 ` Daniel Vetter
2019-11-26 20:27                                   ` Andrzej Pietrasiewicz
2019-11-27  9:51                                     ` Daniel Vetter
2019-11-28 10:47                                   ` james qian wang (Arm Technology China)
2019-11-21 17:22                               ` [PATCHv3/RFC 2/4] drm/malidp: use " Andrzej Pietrasiewicz
2019-11-21 17:22                               ` [PATCHv3/RFC 3/4] drm/komeda: Use afbc helper Andrzej Pietrasiewicz
2019-11-21 17:22                               ` [PATCHv3/RFC 4/4] drm/rockchip: Add support for afbc Andrzej Pietrasiewicz
2019-11-23  7:21                                 ` Ezequiel Garcia
2019-11-23  7:21                                   ` Ezequiel Garcia
2019-11-04 22:12         ` [PATCHv2 " Andrzej Pietrasiewicz
2019-11-05 23:34           ` Daniel Stone [this message]
2019-11-05 23:34             ` Daniel Stone
2019-10-11 11:18 ` [PATCH 2/2] " Andrzej Pietrasiewicz
2019-10-11 11:18   ` Andrzej Pietrasiewicz
2019-10-11 11:59   ` Daniel Stone
2019-10-11 11:59     ` Daniel Stone
2019-10-11 11:59     ` Daniel Stone

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=13a5d60f0262ea2505f95d139e04da7fa710fe7c.camel@collabora.com \
    --to=daniels@collabora.com \
    --cc=Ayan.Halder@arm.com \
    --cc=airlied@linux.ie \
    --cc=andrzej.p@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=james.qian.wang@arm.com \
    --cc=kernel@collabora.com \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=liviu.dudau@arm.com \
    --cc=mark.yao@rock-chips.com \
    --cc=mihail.atanassov@arm.com \
    --cc=sean@poorly.run \
    /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.