dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Figa <tfiga@chromium.org>
To: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 3/5] drm/rockchip: vop: introduce VOP_REG_MASK
Date: Thu, 2 Jun 2016 07:19:23 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160602T090257-641@post.gmane.org> (raw)
In-Reply-To: 1461133097-1478-4-git-send-email-mark.yao@rock-chips.com

Hi Mark,

Mark Yao <mark.yao <at> rock-chips.com> writes:

> 
> Some new vop register support mask, bit[16-31] is mask,
> bit[0-15] is value, the mask is correspond to the value.

Please see my comments inline.

> 
> Signed-off-by: Mark Yao <mark.yao <at> rock-chips.com>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   45 ++++++++++++++-------
------
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.h |    1 +
>  drivers/gpu/drm/rockchip/rockchip_vop_reg.c |    9 +++++-
>  3 files changed, 32 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 28596e7..59f24cd 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
[snip]
> -static inline void vop_mask_write_relaxed(struct vop *vop, uint32_t 
offset,
> -					  uint32_t mask, uint32_t v)
> -{
> -	if (mask) {
> +	if (write_mask) {
> +		v = (v << shift) | (mask << (shift + 16));

If the caller gives "v" too big, it might get over the bit 16 and affect
the mask. IMHO it would be much safer to mask (v << shift) with 0xffff
just in case.

> +	} else {
>  		uint32_t cached_val = vop->regsbak[offset >> 2];
> 
> -		cached_val = (cached_val & ~mask) | v;
> -		writel_relaxed(cached_val, vop->regs + offset);
> -		vop->regsbak[offset >> 2] = cached_val;
> +		v = (cached_val & ~(mask << shift)) | (v << shift);

Should we also mask "v" with "mask" for better safety?

Best regards,
Tomasz


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

  reply	other threads:[~2016-06-02  7:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20  6:18 [PATCH v2 0/5] drm/rockchip: add rk3399 display controller support Mark Yao
2016-04-20  6:18 ` [PATCH v2 1/5] drm/rockchip: sort registers define by chip's number Mark Yao
2016-06-02  6:51   ` Tomasz Figa
2016-06-02  7:05     ` Mark yao
2016-08-17 17:20     ` [PATCH v3 " Sean Paul
2016-08-18  9:08       ` Mark yao
2016-08-18  9:11         ` Daniel Vetter
2016-08-18 10:02           ` Mark yao
2016-08-22 20:30             ` Sean Paul
2016-08-23  0:40               ` Mark yao
2016-08-23 13:13                 ` Sean Paul
2016-08-25  2:25                   ` Mark yao
2016-08-25 17:15                     ` Sean Paul
2016-08-25 17:17                       ` Sean Paul
2016-04-20  6:18 ` [PATCH v2 2/5] dt-bindings: sort Rockchip vop compatible " Mark Yao
2016-04-20  6:18 ` [PATCH v2 3/5] drm/rockchip: vop: introduce VOP_REG_MASK Mark Yao
2016-06-02  7:19   ` Tomasz Figa [this message]
2016-08-17 17:23     ` [PATCH v3 " Sean Paul
2016-04-20  6:18 ` [PATCH v2 4/5] drm/rockchip: vop: add rk3399 vop support Mark Yao
2016-06-02  7:27   ` Tomasz Figa
2016-04-20  6:20 ` [PATCH v2 5/5] dt-bindings: add documentation for Rockchip rk3399 display controllers Mark Yao
2016-06-02  7:33   ` Tomasz Figa
2016-08-17 17:16     ` [PATCH v3 5/5] dt-bindings: add compatible strings for big/little rockchip vops Sean Paul
     [not found] <0001-<1471454202-1631-1-git-send-email-seanpaul@chromium.org>
2016-08-18 21:12 ` Sean Paul
     [not found]   ` <1471554763-22202-1-git-send-email-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-08-19 13:50     ` Rob Herring

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=loom.20160602T090257-641@post.gmane.org \
    --to=tfiga@chromium.org \
    --cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).