-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
chore(draw_buf): add draw buf struct definition #4833
Conversation
CI depends on #4832. Let ignore the CI failure for now. |
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.
Feels quite elegant, however I can't tell how complicated will it be to use lv_draw_buf_t
on all places, instead of using some simpler functions directly.
Anyway, let's go with it. I definitely see the added value of storing the stride and other data with the buffer, assuming it won't introduce too much boiler plate.
I'm planning to update some modules with latest |
I have included Thank you :) |
During the process of debugging freetype, I found that the image cache provided by freetype cannot guarantee that the output bitmap meets the width alignment and address alignment requirements. We may need to manage the cache ourselves and use draw buf to uniformly manage the bitmap output by freetype. |
@FASTSHIFT |
If |
Yes, what we loose is the extra memory and the construction overhead for sure. |
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Hi Gabor, |
I'm thinking about the What is the advantage of providing full control over stride, instead of setting the stride automatically from the width and color format. |
We do need to create draw_bufs with different stride value, see the usage in There's no reason to assume binary file has same stride as GPU needed, it could be already 128 byte aligned which also meets GPU(64Byte assume). For PNG decoders, e.g. 100x100 image, the draw buffer alloced for directly decoded data is 400Byte. If GPU requires 64byte aligned stride, then a 448Byte stride draw buffer is alloced and lv_draw_buf_copy can process possibly by DMA2D. For font with bitmap, we may also want to use draw buf. For example PXP(from NXP) doesn't need So the conclusion is keep stride as open can easy lots of processing without hacking into draw buffer details. |
So
So GPUs need to check for both address and stride before taking a task. However:
|
Yes.
No. The decoded image will always fulfill a draw task' requirement like stride alignment. It relies on |
I think this the catch. The stride alignment of SW render, VG-Lite, PXP, other? That's I believe having a global stride is cleaner. |
SW render, VG-Lite, PXP, other have different alignment requirement, so it's not correct Aside from that, the stride parameter is a basic para for draw buf just like w, h. That's why I mentioned the PNG decoder case.
|
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
I hope the code here can explain it better. |
I understand that the buffers can be copied with on-the-fly stride alignment, but
It would be nice to have solution by design, and keep the buffer copy as a fallback for very special situation. In my head I still have the "no room for failure" policy. If we choose a common stride which works for all it can't be messed up. There are 2 places where it really matter and not trivial:
Regarding fonts, now we have For all other things, like snapshot buffer, canvas buffer, layer buffers, etc, we can use a stride which works for all to not put any limitation on the compatible draw_units. |
I merge it now as blocks a lot of other PR and we can improve it later. |
Description of the feature or fix
Initial proposal of adding
draw_buf
struct.Checkpoints
code-format.py
from the scripts folder. astyle needs to be installed.lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig.Be sure the following conventions are followed:
enum
s instead of macros. If inevitable to usedefine
s export them withLV_EXPORT_CONST_INT(defined_value)
right after thedefine
.type name[]
declaration for array parameters instead oftype * name
void *
pointersmalloc
into a static or global variables. Instead declare the variable inlv_global_t
structure inlv_global.h
and mark the variable with(LV_GLOBAL_DEFAULT()->variable)
when it's used. See a detailed description here.lv_<widget_name>_create(lv_obj_t * parent)
pattern.lv_<module_name>
and should receivelv_obj_t *
as first argument which is a pointer to widget object itself.struct
s should be used via an API and not modified directly via their elements.struct
APIs should follow the widgets' conventions. That is to receive a pointer to thestruct
as the first argument, and the prefix of thestruct
name should be used as the prefix of the function name too (e.g.lv_disp_set_default(lv_disp_t * disp)
)struct
s which are not part of the public API must begin with underscore in order to mark them as "private".struct
as the first argument. Thestruct
must containvoid * user_data
field.void * user_data
and the sameuser_data
needs to be passed as the last argument of the callback.xcb_t
.