Rotate the 3.5 inch LCD screen to 180 degree

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Rotate the 3.5 inch LCD screen to 180 degree

14,620 次查看
jaymind
Contributor IV

I have one query regarding to frambuffer.

I have custom board with i.MX6Q SoC.

I am using Linux kernel 3.03.35 and LCD is 3.5 inch RGB type display.

I want to rotate my LCD screen to 180 degree. I tried a lot to pass parameters to > /sys/..../fbcon/rotate but nothing happen.  :smileysad:

So Is there any way to rotating the screen without compiling the kernel. ?

Bcoz kernel compilation is my last option so I trying to rotate my screen via console Help me regarding oto this issue and give me solution for this.

I also founded some bit "IPU_ROTATE_180" in > /arch/arm/plat-mxc/include/mach/ipu.h and using by > /drivers/video/mxc/mxc_ipuv3_fb.c file.

I did some changes as below.

I passed "IPU_ROTATE_180" instead of "IPU_ROTATE_NONE" in "ipu_device.c" in > /drivers/mxc/ipu3/ but nothing change.

I also passed hard coded value (3 for 180 degree rotation as per enum) in "fbcon.c" file > / driver/video/console but nothing changes.

At where place/files/code should I changes in kernel tree ?

Please help me, its imp for me. :smileysad:

Thanks and Regards

Jaymin D

标签 (1)
标记 (3)
18 回复数

8,564 次查看
ivannikolaenko
Contributor IV

Hi jaymind​!

Did you solve your problem? We faced it too.

0 项奖励
回复

8,565 次查看
zc_tee
Contributor III

I too face the same issue. Does anyone have any solution on this?

I tried to removed the

       if (var->rotate > IPU_ROTATE_VERT_FLIP)

                var->rotate = IPU_ROTATE_NONE;

still, it is not able to rotate 180 degree.

Is it the IPU limitation?

regards,

Tee

0 项奖励
回复

8,565 次查看
ivannikolaenko
Contributor IV

Hello ZC Tee!

It's not an IPU limitation, but IPU driver. The person(s) who wrote this driver, would not or could not implement this functionality.

At this time I am trying to figure out how to use the IPU subblocks and then rewrite a driver, but without any success.

8,565 次查看
mrigendra_chaub
Contributor III

I face this issue too in 2018. Does anyone have updated driver? I am using nxp android O bsp.

0 项奖励
回复

8,565 次查看
jaymind
Contributor IV

Hello,

Somehow I able to rotate kernel logo (splash screen) at the time of booting.(I rotated it not mirrored it)

But I saw that after some extracting of kernel, Kernel itself stop at some point as below, :smileyconfused:

[1.374799] mxc_sdc_fb mxc_sdc_fb.0: register mxc display driver lcd

So anyone has idea, why should these happen.

During this time I can see my custom logo on screen rotated 180 degree perfectly, but kernel not expand more from those point :smileysad: :smileysad:

I did changes in some files in kernel tree as below, so point me out that where it is actually sticking up.

1.     Pass out value '2' to fbi->var.rotate in ipu_init_channel_buffer function (2 function in same file) in drivers/video/mxc/mxc_ipuv3_fb.c file as below.

Here 2 means FB_ROTATE_UD as define in fb.h

ipu_init_channel_buffer(mxc_fbi->ipu,

                     mxc_fbi->ipu_ch, IPU_INPUT_BUFFER,

                     fbi_to_pixfmt(fbi),

                     fbi->var.xres, fbi->var.yres,

                     fb_stride,

                     2,                                              // <--- change here                          

                     base,

                     base,

                     fbi->var.accel_flags &

                        FB_ACCEL_DOUBLE_FLAG ? 0 : base,

                     0, 0);

2.     pass IPU_ROTATE_180 to var-> rotate in in drivers/video/mxc/mxc_ipuv3_fb.c file as below.

var->rotate = IPU_ROTATE_180;

3.     pass vale '2' to ops->rotate in fbcon_set_rotation function in drivers/video/console/fbcon.c as below

static inline void fbcon_set_rotation(struct fb_info *info)

{

    struct fbcon_ops *ops = info->fbcon_par;

    if (!(info->flags & FBINFO_MISC_TILEBLITTING) &&

        ops->p->con_rotate < 4)

        //~ ops->rotate = ops->p->con_rotate;    // original

        ops->rotate = 2;                        

    else

        ops->rotate = 0;                    // original

}

4     pass vale '2' to ops->rotate in fbcon_rotate function in drivers/video/console/fbcon.c as below

static void fbcon_rotate(struct fb_info *info, u32 rotate)

{

    struct fbcon_ops *ops= info->fbcon_par;

    struct fb_info *fb_info;

    if (!ops || ops->currcon == -1)

        return;

    fb_info = registered_fb[con2fb_map[ops->currcon]];

    if (info == fb_info) {

        struct display *p = &fb_display[ops->currcon];

        if (rotate < 4)

            //~ p->con_rotate = rotate;        // original

            p->con_rotate = 2;              

        else

            p->con_rotate = 0;             // original

            //~ p->con_rotate = 2;               

        fbcon_modechanged(info);

    }

}

5.   pass FB_ROTATE_UD to ops->rotate in fbcon_set_rotation  function in drivers/video/console/fbcon.c as below

here FB_ROTATE_UD = 2


static inline void fbcon_set_rotation(struct fb_info *info)

{

    struct fbcon_ops *ops = info->fbcon_par;

    //~ ops->rotate = FB_ROTATE_UR;            // original

    ops->rotate = FB_ROTATE_UD;               

}

So please pint me out any false thing which related to this kernel stop.

----------------------

Kernel stop log as below.

U-Boot 2013.07-00005-g1c2ec3a-dirty (Jul 23 2014 - 14:48:34)

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz

Reset cause: POR

Board: MX6Q-Camaro

DRAM:  1 GiB

MMC:   FSL_SDHC: 0, FSL_SDHC: 1

SF: Detected S25FL512SA with page size 64 KiB, total 64 MiB

In:    serial

Out:   serial

Err:   serial

Net:   FEC

Warning: failed to set MAC address

Hit any key to stop autoboot:  0

mmc0 is current device

mmc0 is current device

** Unrecognized filesystem type **

154 bytes read in 125 ms (1000 Bytes/s)

## Executing script at 80008000

** File not found thermoboot **

3576228 bytes read in 311 ms (11 MiB/s)

Booting from mmc ...

## Booting kernel from Legacy Image at 80800000 ...

   Image Name:   Linux-3.0.35

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    3576164 Bytes = 3.4 MiB

   Load Address: 80008000

   Entry Point:  80008000

   Verifying Checksum ... OK

   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

[    0.000000] Linux version 3.0.35 (root@DTP184) (gcc version 4.7.3 (Timesys 20140310) ) #39 SMP PREEMPT Thu Mar 12 19:46:58 5

[    0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d

[    0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache

[    0.000000] Machine: TFS-PAI Board

[    0.000000] Platform: xl4Memory policy: ECC disabled, Data cache writealloc

[    0.000000] CPU identified as i.MX6Q, silicon rev 1.2

[    0.000000] PERCPU: Embedded 7 pages/cpu @8c008000 s5440 r8192 d15040 u32768

[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 194560

[    0.000000] Kernel command line: console=ttymxc1,115200 consoleblank=0 root=/dev/mmcblk0p2 rootwait rw xl4

[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)

[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)

[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)

[    0.000000] Memory: 768MB = 768MB total

[    0.000000] Memory: 766492k/766492k available, 282084k reserved, 0K highmem

[    0.000000] Virtual kernel memory layout:

[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

[    0.000000]     DMA     : 0xf4600000 - 0xffe00000   ( 184 MB)

[    0.000000]     vmalloc : 0xc0800000 - 0xf2000000   ( 792 MB)

[    0.000000]     lowmem  : 0x80000000 - 0xc0000000   (1024 MB)

[    0.000000]     pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)

[    0.000000]     modules : 0x7f000000 - 0x7fe00000   (  14 MB)

[    0.000000]       .init : 0x80008000 - 0x80045000   ( 244 kB)

[    0.000000]       .text : 0x80045000 - 0x809e3284   (9849 kB)

[    0.000000]       .data : 0x809e4000 - 0x80a40b98   ( 371 kB)

[    0.000000]        .bss : 0x80a40bbc - 0x80a8b2b4   ( 298 kB)

[    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1

[    0.000000] Preemptible hierarchical RCU implementation.

[    0.000000] NR_IRQS:624

[    0.000000] MXC GPIO hardware

[    0.000000] sched_clock: 32 bits at 3000kHz, resolution 333ns, wraps every 1431655ms

[    0.000000] Set periph_clk's parent to pll2_pfd_400M!

[    0.000000] arm_max_freq=800MHz

[    0.000000] MXC_Early serial console at MMIO 0x21e8000 (options '115200')

[    0.000000] bootconsole [ttymxc1] enabled

[    0.000000] Console: colour dummy device 80x30

[    0.214447] Calibrating delay loop... 1581.05 BogoMIPS (lpj=7905280)

[    0.302753] pid_max: default: 32768 minimum: 301

[    0.307725] Mount-cache hash table entries: 512

[    0.313203] CPU: Testing write buffer coherency: ok

[    0.318446] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available

[    0.419201] CPU1: Booted secondary processor

[    0.549198] CPU2: Booted secondary processor

[    0.679208] CPU3: Booted secondary processor

[    0.768489] Brought up 4 CPUs

[    0.784327] SMP: Total of 4 processors activated (6324.22 BogoMIPS).

[    0.813188] print_constraints: dummy:

[    0.817235] NET: Registered protocol family 16

[    0.827059] print_constraints: vddpu: 725 <--> 1300 mV at 1150 mV fast normal

[    0.834752] print_constraints: vddcore: 725 <--> 1300 mV at 1150 mV fast normal

[    0.842618] print_constraints: vddsoc: 725 <--> 1300 mV at 1200 mV fast normal

[    0.850432] print_constraints: vdd2p5: 2000 <--> 2775 mV at 2400 mV fast normal

[    0.858270] print_constraints: vdd1p1: 800 <--> 1400 mV at 1100 mV fast normal

[    0.866067] print_constraints: vdd3p0: 2625 <--> 3400 mV at 3000 mV fast normal

[    0.883579] Initializing xl4 platform

[    0.887613] Initializing OT27 screen

[    0.892200] ttd: obtained gpio for SX8651_PENDOWN

[    0.907577] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.

[    0.914427] hw-breakpoint: 1 breakpoint(s) reserved for watchpoint single-step.

[    0.921797] hw-breakpoint: maximum watchpoint size is 4 bytes.

[    0.932042] IMX usb wakeup probe

[    0.975389] bio: create slab <bio-0> at 0

[    0.987109] mxs-dma mxs-dma-apbh: initialized

[    0.992231] print_constraints: vmmc: 3300 mV

[    0.998767] SCSI subsystem initialized

[    1.003496] spi_imx imx6q-ecspi.0: probed

[    1.009203] usbcore: registered new interface driver usbfs

[    1.014995] usbcore: registered new interface driver hub

[    1.020732] usbcore: registered new device driver usb

[    1.025810] Freescale USB OTG Driver loaded, $Revision: 1.55 $

[    1.034182] pcf857x: probe of 0-0010 failed with error -5

[    1.040242] pcf857x: probe of 0-0011 failed with error -5

[    1.048734] tca8418_keypad 1-0034: tca8418_write_byte failed, reg: 1, val: 25, error: -5

[    1.058483] pcf857x: probe of 1-0010 failed with error -5

[    1.064533] pcf857x: probe of 1-0011 failed with error -5

[    1.088484] imx-ipuv3 imx-ipuv3.0: IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)

[    1.097303] mxc_mipi_csi2 mxc_mipi_csi2: i.MX MIPI CSI2 driver probed

[    1.103811] mxc_mipi_csi2 mxc_mipi_csi2: i.MX MIPI CSI2 dphy version is 0x3130302a

[    1.111718] MIPI CSI2 driver module loaded

[    1.116379] Advanced Linux Sound Architecture Driver Version 1.0.24.

[    1.124541] Switching to clocksource mxc_timer1

[    1.159392] NET: Registered protocol family 2

[    1.164059] IP route cache hash table entries: 32768 (order: 5, 131072 bytes)

[    1.172500] TCP established hash table entries: 131072 (order: 8, 1048576 bytes)

[    1.181963] TCP bind hash table entries: 65536 (order: 7, 786432 bytes)

[    1.190107] TCP: Hash tables configured (established 131072 bind 65536)

[    1.196748] TCP reno registered

[    1.199955] UDP hash table entries: 512 (order: 2, 16384 bytes)

[    1.205935] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)

[    1.212939] NET: Registered protocol family 1

[    1.217982] RPC: Registered named UNIX socket transport module.

[    1.223984] RPC: Registered udp transport module.

[    1.228710] RPC: Registered tcp transport module.

[    1.233489] RPC: Registered tcp NFSv4.1 backchannel transport module.

[    1.241694] PMU: registered new PMU device of type 0

[    1.246997] Static Power Management for Freescale i.MX6

[    1.252298] wait mode is enabled for i.MX6

[    1.256841] cpaddr = c0880000 suspend_iram_base=c08f0000

[    1.262605] PM driver module loaded

[    1.266578] IMX usb wakeup probe

[    1.270831] add wake up source irq 75

[    1.281884] IMX usb wakeup probe

[    1.334589] JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.

[    1.342281] msgmni has been set to 1497

[    1.349868] alg: No test for stdrng (krng)

[    1.354373] io scheduler noop registered

[    1.358320] io scheduler deadline registered

[    1.362877] io scheduler cfq registered (default)

[    1.370302] MIPI DSI driver module loaded

[    1.374799] mxc_sdc_fb mxc_sdc_fb.0: register mxc display driver lcd

and I observed that last line where kernel strop is coming from file -> drivers/video/mxc/mxc_ipuv3_fb.c from mxcfb_dispdrv_init structure.

dev_info(&pdev->dev, "register mxc display driver %s\n", disp_dev);

all type of suggestions are welcome.

Please help me to solve this. :smileyinfo:

Thanks and Regards

Jaymin D

0 项奖励
回复

8,565 次查看
kvbabu
Contributor II

Hi Jaymin,

Console rotation will only become available if Console Rotation Support is compiled in your kernel.

This is purely console rotation. Any other applications that use the framebuffer will remain at their 'normal'orientation.

Actually, the underlying fb driver is totally ignorant of console rotation.

If you are trying to rotated the boot logo, just take the already rotated image and create hex file and attach the hex file to kernel logo subsystem. 

or

if you are trying to rotated the image in application we have lot of possibilities.

x11 It support image rotation

Q5 It support image rotation.

Gtk+ it support image rotation

etc...............

0 项奖励
回复

8,565 次查看
jaymind
Contributor IV

Hello Vasu,

Thanks for reply.

Here I share some things related to my query.

Console Rotation Support is compiled in kernel and its enable in kernel.

Also as of now I successfully rotate my kernel logo/screen to 180 degree after making changes in kernel but kernel stick up those mxc_sdc_fb mxc_sdc_fb.0: register mxc display driver lcd lines, so that is the main problem.


Also I agree with Mr. Vasu "the underlying fb driver is totally ignorant of console rotation" so that is also main reason that I did not get desire rotation in my application.

So how can I do that?:smileyinfo:

One more thing is that I don't used X11 so what are other option for use ??


Share with me details that how can rotate the display by use of Q5 and GTK in i.mx6 ? and also If I want to rotate image by use of X11 then what are the steps for that?


Please let me know all possibilities and solution for it...


Thanks and Regards

Jaymin D





0 项奖励
回复

8,565 次查看
kvbabu
Contributor II

Hello Jaymin,

Can you share you LCD panel driver code and LCD master(frame buffer) driver code.

In I.MX6Q having three frame buffer drivers 1. HDMI 2. MIPI 3. Pure RGB

Please confirm what is the interface you are using right now.

In my previous project  i used I.MX233 processor. I faced same problem in MIPI based LCD panel driver .

I will given complete solution.

I will share Display rotation details ASAP.

Thanks & Best Regards,

Vasubabu.k

0 项奖励
回复

8,565 次查看
jaymind
Contributor IV

Hello,


vasubabu

Any update about Display rotation details which you like to share ASAP ? :smileyinfo:

I am using RGB type display interface right now for 3.5 inch LCD.

After changing in only at one location in kernel tree in fbcon.c file at p->con_rotate change its value to 2 in fbcon_init function I got rotated kernel splash screen (logo) but my kernel hangs

[1.374799] mxc_sdc_fb mxc_sdc_fb.0: register mxc display driver lcd

so, anyone know about this issue or any solution for this then please let me know as early as possible.

Also regard from this issue any one know that how to rotate framebuffer (fb0 in my case) to various angles ?? :smileyconfused::smileyinfo:

I almost searched all posts and also tried a lot with all possibilities, but I got only the mirror image as result, but I want fully rotated image and all things in short whole framebuffer.

On my board there is an X11 (name only) but xrandr, not found and also I am not sure that X11 will run or not on my board so I will rotate framebuffer with the help of a kernel tree and fbcon driver only :smileysad:

Please share my any details, any update, any solution related to this.

It will help me a lot.

Thanks & Regards

JAYMIN DABHI

0 项奖励
回复

8,565 次查看
kvbabu
Contributor II

Hello Jaymin,

Right now i am busy I will come with solution ASAP. May be on monday

Regards,

Vasu.k

0 项奖励
回复

8,565 次查看
kvbabu
Contributor II

Hello Jaymin,

please apply the following changes.

drivers/video/mxc/mxc_ipuv3_fb.c

    }

        printk(KERN_ERR"***************rotate:%d\n", var->rotate);

        //if (var->rotate > IPU_ROTATE_VERT_FLIP)

                var->rotate = IPU_ROTATE_180;

                //var->rotate = IPU_ROTATE_NONE;

        printk(KERN_ERR"**********after set rotate:%d\n", var->rotate);

Just hardcode the value "var->rotate" value It will work.

Find the below images alsoIMG_20150410_190846.jpgIMG_20150410_191645.jpg

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

Regards,

Vasu.k

8,565 次查看
ivannikolaenko
Contributor IV

Hi!
Current realisation of mxc_ipuv3_fb does not support framebuffer rotation other than IPU_ROTATE_VERT_FLIP. That's why Freescale devs add a "monkey patch" with

       if (var->rotate > IPU_ROTATE_VERT_FLIP)

                var->rotate = IPU_ROTATE_NONE;
if you look carefully at your screenshot you will find that there is a vertical flip (vertical mirroring), not a 180 deg. rotation.

One can hardcode every "rotation" variable in FB driver code and IPU driver code, but it will not work until you pass the image through the Image Rotation Block (IRT).
It is _very_ strange that Freescale developers can't implement this base functionality for several years after the release of the i.MX6 processor.

8,565 次查看
zbigniewmazur
Contributor II

Very well said! I agree and have the same issue on many displays so far. Since android 4 till latest android 8.

Only IPU_ROTATE_VERT_FLIP suppoted. All others == no screen

0 项奖励
回复

8,565 次查看
tonioch
Contributor III

Hello Vasu Babu,

I've applied the modification into the file mxc_ipuv3_fb.c . It's actually working for a rotation of 180° (IPU_ROTATE_180) but not for one of 90° (IPU_ROTATE_90_RIGHT) or 270° (IPU_ROTATE_90_LEFT). Even if the value is set (proof via the printk), the following error appears:

imx-ipuv3 2400000.ipu: IPU Warning - IPU_INT_STAT_10 = 0x00100000

And of course, the screen isn't displaying anything..

Do you know how to make that rotation working?

Thanks & regards,

Antoine C.

0 项奖励
回复

8,565 次查看
kvbabu
Contributor II

Hello Jaymin,

After this debug message it is trying to search for display driver is matched or not?

you want rotated the boot logo.

0 项奖励
回复

8,565 次查看
jaymind
Contributor IV

Dear Vasu,

Thanks for informing.

Yes I get rotated kernel logo to 180 degree after changes in kernel but kernel hang as shown in logs.

Regards

Jaymin D

0 项奖励
回复

8,565 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Jaymin

suggest to look below link for rotation examples

ipu-examples/rot_ex1.c at master · rogeriorps/ipu-examples · GitHub

Best regards

igor

0 项奖励
回复

8,565 次查看
divyardharan
Contributor III

Hi

I want to communicate over my serial port on Linux to a device with a

non-standard-baud rate.

I have read the comments in this site

https://sourceware.org/ml/libc-help/2009-05/msg00087.html

The solution described was " is to ORe the c_cflag of struct

termios with BOTHER (= CBAUDEX | B0)".

I am a linux beginner .Could you please tell me how to implement this.

My termios.h is attached with this mail.

Regards

Divya R Dharan

0 项奖励
回复