您尚未登录。

楼主 # 2021-11-02 15:59:14

xyyangkun
会员
注册时间: 2018-03-14
已发帖子: 18
积分: 17

drm plane rotate操作 疑问

使用的rk3568, 接了dsi竖屏:

163	162	connected	DSI-1          	0x0		1	162
  modes:
	name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  1080x1920 62 1080 1116 1120 1150 1920 1926 1928 1934 138000 flags: nhsync, nvsync; type: preferred, driver

有支持rotate的plane,这个plane如何使用?如果我设置roate 90或270后,是不是可以将横屏的1920x1080数据,直接发送到竖屏(1080x1920)上进行显示?
目前rotate操作是调用opencl 旋转后送到竖屏drm显示的。

131	0	0	0,0		0,0	0       	0x00000003
  formats: XR24 AR24 XB24 AB24 RG24 BG24 RG16 BG16 NV12 NV16 NV24 NA12 NA16 NA24
  props:
	8 type:
		flags: immutable enum
		enums: Overlay=0 Primary=1 Cursor=2
		value: 0
	30 IN_FORMATS:
		flags: immutable blob
		blobs:

		value:
			01000000000000000e00000018000000
			0a000000500000005852323441523234
			58423234414232345247323442473234
			52473136424731364e5631324e563136
			4e5632344e4131324e4131364e413234
			ff1b0000000000000000000000000000
			0100000000000008ff1b000000000000
			00000000000000004100000000000008
			ff1b0000000000000000000000000000
			1100000000000008ff1b000000000000
			00000000000000008100000000000008
			ff1b0000000000000000000000000000
			5100000000000008ff1b000000000000
			0000000000000000c100000000000008
			ff1b0000000000000000000000000000
			9100000000000008ff1b000000000000
			0000000000000000d100000000000008
			ff1b0000000000000000000000000000
			7100000000000008ff3f000000000000
			00000000000000000000000000000000
		in_formats blob decoded:
			 XR24:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 AR24:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 XB24:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 AB24:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 RG24:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 BG24:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 RG16:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 BG16:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 NV12:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 NV16:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 NV24:  LINEAR
			 NA12:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 NA16:  (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) (UNKNOWN MODIFIER) LINEAR
			 NA24:  LINEAR
	133 rotation:
		flags: bitmask
		values: rotate-0=0x1 rotate-90=0x2 rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
		value: 0
	134 alpha:
		flags: range
		values: 0 65535
		value: 65535
	135 pixel blend mode:
		flags: enum
		enums: None=2 Pre-multiplied=0 Coverage=1
		value: 0
	136 zpos:
		flags: range
		values: 0 7
		value: 6
	137 NAME:
		flags: immutable bitmask
		values: Cluster1-win0=0x40
		value: 64
	138 FEATURE:
		flags: immutable bitmask
		values: scale=0x1 afbdc=0x10
		value: 17
	139 INPUT_WIDTH:
		flags: immutable range
		values: 0 4096
		value: 0
	140 INPUT_HEIGHT:
		flags: immutable range
		values: 0 2304
		value: 0
	141 OUTPUT_WIDTH:
		flags: immutable range
		values: 0 4096
		value: 0
	142 OUTPUT_HEIGHT:
		flags: immutable range
		values: 0 2304
		value: 0
	143 SCALE_RATE:
		flags: immutable range
		values: 4 4
		value: 0
	144 colorkey:
		flags: range
		values: 0 2164260863
		value: 0

离线

#1 2021-11-03 14:43:32

jlau
会员
注册时间: 2018-06-11
已发帖子: 210
积分: 202.5

Re: drm plane rotate操作 疑问

drmModeObjectSetProperty()

离线

#2 2021-11-03 14:51:26

Dorothy
会员
注册时间: 2021-10-26
已发帖子: 6
积分: 1

Re: drm plane rotate操作 疑问

没看懂你的需求是啥,如果用的是官方默认的Linux的SDK,输入下面的命令看看;

echo "output:all:rotate90"> /tmp/.weston_drm.conf # All screens are rotated 90 degrees

离线

楼主 #3 2021-11-04 14:45:31

xyyangkun
会员
注册时间: 2018-03-14
已发帖子: 18
积分: 17

Re: drm plane rotate操作 疑问

Dorothy 说:

没看懂你的需求是啥,如果用的是官方默认的Linux的SDK,输入下面的命令看看;

echo "output:all:rotate90"> /tmp/.weston_drm.conf # All screens are rotated 90 degrees

先说正常情况:竖屏1080x1920的plane,播放视频,需要1080x1920分辨率的。一般视频是1920x1080格式,如果想在竖屏播放,必须rotate后成1080x1920的才可以发送给plane.
需求就是:想通过设置drm plane的rotate属性,比如设置旋转90度,之后向此plane发送1920x1080的视频,此plane是不是就可以“在内部rotate后”,显示到1080x1920的屏幕上?

离线

楼主 #4 2021-11-04 14:52:05

xyyangkun
会员
注册时间: 2018-03-14
已发帖子: 18
积分: 17

Re: drm plane rotate操作 疑问

jlau 说:

drmModeObjectSetProperty()


尝试通过这个接口设置支持rotate的plane,但是不行。

void set_plane_property(int fd, int plane_id,struct property_arg *p)
{

    drmModeObjectPropertiesPtr props;
    drmModePropertyPtr pt;
    const char *obj_type;
    int ret;
    int i;

    props = drmModeObjectGetProperties(fd, plane_id,
                DRM_MODE_OBJECT_PLANE);

    if(props){
        for (i = 0; i < (int)props->count_props; ++i) {

            pt = drmModeGetProperty(fd, props->props[i]);

            if (!pt)
                continue;
            if (strcmp(pt->name, p->name) == 0){
                drmModeFreeProperty(pt);
                break;
            }

            drmModeFreeProperty(pt);
        }

        if (i == (int)props->count_props) {
            printf("%i has no %s property\n",p->obj_id, p->name);
            return;
        }

        p->prop_id = props->props[i];

        ret = drmModeObjectSetProperty(fd, p->obj_id, p->obj_type,
                           p->prop_id, p->value);
        if (ret < 0)
            printf("faild to set property %s,id %d,value %d\n",p->obj_id, p->name, p->value);

        drmModeFreeObjectProperties(props);
    }
}
void set_rotation(int fd, int plane_id,int value)
{
    struct property_arg prop;


    if(value !=1 && value !=2 && value !=4 && value !=8)
        return;

    memset(&prop, 0, sizeof(prop));
    prop.obj_type = 0;
    prop.name[DRM_PROP_NAME_LEN] = '\0';
    prop.obj_id = plane_id;
    memcpy(prop.name,"rotation",sizeof("rotation"));
    prop.value = value; //rotate-0=0x1 rotate-90=0x2 rotate-180=0x4 rotate-270=0x8, modetest -p can show the details
    set_plane_property(fd,plane_id,&prop);

}
set_rotation(fd,plane_res->planes[index], 0x1);

离线

#5 2021-11-04 17:19:24

jlau
会员
注册时间: 2018-06-11
已发帖子: 210
积分: 202.5

Re: drm plane rotate操作 疑问

跟跟rockchip drm代码

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn