Przeglądaj źródła

Merge tag 'drm-misc-next-fixes-2017-04-12' of git://anongit.freedesktop.org/git/drm-misc into drm-next

drm-misc-next-fixes-2017-04-12

Core changes:
 - Fix off-by-one bug in get_property ioctl for enums/bitmasks (Daniel)

Driver changes:
 - Add mode_fixup to dw-hdmi bridge driver to ensure mode is validated (Romain)

* tag 'drm-misc-next-fixes-2017-04-12' of git://anongit.freedesktop.org/git/drm-misc:
  drm: Fix get_property logic fumble
  drm: dw-hdmi: Implement the mode_fixup drm helper
Dave Airlie 8 lat temu
rodzic
commit
a6a5c983b3

+ 15 - 0
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c

@@ -1947,6 +1947,20 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge)
 	return 0;
 }
 
+static bool dw_hdmi_bridge_mode_fixup(struct drm_bridge *bridge,
+				      const struct drm_display_mode *orig_mode,
+				      struct drm_display_mode *mode)
+{
+	struct dw_hdmi *hdmi = bridge->driver_private;
+	struct drm_connector *connector = &hdmi->connector;
+	enum drm_mode_status status;
+
+	status = dw_hdmi_connector_mode_valid(connector, mode);
+	if (status != MODE_OK)
+		return false;
+	return true;
+}
+
 static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
 				    struct drm_display_mode *orig_mode,
 				    struct drm_display_mode *mode)
@@ -1988,6 +2002,7 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
 	.enable = dw_hdmi_bridge_enable,
 	.disable = dw_hdmi_bridge_disable,
 	.mode_set = dw_hdmi_bridge_mode_set,
+	.mode_fixup = dw_hdmi_bridge_mode_fixup,
 };
 
 static irqreturn_t dw_hdmi_i2c_irq(struct dw_hdmi *hdmi)

+ 1 - 1
drivers/gpu/drm/drm_property.c

@@ -476,7 +476,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
 	    drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
 		list_for_each_entry(prop_enum, &property->enum_list, head) {
 			enum_count++;
-			if (out_resp->count_enum_blobs <= enum_count)
+			if (out_resp->count_enum_blobs < enum_count)
 				continue;
 
 			if (copy_to_user(&enum_ptr[copied].value,