commit 2f66cea
Michael Forney
·
2018-11-26 06:31:36 +0000 UTC
parent 6d8f36c
drm: Query cursor size from driver
3 files changed,
+10,
-2
+7,
-0
1@@ -252,6 +252,7 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
2 bool
3 drm_initialize(void)
4 {
5+ uint64_t val;
6 char primary[128];
7
8 if (!find_primary_drm_device(primary, sizeof(primary))) {
9@@ -265,6 +266,12 @@ drm_initialize(void)
10 ERROR("Could not open DRM device at %s\n", primary);
11 goto error0;
12 }
13+ if (drmGetCap(swc.drm->fd, DRM_CAP_CURSOR_WIDTH, &val) < 0)
14+ val = 64;
15+ swc.drm->cursor_w = val;
16+ if (drmGetCap(swc.drm->fd, DRM_CAP_CURSOR_HEIGHT, &val) < 0)
17+ val = 64;
18+ swc.drm->cursor_h = val;
19
20 drm.path = drmGetRenderDeviceNameFromFd(swc.drm->fd);
21 if (!drm.path) {
+1,
-0
1@@ -12,6 +12,7 @@ struct drm_handler {
2
3 struct swc_drm {
4 int fd;
5+ uint32_t cursor_w, cursor_h;
6 struct wld_context *context;
7 struct wld_renderer *renderer;
8 };
+2,
-2
1@@ -91,7 +91,7 @@ attach(struct view *view, struct wld_buffer *buffer)
2 return 0;
3
4 wld_set_target_buffer(swc.shm->renderer, pointer->cursor.buffer);
5- wld_fill_rectangle(swc.shm->renderer, 0x00000000, 0, 0, 64, 64);
6+ wld_fill_rectangle(swc.shm->renderer, 0x00000000, 0, 0, pointer->cursor.buffer->width, pointer->cursor.buffer->height);
7
8 if (buffer)
9 wld_copy_rectangle(swc.shm->renderer, buffer, 0, 0, 0, 0, buffer->width, buffer->height);
10@@ -234,7 +234,7 @@ pointer_initialize(struct pointer *pointer)
11 view_initialize(&pointer->cursor.view, &view_impl);
12 pointer->cursor.surface = NULL;
13 pointer->cursor.destroy_listener.notify = &handle_cursor_surface_destroy;
14- pointer->cursor.buffer = wld_create_buffer(swc.drm->context, 64, 64, WLD_FORMAT_ARGB8888, WLD_FLAG_MAP);
15+ pointer->cursor.buffer = wld_create_buffer(swc.drm->context, swc.drm->cursor_w, swc.drm->cursor_h, WLD_FORMAT_ARGB8888, WLD_FLAG_MAP);
16 pointer->cursor.internal_buffer = NULL;
17
18 if (!pointer->cursor.buffer)