Page 1 of 1

[Solved] Cairo is not working

Posted: Sat May 27, 2017 2:55 am
by Agola
EDIT: Solved. I had to learn some Cairo before testing it :|

Re: Cairo is not working

Posted: Sat May 27, 2017 3:18 am
by goku420
You say you ported those applications but appear to be trying to run it in kernel space. You're also writing directly to a physical address (instead of using the LFB information Grub/VBE gave you) when you should be mapping that to virtual memory. You're not checking the return value of the cairo functions (I'm assuming they return NULL or something else upon failure).

Re: Cairo is not working

Posted: Sat May 27, 2017 3:28 am
by Agola
goku420 wrote:You say you ported those applications but appear to be trying to run it in kernel space. You're also writing directly to a physical address (instead of using the LFB information Grub/VBE gave you) when you should be mapping that to virtual memory. You're not checking the return value of the cairo functions (I'm assuming they return NULL or something else upon failure).
It was for a simple test, not for real gui.
I'm working with QEMU, so I assume framebuffer is 0xFD000000.

I fixed the problem, looks I should learn the basics of Cairo. Now everything looks good.

Re: Cairo is not working

Posted: Sat May 27, 2017 3:29 am
by goku420
Agola wrote:It is for a simple test, not for real gui.
I'm running my os in QEMU, so I assume framebuffer is 0xFD000000.

I fixed the problem, looks I should learn the basics of Cairo. Now everything looks good.
For the benefit of future readers, what was the problem/solution?

Re: Cairo is not working

Posted: Sat May 27, 2017 3:31 am
by Agola
goku420 wrote:
Agola wrote:It is for a simple test, not for real gui.
I'm running my os in QEMU, so I assume framebuffer is 0xFD000000.

I fixed the problem, looks I should learn the basics of Cairo. Now everything looks good.
For the benefit of future readers, what was the problem/solution?
Cairo wasn't working.

cairo_format_stride_for_width expects format and width as arguments, but I passed height.
cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, 480) had to be cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, 640)

Re: [Solved] Cairo is not working

Posted: Sat May 27, 2017 5:55 am
by no92

Re: [Solved] Cairo is not working

Posted: Sat May 27, 2017 10:02 am
by Agola
Sorry, but I thought it was such a rookie mistake and nobody (except me) can do a mistake like that.