From: Jyri Sarha <jsarha@ti.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org,
Darren Etheridge <detheridge@ti.com>,
tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com
Subject: Re: [PATCH 03/12] drm/tilcdc: verify fb pitch
Date: Wed, 10 Feb 2016 15:18:01 +0200 [thread overview]
Message-ID: <56BB3889.4070008@ti.com> (raw)
In-Reply-To: <20151216083704.GE30437@phenom.ffwll.local>
On 12/16/15 10:37, Daniel Vetter wrote:
> On Tue, Dec 15, 2015 at 09:03:14PM +0200, Jyri Sarha wrote:
>> >From: Tomi Valkeinen<tomi.valkeinen@ti.com>
>> >
>> >LCDC hardware does not support fb pitch that is different (i.e. larger)
>> >than the screen size. The driver currently does no checks for this, and
>> >the results of too big pitch are are flickering and lower fps.
>> >
>> >This issue easily happens when using libdrm's modetest tool with non-32
>> >bpp modes. As modetest always allocated 4 bytes per pixel, it implies a
>> >bigger pitch for 16 or 24 bpp modes.
>> >
>> >This patch adds a check to reject pitches the hardware cannot support.
>> >
>> >Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
>> >Signed-off-by: Darren Etheridge<detheridge@ti.com>
>> >Signed-off-by: Jyri Sarha<jsarha@ti.com>
>> >---
>> > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 31 +++++++++++++++++++++++++++++++
>> > 1 file changed, 31 insertions(+)
>> >
>> >diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
>> >index 7b687ae..105f286 100644
>> >--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
>> >+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
>> >@@ -151,6 +151,22 @@ static void tilcdc_crtc_destroy(struct drm_crtc *crtc)
>> > kfree(tilcdc_crtc);
>> > }
>> >
>> >+static int tilcdc_verify_fb(struct drm_crtc *crtc, struct drm_framebuffer *fb)
>> >+{
>> >+ struct drm_device *dev = crtc->dev;
>> >+ unsigned int depth, bpp;
>> >+
>> >+ drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
>> >+
>> >+ if (fb->pitches[0] != crtc->mode.hdisplay * bpp / 8) {
>> >+ dev_err(dev->dev,
>> >+ "Invalid pitch: fb and crtc widths must be the same");
>> >+ return -EINVAL;
>> >+ }
>> >+
>> >+ return 0;
> This should be done in framebuffer_create instead if tilcdc has this
> requirement everywhere. No point in allowing userspace to create an fb you
> can't use. Only if you have planes with different limits should this be
> checked after fb creation.
>
That would not work because we do not know the mode of the crtc when the
framebuffer is going to be used.
> Also with atomic you'd only need to place this in one function, even if
> you have different per-plane limitations ... hint, hint;-)
I am working on atomic modeset for tilcdc, but I am still a newbie on
DRM front so it takes some time :).
Cheers,
Jyri
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-02-10 13:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 19:03 [PATCH 00/12] drm/tilcdc: fixes and added features from TI tree Jyri Sarha
2015-12-15 19:03 ` [PATCH 01/12] drm/tilcdc: disable console switching during pm operations Jyri Sarha
2015-12-15 19:03 ` [PATCH 02/12] drm/tilcdc: rewrite pixel clock calculation Jyri Sarha
2015-12-15 19:03 ` [PATCH 03/12] drm/tilcdc: verify fb pitch Jyri Sarha
2015-12-16 8:37 ` Daniel Vetter
2016-02-10 13:18 ` Jyri Sarha [this message]
2016-02-10 13:26 ` Daniel Vetter
2015-12-15 19:03 ` [PATCH 04/12] drm/tilcdc: adopt pinctrl support Jyri Sarha
2015-12-15 19:03 ` [PATCH 05/12] drm/tilcdc: fix kernel panic on suspend when no hdmi monitor connected Jyri Sarha
2015-12-15 19:03 ` [PATCH 06/12] drm/tilcdc: make frame_done interrupt active at all times Jyri Sarha
2015-12-15 19:03 ` [PATCH 07/12] drm/tilcdc: disable the lcd controller/dma engine when suspend invoked Jyri Sarha
2015-12-15 19:03 ` [PATCH 08/12] drm/tilcdc: fix the ping-pong dma tearing issue seen on buffer flipping Jyri Sarha
2015-12-15 19:03 ` [PATCH 09/12] drm/tilcdc: correct the dmachannel tracking logic Jyri Sarha
2015-12-15 19:03 ` [PATCH 10/12] drm/tilcdc: make frame completion interrupt always enabled Jyri Sarha
2015-12-15 19:03 ` [PATCH 11/12] drm/tilcdc: Implement dma-buf support for tilcdc Jyri Sarha
2015-12-15 19:03 ` [PATCH 12/12] drm/tilcdc: fix build error when !CONFIG_CPU_FREQ Jyri Sarha
2015-12-16 8:23 ` [PATCH 00/12] drm/tilcdc: fixes and added features from TI tree Tomi Valkeinen
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=56BB3889.4070008@ti.com \
--to=jsarha@ti.com \
--cc=daniel@ffwll.ch \
--cc=detheridge@ti.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=tomi.valkeinen@ti.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.