AnsweredAssumed Answered

How can I rotate just the input in PXP?

Question asked by Steve Schefter on Jul 15, 2019
Latest reply on Aug 12, 2019 by Steve Schefter

I am using an iMX6ULL.  The driver (drivers/dma/pxp/pxp_dma_v3.c) for PXP defaults to performing the rotation at the output when rotation is requested.  That is, it sets the ROTATE0 in PXP_CTRL instead of ROTATE1.  I wish to perform the rotation on just the input.  This is because I wish to use an alpha layer and don't want that rotated (just want PS rotated).

 

I have modified the driver to set ROTATE1 instead but the output is not correct.

 

In order to demonstrate the problem, I created a simple and small input buffer.  It is 16 x 16 pixels of 32 bits each (unpacked 24 bit RGB).  I set the red value to 0xFF and the green value to 0x00.  For the blue value, I set it to the row number so that I can see what PXP has done with the data during rotation:

Input:
========= 0x76fb7000 ==============
00ff0001 00ff0001 00ff0001 00ff0001 00ff0001 00ff0001 00ff0001 00ff0001
00ff0001 00ff0001 00ff0001 00ff0001 00ff0001 00ff0001 00ff0001 00ff0001
========= 0x76fb7040 ==============
00ff0002 00ff0002 00ff0002 00ff0002 00ff0002 00ff0002 00ff0002 00ff0002
00ff0002 00ff0002 00ff0002 00ff0002 00ff0002 00ff0002 00ff0002 00ff0002
========= 0x76fb7080 ==============
00ff0003 00ff0003 00ff0003 00ff0003 00ff0003 00ff0003 00ff0003 00ff0003
00ff0003 00ff0003 00ff0003 00ff0003 00ff0003 00ff0003 00ff0003 00ff0003
========= 0x76fb70c0 ==============
00ff0004 00ff0004 00ff0004 00ff0004 00ff0004 00ff0004 00ff0004 00ff0004
00ff0004 00ff0004 00ff0004 00ff0004 00ff0004 00ff0004 00ff0004 00ff0004

...

00ff000f 00ff000f 00ff000f 00ff000f 00ff000f 00ff000f 00ff000f 00ff000f
00ff000f 00ff000f 00ff000f 00ff000f 00ff000f 00ff000f 00ff000f 00ff000f
========= 0x76fb73c0 ==============
00ff0010 00ff0010 00ff0010 00ff0010 00ff0010 00ff0010 00ff0010 00ff0010
00ff0010 00ff0010 00ff0010 00ff0010 00ff0010 00ff0010 00ff0010 00ff0010

I ask for an output which is 32 x 32 pixels.  With the original rotation (ROTATE0, rotation at output) all appears normal:

 

Output:
========= 0x75b3e000 ==============
00ff0010 00ff0010 00ff000f 00ff000f 00ff000e 00ff000e 00ff000d 00ff000d
00ff000c 00ff000c 00ff000b 00ff000b 00ff000a 00ff000a 00ff0009 00ff0009
00ff0008 00ff0008 00ff0007 00ff0007 00ff0006 00ff0006 00ff0005 00ff0005
00ff0004 00ff0004 00ff0003 00ff0003 00ff0002 00ff0002 00ff0001 00ff0001
========= 0x75b3e080 ==============
00ff0010 00ff0010 00ff000f 00ff000f 00ff000e 00ff000e 00ff000d 00ff000d
00ff000c 00ff000c 00ff000b 00ff000b 00ff000a 00ff000a 00ff0009 00ff0009
00ff0008 00ff0008 00ff0007 00ff0007 00ff0006 00ff0006 00ff0005 00ff0005
00ff0004 00ff0004 00ff0003 00ff0003 00ff0002 00ff0002 00ff0001 00ff0001
========= 0x75b3e100 ==============
00ff0010 00ff0010 00ff000f 00ff000f 00ff000e 00ff000e 00ff000d 00ff000d
00ff000c 00ff000c 00ff000b 00ff000b 00ff000a 00ff000a 00ff0009 00ff0009
00ff0008 00ff0008 00ff0007 00ff0007 00ff0006 00ff0006 00ff0005 00ff0005
00ff0004 00ff0004 00ff0003 00ff0003 00ff0002 00ff0002 00ff0001 00ff0001
etc

So the image has been rotated and doubled in size as expected.

 

That is not the case with input rotation (ROTATE1) though

Output:
========= 0x75b3e000 ==============
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
========= 0x75b3e080 ==============
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
========= 0x75b3e100 ==============
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
etc


In this small 16x16 example, I'm seeing all zeros where the output data should be.  In a larger example, the output data is nonzero in places, but not at all like the input image.

 

The following are the PXP register dumps.

First, the case with rotation performed at the output:

PXP_CTRL 0x0f010103
PXP_STAT 0x04030001
PXP_OUT_CTRL 0x00000000
PXP_OUT_BUF 0x8dd00000
PXP_OUT_BUF2 0x00000000
PXP_OUT_PITCH 0x00000080
PXP_OUT_LRC 0x001f001f
PXP_OUT_PS_ULC 0x00000000
PXP_OUT_PS_LRC 0x001f001f
PXP_OUT_AS_ULC 0x3fff3fff
PXP_OUT_AS_LRC 0x00000000
PXP_PS_CTRL 0x00000004
PXP_PS_BUF 0x8d24d000
PXP_PS_UBUF 0x00000000
PXP_PS_VBUF 0x00000000
PXP_PS_PITCH 0x00000040 64
PXP_PS_BACKGROUND_0 0x00000000
PXP_PS_SCALE 0x07bd07bd
PXP_PS_OFFSET 0x00000000
PXP_PS_CLRKEYLOW_0 0xffffff
PXP_PS_CLRKEYHIGH 0x00000000
PXP_AS_CTRL 0x00000000
PXP_AS_BUF 0x00000000
PXP_AS_PITCH 0x00000000
PXP_AS_CLRKEYLOW 0x00ffffff
PXP_AS_CLRKEYHIGH 0x00000000
PXP_CSC1_COEF0 0x40000000
PXP_CSC1_COEF1 0x01230208
PXP_CSC1_COEF2 0x079b076c
PXP_CSC2_CTRL 0x00000001
PXP_CSC2_COEF0 0x00000000
PXP_CSC2_COEF1 0x00000000
PXP_CSC2_COEF2 0x00000000
PXP_CSC2_COEF3 0x00000000
PXP_CSC2_COEF4 0x00000000
PXP_CSC2_COEF5 0x00000000
PXP_LUT_CTRL 0x80010000
PXP_LUT_ADDR 0x00000000
PXP_LUT_DATA 0x00000000
PXP_LUT_EXTMEM 0x00000000
PXP_CFA 0x00000000
PXP_ALPHA_A_CTRL 0x00000000
PXP_ALPHA_B_CTRL 0x00000000
PXP_POWER_REG0 0x00000000
PXP_NEXT 0x00000000
PXP_DEBUGCTRL 0x00000000
PXP_DEBUG 0x00000000
PXP_VERSION 0x03000000

 

Next, with rotation performed on the input

PXP_CTRL 0x0f011003
PXP_STAT 0x00040001
PXP_OUT_CTRL 0x00000000
PXP_OUT_BUF 0x8d400000
PXP_OUT_BUF2 0x00000000
PXP_OUT_PITCH 0x00000080
PXP_OUT_LRC 0x001f001f
PXP_OUT_PS_ULC 0x00000000
PXP_OUT_PS_LRC 0x001f001f
PXP_OUT_AS_ULC 0x3fff3fff
PXP_OUT_AS_LRC 0x00000000
PXP_PS_CTRL 0x00000004
PXP_PS_BUF 0x8d1be000
PXP_PS_UBUF 0x00000000
PXP_PS_VBUF 0x00000000
PXP_PS_PITCH 0x00000040 64
PXP_PS_BACKGROUND_0 0x00000000
PXP_PS_SCALE 0x07bd07bd
PXP_PS_OFFSET 0x00000000
PXP_PS_CLRKEYLOW_0 0xffffff
PXP_PS_CLRKEYHIGH 0x00000000
PXP_AS_CTRL 0x00000000
PXP_AS_BUF 0x00000000
PXP_AS_PITCH 0x00000000
PXP_AS_CLRKEYLOW 0x00ffffff
PXP_AS_CLRKEYHIGH 0x00000000
PXP_CSC1_COEF0 0x40000000
PXP_CSC1_COEF1 0x01230208
PXP_CSC1_COEF2 0x079b076c
PXP_CSC2_CTRL 0x00000001
PXP_CSC2_COEF0 0x00000000
PXP_CSC2_COEF1 0x00000000
PXP_CSC2_COEF2 0x00000000
PXP_CSC2_COEF3 0x00000000
PXP_CSC2_COEF4 0x00000000
PXP_CSC2_COEF5 0x00000000
PXP_LUT_CTRL 0x80010000
PXP_LUT_ADDR 0x00000000
PXP_LUT_DATA 0x00000000
PXP_LUT_EXTMEM 0x00000000
PXP_CFA 0x00000000
PXP_ALPHA_A_CTRL 0x00000000
PXP_ALPHA_B_CTRL 0x00000000
PXP_POWER_REG0 0x00000000
PXP_NEXT 0x00000000
PXP_DEBUGCTRL 0x00000000
PXP_DEBUG 0x00000000
PXP_VERSION 0x0300000

 

Besides differences in virtual address, the difference is in PXP_CTRL:

PXP_CTRL   0x0f010103 -> 0x0f011003   (set ROTATE1 instead of ROTATE0)

So how can I rotate just the input (PS) and not output (soon to be PS + AS)?

Thanks,

    Steve

Outcomes