Replies: 26 comments 11 replies
-
made a lot of progress on the cairo A4 format item this week. the norns side is pretty much implemented, just have to go back to my libcairo branch now and find what I missed. |
Beta Was this translation helpful? Give feedback.
-
Found there was nothing wrong with my cairo branch in the end, it just needs to be configured with XCB surfaces.
However, I found with A8 and A4 drawing surfaces, some screen text appears to be double width. I think it may have something to do with anti-aliasing. I'm looking into it now. |
Beta Was this translation helpful? Give feedback.
-
This also appears to be a compilation issue, using the standard package with the same norns code doesn't have this result. Essentially when the text extents of I'll see if I can find what options the apt package is compiled with. |
Beta Was this translation helpful? Give feedback.
-
Successfully tested 60 FPS this morning. Only change to the driver was actually clocking down the refresh rate a bit ~111Hz to ~61 Hz. A change to the SPI overlay is what traverses through FBTFT. No noticeable increase in battery usage. FullSizeRender.MOVWill put together a fresh image with gamma controls, Cairo changes, and the FPS all rolled in. After that gonna work on compiling the driver out of tree, and see if I can make it installable with a Debian package. If not, I may try building my own SPI driver. This is captured with my phone at 120 fps. Just a simple script that increments a number every frame at 60 fps. |
Beta Was this translation helpful? Give feedback.
-
very cool, and surprised the driver didn't need a more major change i can test out the image here. the video above is a bit confusing, but perhaps it's a web codec issue on my end? it counts up to 60 twice over the course of 10 seconds? |
Beta Was this translation helpful? Give feedback.
-
@tehn Script:
|
Beta Was this translation helpful? Give feedback.
-
apologies for the delay. just checking the build info for the image you posted: is it for a shield? copied it to a standard norns and getting this error when trying to run
|
Beta Was this translation helpful? Give feedback.
-
No, the image should be for the standard norns. I will double check the image later today, you can reinstalling I've also thought of another way of accomplishing this that perhaps I could get your thoughts on, since it wouldn't require changes to the kernel. We can change the device overlay (it's not built into the kernel) to make the SPI behave as just a generic SPI device, and interact with the screen in the userspace via matron. This not only opens up a lot more possibilities for future improvements, but also removes the need for a frame buffer abstraction in the first place since we could copy the cairo surface directly from I was working on this a bit last week. I can share more when I have a proof of concept. |
Beta Was this translation helpful? Give feedback.
-
@tlubke thanks for the tip, i'll attempt to re-install the lib honestly i'd very much like to avoid a kernel change if possible--- we just recently put the entire userbase through re-imaging and it's perceived (rightly so) as a hassle. but i think 60fps is worth it, personally :) so yes, i'm very interested in your proposal. i don't have any issues philosophically with userspace SPI. in general i'd like to think of the norns more as an embedded system rather than a computer (if that makes sense). |
Beta Was this translation helpful? Give feedback.
-
@tehn I know norns hardware isn't open source, but is there a schematic I could reference? Is it the same pin layout as the shield? I've got SPI devices set up in |
Beta Was this translation helpful? Give feedback.
-
here's the pinout:
https://github.com/monome/norns-image/blob/main/readme-hardware.md#pinout-1
let me know if you need more, happy to provide
…On Tue, Oct 18, 2022 at 6:27 PM tlubke ***@***.***> wrote:
@tehn <https://github.com/tehn> I know norns hardware isn't open source,
but is there a schematic I could reference? Is it the same pin layout as
the shield?
—
Reply to this email directly, view it on GitHub
<#1600 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB4I4EB2HQ5XEJBTL3SLW3WD4P4JANCNFSM6AAAAAAQKYXZLM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
wow. drawing some 60 fps circles with slowly pulsing radii. it's really, really impressive! it'd be great to have some broader testing with this big change--- i'm curious to see how certain heavy scripts react to the new capability. ie, if people can easily convert their scripts to 60fps with a few character edits, this might have ripple effects on the performance of their script. so we may need to do some more docs on optimization. (ps, ended up my first download of the image was corrupted, hence my troubles) any further insights into userland spi? |
Beta Was this translation helpful? Give feedback.
-
Agreed. I think optimization docs should come first, but having SPI in the userspace might allow matron to smartly throttle things and give users a warning. The few scripts I've seen that come closing to maxing out the CPU don't have very intense screen operations. I assume there is no current priority to one system over another (i.e. screen over clock over super collider)?
I believe I'm close, but I may need some help or some more eyes to see what I'm missing. I've tried both using linux IOCTL, and using the BCM2835 library. I just uploaded branches. As a proof of concept, I am trying to turn on "ALL ON" mode, and get the whole screen to light up, the branches only set normal mode like in the driver init. For both of the branches, I experimented with setting different SPI modes, chip selects, and write speeds. IOCTLDefault SPI enabled via
https://github.com/tlubke/norns/tree/tlubke/userspace-spi-IOCTL I am able to see that the right amount of bytes are being written to spidev0.0, and I don't see any error messages on the GPIO writes. Nothing appears to happen on the screen though. BCM2835Since I saw we use the driver in the overlay, figured I would try using the library. Use of the library's SPI function requires that SPI be disabled in https://github.com/tlubke/norns/tree/tlubke/userspace-spi-bcm2835 Side note: I see there is a discussions page in the norns repo now, should I move this issue there (if that is easy/possible)? |
Beta Was this translation helpful? Give feedback.
-
this would be a great use of the discussions page!
…On Tue, Oct 25, 2022 at 2:56 PM tlubke ***@***.***> wrote:
@tehn <https://github.com/tehn>
it'd be great to have some broader testing with this big change--- i'm
curious to see how certain heavy scripts react to the new capability. ie,
if people can easily convert their scripts to 60fps with a few character
edits, this might have ripple effects on the performance of their script.
so we may need to do some more docs on optimization.
Agreed. I think optimization docs should come first, but having SPI in the
userspace might allow matron to smartly throttle things and give users a
warning. The few scripts I've seen that come closing to maxing out the CPU
don't have very intense screen operations. I assume there is no current
priority to one system over another (i.e. screen over clock over super
collider)?
any further insights into userland spi?
I believe I'm close, but I may need some help or some more eyes to see
what I'm missing. I've tried both using linux IOCTL, and using the BCM2835
library. I just uploaded branches. As a proof of concept, I am trying to
turn on "ALL ON" mode, and get the whole screen to light up, the branches
only set normal mode like in the driver init.
For both of the branches, I experimented with setting different SPI modes,
chip selects, and write speeds.
IOCTL
Default SPI enabled via raspi-config and editing /boot/config.txt
...
# Display
# Connected using SPI
dtparam=spi=on
#dtoverlay=ssd1322-spi
https://github.com/tlubke/norns/tree/tlubke/userspace-spi-IOCTL
I am able to see that the right amount of bytes are being written to
spidev0.0, and I don't see any error messages on the GPIO writes. Nothing
appears to happen on the screen though.
BCM2835
Since I saw we use the driver in the overlay, figured I would try using
the library. Use of the library's SPI function requires that SPI be
disabled in raspi-config, and matron has to be run as sudo. I didn't have
access to a device file system to check if bytes were being written, so it
was a bit of a shot in the dark.
https://github.com/tlubke/norns/tree/tlubke/userspace-spi-bcm2835
Side note: I see there is a discussions page in the norns repo now, should
I move this issue there (if that is easy/possible)?
—
Reply to this email directly, view it on GitHub
<#1600 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB4I4CJ4Q2ONVXN6BHAOVTWFAUMNANCNFSM6AAAAAAQKYXZLM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I don't think I have the repo permissions to do this. Could one of you convert the issue when you find the time? |
Beta Was this translation helpful? Give feedback.
-
I wonder if it's an endian issue, isn't rpi little endian? Setting |
Beta Was this translation helpful? Give feedback.
-
Now trying this in
EDIT: nevermind, spi-bcm2835 is built into the kernel and loaded by default. Supposedly won't show up in lsmod. |
Beta Was this translation helpful? Give feedback.
-
Hooked up my norns to an oscilloscope to compare readouts of the SPI pins with the driver vs userspace. Got the Still don't quite know what is wrong, DB0 (SCLK) and DB1 (SDIN) look odd... but SCLK didn't look like how I expected it to when scoping the driver. I can't tell if the screen is supposed to be using an internal clock or an external one (mentioned in the datasheets). If it's external, perhaps clock settings need to be more exact? |
Beta Was this translation helpful? Give feedback.
-
New SPI Driver?Tabling work on userspace SPI right now since I haven't made any progress in a few days. Attempting to write a kernel SPI protocol driver from scratch. Could hopefully then compile it outside the kernel, add it to the existing modules, and change out the overlay. The SPI and framebuffer (maybe I'll do Kernel Mode Setting instead, linux people seem to be adamant fb shouldn't be used anymore) parts seem pretty straightfoward, I don't know much about device tree / overlay yet though. If anyone wants to learn this along with me, just reach out. As far as device files go, I was thinking:
But maybe I should make a device file for all the possible settings mentioned in the SSD1322 datasheet to leave it open to future development? Additional Findings on 60FPS ImageUser
I'm fairly certain the anti-aliasing on A8 is wrong, which might explain the trailing animated element part. I have a hunch the fully white display and other white blocks (image below) might be from the .png import function, which I didn't test. Cairo might not be able to implicitly convert ARGB .pngs to just an alpha channel. Should be able to fix the conversion in |
Beta Was this translation helpful? Give feedback.
-
apologies--- i haven't had a lot of time to do low-level investigation of this (which requires a certain deep focus) i'm not sure what you meant by external vs. internal clock? the screen is an SPI device in follower mode, so the CM3 will provide the clock. |
Beta Was this translation helpful? Give feedback.
-
userspace SPI working with matron: tlubke@2581a25 Should work on any norns, will just require Will be adding/modifying the gamma+brightness code and so on after this, then we can start the discussion on what code relating to There is also not currently a frame rate limit in place, and I haven't dropped the refresh rate in the same I did on the 60FPS image. If anyone has any insight on why setting |
Beta Was this translation helpful? Give feedback.
-
copied from discord How to test experimental screen improvements:
How to revert back to stable norns:
|
Beta Was this translation helpful? Give feedback.
-
Was able to expand the spidev buffer size by adding this to
Not sure why it wasn't working for me before, maybe I was spelling it Added a frame limiter to |
Beta Was this translation helpful? Give feedback.
-
This looks great @tlubke! You poked me at the exact right moment, I finally had some time today to try it out. I have been lurking this conversation (on github and on Discord) and thinking about the implications for ndi-mod but haven't had much to say until I had a chance to get hands on with it. In general you should definitely do what's best for the base case and not worry about ndi-mod, it can probably adapt to whatever. One thing that made ndi-mod efficient was that I could hand the buffer pointer from the Cairo surface directly to the NDI library, since the ARGB buffer can be interpreted as RGBX (when A=R=G=B.) There is no direct equivalent of A8 in the set of NDI-supported frame formats, but there are a couple that are close. NV12 has a Y8 luma plane followed by a subsampled UV plane. So we can interpret the Cairo buffer as NV12 if we construct an appropriate chroma plane that sits directly after it in memory. Here's an implementation of that approach; this branch allows ndi-mod to work with the The cost of this is an 8KiB Another strategy would be for norns to allocate the extra buffer space to allow each Cairo surface to be interpretable as an NV12 frame. This would mean only an additional 50% of memory for each surface (instead of 150%) and no A more plausible proposal would be some kind of hook to allow a mod to substitute its own backing buffer creation routine, but I'm not sure it's worth the effort. On switching to A4: this would be a little more expensive for ndi-mod, as NDI doesn't support any 4bpp formats so we'd have to get into bit-shifting to construct an 8bpp frame. I notice that the Cairo A4 changes involve a lot of shifting on write as well, it's not clear to me that that would overall be a performance win. Finally, this isn't specific to the 60fps changes, but a related enhancement I'd like to propose is a mod hook for screen updates that is rate-limited just like the screen, but is not disabled by the screensaver. This would serve two purposes: One, multiple mods could use the hook instead of replacing |
Beta Was this translation helpful? Give feedback.
-
Opened #1650. Still needs to be tested with desktop norns if someone can help me with that. |
Beta Was this translation helpful? Give feedback.
-
Gamma
Related PRs:
TODO
write()
andclose()
Screen gamma + "DISPLAY" setting menu. #1583 (comment)SYSTEM > RESET
resets display settings Screen gamma + "DISPLAY" setting menu. #1583 (review)Cairo Surface
Related PRs
TODO
Frame Rate
TODO
Update Procedure
possibly a separate issue, see: monome/linux#47 (comment)
Beta Was this translation helpful? Give feedback.
All reactions