[RFC,libdrm 1/3] tegra: Add stream library
Mark Zhang
nvmarkzhang at gmail.com
Thu Dec 27 22:47:23 PST 2012
I just skimmed the code of libdrm while I'm trying to understand the
host1x driver. So below is what I found.
Mark
On 12/13/2012 10:01 PM, Arto Meriläinen wrote:
> From: Arto Merilainen <amerilainen at nvidia.com>
>
> This patch introduces tegra stream library. The library is used for
> buffer management, command stream construction and work
> synchronization.
>
[...]
> +
> +/*
> + * tegra_fence_is_valid(fence)
> + *
> + * Check validity of a fence. We just check that the fence range
> + * is valid w.r.t. host1x hardware.
> + */
> +
> +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.
> + 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.
> +
> + 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 */
>
More information about the dri-devel
mailing list