Home | History | Annotate | Download | only in qxl

Lines Matching defs:qdev

49 static int qxl_alloc_client_monitors_config(struct qxl_device *qdev,
52 if (qdev->client_monitors_config &&
53 count > qdev->client_monitors_config->count) {
54 kfree(qdev->client_monitors_config);
55 qdev->client_monitors_config = NULL;
57 if (!qdev->client_monitors_config) {
58 qdev->client_monitors_config = kzalloc(
59 struct_size(qdev->client_monitors_config,
61 if (!qdev->client_monitors_config)
64 qdev->client_monitors_config->count = count;
75 static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev)
82 num_monitors = qdev->rom->client_monitors_config.count;
83 crc = crc32(0, (const uint8_t *)&qdev->rom->client_monitors_config,
84 sizeof(qdev->rom->client_monitors_config));
85 if (crc != qdev->rom->client_monitors_config_crc)
96 num_monitors = qdev->rom->client_monitors_config.count;
98 if (qdev->client_monitors_config
99 && (num_monitors != qdev->client_monitors_config->count)) {
102 if (qxl_alloc_client_monitors_config(qdev, num_monitors)) {
107 qdev->client_monitors_config->max_allowed = qxl_num_crtc;
108 for (i = 0 ; i < qdev->client_monitors_config->count ; ++i) {
110 &qdev->rom->client_monitors_config.heads[i];
112 &qdev->client_monitors_config->heads[i];
148 static void qxl_update_offset_props(struct qxl_device *qdev)
150 struct drm_device *dev = &qdev->ddev;
158 head = &qdev->client_monitors_config->heads[output->index];
167 void qxl_display_read_client_monitors_config(struct qxl_device *qdev)
169 struct drm_device *dev = &qdev->ddev;
173 status = qxl_display_copy_rom_client_monitors_config(qdev);
192 qxl_update_offset_props(qdev);
201 static int qxl_check_mode(struct qxl_device *qdev,
212 if (size > qdev->vram_size)
217 static int qxl_check_framebuffer(struct qxl_device *qdev,
220 return qxl_check_mode(qdev, bo->surf.width, bo->surf.height);
229 struct qxl_device *qdev = dev->dev_private;
233 rc = qxl_check_mode(qdev, width, height);
250 struct qxl_device *qdev = dev->dev_private;
255 if (!qdev->monitors_config)
259 if (!qdev->client_monitors_config)
261 if (h >= qdev->client_monitors_config->count)
264 head = &qdev->client_monitors_config->heads[h];
291 static void qxl_send_monitors_config(struct qxl_device *qdev)
295 BUG_ON(!qdev->ram_header->monitors_config);
297 if (qdev->monitors_config->count == 0)
300 for (i = 0 ; i < qdev->monitors_config->count ; ++i) {
301 struct qxl_head *head = &qdev->monitors_config->heads[i];
311 qxl_io_monitors_config(qdev);
318 struct qxl_device *qdev = dev->dev_private;
323 if (!qdev->primary_bo) {
328 if (!qdev->monitors_config || qxl_num_crtc <= i)
333 oldcount = qdev->monitors_config->count;
341 if (qdev->monitors_config->count < i + 1)
342 qdev->monitors_config->count = i + 1;
343 if (qdev->primary_bo == qdev->dumb_shadow_bo)
344 head.x += qdev->dumb_heads[i].x;
350 if (qdev->monitors_config->count == i + 1)
351 qdev->monitors_config->count = i;
357 if (head.width == qdev->monitors_config->heads[i].width &&
358 head.height == qdev->monitors_config->heads[i].height &&
359 head.x == qdev->monitors_config->heads[i].x &&
360 head.y == qdev->monitors_config->heads[i].y &&
361 oldcount == qdev->monitors_config->count)
367 if (oldcount != qdev->monitors_config->count)
369 oldcount, qdev->monitors_config->count,
372 qdev->monitors_config->heads[i] = head;
373 qdev->monitors_config->max_allowed = qxl_num_crtc;
374 qxl_send_monitors_config(qdev);
421 struct qxl_device *qdev = fb->dev->dev_private;
448 qxl_draw_dirty_fb(qdev, fb, qobj, flags, color,
483 struct qxl_device *qdev = plane->dev->dev_private;
491 return qxl_check_framebuffer(qdev, bo);
497 struct qxl_device *qdev = dev->dev_private;
507 ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd),
521 cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
526 cmd->u.set.shape = qxl_bo_physical_address(qdev, qcrtc->cursor_bo, 0);
529 qxl_release_unmap(qdev, release, &cmd->release_info);
531 qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
537 qxl_release_free(qdev, release);
544 struct qxl_device *qdev = plane->dev->dev_private;
558 if (qdev->primary_bo)
559 qxl_io_destroy_primary(qdev);
560 qxl_io_create_primary(qdev, primary);
566 qdev->dumb_heads[plane->state->crtc->index].x;
568 qxl_draw_dirty_fb(qdev, plane->state->fb, bo, 0, 0, &norect, 1, 1,
575 struct qxl_device *qdev = plane->dev->dev_private;
581 qxl_io_destroy_primary(qdev);
591 struct qxl_device *qdev = dev->dev_private;
603 ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd),
618 ret = qxl_alloc_bo_reserved(qdev, release,
650 cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release);
652 cmd->u.set.shape = qxl_bo_physical_address(qdev,
665 cmd = (struct qxl_cursor_cmd *) qxl_release_map(qdev, release);
672 qxl_release_unmap(qdev, release, &cmd->release_info);
673 qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
692 qxl_release_free(qdev, release);
700 struct qxl_device *qdev = plane->dev->dev_private;
705 ret = qxl_alloc_release_reserved(qdev, sizeof(*cmd),
713 qxl_release_free(qdev, release);
717 cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
719 qxl_release_unmap(qdev, release, &cmd->release_info);
721 qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
725 static void qxl_update_dumb_head(struct qxl_device *qdev,
730 if (index >= qdev->monitors_config->max_allowed)
741 if (qdev->dumb_heads[index].width == width &&
742 qdev->dumb_heads[index].height == height)
746 qdev->dumb_heads[index].width,
747 qdev->dumb_heads[index].height,
749 qdev->dumb_heads[index].width = width;
750 qdev->dumb_heads[index].height = height;
753 static void qxl_calc_dumb_shadow(struct qxl_device *qdev,
760 for (i = 0; i < qdev->monitors_config->max_allowed; i++) {
761 head = qdev->dumb_heads + i;
774 if (!qdev->dumb_shadow_bo ||
775 qdev->dumb_shadow_bo->surf.width != surf->width ||
776 qdev->dumb_shadow_bo->surf.height != surf->height)
783 struct qxl_device *qdev = plane->dev->dev_private;
797 qxl_update_dumb_head(qdev, new_state->crtc->index,
799 qxl_calc_dumb_shadow(qdev, &surf);
800 if (!qdev->dumb_shadow_bo ||
801 qdev->dumb_shadow_bo->surf.width != surf.width ||
802 qdev->dumb_shadow_bo->surf.height != surf.height) {
803 if (qdev->dumb_shadow_bo) {
805 (&qdev->dumb_shadow_bo->tbo.base);
806 qdev->dumb_shadow_bo = NULL;
808 qxl_bo_create(qdev, surf.height * surf.stride,
810 &qdev->dumb_shadow_bo);
812 if (user_bo->shadow != qdev->dumb_shadow_bo) {
818 drm_gem_object_get(&qdev->dumb_shadow_bo->tbo.base);
819 user_bo->shadow = qdev->dumb_shadow_bo;
896 static struct drm_plane *qxl_create_plane(struct qxl_device *qdev,
925 err = drm_universal_plane_init(&qdev->ddev, plane, possible_crtcs,
944 struct qxl_device *qdev = dev->dev_private;
951 primary = qxl_create_plane(qdev, 1 << crtc_id, DRM_PLANE_TYPE_PRIMARY);
957 cursor = qxl_create_plane(qdev, 1 << crtc_id, DRM_PLANE_TYPE_CURSOR);
986 struct qxl_device *qdev = dev->dev_private;
992 if (qdev->client_monitors_config) {
994 head = &qdev->client_monitors_config->heads[output->index];
1012 struct qxl_device *qdev = ddev->dev_private;
1014 if (qxl_check_mode(qdev, mode->hdisplay, mode->vdisplay) != 0)
1045 struct qxl_device *qdev = ddev->dev_private;
1049 if (!qdev->client_monitors_config) {
1053 connected = qdev->client_monitors_config->count > output->index &&
1054 qxl_head_enabled(&qdev->client_monitors_config->heads[output->index]);
1090 static int qxl_mode_create_hotplug_mode_update_property(struct qxl_device *qdev)
1092 if (qdev->hotplug_mode_update_property)
1095 qdev->hotplug_mode_update_property =
1096 drm_property_create_range(&qdev->ddev, DRM_MODE_PROP_IMMUTABLE,
1104 struct qxl_device *qdev = dev->dev_private;
1132 qdev->hotplug_mode_update_property, 0);
1155 int qxl_create_monitors_object(struct qxl_device *qdev)
1162 ret = qxl_gem_object_create(qdev, monitors_config_size, 0,
1169 qdev->monitors_config_bo = gem_to_qxl_bo(gobj);
1171 ret = qxl_bo_pin(qdev->monitors_config_bo);
1175 qxl_bo_kmap(qdev->monitors_config_bo, NULL);
1177 qdev->monitors_config = qdev->monitors_config_bo->kptr;
1178 qdev->ram_header->monitors_config =
1179 qxl_bo_physical_address(qdev, qdev->monitors_config_bo, 0);
1181 memset(qdev->monitors_config, 0, monitors_config_size);
1182 qdev->dumb_heads = kcalloc(qxl_num_crtc, sizeof(qdev->dumb_heads[0]),
1184 if (!qdev->dumb_heads) {
1185 qxl_destroy_monitors_object(qdev);
1191 int qxl_destroy_monitors_object(struct qxl_device *qdev)
1195 qdev->monitors_config = NULL;
1196 qdev->ram_header->monitors_config = 0;
1198 qxl_bo_kunmap(qdev->monitors_config_bo);
1199 ret = qxl_bo_unpin(qdev->monitors_config_bo);
1203 qxl_bo_unref(&qdev->monitors_config_bo);
1207 int qxl_modeset_init(struct qxl_device *qdev)
1212 drm_mode_config_init(&qdev->ddev);
1214 ret = qxl_create_monitors_object(qdev);
1218 qdev->ddev.mode_config.funcs = (void *)&qxl_mode_funcs;
1221 qdev->ddev.mode_config.min_width = 0;
1222 qdev->ddev.mode_config.min_height = 0;
1223 qdev->ddev.mode_config.max_width = 8192;
1224 qdev->ddev.mode_config.max_height = 8192;
1226 qdev->ddev.mode_config.fb_base = qdev->vram_base;
1228 drm_mode_create_suggested_offset_properties(&qdev->ddev);
1229 qxl_mode_create_hotplug_mode_update_property(qdev);
1232 qdev_crtc_init(&qdev->ddev, i);
1233 qdev_output_init(&qdev->ddev, i);
1236 qxl_display_read_client_monitors_config(qdev);
1238 drm_mode_config_reset(&qdev->ddev);
1242 void qxl_modeset_fini(struct qxl_device *qdev)
1244 qxl_destroy_monitors_object(qdev);
1245 drm_mode_config_cleanup(&qdev->ddev);