From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: Eric Anholt <eric@anholt.net>, dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/vc4: Squash commit for Mario's precise vblank timestamping.
Date: Sat, 9 Jul 2016 19:09:04 +0200 [thread overview]
Message-ID: <57812FB0.6000207@gmail.com> (raw)
In-Reply-To: <1468003498-2476-2-git-send-email-eric@anholt.net>
Hi Eric,
thanks for all the infos and help! Both your patches look good and i
have successfully tested them on top of with my vblank timestamping patch.
So for both:
Reviewed-and-tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Will you squash 2/2 into my patch or should i resend my patch with yours
squashed in?
thanks,
-mario
On 07/08/2016 08:44 PM, Eric Anholt wrote:
> Read out the DISPBASE registers to decide on the FIFO size.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>
> Mario: How about this for a squash into your commit? Here are the
> values I dumped for cob_size:
>
> [ 2.148314] [drm] Scaler 0 size 5232
> [ 2.162239] [drm] Scaler 2 size 2048
> [ 2.172957] [drm] Scaler 1 size 13456
>
> drivers/gpu/drm/vc4/vc4_crtc.c | 23 +++++++++++++++++++++--
> drivers/gpu/drm/vc4/vc4_regs.h | 18 +++++++++++++++++-
> 2 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index baf962bce063..3b7db17c356d 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -55,6 +55,8 @@ struct vc4_crtc {
> u8 lut_r[256];
> u8 lut_g[256];
> u8 lut_b[256];
> + /* Size in pixels of the COB memory allocated to this CRTC. */
> + u32 cob_size;
>
> struct drm_pending_vblank_event *event;
> };
> @@ -195,8 +197,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
> *hpos = 0;
>
> /* This is the offset we need for translating hvs -> pv scanout pos. */
> - /* XXX Find proper formula from hw docs instead of guesstimating? */
> - fifo_lines = 2048 * 7 / mode->crtc_hdisplay;
> + fifo_lines = vc4_crtc->cob_size / mode->crtc_hdisplay;
>
> if (fifo_lines > 0)
> ret |= DRM_SCANOUTPOS_VALID;
> @@ -873,6 +874,22 @@ static void vc4_set_crtc_possible_masks(struct drm_device *drm,
> }
> }
>
> +static void
> +vc4_crtc_get_cob_allocation(struct vc4_crtc *vc4_crtc)
> +{
> + struct drm_device *drm = vc4_crtc->base.dev;
> + struct vc4_dev *vc4 = to_vc4_dev(drm);
> + u32 dispbase = HVS_READ(SCALER_DISPBASEX(vc4_crtc->channel));
> + /* Top/base are supposed to be 4-pixel aligned, but the
> + * Raspberry Pi firmware fills the low bits (which are
> + * presumably ignored).
> + */
> + u32 top = VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_TOP) & ~3;
> + u32 base = VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_BASE) & ~3;
> +
> + vc4_crtc->cob_size = top - base + 4;
> +}
> +
> static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
> {
> struct platform_device *pdev = to_platform_device(dev);
> @@ -949,6 +966,8 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
> crtc->cursor = cursor_plane;
> }
>
> + vc4_crtc_get_cob_allocation(vc4_crtc);
> +
> CRTC_WRITE(PV_INTEN, 0);
> CRTC_WRITE(PV_INTSTAT, PV_INT_VFP_START);
> ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
> diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h
> index 63cdc28ff7bb..160942a9180e 100644
> --- a/drivers/gpu/drm/vc4/vc4_regs.h
> +++ b/drivers/gpu/drm/vc4/vc4_regs.h
> @@ -366,7 +366,6 @@
> # define SCALER_DISPBKGND_FILL BIT(24)
>
> #define SCALER_DISPSTAT0 0x00000048
> -#define SCALER_DISPBASE0 0x0000004c
> # define SCALER_DISPSTATX_MODE_MASK VC4_MASK(31, 30)
> # define SCALER_DISPSTATX_MODE_SHIFT 30
> # define SCALER_DISPSTATX_MODE_DISABLED 0
> @@ -379,6 +378,20 @@
> # define SCALER_DISPSTATX_FRAME_COUNT_SHIFT 12
> # define SCALER_DISPSTATX_LINE_MASK VC4_MASK(11, 0)
> # define SCALER_DISPSTATX_LINE_SHIFT 0
> +
> +#define SCALER_DISPBASE0 0x0000004c
> +/* Last pixel in the COB (display FIFO memory) allocated to this HVS
> + * channel. Must be 4-pixel aligned (and thus 4 pixels less than the
> + * next COB base).
> + */
> +# define SCALER_DISPBASEX_TOP_MASK VC4_MASK(31, 16)
> +# define SCALER_DISPBASEX_TOP_SHIFT 16
> +/* First pixel in the COB (display FIFO memory) allocated to this HVS
> + * channel. Must be 4-pixel aligned.
> + */
> +# define SCALER_DISPBASEX_BASE_MASK VC4_MASK(15, 0)
> +# define SCALER_DISPBASEX_BASE_SHIFT 0
> +
> #define SCALER_DISPCTRL1 0x00000050
> #define SCALER_DISPBKGND1 0x00000054
> #define SCALER_DISPBKGNDX(x) (SCALER_DISPBKGND0 + \
> @@ -389,6 +402,9 @@
> (x) * (SCALER_DISPSTAT1 - \
> SCALER_DISPSTAT0))
> #define SCALER_DISPBASE1 0x0000005c
> +#define SCALER_DISPBASEX(x) (SCALER_DISPBASE0 + \
> + (x) * (SCALER_DISPBASE1 - \
> + SCALER_DISPBASE0))
> #define SCALER_DISPCTRL2 0x00000060
> #define SCALER_DISPCTRLX(x) (SCALER_DISPCTRL0 + \
> (x) * (SCALER_DISPCTRL1 - \
>
_______________________________________________
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: Mario Kleiner <mario.kleiner.de@gmail.com>
To: Eric Anholt <eric@anholt.net>, dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, Mario Kleiner <mario.kleiner.de@gmail.com>
Subject: Re: [PATCH 2/2] drm/vc4: Squash commit for Mario's precise vblank timestamping.
Date: Sat, 9 Jul 2016 19:09:04 +0200 [thread overview]
Message-ID: <57812FB0.6000207@gmail.com> (raw)
In-Reply-To: <1468003498-2476-2-git-send-email-eric@anholt.net>
Hi Eric,
thanks for all the infos and help! Both your patches look good and i
have successfully tested them on top of with my vblank timestamping patch.
So for both:
Reviewed-and-tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Will you squash 2/2 into my patch or should i resend my patch with yours
squashed in?
thanks,
-mario
On 07/08/2016 08:44 PM, Eric Anholt wrote:
> Read out the DISPBASE registers to decide on the FIFO size.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>
> Mario: How about this for a squash into your commit? Here are the
> values I dumped for cob_size:
>
> [ 2.148314] [drm] Scaler 0 size 5232
> [ 2.162239] [drm] Scaler 2 size 2048
> [ 2.172957] [drm] Scaler 1 size 13456
>
> drivers/gpu/drm/vc4/vc4_crtc.c | 23 +++++++++++++++++++++--
> drivers/gpu/drm/vc4/vc4_regs.h | 18 +++++++++++++++++-
> 2 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index baf962bce063..3b7db17c356d 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -55,6 +55,8 @@ struct vc4_crtc {
> u8 lut_r[256];
> u8 lut_g[256];
> u8 lut_b[256];
> + /* Size in pixels of the COB memory allocated to this CRTC. */
> + u32 cob_size;
>
> struct drm_pending_vblank_event *event;
> };
> @@ -195,8 +197,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
> *hpos = 0;
>
> /* This is the offset we need for translating hvs -> pv scanout pos. */
> - /* XXX Find proper formula from hw docs instead of guesstimating? */
> - fifo_lines = 2048 * 7 / mode->crtc_hdisplay;
> + fifo_lines = vc4_crtc->cob_size / mode->crtc_hdisplay;
>
> if (fifo_lines > 0)
> ret |= DRM_SCANOUTPOS_VALID;
> @@ -873,6 +874,22 @@ static void vc4_set_crtc_possible_masks(struct drm_device *drm,
> }
> }
>
> +static void
> +vc4_crtc_get_cob_allocation(struct vc4_crtc *vc4_crtc)
> +{
> + struct drm_device *drm = vc4_crtc->base.dev;
> + struct vc4_dev *vc4 = to_vc4_dev(drm);
> + u32 dispbase = HVS_READ(SCALER_DISPBASEX(vc4_crtc->channel));
> + /* Top/base are supposed to be 4-pixel aligned, but the
> + * Raspberry Pi firmware fills the low bits (which are
> + * presumably ignored).
> + */
> + u32 top = VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_TOP) & ~3;
> + u32 base = VC4_GET_FIELD(dispbase, SCALER_DISPBASEX_BASE) & ~3;
> +
> + vc4_crtc->cob_size = top - base + 4;
> +}
> +
> static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
> {
> struct platform_device *pdev = to_platform_device(dev);
> @@ -949,6 +966,8 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
> crtc->cursor = cursor_plane;
> }
>
> + vc4_crtc_get_cob_allocation(vc4_crtc);
> +
> CRTC_WRITE(PV_INTEN, 0);
> CRTC_WRITE(PV_INTSTAT, PV_INT_VFP_START);
> ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
> diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h
> index 63cdc28ff7bb..160942a9180e 100644
> --- a/drivers/gpu/drm/vc4/vc4_regs.h
> +++ b/drivers/gpu/drm/vc4/vc4_regs.h
> @@ -366,7 +366,6 @@
> # define SCALER_DISPBKGND_FILL BIT(24)
>
> #define SCALER_DISPSTAT0 0x00000048
> -#define SCALER_DISPBASE0 0x0000004c
> # define SCALER_DISPSTATX_MODE_MASK VC4_MASK(31, 30)
> # define SCALER_DISPSTATX_MODE_SHIFT 30
> # define SCALER_DISPSTATX_MODE_DISABLED 0
> @@ -379,6 +378,20 @@
> # define SCALER_DISPSTATX_FRAME_COUNT_SHIFT 12
> # define SCALER_DISPSTATX_LINE_MASK VC4_MASK(11, 0)
> # define SCALER_DISPSTATX_LINE_SHIFT 0
> +
> +#define SCALER_DISPBASE0 0x0000004c
> +/* Last pixel in the COB (display FIFO memory) allocated to this HVS
> + * channel. Must be 4-pixel aligned (and thus 4 pixels less than the
> + * next COB base).
> + */
> +# define SCALER_DISPBASEX_TOP_MASK VC4_MASK(31, 16)
> +# define SCALER_DISPBASEX_TOP_SHIFT 16
> +/* First pixel in the COB (display FIFO memory) allocated to this HVS
> + * channel. Must be 4-pixel aligned.
> + */
> +# define SCALER_DISPBASEX_BASE_MASK VC4_MASK(15, 0)
> +# define SCALER_DISPBASEX_BASE_SHIFT 0
> +
> #define SCALER_DISPCTRL1 0x00000050
> #define SCALER_DISPBKGND1 0x00000054
> #define SCALER_DISPBKGNDX(x) (SCALER_DISPBKGND0 + \
> @@ -389,6 +402,9 @@
> (x) * (SCALER_DISPSTAT1 - \
> SCALER_DISPSTAT0))
> #define SCALER_DISPBASE1 0x0000005c
> +#define SCALER_DISPBASEX(x) (SCALER_DISPBASE0 + \
> + (x) * (SCALER_DISPBASE1 - \
> + SCALER_DISPBASE0))
> #define SCALER_DISPCTRL2 0x00000060
> #define SCALER_DISPCTRLX(x) (SCALER_DISPCTRL0 + \
> (x) * (SCALER_DISPCTRL1 - \
>
next prev parent reply other threads:[~2016-07-09 17:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 6:17 Precise vblank timestamping for VC4 kms Mario Kleiner
2016-06-23 6:17 ` [PATCH] drm/vc4: Implement precise vblank timestamping Mario Kleiner
2016-07-08 2:31 ` Eric Anholt
2016-07-08 18:44 ` [PATCH 1/2] drm/vc4: Bind the HVS before we bind the individual CRTCs Eric Anholt
2016-07-08 18:44 ` Eric Anholt
2016-07-08 18:44 ` [PATCH 2/2] drm/vc4: Squash commit for Mario's precise vblank timestamping Eric Anholt
2016-07-08 18:44 ` Eric Anholt
2016-07-09 17:09 ` Mario Kleiner [this message]
2016-07-09 17:09 ` Mario Kleiner
2016-07-10 16:05 ` Eric Anholt
2016-07-10 16:05 ` Eric Anholt
2016-06-23 7:28 ` Precise vblank timestamping for VC4 kms Daniel Vetter
2016-06-27 10:31 ` Mario Kleiner
2016-06-23 13:18 ` Ville Syrjälä
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=57812FB0.6000207@gmail.com \
--to=mario.kleiner.de@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=linux-kernel@vger.kernel.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.