tests/modetest: get cursor width and height by drmGetCap

Should get cursor width and height by drmGetCap.

Signed-off-by: ZhiJie.Zhang <zhangzhijie@loongson.cn>
main
ZhiJie.Zhang 2021-03-08 20:35:30 +08:00 committed by Simon Ser
parent a7892962e1
commit d201a41d1a
1 changed files with 11 additions and 3 deletions

View File

@ -1710,13 +1710,21 @@ static void set_planes(struct device *dev, struct plane_arg *p, unsigned int cou
static void set_cursors(struct device *dev, struct pipe_arg *pipes, unsigned int count) static void set_cursors(struct device *dev, struct pipe_arg *pipes, unsigned int count)
{ {
uint32_t handles[4] = {0}, pitches[4] = {0}, offsets[4] = {0}; uint32_t handles[4] = {0}, pitches[4] = {0}, offsets[4] = {0};
uint32_t cw = 64;
uint32_t ch = 64;
struct bo *bo; struct bo *bo;
uint64_t value;
unsigned int i; unsigned int i;
int ret; int ret;
/* maybe make cursor width/height configurable some day */ ret = drmGetCap(dev->fd, DRM_CAP_CURSOR_WIDTH, &value);
uint32_t cw = 64; if (!ret)
uint32_t ch = 64; cw = value;
ret = drmGetCap(dev->fd, DRM_CAP_CURSOR_HEIGHT, &value);
if (!ret)
ch = value;
/* create cursor bo.. just using PATTERN_PLAIN as it has /* create cursor bo.. just using PATTERN_PLAIN as it has
* translucent alpha * translucent alpha