Proposed GraphicsV enhancements
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13
Michael Drake (88) 336 posts |
What’s the rationale behind that? It seems an odd restriction to me. Would the OS actually enforce it? If the ROL branch’s *IconSprites ever gets updated to support the new ‘AX’ suffix, then they can add support for the alpha channel format too. Only supporting the alpha mask type seems like a bizarre technical restriction that will result in the situation where this alpha sprite works, but that one doesn’t. |
Jeffrey Lee (213) 6048 posts |
There are a few reasons I’m opposed to this:
The ‘A’ flag only indicates alpha mask support Mainly to keep things open for if the ‘A’ flag support gets added to the ROL branch. Theoretically all someone would need to do is softload our version of the Wimp. For enforcing the flag I was only thinking of implementing one check – if during the desktop startup the Wimp determines that alpha masks are supported it will make the ‘A’ flag available, else it will make it unavailable. Apart from potentially looking for ‘A’ files the actual code which loads the sprites will be left pretty much as-is. I.e. if the OS loads the sprite file and merges it into the sprite pool OK then the Wimp will use it. You do raise a good point about people getting confused when they find that (e.g.) an alpha channel sprite won’t work when loaded on an ‘A’ aware version of ROL’s OS. But technically we’ve been in that situation for ages, where people developing primarily for ROL’s OS might have released apps containing alpha masks or 64K colours which until now wouldn’t have worked on RISC OS 5. But if people are worried about alpha channel sprites slipping out under the ‘A’ name then I don’t have any strong feelings against extending ‘A’ to cover all the RISC OS 5 formats. |
Jeffrey Lee (213) 6048 posts |
This is now implemented. I’ve also fixed the icon shading/inverting to cope with true colour sprites (previously they’d just be rendered normally). Let me know if you think the quality could do with improving – for speed reasons shading/inverting of true colour sprites is using a set of lookup tables rather than doing the full calculations for each pixel, and the lookup tables are currently quite small (3 tables of 4K colours each). Bumping them up to 32K colour is possible, but it would increase the memory usage to 384K, so I’d probably want to tweak things a bit to get it back down to a more sensible level. |
Chris Gransden (337) 1202 posts |
I just tried the latest rom with this change (OMAP3 and OMAP4) on a Pandaboard ES and BeagleBoard Xm. Both hang as soon as ‘ModuleInit’ appears on the serial console. |
Jeffrey Lee (213) 6048 posts |
Oops. I should really stop making last-minute minor edits and then not testing them. I’ve submitted a fix. |
Jeffrey Lee (213) 6048 posts |
I’ve just finished submitting the following batch of changes:
Note that once a new hard disc image is available, people will most likely want to update their copy of the screen setup plugin – the old plugin is buggy and might crash if it’s used on a system where the new screen modes are available. Next on my todo list is to sort out multiple head support, including things such as display detection, head/driver selection from within the display manager, how to deal with different displays needing different MDFs, etc. |
William Harden (2174) 244 posts |
Jeffrey: Do you have any proposals for an API for hotplug of displays? Having needed to deal with EDID to get my Panda working I now think I understand what would be needed to complete the first 1/3 of the EDID bounty, and if time allows I’ll have a go at implementing it. Multiple displays will make that…err…interesting but shouldn’t cause major headaches one hopes. |
Jeffrey Lee (213) 6048 posts |
I don’t have anything concrete, but my current thinking is that things will work along the following lines:
Taking the above into account, I’m thinking the display detection system should operate as follows:
I’m thinking that somewhere (either as part of the results list or as part of a separate GraphicsV call) the driver should be able to indicate whether connection and/or disconnection can be detected automatically (i.e. by an IRQ, which will then trigger a service call). I’m thinking this automatic detection would have to be at the driver’s discretion (potentially also tied to an “I’m enabling automatic detection”/“I’m disabling automatic detection” service call), as the driver will be the one which knows best when detection is and isn’t possible/sensible. Case in point – TV-out detection on OMAP can only be performed if the hardware is powered on and generating a video signal. So if you’re using the TV then detecting disconnects comes virtually for free (and can easily be assigned to an IRQ), but if you’re not using the TV then you could waste a lot of battery power by leaving the TV detection running all the time. Related to this, there also needs to be a service call to notify software of drivers starting/stopping (i.e. when OS_ScreenMode 65 & 66 are called). E.g. for a USB displaylink driver I’d expect the module to register and deregister GraphicsV drivers on the fly as the USB devices are connected and disconnected. And that may or may not correspond with display connection/disconnection, depending on whether it’s a device with a builtin LCD or a generic displaylink to VGA/DVI adapter. I was initially thinking ROL’s Service_DisplayStatus would be a good fit for this, but I’ve since decided against that as it’s geared towards their VideoV vector and not our GraphicsV vector. |
WPB (1391) 352 posts |
Not tried any of this yet, but sterling work, Jeffrey! Well done. |
William Harden (2174) 244 posts |
Jeffrey: could I suggest also adding to the GraphicsV supported features flags: EDID support? Looks like EDID from the Pi isn’t returning anything useful, and VIDC will presumably be the same. It would be useful to read the flag to know when a driver supports EDID or not. |
Rick Murray (539) 13806 posts |
Could I suggest instead a new GraphicsV op to return the EDID block? Rather then being IIC ops, the driver itself will obtain the EDID; with a null block meaning there is no data. RFC? |
Jeffrey Lee (213) 6048 posts |
An “EDID support” flag doesn’t make much sense – after all, it’s the IICOp call that’s returning the EDID, and without probing the bus itself the driver won’t know if there’s a monitor there capable of returning the data. One of the things that yesterday’s changes will have fixed was a bug which meant that on the Pi the IICOp call was reporting success, even though nothing was happening. So if you try again with today’s ROM you should get a sensible result (the GraphicsV call will be left unclaimed, i.e. R4 unmodified). For VIDC, the driver currently generates a fake EDID block and returns that when it receives a suitable IICOp call. The block is basically empty apart from the sync type, which the driver detects by probing the ID pins. But despite lacking any mode timing information it should be a valid block. Could I suggest instead a new GraphicsV op to return the EDID block? Rather then being IIC ops, the driver itself will obtain the EDID; with a null block meaning there is no data. We could do, but why make a call that’s limited to just reading the EDID block, when we’ve already got a more general interface available? Sure, the Pi might not allow us direct access to the IIC bus to read the data ourselves, but it’s trivial to create a fake GraphicsV IICOp implementation which returns the EDID block the GPU gives us. Back to the topic of multiple heads/outputs for a moment – I’m now thinking that having to specify both the head and output when making GraphicsV calls is a step too far and introduces too much complexity to the API. So instead I’m thinking that each output will be treated as its own head, and for the cases where one head/output can’t be active at the same time as another, a DriverFeatures or HeadFeatures call will return a list or mask of which other heads can’t be active at the same time as that head. As far as I can tell this will simplify the most common cases (reading the details of heads, switching output between heads, drivers which have no limitations on how many heads/outputs are active, etc.) while only complicating software which will want to drive multiple heads at once (as it will have to do a bit of work itself to deduce the dependencies between heads). Thoughts? |
William Harden (2174) 244 posts |
Jeffrey: Ah – I had presumed the Pi’s output was the ‘intended behaviour’. The problem is not so much monitors that don’t support it, but video output devices that don’t (both because they are legacy – or of course because they are ‘virtual’ devices – dual monitor display RPCEmu by having two windows with different ‘screens’ on each?!?). To offer EDID, we have to use a ‘Use EDID if available’ flag (as oppose to use MDF). I had expected several possible outcomes in configuration: 1) We don’t respond (or flag set saying it’s unsupported) – the device can’t offer EDID, so grey the option. Obviously it’s important to distinguish between case 1 and case 2 – case 1 means don’t offer it, and case 2 should mean we still offer it with warnings. Agree – I can’t really see a case for another API interface for EDID because those cases should be edge cases and can be faked if need be. Another question: I assume that returning R4 unchanged if unsupported and not doing anything silly (ie. like crashing) is mandatory? So if the Screen plugin were to call GraphicsV just to see whether R4 had changed or not at plugin startup would be safe – there is no reason why this would |
Jeffrey Lee (213) 6048 posts |
Correct.
Yep, that should be fine. And if we some day find out that it isn’t fine (e.g. there’s a driver which has to implement the IICOp call but we know will never support EDID) we can at that point decide that a “supports EDID” flag or “return EDID block” call is a better way of doing things :) I’m not sure if you’ve spotted it or not, but if the IICOp call is implemented then it will provide a return code in R0. IICStatus_Completed will be returned if the data was read OK (although there’s still the chance of the EEPROM in the monitor containing corrupt EDID data), and IICStatus_NoACK will be returned if there was no response (i.e. no monitor connected or monitor doesn’t contain an EDID chip). Other return codes are likely to be caused by temporary transmission errors. |
Steve Pampling (1551) 8154 posts |
Jeffrey – the Screen Plugin and the latest ROM. Is this a problem with the plug-in or RPCEmu feeding the new graphics handler with incorrect information? NB. Not a problem for me, just poking and testing. |
Jeffrey Lee (213) 6048 posts |
It’s a bug with the plugin. If all goes well there should be a new hard disc image available tomorrow morning with a fixed version (it would have been available today, but the automated disc image builds have been disabled for a while now due to a problem with Perl – but we think that’s been fixed now, so ROOL are going to try re-enabling the automated build) |
Steve Pampling (1551) 8154 posts |
OK, time for a beer1 and then check tomorrow. 1 I keep a stock at a cool room temperature (cold means you can’t taste it properly, although with stuff from big brewers that’s probably a bonus) |
Frederick Bambrough (1372) 837 posts |
The ZIP file version of the disc update seems to have failed to update. |
Steve Pampling (1551) 8154 posts |
The self extractor version did update but the file date appears to be showing as 16 Dec rather than 17 Dec. For the record the available self extractor version has the fixed version of the screen plugin. Initial: |
Jeffrey Lee (213) 6048 posts |
Well spotted – I guess I didn’t think to check whether the buffer used by the Colours box would be long enough! I’ve now submitted a fix. |
Steve Pampling (1551) 8154 posts |
Thanks for that but really it was idle prodding rather than a systematic check. |
Martin Bazley (331) 379 posts |
A few questions from a practical perspective: MBBack works by reading the mode variables of the current mode, reading the mode variables of an input sprite’s mode word, then creating a new sprite which has a mode word equivalent to that of the current mode. So, for example, if you display a 32bpp sprite in an 8bpp mode, it’ll get reduced to 8bpp before being passed to the Pinboard. The tricky bit is forming the new sprite mode word and allocating the correct amount of memory to hold the new sprite, and there I suspect the new formats are going to throw a spanner in the works. First off, does RO5 behave like RO6, in that for a 64K colour mode, Log2BPP is returned as 4 but additionally bit 8 of ModeFlags (“fully definable 256 colour palette”) is set to 1? Secondly, do 4096 colour modes and sprites support palettes? How much do I need to know about the new formats in order to enhance MBBack to produce them? I presume at the very least I will need to teach it about the new mode words. And how can I determine, from a mode word and set of dimensions, how much memory a sprite of any format will take? Now Log2BPP can be 6 or 7, it won’t be as simple as shifting right by 3 and word-aligning any more, will it? Could I put in a request for an enhancement to the OS APIs, assuming it doesn’t exist already and I haven’t stupidly missed it? Given a sprite mode, x and y dimensions, and masking/palette flags, calculate how much memory a sprite will occupy. This task has never been simple, and seems likely to get a whole lot more complicated. I’ve just realised that you can in fact use the value returned from OS_ScreenMode 1 as input to OS_SpriteOp 15, so I suspect I’ll be taking advantage of that in the near future. |
Jeffrey Lee (213) 6048 posts |
Correct. I’m somewhat surprised that there isn’t a SWI to generate a sprite mode word for a given screen mode. The way I’ve seen the OS do it when it wants to cache a sprite in the current screen mode is to use OS_SpriteOp 16 to create a sprite from an arbitrary portion of the screen, and then redirect output to it and use OS_SpriteOp 52 to plot in the desired sprite. You’ll still have to calculate the memory requirements manually, but the sprite mode word generation and initialisation of the sprite palette will be fully handled by the OS.
Yes. See Valid Mode Variable Combinations for a list of all modes supported by all OS versions.
No.
If you use OS_ReadModeVariable to examine the sprite mode words, and use OS_SpriteOp 16 to create a sprite in the same mode as the screen, then you shouldn’t need to know anything about the structure of the sprite mode words.
Although Log2BPP of 6 and 7 have been defined in the spec, at the moment there’s only rudimentary support for them in the OS. In particular I suspect it will be a long time until you see the desktop start using Log2BPP of 6 or 7 (too much stuff assumes Log2BPP really is the log2 of the BPP). However at some point in the future you might start seeing sprites which use Log2BPP of 6 and 7.
Sounds like a sensible idea. I’ll probably make it so that you can pass in any old mode specifier, and it will return both the size of sprite needed and the corresponding sprite mode word – so it can serve double-duty as both a way of converting mode specifiers to mode words and calculating the size of a sprite.
Yes, that’s also a good way of dealing with things. Probably better than OS_SpriteOp 16 in most cases as it will avoid the pointless read from screen memory. |
Steve Revill (20) 1361 posts |
@William: if you’re thinking of having a pop at the EDID support, another thing you should be aware of is the CEA-861 extension blocks which can be present after the legacy EDID block. These are increasingly common on modern sinks (e.g. TVs) and should probably be used in preference to the legacy EDID info – with parsing that being the fall-back position. You have to read the wording of the specifications for EDID very carefully (and they aren’t free, so you’ll probably just have to read other pages, like Wikipedia, instead); its possible for lists to be empty, for multiple entries to be flagged as “preferred”/“native”, for the first entry not to be the one flagged as “preferred”/“native”, for none of the items to be flagged at all (in which case you should usually prefer the first one listed) and for the info in the EDID block to simply be incorrect (especially in cheaper/older sinks). Parsing EDID is the sort of thing that you eventually fine-tune after throwing lots of different hardware (and connection types, e.g. HDMI, DVI, etc) at it… so, exactly the sort of thing all our intrepid users (those who try the odd-numbered builds) can help with. I’d advise that you implement a command to dump the EDID data to a file for debug purposes – if anyone finds odd behaviour with their setup, they can send that which would help enormously with figuring out what’s going on. |
Steve Revill (20) 1361 posts |
@Jeffrey – at some point, it might be good to have a plain English summary of what the work you’ve been doing will mean to users, both in real terms and in terms of what potential features it’s opening up. Apologies if that’s already on the wiki and I’ve missed it. It’s basically the sort of stuff we will want to put in the 5.22 release note when that release comes around (probably not until April ’14 at the earliest). |
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13