misc pull req all over. Biggest thing is the drm_connector_(un)register_all cleanup from Alexey for drivers without the load/unload midlayer hooks. I.e. all the new ones, and a bunch of the pending new atomic drivers depend upon this. Or at least I asked them to rebase ;-) * tag 'topic/drm-misc-2016-04-21' of git://anongit.freedesktop.org/drm-intel: drm: Make drm.debug parameter description more helpful drm: Remove warning from drm_connector_unregister_all() drm: probe_helper: Hide ugly ifdef drm: rcar-du: Use generic drm_connector_register_all() helper drm: atmel_hldc: Use generic drm_connector_register_all() helper drm: Introduce drm_connector_register_all() helper drm: fix lut value extraction function drm/atomic-helper: Print an error if vblank wait times out drm/dp/mst: Restore primary hub guid on resume drm: Release driver references to handle before making it available again drm/i915/dp/mst: Add source port info to debugfs output drm/dp/mst: Enhance DP MST debugfs output drm/edid: Add drm_edid_get_monitor_name() include/drm: Reword debug categories comment. drm/crtc_helper: Reset empty plane state in drm_helper_crtc_mode_set_base() drm/virtio: Drop dummy gamma table support drm/bochs: Drop fake gamma support drm/core: Fix ordering in drm_mode_config_cleanup.
Unified · Split
| @@ -584,34 +584,6 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev) · 583 unmodified lines | ||
| 584 | 584 | destroy_workqueue(dc->wq); |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | −static int atmel_hlcdc_dc_connector_plug_all(struct drm_device *dev) | |
| 588 | −{ | |
| 589 | − struct drm_connector *connector, *failed; | |
| 590 | − int ret; | |
| 591 | − | |
| 592 | − mutex_lock(&dev->mode_config.mutex); | |
| 593 | − list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | |
| 594 | − ret = drm_connector_register(connector); | |
| 595 | − if (ret) { | |
| 596 | − failed = connector; | |
| 597 | − goto err; | |
| 598 | − } | |
| 599 | − } | |
| 600 | − mutex_unlock(&dev->mode_config.mutex); | |
| 601 | − return 0; | |
| 602 | − | |
| 603 | −err: | |
| 604 | − list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | |
| 605 | − if (failed == connector) | |
| 606 | − break; | |
| 607 | − | |
| 608 | − drm_connector_unregister(connector); | |
| 609 | − } | |
| 610 | − mutex_unlock(&dev->mode_config.mutex); | |
| 611 | − | |
| 612 | − return ret; | |
| 613 | −} | |
| 614 | − | |
| 615 | 587 | static void atmel_hlcdc_dc_connector_unplug_all(struct drm_device *dev) |
| 616 | 588 | { |
| 617 | 589 | mutex_lock(&dev->mode_config.mutex); |
| @@ -736,7 +708,7 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev) · 118 unmodified lines | ||
| 736 | 708 | if (ret) |
| 737 | 709 | goto err_unload; |
| 738 | 710 | |
| 739 | − ret = atmel_hlcdc_dc_connector_plug_all(ddev); | |
| 711 | + ret = drm_connector_register_all(ddev); | |
| 740 | 712 | if (ret) |
| 741 | 713 | goto err_unregister; |
| 742 | 714 | |
| @@ -162,22 +162,7 @@ static int bochs_fbdev_destroy(struct bochs_device *bochs) · 161 unmodified lines | ||
| 162 | 162 | return 0; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | −void bochs_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, | |
| 166 | − u16 blue, int regno) | |
| 167 | −{ | |
| 168 | −} | |
| 169 | − | |
| 170 | −void bochs_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | |
| 171 | − u16 *blue, int regno) | |
| 172 | −{ | |
| 173 | − *red = regno; | |
| 174 | − *green = regno; | |
| 175 | − *blue = regno; | |
| 176 | −} | |
| 177 | − | |
| 178 | 165 | static const struct drm_fb_helper_funcs bochs_fb_helper_funcs = { |
| 179 | − .gamma_set = bochs_fb_gamma_set, | |
| 180 | − .gamma_get = bochs_fb_gamma_get, | |
| 181 | 166 | .fb_probe = bochsfb_create, |
| 182 | 167 | }; |
| 183 | 168 | |
| @@ -93,11 +93,6 @@ static void bochs_crtc_commit(struct drm_crtc *crtc) · 92 unmodified lines | ||
| 93 | 93 | { |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | −static void bochs_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | |
| 97 | − u16 *blue, uint32_t start, uint32_t size) | |
| 98 | −{ | |
| 99 | −} | |
| 100 | − | |
| 101 | 96 | static int bochs_crtc_page_flip(struct drm_crtc *crtc, |
| 102 | 97 | struct drm_framebuffer *fb, |
| 103 | 98 | struct drm_pending_vblank_event *event, |
| @@ -120,7 +115,6 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc, · 16 unmodified lines | ||
| 120 | 115 | |
| 121 | 116 | /* These provide the minimum set of functions required to handle a CRTC */ |
| 122 | 117 | static const struct drm_crtc_funcs bochs_crtc_funcs = { |
| 123 | − .gamma_set = bochs_crtc_gamma_set, | |
| 124 | 118 | .set_config = drm_crtc_helper_set_config, |
| 125 | 119 | .destroy = drm_crtc_cleanup, |
| 126 | 120 | .page_flip = bochs_crtc_page_flip, |
| @@ -140,7 +134,6 @@ static void bochs_crtc_init(struct drm_device *dev) · 13 unmodified lines | ||
| 140 | 134 | struct drm_crtc *crtc = &bochs->crtc; |
| 141 | 135 | |
| 142 | 136 | drm_crtc_init(dev, crtc, &bochs_crtc_funcs); |
| 143 | − drm_mode_crtc_set_gamma_size(crtc, 256); | |
| 144 | 137 | drm_crtc_helper_add(crtc, &bochs_helper_funcs); |
| 145 | 138 | } |
| 146 | 139 | |
| @@ -1103,6 +1103,8 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, · 1102 unmodified lines | ||
| 1103 | 1103 | drm_crtc_vblank_count(crtc), |
| 1104 | 1104 | msecs_to_jiffies(50)); |
| 1105 | 1105 | |
| 1106 | + WARN(!ret, "[CRTC:%d] vblank wait timed out\n", crtc->base.id); | |
| 1107 | + | |
| 1106 | 1108 | drm_crtc_vblank_put(crtc); |
| 1107 | 1109 | } |
| 1108 | 1110 | } |
| @@ -1067,6 +1067,46 @@ void drm_connector_unregister(struct drm_connector *connector) · 1066 unmodified lines | ||
| 1067 | 1067 | } |
| 1068 | 1068 | EXPORT_SYMBOL(drm_connector_unregister); |
| 1069 | 1069 | |
| 1070 | +/** | |
| 1071 | + * drm_connector_register_all - register all connectors | |
| 1072 | + * @dev: drm device | |
| 1073 | + * | |
| 1074 | + * This function registers all connectors in sysfs and other places so that | |
| 1075 | + * userspace can start to access them. Drivers can call it after calling | |
| 1076 | + * drm_dev_register() to complete the device registration, if they don't call | |
| 1077 | + * drm_connector_register() on each connector individually. | |
| 1078 | + * | |
| 1079 | + * When a device is unplugged and should be removed from userspace access, | |
| 1080 | + * call drm_connector_unregister_all(), which is the inverse of this | |
| 1081 | + * function. | |
| 1082 | + * | |
| 1083 | + * Returns: | |
| 1084 | + * Zero on success, error code on failure. | |
| 1085 | + */ | |
| 1086 | +int drm_connector_register_all(struct drm_device *dev) | |
| 1087 | +{ | |
| 1088 | + struct drm_connector *connector; | |
| 1089 | + int ret; | |
| 1090 | + | |
| 1091 | + mutex_lock(&dev->mode_config.mutex); | |
| 1092 | + | |
| 1093 | + drm_for_each_connector(connector, dev) { | |
| 1094 | + ret = drm_connector_register(connector); | |
| 1095 | + if (ret) | |
| 1096 | + goto err; | |
| 1097 | + } | |
| 1098 | + | |
| 1099 | + mutex_unlock(&dev->mode_config.mutex); | |
| 1100 | + | |
| 1101 | + return 0; | |
| 1102 | + | |
| 1103 | +err: | |
| 1104 | + mutex_unlock(&dev->mode_config.mutex); | |
| 1105 | + drm_connector_unregister_all(dev); | |
| 1106 | + return ret; | |
| 1107 | +} | |
| 1108 | +EXPORT_SYMBOL(drm_connector_register_all); | |
| 1109 | + | |
| 1070 | 1110 | /** |
| 1071 | 1111 | * drm_connector_unregister_all - unregister connector userspace interfaces |
| 1072 | 1112 | * @dev: drm device |
| @@ -1082,7 +1122,7 @@ void drm_connector_unregister_all(struct drm_device *dev) · 9 unmodified lines | ||
| 1082 | 1122 | struct drm_connector *connector; |
| 1083 | 1123 | |
| 1084 | 1124 | /* FIXME: taking the mode config mutex ends up in a clash with sysfs */ |
| 1085 | − drm_for_each_connector(connector, dev) | |
| 1125 | + list_for_each_entry(connector, &dev->mode_config.connector_list, head) | |
| 1086 | 1126 | drm_connector_unregister(connector); |
| 1087 | 1127 | } |
| 1088 | 1128 | EXPORT_SYMBOL(drm_connector_unregister_all); |
| @@ -5914,6 +5954,15 @@ void drm_mode_config_cleanup(struct drm_device *dev) · 4825 unmodified lines | ||
| 5914 | 5954 | drm_property_destroy(dev, property); |
| 5915 | 5955 | } |
| 5916 | 5956 | |
| 5957 | + list_for_each_entry_safe(plane, plt, &dev->mode_config.plane_list, | |
| 5958 | + head) { | |
| 5959 | + plane->funcs->destroy(plane); | |
| 5960 | + } | |
| 5961 | + | |
| 5962 | + list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) { | |
| 5963 | + crtc->funcs->destroy(crtc); | |
| 5964 | + } | |
| 5965 | + | |
| 5917 | 5966 | list_for_each_entry_safe(blob, bt, &dev->mode_config.property_blob_list, |
| 5918 | 5967 | head_global) { |
| 5919 | 5968 | drm_property_unreference_blob(blob); |
| @@ -5932,15 +5981,6 @@ void drm_mode_config_cleanup(struct drm_device *dev) · 12 unmodified lines | ||
| 5932 | 5981 | drm_framebuffer_free(&fb->refcount); |
| 5933 | 5982 | } |
| 5934 | 5983 | |
| 5935 | − list_for_each_entry_safe(plane, plt, &dev->mode_config.plane_list, | |
| 5936 | − head) { | |
| 5937 | − plane->funcs->destroy(plane); | |
| 5938 | − } | |
| 5939 | − | |
| 5940 | − list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) { | |
| 5941 | − crtc->funcs->destroy(crtc); | |
| 5942 | − } | |
| 5943 | − | |
| 5944 | 5984 | ida_destroy(&dev->mode_config.connector_ida); |
| 5945 | 5985 | idr_destroy(&dev->mode_config.tile_idr); |
| 5946 | 5986 | idr_destroy(&dev->mode_config.crtc_idr); |
| @@ -1053,10 +1053,12 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, · 1052 unmodified lines | ||
| 1053 | 1053 | |
| 1054 | 1054 | if (plane->funcs->atomic_duplicate_state) |
| 1055 | 1055 | plane_state = plane->funcs->atomic_duplicate_state(plane); |
| 1056 | − else if (plane->state) | |
| 1056 | + else { | |
| 1057 | + if (!plane->state) | |
| 1058 | + drm_atomic_helper_plane_reset(plane); | |
| 1059 | + | |
| 1057 | 1060 | plane_state = drm_atomic_helper_plane_duplicate_state(plane); |
| 1058 | − else | |
| 1059 | − plane_state = kzalloc(sizeof(*plane_state), GFP_KERNEL); | |
| 1061 | + } | |
| 1060 | 1062 | if (!plane_state) |
| 1061 | 1063 | return -ENOMEM; |
| 1062 | 1064 | plane_state->plane = plane; |
| @@ -2121,6 +2121,8 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr) · 2120 unmodified lines | ||
| 2121 | 2121 | |
| 2122 | 2122 | if (mgr->mst_primary) { |
| 2123 | 2123 | int sret; |
| 2124 | + u8 guid[16]; | |
| 2125 | + | |
| 2124 | 2126 | sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE); |
| 2125 | 2127 | if (sret != DP_RECEIVER_CAP_SIZE) { |
| 2126 | 2128 | DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n"); |
| @@ -2135,6 +2137,16 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr) · 8 unmodified lines | ||
| 2135 | 2137 | ret = -1; |
| 2136 | 2138 | goto out_unlock; |
| 2137 | 2139 | } |
| 2140 | + | |
| 2141 | + /* Some hubs forget their guids after they resume */ | |
| 2142 | + sret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16); | |
| 2143 | + if (sret != 16) { | |
| 2144 | + DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n"); | |
| 2145 | + ret = -1; | |
| 2146 | + goto out_unlock; | |
| 2147 | + } | |
| 2148 | + drm_dp_check_mstb_guid(mgr->mst_primary, guid); | |
| 2149 | + | |
| 2138 | 2150 | ret = 0; |
| 2139 | 2151 | } else |
| 2140 | 2152 | ret = -1; |
| @@ -2729,7 +2741,7 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m, · 588 unmodified lines | ||
| 2729 | 2741 | |
| 2730 | 2742 | seq_printf(m, "%smst: %p, %d\n", prefix, mstb, mstb->num_ports); |
| 2731 | 2743 | list_for_each_entry(port, &mstb->ports, next) { |
| 2732 | − seq_printf(m, "%sport: %d: ddps: %d ldps: %d, sdp: %d/%d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port->num_sdp_streams, port->num_sdp_stream_sinks, port, port->connector); | |
| 2744 | + seq_printf(m, "%sport: %d: input: %d: pdt: %d, ddps: %d ldps: %d, sdp: %d/%d, %p, conn: %p\n", prefix, port->port_num, port->input, port->pdt, port->ddps, port->ldps, port->num_sdp_streams, port->num_sdp_stream_sinks, port, port->connector); | |
| 2733 | 2745 | if (port->mstb) |
| 2734 | 2746 | drm_dp_mst_dump_mstb(m, port->mstb); |
| 2735 | 2747 | } |
| @@ -2750,6 +2762,16 @@ static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr, · 14 unmodified lines | ||
| 2750 | 2762 | return false; |
| 2751 | 2763 | } |
| 2752 | 2764 | |
| 2765 | +static void fetch_monitor_name(struct drm_dp_mst_topology_mgr *mgr, | |
| 2766 | + struct drm_dp_mst_port *port, char *name, | |
| 2767 | + int namelen) | |
| 2768 | +{ | |
| 2769 | + struct edid *mst_edid; | |
| 2770 | + | |
| 2771 | + mst_edid = drm_dp_mst_get_edid(port->connector, mgr, port); | |
| 2772 | + drm_edid_get_monitor_name(mst_edid, name, namelen); | |
| 2773 | +} | |
| 2774 | + | |
| 2753 | 2775 | /** |
| 2754 | 2776 | * drm_dp_mst_dump_topology(): dump topology to seq file. |
| 2755 | 2777 | * @m: seq_file to dump output to |
| @@ -2762,6 +2784,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, · 6 unmodified lines | ||
| 2762 | 2784 | { |
| 2763 | 2785 | int i; |
| 2764 | 2786 | struct drm_dp_mst_port *port; |
| 2787 | + | |
| 2765 | 2788 | mutex_lock(&mgr->lock); |
| 2766 | 2789 | if (mgr->mst_primary) |
| 2767 | 2790 | drm_dp_mst_dump_mstb(m, mgr->mst_primary); |
| @@ -2770,14 +2793,21 @@ void drm_dp_mst_dump_topology(struct seq_file *m, · 2 unmodified lines | ||
| 2770 | 2793 | mutex_unlock(&mgr->lock); |
| 2771 | 2794 | |
| 2772 | 2795 | mutex_lock(&mgr->payload_lock); |
| 2773 | − seq_printf(m, "vcpi: %lx %lx\n", mgr->payload_mask, mgr->vcpi_mask); | |
| 2796 | + seq_printf(m, "vcpi: %lx %lx %d\n", mgr->payload_mask, mgr->vcpi_mask, | |
| 2797 | + mgr->max_payloads); | |
| 2774 | 2798 | |
| 2775 | 2799 | for (i = 0; i < mgr->max_payloads; i++) { |
| 2776 | 2800 | if (mgr->proposed_vcpis[i]) { |
| 2801 | + char name[14]; | |
| 2802 | + | |
| 2777 | 2803 | port = container_of(mgr->proposed_vcpis[i], struct drm_dp_mst_port, vcpi); |
| 2778 | − seq_printf(m, "vcpi %d: %d %d %d\n", i, port->port_num, port->vcpi.vcpi, port->vcpi.num_slots); | |
| 2804 | + fetch_monitor_name(mgr, port, name, sizeof(name)); | |
| 2805 | + seq_printf(m, "vcpi %d: %d %d %d sink name: %s\n", i, | |
| 2806 | + port->port_num, port->vcpi.vcpi, | |
| 2807 | + port->vcpi.num_slots, | |
| 2808 | + (*name != 0) ? name : "Unknown"); | |
| 2779 | 2809 | } else |
| 2780 | − seq_printf(m, "vcpi %d:unsed\n", i); | |
| 2810 | + seq_printf(m, "vcpi %d:unused\n", i); | |
| 2781 | 2811 | } |
| 2782 | 2812 | for (i = 0; i < mgr->max_payloads; i++) { |
| 2783 | 2813 | seq_printf(m, "payload %d: %d, %d, %d\n", |
| @@ -2817,8 +2847,9 @@ void drm_dp_mst_dump_topology(struct seq_file *m, · 33 unmodified lines | ||
| 2817 | 2847 | for (i = 0; i < 0x3; i++) |
| 2818 | 2848 | seq_printf(m, "%02x", buf[i]); |
| 2819 | 2849 | seq_printf(m, " devid: "); |
| 2820 | − for (i = 0x3; i < 0x8; i++) | |
| 2850 | + for (i = 0x3; i < 0x8 && buf[i]; i++) | |
| 2821 | 2851 | seq_printf(m, "%c", buf[i]); |
| 2852 | + | |
| 2822 | 2853 | seq_printf(m, " revision: hw: %x.%x sw: %x.%x", buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa], buf[0xb]); |
| 2823 | 2854 | seq_printf(m, "\n"); |
| 2824 | 2855 | bret = dump_dp_payload_table(mgr, buf); |
| @@ -37,13 +37,23 @@ · 36 unmodified lines | ||
| 37 | 37 | #include "drm_legacy.h" |
| 38 | 38 | #include "drm_internal.h" |
| 39 | 39 | |
| 40 | −unsigned int drm_debug = 0; /* bitmask of DRM_UT_x */ | |
| 40 | +/* | |
| 41 | + * drm_debug: Enable debug output. | |
| 42 | + * Bitmask of DRM_UT_x. See include/drm/drmP.h for details. | |
| 43 | + */ | |
| 44 | +unsigned int drm_debug = 0; | |
| 41 | 45 | EXPORT_SYMBOL(drm_debug); |
| 42 | 46 | |
| 43 | 47 | MODULE_AUTHOR(CORE_AUTHOR); |
| 44 | 48 | MODULE_DESCRIPTION(CORE_DESC); |
| 45 | 49 | MODULE_LICENSE("GPL and additional rights"); |
| 46 | −MODULE_PARM_DESC(debug, "Enable debug output"); | |
| 50 | +MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n" | |
| 51 | +"\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n" | |
| 52 | +"\t\tBit 1 (0x02) will enable DRIVER messages (drm controller code)\n" | |
| 53 | +"\t\tBit 2 (0x04) will enable KMS messages (modesetting code)\n" | |
| 54 | +"\t\tBit 3 (0x08) will enable PRIME messages (prime code)\n" | |
| 55 | +"\t\tBit 4 (0x10) will enable ATOMIC messages (atomic code)\n" | |
| 56 | +"\t\tBit 5 (0x20) will enable VBL messages (vblank code)"); | |
| 47 | 57 | module_param_named(debug, drm_debug, int, 0600); |
| 48 | 58 | |
| 49 | 59 | static DEFINE_SPINLOCK(drm_minor_lock); |
| @@ -715,7 +725,11 @@ EXPORT_SYMBOL(drm_dev_unref); · 665 unmodified lines | ||
| 715 | 725 | * |
| 716 | 726 | * Register the DRM device @dev with the system, advertise device to user-space |
| 717 | 727 | * and start normal device operation. @dev must be allocated via drm_dev_alloc() |
| 718 | − * previously. | |
| 728 | + * previously. Right after drm_dev_register() the driver should call | |
| 729 | + * drm_connector_register_all() to register all connectors in sysfs. This is | |
| 730 | + * a separate call for backward compatibility with drivers still using | |
| 731 | + * the deprecated ->load() callback, where connectors are registered from within | |
| 732 | + * the ->load() callback. | |
| 719 | 733 | * |
| 720 | 734 | * Never call this twice on any device! |
| 721 | 735 | * |
| @@ -3293,6 +3293,46 @@ monitor_name(struct detailed_timing *t, void *data) · 3292 unmodified lines | ||
| 3293 | 3293 | *(u8 **)data = t->data.other_data.data.str.str; |
| 3294 | 3294 | } |
| 3295 | 3295 | |
| 3296 | +static int get_monitor_name(struct edid *edid, char name[13]) | |
| 3297 | +{ | |
| 3298 | + char *edid_name = NULL; | |
| 3299 | + int mnl; | |
| 3300 | + | |
| 3301 | + if (!edid || !name) | |
| 3302 | + return 0; | |
| 3303 | + | |
| 3304 | + drm_for_each_detailed_block((u8 *)edid, monitor_name, &edid_name); | |
| 3305 | + for (mnl = 0; edid_name && mnl < 13; mnl++) { | |
| 3306 | + if (edid_name[mnl] == 0x0a) | |
| 3307 | + break; | |
| 3308 | + | |
| 3309 | + name[mnl] = edid_name[mnl]; | |
| 3310 | + } | |
| 3311 | + | |
| 3312 | + return mnl; | |
| 3313 | +} | |
| 3314 | + | |
| 3315 | +/** | |
| 3316 | + * drm_edid_get_monitor_name - fetch the monitor name from the edid | |
| 3317 | + * @edid: monitor EDID information | |
| 3318 | + * @name: pointer to a character array to hold the name of the monitor | |
| 3319 | + * @bufsize: The size of the name buffer (should be at least 14 chars.) | |
| 3320 | + * | |
| 3321 | + */ | |
| 3322 | +void drm_edid_get_monitor_name(struct edid *edid, char *name, int bufsize) | |
| 3323 | +{ | |
| 3324 | + int name_length; | |
| 3325 | + char buf[13]; | |
| 3326 | + | |
| 3327 | + if (bufsize <= 0) | |
| 3328 | + return; | |
| 3329 | + | |
| 3330 | + name_length = min(get_monitor_name(edid, buf), bufsize - 1); | |
| 3331 | + memcpy(name, buf, name_length); | |
| 3332 | + name[name_length] = '\0'; | |
| 3333 | +} | |
| 3334 | +EXPORT_SYMBOL(drm_edid_get_monitor_name); | |
| 3335 | + | |
| 3296 | 3336 | /** |
| 3297 | 3337 | * drm_edid_to_eld - build ELD from EDID |
| 3298 | 3338 | * @connector: connector corresponding to the HDMI/DP sink |
| @@ -3306,7 +3346,6 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) · 7 unmodified lines | ||
| 3306 | 3346 | { |
| 3307 | 3347 | uint8_t *eld = connector->eld; |
| 3308 | 3348 | u8 *cea; |
| 3309 | − u8 *name; | |
| 3310 | 3349 | u8 *db; |
| 3311 | 3350 | int total_sad_count = 0; |
| 3312 | 3351 | int mnl; |
| @@ -3320,14 +3359,8 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) · 7 unmodified lines | ||
| 3320 | 3359 | return; |
| 3321 | 3360 | } |
| 3322 | 3361 | |
| 3323 | − name = NULL; | |
| 3324 | − drm_for_each_detailed_block((u8 *)edid, monitor_name, &name); | |
| 3325 | − /* max: 13 bytes EDID, 16 bytes ELD */ | |
| 3326 | − for (mnl = 0; name && mnl < 13; mnl++) { | |
| 3327 | − if (name[mnl] == 0x0a) | |
| 3328 | − break; | |
| 3329 | − eld[20 + mnl] = name[mnl]; | |
| 3330 | − } | |
| 3362 | + mnl = get_monitor_name(edid, eld + 20); | |
| 3363 | + | |
| 3331 | 3364 | eld[4] = (cea[1] << 5) | mnl; |
| 3332 | 3365 | DRM_DEBUG_KMS("ELD monitor %s\n", eld + 20); |
| 3333 | 3366 | |
| @@ -279,7 +279,6 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) · 278 unmodified lines | ||
| 279 | 279 | int |
| 280 | 280 | drm_gem_handle_delete(struct drm_file *filp, u32 handle) |
| 281 | 281 | { |
| 282 | − struct drm_device *dev; | |
| 283 | 282 | struct drm_gem_object *obj; |
| 284 | 283 | |
| 285 | 284 | /* This is gross. The idr system doesn't let us try a delete and |
| @@ -294,18 +293,19 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) · 8 unmodified lines | ||
| 294 | 293 | spin_lock(&filp->table_lock); |
| 295 | 294 | |
| 296 | 295 | /* Check if we currently have a reference on the object */ |
| 297 | − obj = idr_find(&filp->object_idr, handle); | |
| 298 | − if (obj == NULL) { | |
| 299 | − spin_unlock(&filp->table_lock); | |
| 296 | + obj = idr_replace(&filp->object_idr, NULL, handle); | |
| 297 | + spin_unlock(&filp->table_lock); | |
| 298 | + if (IS_ERR_OR_NULL(obj)) | |
| 300 | 299 | return -EINVAL; |
| 301 | − } | |
| 302 | − dev = obj->dev; | |
| 303 | 300 | |
| 304 | − /* Release reference and decrement refcount. */ | |
| 301 | + /* Release driver's reference and decrement refcount. */ | |
| 302 | + drm_gem_object_release_handle(handle, obj, filp); | |
| 303 | + | |
| 304 | + /* And finally make the handle available for future allocations. */ | |
| 305 | + spin_lock(&filp->table_lock); | |
| 305 | 306 | idr_remove(&filp->object_idr, handle); |
| 306 | 307 | spin_unlock(&filp->table_lock); |
| 307 | 308 | |
| 308 | − drm_gem_object_release_handle(handle, obj, filp); | |
| 309 | 309 | return 0; |
| 310 | 310 | } |
| 311 | 311 | EXPORT_SYMBOL(drm_gem_handle_delete); |
| @@ -264,10 +264,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, · 263 unmodified lines | ||
| 264 | 264 | count = drm_add_edid_modes(connector, edid); |
| 265 | 265 | drm_edid_to_eld(connector, edid); |
| 266 | 266 | } else { |
| 267 | −#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE | |
| 268 | 267 | count = drm_load_edid_firmware(connector); |
| 269 | 268 | if (count == 0) |
| 270 | −#endif | |
| 271 | 269 | count = (*connector_funcs->get_modes)(connector); |
| 272 | 270 | } |
| 273 | 271 | |
| @@ -3434,7 +3434,8 @@ static int i915_dp_mst_info(struct seq_file *m, void *unused) · 3433 unmodified lines | ||
| 3434 | 3434 | intel_dig_port = enc_to_dig_port(encoder); |
| 3435 | 3435 | if (!intel_dig_port->dp.can_mst) |
| 3436 | 3436 | continue; |
| 3437 | − | |
| 3437 | + seq_printf(m, "MST Source Port %c\n", | |
| 3438 | + port_name(intel_dig_port->port)); | |
| 3438 | 3439 | drm_dp_mst_dump_topology(m, &intel_dig_port->dp.mst_mgr); |
| 3439 | 3440 | } |
| 3440 | 3441 | drm_modeset_unlock_all(dev); |
| @@ -361,14 +361,7 @@ static int rcar_du_probe(struct platform_device *pdev) · 360 unmodified lines | ||
| 361 | 361 | if (ret) |
| 362 | 362 | goto error; |
| 363 | 363 | |
| 364 | − mutex_lock(&ddev->mode_config.mutex); | |
| 365 | − drm_for_each_connector(connector, ddev) { | |
| 366 | − ret = drm_connector_register(connector); | |
| 367 | − if (ret < 0) | |
| 368 | − break; | |
| 369 | − } | |
| 370 | − mutex_unlock(&ddev->mode_config.mutex); | |
| 371 | − | |
| 364 | + ret = drm_connector_register_all(ddev); | |
| 372 | 365 | if (ret < 0) |
| 373 | 366 | goto error; |
| 374 | 367 | |
| @@ -38,13 +38,6 @@ · 37 unmodified lines | ||
| 38 | 38 | #define XRES_MAX 8192 |
| 39 | 39 | #define YRES_MAX 8192 |
| 40 | 40 | |
| 41 | −static void virtio_gpu_crtc_gamma_set(struct drm_crtc *crtc, | |
| 42 | − u16 *red, u16 *green, u16 *blue, | |
| 43 | − uint32_t start, uint32_t size) | |
| 44 | −{ | |
| 45 | − /* TODO */ | |
| 46 | −} | |
| 47 | − | |
| 48 | 41 | static void |
| 49 | 42 | virtio_gpu_hide_cursor(struct virtio_gpu_device *vgdev, |
| 50 | 43 | struct virtio_gpu_output *output) |
| @@ -173,7 +166,6 @@ static int virtio_gpu_page_flip(struct drm_crtc *crtc, · 122 unmodified lines | ||
| 173 | 166 | static const struct drm_crtc_funcs virtio_gpu_crtc_funcs = { |
| 174 | 167 | .cursor_set2 = virtio_gpu_crtc_cursor_set, |
| 175 | 168 | .cursor_move = virtio_gpu_crtc_cursor_move, |
| 176 | − .gamma_set = virtio_gpu_crtc_gamma_set, | |
| 177 | 169 | .set_config = drm_atomic_helper_set_config, |
| 178 | 170 | .destroy = drm_crtc_cleanup, |
| 179 | 171 | |
| @@ -416,7 +408,6 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index) · 236 unmodified lines | ||
| 416 | 408 | return PTR_ERR(plane); |
| 417 | 409 | drm_crtc_init_with_planes(dev, crtc, plane, NULL, |
| 418 | 410 | &virtio_gpu_crtc_funcs, NULL); |
| 419 | − drm_mode_crtc_set_gamma_size(crtc, 256); | |
| 420 | 411 | drm_crtc_helper_add(crtc, &virtio_gpu_crtc_helper_funcs); |
| 421 | 412 | plane->crtc = crtc; |
| 422 | 413 | |
| @@ -90,7 +90,7 @@ struct reservation_object; · 89 unmodified lines | ||
| 90 | 90 | struct dma_buf_attachment; |
| 91 | 91 | |
| 92 | 92 | /* |
| 93 | − * 4 debug categories are defined: | |
| 93 | + * The following categories are defined: | |
| 94 | 94 | * |
| 95 | 95 | * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ... |
| 96 | 96 | * This is the category used by the DRM_DEBUG() macro. |
| @@ -2249,7 +2249,8 @@ static inline unsigned drm_connector_index(struct drm_connector *connector) · 2248 unmodified lines | ||
| 2249 | 2249 | return connector->connector_id; |
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | −/* helper to unregister all connectors from sysfs for device */ | |
| 2252 | +/* helpers to {un}register all connectors from sysfs for device */ | |
| 2253 | +extern int drm_connector_register_all(struct drm_device *dev); | |
| 2253 | 2254 | extern void drm_connector_unregister_all(struct drm_device *dev); |
| 2254 | 2255 | |
| 2255 | 2256 | extern int drm_bridge_add(struct drm_bridge *bridge); |
| @@ -2500,6 +2501,8 @@ extern int drm_edid_header_is_valid(const u8 *raw_edid); · 244 unmodified lines | ||
| 2500 | 2501 | extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid, |
| 2501 | 2502 | bool *edid_corrupt); |
| 2502 | 2503 | extern bool drm_edid_is_valid(struct edid *edid); |
| 2504 | +extern void drm_edid_get_monitor_name(struct edid *edid, char *name, | |
| 2505 | + int buflen); | |
| 2503 | 2506 | |
| 2504 | 2507 | extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev, |
| 2505 | 2508 | char topology[8]); |
| @@ -2590,10 +2593,14 @@ static inline struct drm_property *drm_property_find(struct drm_device *dev, · 84 unmodified lines | ||
| 2590 | 2593 | static inline uint32_t drm_color_lut_extract(uint32_t user_input, |
| 2591 | 2594 | uint32_t bit_precision) |
| 2592 | 2595 | { |
| 2593 | − uint32_t val = user_input + (1 << (16 - bit_precision - 1)); | |
| 2596 | + uint32_t val = user_input; | |
| 2594 | 2597 | uint32_t max = 0xffff >> (16 - bit_precision); |
| 2595 | 2598 | |
| 2596 | − val >>= 16 - bit_precision; | |
| 2599 | + /* Round only if we're not using full precision. */ | |
| 2600 | + if (bit_precision < 16) { | |
| 2601 | + val += 1UL << (16 - bit_precision - 1); | |
| 2602 | + val >>= 16 - bit_precision; | |
| 2603 | + } | |
| 2597 | 2604 | |
| 2598 | 2605 | return clamp_val(val, 0, max); |
| 2599 | 2606 | } |
| @@ -328,7 +328,15 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb); · 327 unmodified lines | ||
| 328 | 328 | int drm_av_sync_delay(struct drm_connector *connector, |
| 329 | 329 | const struct drm_display_mode *mode); |
| 330 | 330 | struct drm_connector *drm_select_eld(struct drm_encoder *encoder); |
| 331 | + | |
| 332 | +#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE | |
| 331 | 333 | int drm_load_edid_firmware(struct drm_connector *connector); |
| 334 | +#else | |
| 335 | +static inline int drm_load_edid_firmware(struct drm_connector *connector) | |
| 336 | +{ | |
| 337 | + return 0; | |
| 338 | +} | |
| 339 | +#endif | |
| 332 | 340 | |
| 333 | 341 | int |
| 334 | 342 | drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, |