All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Arun Kumar K <arunkk.samsung@gmail.com>,
	Pawel Osciak <posciak@chromium.org>,
	Kamil Debski <k.debski@samsung.com>
Cc: Arun Kumar K <arun.kk@samsung.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Kiran Avnd <avnd.kiran@samsung.com>
Subject: Re: [PATCH 1/3] [media] s5p-mfc: Add variants to access mfc registers
Date: Fri, 09 May 2014 07:20:30 +0200	[thread overview]
Message-ID: <536C659E.5030601@gmail.com> (raw)
In-Reply-To: <536C5E53.8030007@gmail.com>

Hi Arun, Paweł,

On 09.05.2014 06:49, Arun Kumar K wrote:
> Hi Kamil,
>
> On 05/09/14 06:30, Pawel Osciak wrote:
>> Hi Kamil,
>>
>> On Fri, May 9, 2014 at 1:31 AM, Kamil Debski <k.debski@samsung.com> wrote:
>>>
>>> Hi Arun,
>>>
>>> I think that this driver is getting too complicated now.
>>>
>>> First there are separate files for MFC versions, but in addition there are
>>> many
>>> IF_MFCVx in there.
>>
>> The intention of this patch is to actually get rid of IF_MFCVx
>> conditionals wherever possible.
>>
>>>
>>> I am curious how many additional lines it would take to
>>> add s5p_mfc_cmd_v8.* and s5p_mfc_opr_v8.*.
>>>
>>> I get the point that this approach may result in less lines added, but
>>> having a callback specific for version use register pointers specific for
>>> another version makes the code look unreadable and difficult to maintain.
>>
>> Could you please give an example of how this reduces readability?
>> I personally feel this patch makes things much more readable (see below).
>>
>> On the other hand, if we continued without the current method, we
>> would have to sprinkle
>> IF_MFCVx macros all around actual functions/operations, instead of
>> just containing this
>> to the regs structure, and the only difference in each path would be
>> register name defines.
>> I don't feel this would be a better direction to be honest.
>>
>> Compare, new, after this patch:
>>
>>> +     WRITEL(y_addr, mfc_regs->e_source_first_plane_addr);
>>> +     WRITEL(c_addr, mfc_regs->e_source_second_plane_addr);
>>
>> vs previously, before this patch:
>>
>>> -     if (IS_MFCV7(dev)) {
>>> -             WRITEL(y_addr, S5P_FIMV_E_SOURCE_FIRST_ADDR_V7);
>>> -             WRITEL(c_addr, S5P_FIMV_E_SOURCE_SECOND_ADDR_V7);
>>> -     } else {
>>> -             WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6);
>>> -             WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6);
>>> -     }
>>
>> And of course adding V8 more would make it even worse with yet another
>> else if case.
>>
>>
>>> Please give your opinion on another way to add support for v8.
>>> s5p_mfc_cmd_v8.* and s5p_mfc_opr_v8.* ?
>>
>> If we add v7 and v8 files, a majority of their code will look like this:
>>
>> s5p_mfc_opr_v6.c:
>> (...)
>> void foo_v6(args)
>> {
>>     foofun(REGISTER_A_V6);
>>     barfun(REGISTER_B_V6);
>> }
>> (...)
>>
>> s5p_mfc_opr_v7.c:
>> (...)
>> void foo_v7(args)
>> {
>>     foofun(REGISTER_A_V7);
>>     barfun(REGISTER_B_V7);
>> }
>> (...)
>>
>> s5p_mfc_opr_v8.c:
>> (...)
>> void foo_v8(args)
>> {
>>     foofun(REGISTER_A_V8);
>>     barfun(REGISTER_B_V8);
>> }
>> (...)
>>
>> I'm not sure this is less error prone and less code...
>>
>
> Adding on to this, I had a discussion with the firmware team and what I
> got to know is future firmwares are also going to keep the operation
> sequence same as v6, but there can be more changes in register offsets
> as they accomodate more features. So if we go with opr_v8.c, we _might_
> need opr_v9.c also with hardly any change in the code except register
> offset modifications.

If register offsets make for most of the differences between particular 
MFC versions, then probably having the register pointers used instead of 
base + OFFSET could be useful. Unfortunately we don't have much 
information about the newer variants, so it's hard to say.

Btw. I wonder why the firmware team couldn't simply add new registers at 
the end of the address space, without breaking software compatibility 
with every new version, even though rest of programming model mostly 
stays intact, which is a pure nonsense. Couldn't you complain to the for 
this if you have contact with them? Otherwise this madness will never stop.

Best regards,
Tomasz

  reply	other threads:[~2014-05-09  5:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 12:57 [PATCH 0/3] Add MFCv8 support Arun Kumar K
2014-04-23 12:57 ` [PATCH 1/3] [media] s5p-mfc: Add variants to access mfc registers Arun Kumar K
2014-05-08 16:31   ` Kamil Debski
2014-05-09  1:00     ` Pawel Osciak
2014-05-09  4:49       ` Arun Kumar K
2014-05-09  5:20         ` Tomasz Figa [this message]
2014-05-09  5:31           ` Arun Kumar K
2014-05-13 10:33       ` Kamil Debski
2014-05-13 10:32   ` Kamil Debski
2014-05-13 11:24     ` Arun Kumar K
2014-04-23 12:57 ` [PATCH 2/3] [media] s5p-mfc: Core support to add v8 decoder Arun Kumar K
2014-04-29 17:15   ` Sachin Kamat
2014-04-30  5:45     ` Arun Kumar K
2014-04-30  5:49       ` Sachin Kamat
2014-04-30  5:52         ` Arun Kumar K
2014-04-23 12:57 ` [PATCH 3/3] [media] s5p-mfc: Rename IS_MFCV7 macro Arun Kumar K

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=536C659E.5030601@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=arun.kk@samsung.com \
    --cc=arunkk.samsung@gmail.com \
    --cc=avnd.kiran@samsung.com \
    --cc=k.debski@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=posciak@chromium.org \
    --cc=s.nawrocki@samsung.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.