[RFC,libdrm 1/3] tegra: Add stream library

2013-01-02 Thread Mark Zhang
On 01/02/2013 02:31 PM, Terje Bergstr?m wrote: > On 02.01.2013 04:44, Mark Zhang wrote: >> Agree. If we are able to do something dynamically, normally that'll be >> better. >> >> Terje, we can get the Tegra version in FUSE. I think we don't need this >> kind of try-catch logics. > > We'd need to h

[RFC,libdrm 1/3] tegra: Add stream library

2013-01-02 Thread Mark Zhang
On 12/31/2012 02:22 PM, Terje Bergstr?m wrote: > On 28.12.2012 22:48, Thierry Reding wrote: >> I disagree. We shouldn't be hiding this kind of detail behind an #ifdef. >> Instead it should be detected at runtime. Otherwise you'll need to build >> different versions of libdrm for every generation of

[RFC,libdrm 1/3] tegra: Add stream library

2013-01-02 Thread Terje Bergström
On 02.01.2013 04:44, Mark Zhang wrote: > Agree. If we are able to do something dynamically, normally that'll be > better. > > Terje, we can get the Tegra version in FUSE. I think we don't need this > kind of try-catch logics. We'd need to have in user space a map of SoC version -> number of sync

Re: [RFC,libdrm 1/3] tegra: Add stream library

2013-01-01 Thread Mark Zhang
On 01/02/2013 02:31 PM, Terje Bergström wrote: > On 02.01.2013 04:44, Mark Zhang wrote: >> Agree. If we are able to do something dynamically, normally that'll be >> better. >> >> Terje, we can get the Tegra version in FUSE. I think we don't need this >> kind of try-catch logics. > > We'd need to h

Re: [RFC,libdrm 1/3] tegra: Add stream library

2013-01-01 Thread Terje Bergström
On 02.01.2013 04:44, Mark Zhang wrote: > Agree. If we are able to do something dynamically, normally that'll be > better. > > Terje, we can get the Tegra version in FUSE. I think we don't need this > kind of try-catch logics. We'd need to have in user space a map of SoC version -> number of sync

Re: [RFC,libdrm 1/3] tegra: Add stream library

2013-01-01 Thread Mark Zhang
On 12/31/2012 02:22 PM, Terje Bergström wrote: > On 28.12.2012 22:48, Thierry Reding wrote: >> I disagree. We shouldn't be hiding this kind of detail behind an #ifdef. >> Instead it should be detected at runtime. Otherwise you'll need to build >> different versions of libdrm for every generation of

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-31 Thread Terje Bergström
On 28.12.2012 22:48, Thierry Reding wrote: > I disagree. We shouldn't be hiding this kind of detail behind an #ifdef. > Instead it should be detected at runtime. Otherwise you'll need to build > different versions of libdrm for every generation of Tegra. That may be > fine for NVIDIA provided BSPs,

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-30 Thread Terje Bergström
On 28.12.2012 22:48, Thierry Reding wrote: > I disagree. We shouldn't be hiding this kind of detail behind an #ifdef. > Instead it should be detected at runtime. Otherwise you'll need to build > different versions of libdrm for every generation of Tegra. That may be > fine for NVIDIA provided BSPs,

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Thierry Reding
On Fri, Dec 28, 2012 at 09:45:48AM +0200, Arto Merilainen wrote: > 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 && fenc

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Mark Zhang
On 12/28/2012 04:50 PM, Arto Merilainen wrote: > On 12/28/2012 09:57 AM, Mark Zhang wrote: >> On 12/28/2012 03:45 PM, Arto Merilainen wrote: >>> On 12/28/2012 08:47 AM, Mark Zhang wrote: > + > +/* Add fences */ > +if (num_fences) { > + > +tegra_stream_push(stream

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Mark Zhang
On 12/28/2012 03:45 PM, Arto Merilainen wrote: > 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; >> >>

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Mark Zhang
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 > > This patch introduces tegra stream library. The library is used for > buffer management, command stream co

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Thierry Reding
On Fri, Dec 28, 2012 at 09:45:48AM +0200, Arto Merilainen wrote: > 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 && fenc

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Arto Merilainen
On 12/28/2012 11:04 AM, Mark Zhang wrote: > On 12/28/2012 04:50 PM, Arto Merilainen wrote: >> >> In my opinion asking tegra_stream_begin() to put a bad fence into the >> stream is a case we should never be. assert() kills the application >> immediately (in debug builds) and usually this helps the p

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Arto Merilainen
On 12/28/2012 09:57 AM, Mark Zhang wrote: > On 12/28/2012 03:45 PM, Arto Merilainen wrote: >> On 12/28/2012 08:47 AM, Mark Zhang wrote: + +/* Add fences */ +if (num_fences) { + +tegra_stream_push(stream, +nvhost_opcode_setclass(NV_HOST1X_CLA

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Arto Merilainen
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

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Arto Merilainen
On 12/28/2012 11:04 AM, Mark Zhang wrote: On 12/28/2012 04:50 PM, Arto Merilainen wrote: In my opinion asking tegra_stream_begin() to put a bad fence into the stream is a case we should never be. assert() kills the application immediately (in debug builds) and usually this helps the programmer

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Mark Zhang
On 12/28/2012 04:50 PM, Arto Merilainen wrote: > On 12/28/2012 09:57 AM, Mark Zhang wrote: >> On 12/28/2012 03:45 PM, Arto Merilainen wrote: >>> On 12/28/2012 08:47 AM, Mark Zhang wrote: > + > +/* Add fences */ > +if (num_fences) { > + > +tegra_stream_push(stream

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-28 Thread Arto Merilainen
On 12/28/2012 09:57 AM, Mark Zhang wrote: On 12/28/2012 03:45 PM, Arto Merilainen wrote: On 12/28/2012 08:47 AM, Mark Zhang wrote: + +/* Add fences */ +if (num_fences) { + +tegra_stream_push(stream, +nvhost_opcode_setclass(NV_HOST1X_CLASS_ID, +host1x_ucla

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-27 Thread Mark Zhang
On 12/28/2012 03:45 PM, Arto Merilainen wrote: > 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; >> >>

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-27 Thread Arto Merilainen
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

Re: [RFC,libdrm 1/3] tegra: Add stream library

2012-12-27 Thread Mark Zhang
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 > > This patch introduces tegra stream library. The library is used for > buffer management, command stream co

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-13 Thread Arto Meriläinen
From: Arto Merilainen This patch introduces tegra stream library. The library is used for buffer management, command stream construction and work synchronization. Signed-off-by: Arto Merilainen --- Makefile.am|6 +- configure.ac | 13 + tegra/Makefile.am

[RFC,libdrm 1/3] tegra: Add stream library

2012-12-13 Thread Arto Meriläinen
From: Arto Merilainen This patch introduces tegra stream library. The library is used for buffer management, command stream construction and work synchronization. Signed-off-by: Arto Merilainen --- Makefile.am|6 +- configure.ac | 13 + tegra/Makefile.am