Comments (5)
Thanks for the feedback, a couple of remarks:
DrmFourcc implements TryForm, while DrmModifier uses From with an additional Unrecognized(u64) variant, making it inconsistent
This is by design, given a large portion of modifiers are expressed as marcos in the original header, there is no way to ensure this crate contains all modifiers. The Unrecognized variant is basically required (and would have to be implemented by downstream otherwise) to make any use of it.
There is also struct UnrecognizedModifier(pub u64), which I don't get the point of, since we have DrmModifier::Unrecognized(u64)
I think that is indeed just an oversight of previous implementations
Many implementations of PartialEq, Eq that could have been derives
There are two for DrmModifier
, which are there again by design, because some modifiers share the same internal code (but have multiple names).
For those the equality test needs to be true, even though they are different variants.
All enum conversion can be implemented by num_enum
I don't think (please correct me on that one) that num_enum
can handle multiple names for the same value (though it can handle the reverse).
This might be true for DrmFormat
, but given we generate the conversions anyway, I am not sure there is much to gain here (except another dependency).
Crate can be fully no_std with optional alloc for String
True. Pull requests welcome
Missing Into, From, TryFrom implementations where it makes sense
Not sure, which ones you are referring to, but again PRs welcome :)
I could volunteer for a refactoring, but I feel that it would be a bomb PR with a complete rewrite, which I'm not sure is welcome
I certainly would prefer multiple PRs with smaller scope to make review easier. But as long as if stuff is clearly improved, I will put it the time to try and deal with a large PR as well.
But please re-evaluate your points. Some stuff is there by design, because drm modifiers are a mess (like this crate).
from drm-fourcc-rs.
FYI I built this for a prototype which I ended up abandoning. I've added Drakulix as a contributor, and I'm happy to do any admin work needed, but I have no interest in refactoring/cleaning up.
from drm-fourcc-rs.
Not to be rude, but this whole crate is a bit of a mess:
DrmFourcc
implementsTryForm<u32>
, whileDrmModifier
usesFrom<u64>
with an additionalUnrecognized(u64)
variant, making it inconsistent- There is also
struct UnrecognizedModifier(pub u64)
, which I don't get the point of, since we haveDrmModifier::Unrecognized(u64)
- Many implementations of
PartialEq
,Eq
that could have been derives - All enum conversion can be implemented by num_enum
- Crate can be fully
no_std
with optionalalloc
forString
- Missing
Into
,From
,TryFrom
implementations where it makes sense
I could volunteer for a refactoring, but I feel that it would be a bomb PR with a complete rewrite, which I'm not sure is welcome
from drm-fourcc-rs.
Thanks for the in depth reply, I take some of my points back
DrmFourcc implements TryForm, while DrmModifier uses From with an additional Unrecognized(u64) variant, making it inconsistent
This is by design, given a large portion of modifiers are expressed as marcos in the original header, there is no way to ensure this crate contains all modifiers. The Unrecognized variant is basically required (and would have to be implemented by downstream otherwise) to make any use of it.
Makes sense, hence I would like to suggest the same for DrmFourcc, since it could also be missing formats that are defined in fourcc, but are not yet in the kernel. I.e. MJPG is already used by libcamera in raspberry pi, but is not yet upstreamed to linux kernel. This would allow using the library without forking it when format is missing.
After looking at drm_fourcc.h
it seems that it is more cursed than I thought
from drm-fourcc-rs.
Makes sense, hence I would like to suggest the same for DrmFourcc, since it could also be missing formats that are defined in fourcc, but are not yet in the kernel. I.e. MJPG is already used by libcamera in raspberry pi, but is not yet upstreamed to linux kernel. This would allow using the library without forking it when format is missing.
Oh interesting, I always assumed drm_fourcc.h
would contain all valid formats on a given platform+distro, but in that case we have a definite use-case for an Unrecognized
variant of the Fourcc
enum.
After looking at drm_fourcc.h it seems that it is more cursed than I thought
That is how I felt contributing to this generator. 😆
from drm-fourcc-rs.
Related Issues (9)
- Also generate bindings for drm modifiers? HOT 5
- Missing a couple of i915 modifiers HOT 2
- Use pkg-config to find headers for the `build_bindings` feature
- CI step to ensure generator was run during a pull request
- Misses modifiers with _ in the name
- Should Debug and Display output the same thing?
- R8 format panics on debug HOT 1
- Address no_std use case HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drm-fourcc-rs.