Browse Source

Merge tag 'drm-intel-fixes-2015-08-07' of git://anongit.freedesktop.org/drm-intel

Pull drm fixes from Daniel Vetter:
 "One i915 regression fix and a drm core one since Dave's not around,
  both introduced in 4.2 so not cc: stable.

  The fix for the warning Ted reported isn't in here yet since he didn't
  yet supply a tested-by and I can't repro this one myself (it's in
  fixup code that needs firmware doing something i915 wouldn't do)"

* tag 'drm-intel-fixes-2015-08-07' of git://anongit.freedesktop.org/drm-intel:
  drm/vblank: Use u32 consistently for vblank counters
  drm/i915: Allow parsing of variable size child device entries from VBT
Linus Torvalds 10 năm trước cách đây
mục cha
commit
981dae742b
3 tập tin đã thay đổi với 25 bổ sung6 xóa
  1. 1 1
      drivers/gpu/drm/drm_irq.c
  2. 23 4
      drivers/gpu/drm/i915/intel_bios.c
  3. 1 1
      include/drm/drmP.h

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

@@ -75,7 +75,7 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600)
 module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);
 
 static void store_vblank(struct drm_device *dev, int crtc,
-			 unsigned vblank_count_inc,
+			 u32 vblank_count_inc,
 			 struct timeval *t_vblank)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[crtc];

+ 23 - 4
drivers/gpu/drm/i915/intel_bios.c

@@ -1075,15 +1075,34 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 	const union child_device_config *p_child;
 	union child_device_config *child_dev_ptr;
 	int i, child_device_num, count;
-	u16	block_size;
+	u8 expected_size;
+	u16 block_size;
 
 	p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
 	if (!p_defs) {
 		DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
 		return;
 	}
-	if (p_defs->child_dev_size < sizeof(*p_child)) {
-		DRM_ERROR("General definiton block child device size is too small.\n");
+	if (bdb->version < 195) {
+		expected_size = 33;
+	} else if (bdb->version == 195) {
+		expected_size = 37;
+	} else if (bdb->version <= 197) {
+		expected_size = 38;
+	} else {
+		expected_size = 38;
+		DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
+				 expected_size, bdb->version);
+	}
+
+	if (expected_size > sizeof(*p_child)) {
+		DRM_ERROR("child_device_config cannot fit in p_child\n");
+		return;
+	}
+
+	if (p_defs->child_dev_size != expected_size) {
+		DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
+			  p_defs->child_dev_size, expected_size, bdb->version);
 		return;
 	}
 	/* get the block size of general definitions */
@@ -1130,7 +1149,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 
 		child_dev_ptr = dev_priv->vbt.child_dev + count;
 		count++;
-		memcpy(child_dev_ptr, p_child, sizeof(*p_child));
+		memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
 	}
 	return;
 }

+ 1 - 1
include/drm/drmP.h

@@ -691,7 +691,7 @@ struct drm_vblank_crtc {
 	struct timer_list disable_timer;		/* delayed disable timer */
 
 	/* vblank counter, protected by dev->vblank_time_lock for writes */
-	unsigned long count;
+	u32 count;
 	/* vblank timestamps, protected by dev->vblank_time_lock for writes */
 	struct timeval time[DRM_VBLANKTIME_RBSIZE];