public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Starkey <brian.starkey@arm.com>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	liviu.dudau@arm.com, laurent.pinchart@ideasonboard.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 6/6] drm: mali-dp: Add writeback connector
Date: Tue, 18 Apr 2017 18:35:29 +0100	[thread overview]
Message-ID: <20170418173529.GC325@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <20170414114700.552acc82@bbrezillon>

On Fri, Apr 14, 2017 at 11:47:00AM +0200, Boris Brezillon wrote:
>On Fri, 25 Nov 2016 16:49:04 +0000
>Brian Starkey <brian.starkey@arm.com> wrote:
>
>> +static int
>> +malidp_mw_encoder_atomic_check(struct drm_encoder *encoder,
>> +			       struct drm_crtc_state *crtc_state,
>> +			       struct drm_connector_state *conn_state)
>> +{
>> +	struct malidp_mw_connector_state *mw_state = to_mw_state(conn_state);
>> +	struct malidp_drm *malidp = encoder->dev->dev_private;
>> +	struct drm_framebuffer *fb;
>> +	int i, n_planes;
>> +
>> +	if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
>> +		return 0;
>> +
>> +	fb = conn_state->writeback_job->fb;
>> +	if ((fb->width != crtc_state->mode.hdisplay) ||
>> +	    (fb->height != crtc_state->mode.vdisplay)) {
>> +		DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n",
>> +				fb->width, fb->height);
>> +		return -EINVAL;
>> +	}
>
>These checks look pretty generic to me. Shouldn't we have a default
>helper doing that?
>

Yeah makes sense. These should be common to everyone until
cropping/scaling support is added.

>> +
>> +	mw_state->format =
>> +		malidp_hw_get_format_id(&malidp->dev->map, SE_MEMWRITE,
>> +					fb->pixel_format);
>> +	if (mw_state->format == MALIDP_INVALID_FORMAT_ID) {
>
>Same goes here. By adding a format_types table similar to what is
>exposed in drm_plane [1], we could do this check in the core. The only
>thing left to the driver is the 4CC -> driver-specific-id conversion.
>

Yeah could do, but given our driver requires us to run through the
whole table to get the HW ID anyway it seemed like totally wasted
effort to do the same thing in the core.

It's probably a negligible overhead, but it's also unnecessary for
100% of the current writeback implementations ;-)

If a different driver is implemented such that the HW ID lookup isn't
an exhaustive list search then we could add a helper for them to use
which checks the blob.

Cheers,
-Brian

>> +		struct drm_format_name_buf format_name;
>> +
>> +		DRM_DEBUG_KMS("Invalid pixel format %s\n",
>> +			      drm_get_format_name(fb->pixel_format, &format_name));
>> +		return -EINVAL;
>> +	}
>> +
>> +	n_planes = drm_format_num_planes(fb->pixel_format);
>> +	for (i = 0; i < n_planes; i++) {
>> +		struct drm_gem_cma_object *obj = drm_fb_cma_get_gem_obj(fb, i);
>> +		if (!malidp_hw_pitch_valid(malidp->dev, fb->pitches[i])) {
>> +			DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n",
>> +				      fb->pitches[i], i);
>> +			return -EINVAL;
>> +		}
>> +		mw_state->pitches[i] = fb->pitches[i];
>> +		mw_state->addrs[i] = obj->paddr + fb->offsets[i];
>> +	}
>> +	mw_state->n_planes = n_planes;
>> +
>> +	return 0;
>> +}
>
>
>[1]http://lxr.free-electrons.com/source/include/drm/drm_plane.h#L482

  reply	other threads:[~2017-04-18 17:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25 16:48 [RFC PATCH v3 0/6] Introduce writeback connectors Brian Starkey
2016-11-25 16:48 ` [PATCH 1/6] drm: Add writeback connector type Brian Starkey
2017-04-14 10:08   ` Boris Brezillon
2017-04-18 17:34     ` Brian Starkey
2017-04-18 19:57       ` Boris Brezillon
2017-04-19  9:51         ` Brian Starkey
2017-04-19 11:34           ` Boris Brezillon
2017-04-19 12:50             ` Brian Starkey
2017-05-05  8:22   ` Boris Brezillon
2017-05-05 12:47     ` Liviu Dudau
2016-11-25 16:49 ` [PATCH 2/6] drm: writeback: Add out-fences for writeback connectors Brian Starkey
2017-04-14 10:11   ` Boris Brezillon
2017-04-18 17:35     ` Brian Starkey
2016-11-25 16:49 ` [PATCH 3/6] drm: mali-dp: Rename malidp_input_format Brian Starkey
2016-11-25 16:49 ` [PATCH 4/6] drm: mali-dp: Add support for writeback on DP550/DP650 Brian Starkey
2016-11-25 16:49 ` [PATCH 5/6] drm: mali-dp: Add RGB writeback formats for DP550/DP650 Brian Starkey
2016-11-25 16:49 ` [PATCH 6/6] drm: mali-dp: Add writeback connector Brian Starkey
2017-04-14  9:47   ` Boris Brezillon
2017-04-18 17:35     ` Brian Starkey [this message]
2017-04-14  9:35 ` [RFC PATCH v3 0/6] Introduce writeback connectors Boris Brezillon
2017-04-18 17:31   ` Brian Starkey

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=20170418173529.GC325@e106950-lin.cambridge.arm.com \
    --to=brian.starkey@arm.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=liviu.dudau@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox