All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>
To: Brian Starkey <brian.starkey@arm.com>
Cc: charles.xu@arm.com, nd@arm.com, matt.szczesiak@arm.com,
	airlied@linux.ie, liviu.dudau@arm.com,
	dri-devel@lists.freedesktop.org, maxime.ripard@bootlin.com,
	david.garbett@arm.com, seanpaul@chromium.org, lisa.wu@arm.com,
	daniel.vetter@ffwll.ch, malidp@foss.arm.com, ayan.halder@arm.com,
	james.qian.wang@arm.com
Subject: Re: [PATCH v5 4/9] drm: mali-dp: Enable Mali-DP tiled buffer formats
Date: Mon, 22 Oct 2018 11:08:47 +0100	[thread overview]
Message-ID: <20181022100847.GB17598@e114479-lin.cambridge.arm.com> (raw)
In-Reply-To: <20181019131722.GC78@DESKTOP-E1NTVVP.localdomain>

On Fri, Oct 19, 2018 at 02:17:22PM +0100, Brian Starkey wrote:
> Hi Alex,
> 
> On Fri, Oct 19, 2018 at 11:57:47AM +0100, Alexandru Gheorghe wrote:
> >Enable the following formats
> >- DRM_FORMAT_X0L0: DP650
> >- DRM_FORMAT_X0L2: DP550, DP650
> >
> >Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
> 
> A couple of suggestions below, but with or without you can add my
> r-b.

Will address them in the next version.

> 
> >---
> >drivers/gpu/drm/arm/malidp_hw.c     | 14 +++++++++++---
> >drivers/gpu/drm/arm/malidp_planes.c | 23 +++++++++++++++++++++--
> >2 files changed, 32 insertions(+), 5 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
> >index c94a4422e0e9..e01fc0e5b503 100644
> >--- a/drivers/gpu/drm/arm/malidp_hw.c
> >+++ b/drivers/gpu/drm/arm/malidp_hw.c
> >@@ -77,12 +77,18 @@ static const struct malidp_format_id malidp500_de_formats[] = {
> >	{ DRM_FORMAT_YUYV, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 2) },	\
> >	{ DRM_FORMAT_UYVY, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 3) },	\
> >	{ DRM_FORMAT_NV12, DE_VIDEO1 | DE_VIDEO2 | SE_MEMWRITE, MALIDP_ID(5, 6) },	\
> >-	{ DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) }
> >+	{ DRM_FORMAT_YUV420, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 7) }, \
> >+	{ DRM_FORMAT_X0L2, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(6, 6)}
> >
> >static const struct malidp_format_id malidp550_de_formats[] = {
> >	MALIDP_COMMON_FORMATS,
> >};
> >
> >+static const struct malidp_format_id malidp650_de_formats[] = {
> >+	MALIDP_COMMON_FORMATS,
> >+	{ DRM_FORMAT_X0L0, DE_VIDEO1 | DE_VIDEO2, MALIDP_ID(5, 4)},
> >+};
> >+
> >static const struct malidp_layer malidp500_layers[] = {
> >	{ DE_VIDEO1, MALIDP500_DE_LV_BASE, MALIDP500_DE_LV_PTR_BASE, MALIDP_DE_LV_STRIDE0, MALIDP500_LV_YUV2RGB },
> >	{ DE_GRAPHICS1, MALIDP500_DE_LG1_BASE, MALIDP500_DE_LG1_PTR_BASE, MALIDP_DE_LG_STRIDE, 0 },
> >@@ -595,6 +601,8 @@ static int malidp550_rotmem_required(struct malidp_hw_device *hwdev, u16 w, u16
> >	case DRM_FORMAT_BGR565:
> >	case DRM_FORMAT_UYVY:
> >	case DRM_FORMAT_YUYV:
> >+	case DRM_FORMAT_X0L0:
> >+	case DRM_FORMAT_X0L2:
> >		bytes_per_col = 32;
> >		break;
> >	/* 16 lines at 1.5 bytes per pixel */
> >@@ -860,8 +868,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = {
> >					    MALIDP550_DC_IRQ_SE,
> >				.vsync_irq = MALIDP550_DC_IRQ_CONF_VALID,
> >			},
> >-			.pixel_formats = malidp550_de_formats,
> >-			.n_pixel_formats = ARRAY_SIZE(malidp550_de_formats),
> >+			.pixel_formats = malidp650_de_formats,
> >+			.n_pixel_formats = ARRAY_SIZE(malidp650_de_formats),
> >			.bus_align_bytes = 16,
> >		},
> >		.query_hw = malidp650_query_hw,
> >diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> >index 49c37f6dd63e..33bbc29da774 100644
> >--- a/drivers/gpu/drm/arm/malidp_planes.c
> >+++ b/drivers/gpu/drm/arm/malidp_planes.c
> >@@ -196,13 +196,26 @@ static int malidp_de_plane_check(struct drm_plane *plane,
> >	ms->n_planes = fb->format->num_planes;
> >	for (i = 0; i < ms->n_planes; i++) {
> >		u8 alignment = malidp_hw_get_pitch_align(mp->hwdev, rotated);
> >-		if (fb->pitches[i] & (alignment - 1)) {
> >+
> >+		if ((fb->pitches[i] * drm_format_info_block_height(fb->format, i))
> >+				& (alignment - 1)) {
> >			DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n",
> >				      fb->pitches[i], i);
> >			return -EINVAL;
> >		}
> >	}
> >
> >+	if (fb->width % drm_format_info_block_width(fb->format, 0) ||
> >+	    fb->height % drm_format_info_block_height(fb->format, 0)) {
> >+		DRM_DEBUG_KMS("Buffer width/height needs to be a multiple of tile sizes");
> >+		return -EINVAL;
> >+	}
> >+	if ((state->src_x >> 16) % drm_format_info_block_width(fb->format, 0) ||
> >+	    (state->src_y >> 16) % drm_format_info_block_height(fb->format, 0)) {
> >+		DRM_DEBUG_KMS("Plane src_x/src_y needs to be a multiple of tile sizes");
> >+		return -EINVAL;
> >+	}
> 
> Some local variables for block_w and block_h instead of all the
> function calls might be easier to parse in this function.
> 
> >+
> >	if ((state->crtc_w > mp->hwdev->max_line_size) ||
> >	    (state->crtc_h > mp->hwdev->max_line_size) ||
> >	    (state->crtc_w < mp->hwdev->min_line_size) ||
> >@@ -258,8 +271,14 @@ static void malidp_de_set_plane_pitches(struct malidp_plane *mp,
> >		num_strides = (mp->hwdev->hw->features &
> >			       MALIDP_DEVICE_LV_HAS_3_STRIDES) ? 3 : 2;
> >
> >+	/*
> >+	 * The drm convention for pitch is that it needs to cover width * cpp,
> >+	 * but our hardware wants the pitch/stride to cover all rows included
> >+	 * in a tile.
> >+	 */
> >	for (i = 0; i < num_strides; ++i)
> >-		malidp_hw_write(mp->hwdev, pitches[i],
> >+		malidp_hw_write(mp->hwdev, pitches[i] *
> >+				drm_format_info_block_height(mp->base.state->fb->format, i),
> >				mp->layer->base +
> >				mp->layer->stride_offset + i * 4);
> 
> Personally I think longer lines which don't break up the arguments (or
> local variables again) would make this easier to read.
> 
> Cheers,
> -Brian
> 
> >}
> >-- 
> >2.18.0
> >

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

  reply	other threads:[~2018-10-22 10:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 10:57 [PATCH v5 0/9] Add method to describe tile/bit_level_packed formats Alexandru Gheorghe
2018-10-19 10:57 ` [PATCH v5 1/9] drm: fourcc: Convert drm_format_info kerneldoc to in-line member documentation Alexandru Gheorghe
2018-10-19 12:54   ` Maxime Ripard
2018-10-22  9:36     ` Alexandru-Cosmin Gheorghe
2018-10-19 10:57 ` [PATCH v5 2/9] drm/fourcc: Add char_per_block, block_w and block_h in drm_format_info Alexandru Gheorghe
2018-10-19 13:09   ` Brian Starkey
2018-10-22 10:07     ` Alexandru-Cosmin Gheorghe
2018-10-19 10:57 ` [PATCH v5 3/9] drm/fourcc: Add fourcc for Mali linear tiled formats Alexandru Gheorghe
2018-10-19 13:12   ` Brian Starkey
2018-10-19 10:57 ` [PATCH v5 4/9] drm: mali-dp: Enable Mali-DP tiled buffer formats Alexandru Gheorghe
2018-10-19 13:17   ` Brian Starkey
2018-10-22 10:08     ` Alexandru-Cosmin Gheorghe [this message]
2018-10-19 10:57 ` [PATCH v5 5/9] drm: Extend framebuffer_check to handle formats with cpp/char_per_block 0 Alexandru Gheorghe
2018-10-19 13:21   ` Brian Starkey
2018-10-22 10:09     ` Alexandru-Cosmin Gheorghe
2018-10-19 10:57 ` [PATCH v5 6/9] drm/fourcc: Add AFBC yuv fourccs for Mali Alexandru Gheorghe
2018-10-19 10:57 ` [PATCH v5 7/9] drm/afbc: Add AFBC modifier usage documentation Alexandru Gheorghe
2018-10-19 10:57 ` [PATCH v5 8/9] drm/selftest: Refactor test-drm_plane_helper Alexandru Gheorghe
2018-10-19 15:14   ` Daniel Vetter
2018-10-22  9:40     ` Alexandru-Cosmin Gheorghe
2018-10-19 10:57 ` [PATCH v5 9/9] drm/selftests: Add tests for drm_format_info* helpers Alexandru Gheorghe
2018-10-19 15:29   ` Daniel Vetter
2018-10-22 10:32     ` Alexandru-Cosmin Gheorghe
2018-10-23 13:56       ` Daniel Vetter

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=20181022100847.GB17598@e114479-lin.cambridge.arm.com \
    --to=alexandru-cosmin.gheorghe@arm.com \
    --cc=airlied@linux.ie \
    --cc=ayan.halder@arm.com \
    --cc=brian.starkey@arm.com \
    --cc=charles.xu@arm.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=david.garbett@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=james.qian.wang@arm.com \
    --cc=lisa.wu@arm.com \
    --cc=liviu.dudau@arm.com \
    --cc=malidp@foss.arm.com \
    --cc=matt.szczesiak@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=nd@arm.com \
    --cc=seanpaul@chromium.org \
    /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.