-
Notifications
You must be signed in to change notification settings - Fork 52
ipu3: Image rotation support #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have any spec for this, right? Maybe print a warning or debug for any unknown value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rotation is reverse engineered so 1 == 180 is just a guess but a comment is indeed necessary.
For the orientation we have this spec on page 351 so I'll add a comment for that as well.
What do you think about the switch-statement? Is there a better way of doing the conversion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'd probably find / need to add macros for the 4/5 values for the _PLD panel field when this goes upstream. The switch itself is fine imo.
I'm surprised to find 1==180, as it sort of precludes a sensor being mounted at 90 degrees or something...I was expecting something like 1 = 90 degrees, 2 = 180. Anyway, I think that probably ought to return the input value in the case that it's not 1, otherwise if we do find some other value in there it'll be masked here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the link! Maybe mention that this value comes from the ACPI PLD buffer, then people can find the spec for that themselves. Also since anything except front and back seem to be directly translatable from ACPI, I think you should go with a warning here (as opposed to a debug print).
Yeah, I think those should be constants if they're defined in ACPI. Maybe also for the rotation.
I agree with @djrscally. I think switch is probably the best option here. A lookup-table would be an alternative, but doesn't make much sense here, I think.
I assume we don't know any device that has a 90 degree sensor so we could check this?
I'm not entirely sure if returning the input value is a good thing, but there should be something to help us figure out if there's an unknown value (that's why I proposed warning or debug messages).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, they could just got in cio2-bridge.h
Not to my knowledge, I don't recall anything except a 180 rotation, I was just going off what Windows apparently expects from the rotation field in _PLD: https://docs.microsoft.com/en-us/windows-hardware/drivers/stream/camera-device-orientation.
Then again, given the field is called "degree" you'd really expect it to be in degrees if anything!
EDIT: In fact, honestly, the fact that 1 = 180 degree rotation means this has to be a binary field. You could just make that function something along the lines of:
Fair enough; a debug print is good for me too then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... let's just hope the 0/1 thing is consistent for now and we don't end up with other devices actually having a rotation in degrees there. Might be a bit messy handling that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also strange that
degreeis only 8-bit so it cannot encode e.g. 270 degree directly.I'll try to go through the SSDB buffers and find all values for degree then we have a better picture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I grepped the ACPI info from here and most of the sensors have 0 or 1 in the degree field (SSDB) and 0 in the roation field (PLD).
There are some quirks though:
I think it's save to treat degree as a "binary" variable for now and treat the three devices separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whelp, of course there are... would be too easy otherwise, would it. I think we can assume though that it's either 0, 1, 2, (maybe 3?) and 90, 180. So still possible to somewhat sanely handle those.
Hmm, too bad those are IPU4 devices. But at least we now know that we can maybe check these values in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good grief!
Yeah, sounds sensible to me.