Yocto编译libdrm

在调试display时经常使用modetest工具,modetest.c源码由libdrm提供,yocto提供了编译libdrm的方法:

poky/meta/recipes-graphics/drm/libdrm_2.4.91.bb

1、bb文件指定libdrm从网上fetch的路径:

 13 SRC_URI = "http://dri.freedesktop.org/libdrm/${BP}.tar.bz2 \                    
 14            file://installtests.patch \                                          
 15            file://fix_O_CLOEXEC_undeclared.patch \                              
 16            file://0001-configure.ac-Allow-explicit-enabling-of-cunit-tests.patch \                                                                             
 17           " 

2、bitbake命令编译libdrm;

bitbake libdrm

tmp/work/aarch64-sdrv-linux/libdrm/2.4.91-r0/libdrm-2.4.9目录是check out出来的源码:

libdrm-2.4.91$ ls
aclocal.m4      configure     include          libsync.h         meson.build        README              xf86atomic.h   xf86drmMode.h
amdgpu          configure.ac  intel            m4                meson_options.txt  tegra               xf86drm.c      xf86drmRandom.c
autom4te.cache  data          libdrm_lists.h   Makefile.am       nouveau            tests               xf86drm.h      xf86drmRandom.h
build-aux       etnaviv       libdrm_macros.h  Makefile.in       omap               util_double_list.h  xf86drmHash.c  xf86drmSL.c
config.h.in     exynos        libdrm.pc.in     Makefile.sources  patches            util_math.h         xf86drmHash.h
config.h.in~    freedreno     libkms           man 

tmp/work/aarch64-sdrv-linux/libdrm/2.4.91-r0/image 目录中生成可执行bin文件:

image/
└── usr
    ├── bin
    ├── include
    ├── lib
    └── share

ls image/usr/bin/
drmdevice  etnaviv_2d_test        etnaviv_cmd_stream_test  kms-steal-crtc  kms-universal-planes  modetest  random
drmsl      etnaviv_bo_cache_test  hash                     kmstest         modeprint             proptest  vbltest

3、modetest使用方法:

modetest可以查询板卡的显示能力,使用-h参数查看详细用法:

modetest -h
usage: modetest [-cDdefMPpsCvw]

 Query options:

        -c      list connectors
        -e      list encoders
        -f      list framebuffers
        -p      list CRTCs and planes (pipes)

 Test options:

        -P <plane_id>@<crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>]  set a plane
        -s <connector_id>[,<connector_id>][@<crtc_id>]:<mode>[-<vrefresh>][@<format>]   set a mode
        -C      test hw cursor
        -v      test vsynced page flipping
        -w <obj_id>:<prop_name>:<value> set property

 Generic options:

        -d      drop master after mode set
        -M module       use the given driver
        -D device       use the given device

        Default is to dump all info.

modetest 加-M参数再加上DRM driver的名称可以查看显示能力:

比如MTK 的板卡,需要查看connectors、encoders、CRTCs、planes,使用命令:modetest -M mediatek

 modetest -M mediatek

Encoders:
id      crtc    type    possible crtcs  possible clones
30      44      DSI     0x00000001      0x00000000
32      57      TMDS    0x00000002      0x00000000
38      44      Virtual 0x00000001      0x00000000
51      57      Virtual 0x00000002      0x00000000

Connectors:
id      encoder status          name            size (mm)       modes   encoders
31      30      connected       eDP-1           0x0             1       30
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  1920x720 60 1920 1944 1960 1984 720 760 768 792 96000 flags: ; type:
  props:
        1 EDID:
                flags: immutable blob
                blobs:

                value:
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 0
33      32      connected       LVDS-1          293x110         1       32
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  800x480 30 800 810 822 832 480 490 518 528 13178 flags: ; type: preferred, driver
  props:
        1 EDID:
                flags: immutable blob
                blobs:

                value:
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 0
39      38      disconnected    (null)-1        0x0             0       38
  props:
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 0
        35 WRITEBACK_PIXEL_FORMATS:
                flags: immutable blob
                blobs:

                value:
                        52473234
52      51      disconnected    (null)-2        0x0             0       51
  props:
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 0
        35 WRITEBACK_PIXEL_FORMATS:
                flags: immutable blob
                blobs:

                value:
                        52473234

CRTCs:
id      fb      pos     size
44      70      (0,0)   (1920x720)
  1920x720 60 1920 1944 1960 1984 720 760 768 792 96000 flags: ; type:
  props:
        45 PQPARAM:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        46 PQINDEX:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        47 COLOR_BYPASS:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        48 COLOR_WINDOW:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        49 GET_PQPARAM:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        23 GAMMA_LUT:
                flags: blob
                blobs:

                value:
        24 GAMMA_LUT_SIZE:
                flags: immutable range
                values: 0 4294967295
                value: 512
57      71      (0,0)   (800x480)
  800x480 30 800 810 822 832 480 490 518 528 13178 flags: ; type: preferred, driver
  props:
        58 PQPARAM:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        59 PQINDEX:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        60 COLOR_BYPASS:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        61 COLOR_WINDOW:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        62 GET_PQPARAM:
                flags: range
                values: 0 18446744073709551615
                value: 4294967294
        23 GAMMA_LUT:
                flags: blob
                blobs:

                value:
        24 GAMMA_LUT_SIZE:
                flags: immutable range
                values: 0 4294967295
                value: 512

Planes:
id      crtc    fb      CRTC x,y        x,y     gamma size      possible crtcs
40      44      70      0,0             0,0     0               0x00000001
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 1
        25 alpha:
                flags: range
                values: 0 255
                value: 255
41      0       0       0,0             0,0     0               0x00000001
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0
        25 alpha:
                flags: range
                values: 0 255
                value: 255
42      0       0       0,0             0,0     0               0x00000001
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0
        25 alpha:
                flags: range
                values: 0 255
                value: 255
43      0       0       0,0             0,0     0               0x00000001
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0
        25 alpha:
                flags: range
                values: 0 255
                value: 255
53      57      71      0,0             0,0     0               0x00000002
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 1
        25 alpha:
                flags: range
                values: 0 255
                value: 255
54      0       0       0,0             0,0     0               0x00000002
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0
        25 alpha:
                flags: range
                values: 0 255
                value: 255
55      0       0       0,0             0,0     0               0x00000002
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0
        25 alpha:
                flags: range
                values: 0 255
                value: 255
56      0       0       0,0             0,0     0               0x00000002
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0
        25 alpha:
                flags: range
                values: 0 255
                value: 255

Frame buffers:
id      size    pitch

connectors显示了display连接链路状态:

status=connected说明链路创建ok ,encoders=30说明该connector(id=31)绑定的encoder id=30;

分辨率:1920x720 

刷新率:60帧

Connectors:
id      encoder status          name            size (mm)       modes   encoders
31      30      connected       eDP-1           0x0             1       30
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  1920x720 60 1920 1944 1960 1984 720 760 768 792 96000 flags: ; type:

hdisp 等参数和source code中设定相同:

 560 static const struct drm_display_mode auo_g133han01_mode = {                     
 561         .clock = 96000,                                                         
 562         .hdisplay = 1920,                                                       
 563         .hsync_start = 1920 + 32,                                               
 564         .hsync_end = 1920 + 32 + 1,                                             
 565         .htotal = 1920 + 32 + 1 + 31,                                           
 566         .vdisplay = 720,                                                        
 567         .vsync_start = 720 + 18,                                                
 568         .vsync_end = 720 + 18 + 1,                                              
 569         .vtotal = 720 + 18 + 1 + 17,                                            
 570         .vrefresh = 60,                                                         
 571 };   

4、planes

plane中的format表面该plane支持的色彩格式:

Planes:
id      crtc    fb      CRTC x,y        x,y     gamma size      possible crtcs
40      44      70      0,0             0,0     0               0x00000001
  formats: XR24 XB24 AR24 AB24 RA24 RG24 BG24 RG16 BG16 UYVY YUYV
  props:
        5 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 1
        25 alpha:
                flags: range
                values: 0 255
                value: 255

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值