cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ptg
Observer
Observer
4,265 Views
Registered: ‎05-07-2018

Getting simple output with Xilinx DRM KMS framework

I'm trying to get Linux framebuffer output with VDMA and AXI4-Stream to Video Out.

 

The PL Display driver in Xilinx DRM KMS seems to provide CRTC which is to be connected with DRM encoder and DRM connector implemented in HDMI Tx, DSI Tx, SDI Tx drivers. As I don't need any real PHY, any of them are not applicable. I just want a plain, fixed resolution DRM encoder + connector.

 

I thought of making dummy DRM encoder + connector based on them but the DRM stack is way too complicated to understand. It's great to have official way to get it.

 

I read:

DPDMA graphics stack via live output->PL (no physical display port connection)

ZCU102: How to pass GPU output to the PL

 

My old post to get framebuffer with DPDRM:

Mali 3D w/o DP PHY

0 Kudos
5 Replies
hokim
Scholar
Scholar
4,228 Views
Registered: ‎10-21-2015

Hi,

 

There seems to be no way except you learn from linux source code.

 

Write your driver like

https://github.com/Xilinx/linux-xlnx/blob/master/drivers/gpu/drm/xilinx/xilinx_drm_dsi.c

https://github.com/Xilinx/linux-xlnx/blob/master/drivers/gpu/drm/xilinx/xilinx_drm_sdi.c

 

The followings show how to write devicetree for your driver 

https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/drm/xilinx/xilinx_drm.txt (Example 4)

https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/drm/xilinx/dsi.txt

https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/drm/xilinx/sdi.txt

 

Note how to use the following functions  in the above source codes.

drm_encoder_init, drm_encoder_helper_add, drm_connector_init, drm_connector_helper_add, drm_connector_register, drm_mode_connector_attach_encoder

0 Kudos
ptg
Observer
Observer
4,213 Views
Registered: ‎05-07-2018

@hokim Thanks for your post, but unfortunately the DRM driver you showed is the old one. The new one, drivers/gpu/drm/xlnx, has "Modular structure" according to Changelog. I guess drivers/gpu/drm/xlnx/xlnx_pl_disp.c stands for a split "module" which provides a Plane and a CRTC for encoders, while DPDRM has its own CRTC impl in it.

 

 

0 Kudos
hokim
Scholar
Scholar
4,198 Views
Registered: ‎10-21-2015

0 Kudos
ptg
Observer
Observer
4,152 Views
Registered: ‎05-07-2018

I managed to get a dummy Encoder and Connector with my dummy driver (based on DSI driver, just disabled read/write of registers) .

 

Device tree:

 

 

        dummy {
                status = "okay";
                compatible = "xlnx,dummy";
                xlnx,dsi-num-lanes = <0x4>;
                xlnx,dsi-data-type = <0x0>;
                #address-cells = <0x1>;
                #size-cells = <0x0>;

                port@0 {
                        reg = <0x0>;

                        endpoint {
                                remote-endpoint = <0x37>;
                                linux,phandle = <0x38>;
                                phandle = <0x38>;
                        };
                };

                simple-panel@0 {
                        compatible = "dummypanel";
                        reg = <0x0>;
                };
        };

...

        drm-pl-disp-drv {
                compatible = "xlnx,pl-disp";
                dmas = <0x36 0x0>;
                dma-names = "dma0";
                xlnx,vformat = "RGB8";

                port@0 {

                        endpoint {
                                remote-endpoint = <0x38>;
                                linux,phandle = <0x37>;
                                phandle = <0x37>;
                        };
                };
        };

 

 

and modified drivers/gpu/drm/panel/panel-simple.c to specify the panel info.

 

Successfully my kernel probed it and /dev/fb0 is visible but Xorg doesn't work.

 

I found a bug in drivers/drm/xlnx/xlnx_crtc.c Line 52.

 

 

-- #define XLNX_CRTC_MAX_HEIGHT_WIDTH  UINT_MAX
++ #define XLNX_CRTC_MAX_HEIGHT_WIDTH  INT_MAX

UINT_MAX will be interpret as -1 in Xorg somehow and leads to misunderstand max resolution.

 

 

 

[    17.972] (II) ARMSOC(0): drmmode_pre_init:1682 Got KMS resources
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1685   1 connectors, 1 encoders
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1688   1 crtcs, 0 fbs
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1691   0x0 minimum resolution
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1694   -1x-1 maximum resolution

this will be fixed like

 

 

[    17.972] (II) ARMSOC(0): drmmode_pre_init:1682 Got KMS resources
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1685   1 connectors, 1 encoders
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1688   1 crtcs, 0 fbs
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1691   0x0 minimum resolution
[    17.972] (II) ARMSOC(0): drmmode_pre_init:1694   2147483647x2147483647 maximum resolution

Also dug into xf86-video-armsoc (armsoc_drv.so). This will die by SIGSEGV when it calls xf86CrtcRotate(). After skipping it, X still dies by EINVAL.

 

 

[    18.009] (EE) ARMSOC(0): ERROR: drm failed to set mode: Invalid argument
[    18.010] (II) ARMSOC(0): drmmode_revert_mode:235 No last good values to use
[    18.010] (II) ARMSOC(0): drmmode_set_mode_major:445: Exiting

 

 

I gave up digging xf86 API which is too deep to dive in.

 

My initial motivation to use PL Display was avoiding DPDRM which is still unavailable to use without PHY. (Recently initialization without PHY patch is added but it disables the CRTC and we can't use Xorg on it)

 

 

 

liufengwuhen
Explorer
Explorer
3,218 Views
Registered: ‎02-15-2019

请问你最后怎么解决的,我也遇到了同样的问题。
0 Kudos