From: Ilia Mirkin <imirkin@alum.mit.edu>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/2] edid-decode: add function to enable usage as a library
Date: Mon, 10 Feb 2020 09:58:57 -0500 [thread overview]
Message-ID: <CAKb7Uvj2XV0+tr48EetVE1e_Vqpr-2zQCnR7NCWagWnbCEcyeQ@mail.gmail.com> (raw)
In-Reply-To: <3e56402b-9841-99a3-730c-b1fd2bc2cc5d@xs4all.nl>
On Mon, Feb 10, 2020 at 6:23 AM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
>
> Hi Ilia,
>
> I pushed my patch to initialize edid_state in the constructor to the
> edid-decode git repo.
Hmm... I thought it should already work before that. Things should get
zero-initialized in C++ constructors. There are some subtleties with
PODs though, but I don't think they apply here. But it's been a while
since I've looked at those C++ details, and your update constructor
definitely doesn't hurt.
>
> I've also split off the 'write to a file' part from edid_from_file into
> a separate edid_to_file function, so you'll have to rebase your patch.
Will do.
>
> Two comments below:
>
> On 2/9/20 6:49 PM, Ilia Mirkin wrote:
> > This is helpful for an emscripten setup, as there's no great way to
> > reinitialize the object from scratch.
> >
> > Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> > ---
> > edid-decode.cpp | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/edid-decode.cpp b/edid-decode.cpp
> > index ef50da2..fd17bc6 100644
> > --- a/edid-decode.cpp
> > +++ b/edid-decode.cpp
> > @@ -1005,3 +1005,21 @@ int main(int argc, char **argv)
> > return edid_from_file(argv[optind], argv[optind + 1], out_fmt);
> > return ret ? ret : state.parse_edid();
> > }
> > +
> > +#ifdef __EMSCRIPTEN__
> > +/*
> > + * The surrounding JavaScript implementation will call this function
> > + * each time it wants to decode an EDID. So this should reset all the
> > + * state and start over.
> > + */
> > +extern "C" int parse_edid(const char *input) {
>
> '{' should start on the next line. Let's keep the coding style consistent.
Right, my bad.
>
> > + for (unsigned i = 0; i < EDID_MAX_BLOCKS + 1; i++) {
> > + s_msgs[i][0].clear();
> > + s_msgs[i][1].clear();
> > + }
>
> I'm pretty sure that this for loop is not necessary. Can you drop this
> for loop and see if it works?
The current code has:
static void show_msgs(bool is_warn)
{
printf("\n%s:\n\n", is_warn ? "Warnings" : "Failures");
for (unsigned i = 0; i < state.num_blocks; i++) {
if (s_msgs[i][is_warn].empty())
continue;
print-the-error
What would prevent an error from a previous run to appear without an
explicit clearing of s_msgs?
>
> > + options[OptCheck] = 1;
> > + state = edid_state();
> > + int ret = edid_from_file(input, NULL, OUT_FMT_DEFAULT);
> > + return ret ? ret : state.parse_edid();
> > +}
> > +#endif
> >
>
> Regards,
>
> Hans
next prev parent reply other threads:[~2020-02-10 14:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-09 17:49 [PATCH 0/2] edid-decode: add emscripten support Ilia Mirkin
2020-02-09 17:49 ` [PATCH 1/2] edid-decode: add function to enable usage as a library Ilia Mirkin
2020-02-10 11:23 ` Hans Verkuil
2020-02-10 14:58 ` Ilia Mirkin [this message]
2020-02-13 0:48 ` Ilia Mirkin
2020-02-13 7:16 ` Hans Verkuil
2020-02-09 17:49 ` [PATCH 2/2] edid-decode: add build rule for emscripten output Ilia Mirkin
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=CAKb7Uvj2XV0+tr48EetVE1e_Vqpr-2zQCnR7NCWagWnbCEcyeQ@mail.gmail.com \
--to=imirkin@alum.mit.edu \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-media@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 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).