All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Jyri Sarha <jsarha@ti.com>, dri-devel@lists.freedesktop.org
Cc: peter.ujfalusi@ti.com, laurent.pinchart@ideasonboard.com
Subject: Re: [PATCH 3/4] drm/omapdrm: Work-a-round for errata i734 (LCD1 Gamma) in DSS dispc
Date: Mon, 23 May 2016 14:00:27 +0300	[thread overview]
Message-ID: <5742E2CB.20009@ti.com> (raw)
In-Reply-To: <5742D273.5020204@ti.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1843 bytes --]


On 23/05/16 12:50, Jyri Sarha wrote:
> On 05/20/16 16:21, Tomi Valkeinen wrote:
>>>> +
>>>> +static int dispc_errata_i734_wa_init(void)
>>>> +{
>>>> +	size_t buff_size = i734.ovli.width * i734.ovli.height *
>> "buf_size" would match the other names =).
>>
>> Usually I try to do only simple initializations when declaring the
>> locals. This is a bit on the complex side, and also there's a check
>> below that can make all this init calculation not needed.
>>
> 
> Compiler optimizations should delay the initialization to happen only if
> it is needed.

That is true.

My worry is more on the functional side: if you do, say, calculations
there and, e.g. do a division, it's easy to get division by zero if all
the variables are not actually valid. Or if you do get_foo(channel), and
get_foo() only works for certain channels, again you could hit a crash.

Those kind of things happen easily when you have code like:

int foo = get_foo(channel);

if (channel != XYZ)
	return;

>>>> +
>>>> +static void dispc_errata_i734_wa(void)
>>>> +{
>>>> +	u32 vsync_irq = dispc_mgr_get_vsync_irq(OMAP_DSS_CHANNEL_LCD);
>>>> +	u32 framedone_irq = dispc_mgr_get_framedone_irq(OMAP_DSS_CHANNEL_LCD);
>>>> +	u32 gatestate = REG_GET(DISPC_CONTROL, 8, 4);
>> Here too, too complex initializations. Especially doing register
>> reads/writes should be something done in the "real" code. The bits you
>> read might not even be valid on some platforms which don't have the i734.
>>
> 
> You are right about the register read. Compiler should not optimize the
> register access. But - but with your permission - I'll keep the IRQ mask
> initializations as they are quite constant in nature anyway.

Yes, those should be fine. Presuming all DSS versions have CHANNEL_LCD,
which happens to be the case =).

 Tomi


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

  reply	other threads:[~2016-05-23 11:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20  6:35 [PATCH 0/4] drm/omapdrm: gamma table support Jyri Sarha
2016-05-20  6:35 ` [PATCH 1/4] drm/omapdrm: omap_modeset_init: Separate crtc id and plane id indexing Jyri Sarha
2016-05-20 12:14   ` Tomi Valkeinen
2016-05-20  6:35 ` [PATCH 2/4] drm/omapdrm: Add gamma table support to DSS dispc Jyri Sarha
2016-05-20 12:51   ` Tomi Valkeinen
2016-05-20 13:14     ` Jyri Sarha
2016-05-20 13:23       ` Tomi Valkeinen
2016-05-20  6:35 ` [PATCH 3/4] drm/omapdrm: Work-a-round for errata i734 (LCD1 Gamma) in " Jyri Sarha
2016-05-20 13:21   ` Tomi Valkeinen
2016-05-23  9:50     ` Jyri Sarha
2016-05-23 11:00       ` Tomi Valkeinen [this message]
2016-05-20  6:35 ` [PATCH 4/4] drm/omapdrm: Implement gamma_lut atomic crtc property Jyri Sarha
2016-05-20  7:05   ` Daniel Vetter
2016-05-20  7:35     ` Jyri Sarha
2016-05-20  8:14       ` 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=5742E2CB.20009@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=peter.ujfalusi@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.