All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arto Merilainen <amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Mark Zhang <nvmarkzhang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org"
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>,
	"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Francis Hart <fhart-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Terje Bergstrom
	<tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: Re: [RFC,libdrm 1/3] tegra: Add stream library
Date: Fri, 28 Dec 2012 09:45:48 +0200	[thread overview]
Message-ID: <50DD4E2C.2070104@nvidia.com> (raw)
In-Reply-To: <50DD407B.3030306-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 12/28/2012 08:47 AM, Mark Zhang wrote:
>> +int tegra_fence_is_valid(const struct tegra_fence *fence)
>> +{
>> +    int valid = fence ? 1 : 0;
>> +    valid = valid && fence->id != (uint32_t) -1;
>> +    valid = valid && fence->id < 32;
>
> Hardcode here. Assume always has 32 syncpts.
> Change to a micro wrapped with tegra version ifdef will be better.
>

You are correct. I will fix this.

>> +    return valid;
>> +}
>> +
> [...]
>> +
>> +    /* Add fences */
>> +    if (num_fences) {
>> +
>> +        tegra_stream_push(stream,
>> +            nvhost_opcode_setclass(NV_HOST1X_CLASS_ID,
>> +            host1x_uclass_wait_syncpt_r(), num_fences));
>> +
>> +        for (; num_fences; num_fences--, fence++) {
>> +            assert(tegra_fence_is_valid(fence));
>
> This is useless. We already add "1 + num_fences" to num_words above. So
> move this "assert" before adding "1 + num_fences" to num_words makes sense.
>

The assertion checks the validity of a single fence - not if there is 
room in the command buffer.

The goal is to prevent having invalid fences in the command stream. If 
this check were not here it would be possible to initialise a fence with 
tegra_fence_clear() and put that fence into the stream.

>> +
>> +            tegra_stream_push(stream, nvhost_class_host_wait_syncpt(fence->id,
>> +                fence->value));
>> +        }
>> +    }
>> +
>> +    if (class_id)
>> +        tegra_stream_push(stream, nvhost_opcode_setclass(class_id, 0, 0));
>> +
>> +    return 0;
>> +}
>> +
> [...]
>> +
>> +#endif /* TEGRA_DRMIF_H */
>>

- Arto

  parent reply	other threads:[~2012-12-28  7:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13 14:01 [RFC,libdrm 0/3] NVIDIA Tegra support Arto Meriläinen
2012-12-13 14:01 ` [RFC,libdrm 1/3] tegra: Add stream library Arto Meriläinen
     [not found]   ` <1355407268-32381-2-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-28  6:47     ` Mark Zhang
     [not found]       ` <50DD407B.3030306-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-28  7:45         ` Arto Merilainen [this message]
     [not found]           ` <50DD4E2C.2070104-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-28  7:57             ` Mark Zhang
     [not found]               ` <50DD50E1.80006-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-28  8:50                 ` Arto Merilainen
     [not found]                   ` <50DD5D6D.3090504-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-28  9:04                     ` Mark Zhang
     [not found]                       ` <50DD6098.60900-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-28  9:20                         ` Arto Merilainen
2012-12-28 20:48             ` Thierry Reding
     [not found]               ` <20121228204847.GA4309-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-12-31  6:22                 ` Terje Bergström
     [not found]                   ` <50E12F1A.3000803-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-02  2:44                     ` Mark Zhang
     [not found]                       ` <50E39F2A.1000405-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-02  6:31                         ` Terje Bergström
     [not found]                           ` <50E3D45D.5050206-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-02  6:53                             ` Mark Zhang
2012-12-13 14:01 ` [RFC,libdrm 2/3] tegra: Add 2d library Arto Meriläinen
     [not found]   ` <1355407268-32381-3-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-12-28  6:48     ` Mark Zhang
2012-12-13 14:01 ` [RFC,libdrm 3/3] tests: tegra: Add 2d tests Arto Meriläinen

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=50DD4E2C.2070104@nvidia.com \
    --to=amerilainen-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=fhart-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nvmarkzhang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.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.