90 degree or 270 degree rotation not working using fb0 rotate?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

90 degree or 270 degree rotation not working using fb0 rotate?

Jump to solution
14,492 Views
bhuvaneshsurach
Contributor I

Hi All,

   I am using imx6q Rev D sabrelite board. Using the Linux kernel version 3.0.35. The board is connected with 3 LCD 4.2", 7.1" and 12.3". On boot up, i am able to rotate the logo to 180 degree using command, "echo 1 > /sys/class/graphics/fb0/rotate" but not able to rotate the logo 90 degree or 270 degree. Please provide your suggestions on how rotation of 90 degree or 270 degree can be accomplished using fb0 rotate.

Labels (4)
1 Solution
6,973 Views
saurabh206
Senior Contributor III

Hi,

following code can be useful

               //set rotate using IDMA            

                memset(&rot_info, 0x00, sizeof(ipu_rot_info_t));

                rot_info.width_in = panel->height;

                rot_info.height_in = panel->width;

                rot_info.width_out = panel->width;

                rot_info.height_out = panel->height;

                rot_info.strideline_in = rot_info.width_in;

                rot_info.strideline_out = rot_info.width_out;

                rot_info.pixel_format_in = NON_INTERLEAVED_YUV422; //INTERLEAVED_RGB565;

                rot_info.pixel_format_out = NON_INTERLEAVED_YUV422; //INTERLEAVED_RGB565;                                                                                      

                rot_info.rot = 1;            

                rot_info.hf = 0;             

                rot_info.vf = 0;             

                rot_info.addr0_in = res_out_mem;

                rot_info.addr0_out = rot_out_mem;

                rot_info.ubo_in = 0xc0000;   

                rot_info.ubo_out = 0xc0000;

                ipu_rotate_idmac_config(ipu_index, rot_chnl_in, rot_chnl_out, rot_info);

Thanks,

Saurabh

View solution in original post

0 Kudos
Reply
18 Replies
6,973 Views
michaelliesenbe
Contributor I

Hi Timesys,

facing this problem now.

Can you please explain how to do this workaround?

0 Kudos
Reply
6,973 Views
timesyssupport
Senior Contributor II

Hello everyone,

Although gst-inspect reports that imxvideosrc supports rotation, in our testing only vertical mirroring works (rotate=2). 
It seems that the rotation functionality has not been carried over from the imx51 line.

A workaround is to perform the rotation using the the imxvideosink element, where rotation is given in degrees (90,180, etc). 
The output device can be specified using the option "device=" (/dev/video16, /dev/video17, etc).

To get horizontal mirroring, we use rotate=3 to get vertical mirroring in imxvideosrc, and then use rotate=180 in the imxvideosink.


I hope this is useful for someone!

0 Kudos
Reply
6,973 Views
vladislavkaluts
Contributor II

Hello everybody,

I have same problem.

Did you guys find a solution?

0 Kudos
Reply
6,973 Views
ChucoChe
NXP Employee
NXP Employee

Hi,

I believe /sys/class/graphics/fb0/rotate will do vertical flip when passing 1 to it. Below the rotation enum of the IPU driver.

IPU_ROTATE_NONE = 0,
IPU_ROTATE_VERT_FLIP = 1,
IPU_ROTATE_HORIZ_FLIP = 2,
IPU_ROTATE_180 = 3,
IPU_ROTATE_90_RIGHT = 4,
IPU_ROTATE_90_RIGHT_VFLIP = 5,
IPU_ROTATE_90_RIGHT_HFLIP = 6,
IPU_ROTATE_90_LEFT = 7,

You could try to modify the fb driver to get another rotation. The driver is in <linux>/drivers/video/mxc/mxc_ipuv3_fb,c.

For a concrete example on how to use the IPU for rotation please check the mxc_ipudev_test in the imx-test package.

BTW. IPU rotation uses the IRT and it's slow 100Mp/sec. For faster rotation use GPU GC320.

Michel

0 Kudos
Reply
6,973 Views
joepsycho
Contributor II

There are two lines of code in the /driver/video/mxc/mxc_ipuv3_fb.c

If (var->rotate > IPU_ROTATE_VERT_FLIP)

var->rotate = IPU_ROTATE_NONE

I think it's the reason why I get the result which is mentioned above, so I comment those lines out and rebuild the kernel image.

After that I re-check the rotation function by doing "echo 4 > /sys/class/graphics/fb0/rotate", but things does not work out as i think,

there is an error occur and the error message shows "imx-ipuv3 imx-ipuv3.0: IPU Warning - IPU_INT_STAT_10 = 0x00080000"

Could you help me out, please?

0 Kudos
Reply
6,973 Views
ChucoChe
NXP Employee
NXP Employee

Interesting, have tried setting other values?

karinavalencia is there some one with fb driver knowledge that could help us with this one?

Michel

0 Kudos
Reply
6,973 Views
joepsycho
Contributor II

Comment out two lines of code in the /driver/video/mxc/mxc_ipuv3_fb.c

//If (var->rotate > IPU_ROTATE_VERT_FLIP)

     //var->rotate = IPU_ROTATE_NONE

and after rebuilding I got results below:

echo 0 > /sys/class/graphics/fb0/rotate     => No Rotation

echo 1 > /sys/class/graphics/fb0/rotate     => Vertical Flip

echo 2 > /sys/class/graphics/fb0/rotate     => No Rotation

echo 3 > /sys/class/graphics/fb0/rotate     => Vertical Flip

echo 4 > /sys/class/graphics/fb0/rotate     => Error Message : imx-ipuv3 imx-ipuv3.0: IPU Warning - IPU_INT_STAT_10 = 0x00080000

echo 5 > /sys/class/graphics/fb0/rotate     => Error Message : imx-ipuv3 imx-ipuv3.0: IPU Warning - IPU_INT_STAT_10 = 0x00080000

echo 6 > /sys/class/graphics/fb0/rotate     => Error Message : imx-ipuv3 imx-ipuv3.0: IPU Warning - IPU_INT_STAT_10 = 0x00080000

echo 7 > /sys/class/graphics/fb0/rotate     => Error Message : imx-ipuv3 imx-ipuv3.0: IPU Warning - IPU_INT_STAT_10 = 0x00080000

The BSP version I use is L3.0.35.12.09.01, is there any idea about this?

0 Kudos
Reply
6,973 Views
ivannikolaenko
Contributor IV

Hi Allen Wang,

Did you find the solution of this issue?

We have the same problem and can't find a solution.

Best regards,

Ivan.

0 Kudos
Reply
6,973 Views
saurabh206
Senior Contributor III

Hi,

If you want to do rotation than you need to use the IC of IPU.

With above approach Horizontal flip is not working, so you cannot do remaining operations.

Thanks

Saurabh

0 Kudos
Reply
6,973 Views
joepsycho
Contributor II

Thank you for your reply, could you tell me more detail about how to do that? What does IC of IPU mean?

If I want to rotate the penguin logo in 90 degrees, what should I do?

Is that a direct rotation of framebuffer?

0 Kudos
Reply
6,974 Views
saurabh206
Senior Contributor III

Hi,

following code can be useful

               //set rotate using IDMA            

                memset(&rot_info, 0x00, sizeof(ipu_rot_info_t));

                rot_info.width_in = panel->height;

                rot_info.height_in = panel->width;

                rot_info.width_out = panel->width;

                rot_info.height_out = panel->height;

                rot_info.strideline_in = rot_info.width_in;

                rot_info.strideline_out = rot_info.width_out;

                rot_info.pixel_format_in = NON_INTERLEAVED_YUV422; //INTERLEAVED_RGB565;

                rot_info.pixel_format_out = NON_INTERLEAVED_YUV422; //INTERLEAVED_RGB565;                                                                                      

                rot_info.rot = 1;            

                rot_info.hf = 0;             

                rot_info.vf = 0;             

                rot_info.addr0_in = res_out_mem;

                rot_info.addr0_out = rot_out_mem;

                rot_info.ubo_in = 0xc0000;   

                rot_info.ubo_out = 0xc0000;

                ipu_rotate_idmac_config(ipu_index, rot_chnl_in, rot_chnl_out, rot_info);

Thanks,

Saurabh

0 Kudos
Reply
6,973 Views
vladislavkaluts
Contributor II

Could you tell where to use this code?

Thanks!

0 Kudos
Reply
6,973 Views
saurabh206
Senior Contributor III
0 Kudos
Reply
6,979 Views
vladislavkaluts
Contributor II

Hi Saurabh,

Thank you for link.

But code above can not be applied to code by the link.

I tried code by the link and unfortunatelly it is not rotated my framebuffer.

Best Ragards,

Vlad.

0 Kudos
Reply
6,979 Views
joepsycho
Contributor II

I got the same problem with bhuvaneshsurachari, any suggestion?

0 Kudos
Reply
6,979 Views
LeonardoSandova
Specialist I

I do not think non-180-degrees rotations are possible. ChucoChe, any comment on this ?

Leo

0 Kudos
Reply
6,979 Views
joepsycho
Contributor II

After re-check the /sys/class/graphics/fb0/rotate and according to the image presentation , I think it's more like mirroring, not a rotation, and to each 1 > /sys/class/graphics/fb0/rotate is considered  the mirror property equals true, other numbers considered false

0 Kudos
Reply
6,979 Views
joepsycho
Contributor II

If non-180-degree rotation is unavailable, then how to implement portrait screen orientation?

0 Kudos
Reply