Hi,
I did a backport to 3.19.2 (attached), but I'm not the author of the patch.
Original commit id: f37b5c2be8979993efee2da50b51126e3908eb8b
Johannes
On Mon, Mar 16, 2015 at 01:55PM +0100, [email protected] wrote:
> The patch below does not apply to the 3.19-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <[email protected]>.
>
> thanks,
>
> greg k-h
diff -Naur linux-3.19.2.orig/drivers/gpu/drm/i915/i915_gem_stolen.c linux-3.19.2/drivers/gpu/drm/i915/i915_gem_stolen.c
--- linux-3.19.2.orig/drivers/gpu/drm/i915/i915_gem_stolen.c 2015-03-18 14:11:52.000000000 +0100
+++ linux-3.19.2/drivers/gpu/drm/i915/i915_gem_stolen.c 2015-03-24 22:13:16.861396812 +0100
@@ -485,10 +485,7 @@
stolen_offset, gtt_offset, size);
/* KISS and expect everything to be page-aligned */
- BUG_ON(stolen_offset & 4095);
- BUG_ON(size & 4095);
-
- if (WARN_ON(size == 0))
+ if (WARN_ON(size == 0 || stolen_offset & 4095 || size & 4095))
return NULL;
stolen = kzalloc(sizeof(*stolen), GFP_KERNEL);
diff -Naur linux-3.19.2.orig/drivers/gpu/drm/i915/intel_display.c linux-3.19.2/drivers/gpu/drm/i915/intel_display.c
--- linux-3.19.2.orig/drivers/gpu/drm/i915/intel_display.c 2015-03-18 14:11:52.000000000 +0100
+++ linux-3.19.2/drivers/gpu/drm/i915/intel_display.c 2015-03-24 22:18:09.193425293 +0100
@@ -2339,13 +2339,19 @@
struct drm_device *dev = crtc->base.dev;
struct drm_i915_gem_object *obj = NULL;
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
- u32 base = plane_config->base;
+ u32 base_aligned = round_down(plane_config->base, PAGE_SIZE);
+ u32 size_aligned = round_up(plane_config->base + plane_config->size,
+ PAGE_SIZE);
+
+ size_aligned -= base_aligned;
if (plane_config->size == 0)
return false;
- obj = i915_gem_object_create_stolen_for_preallocated(dev, base, base,
- plane_config->size);
+ obj = i915_gem_object_create_stolen_for_preallocated(dev,
+ base_aligned,
+ base_aligned,
+ size_aligned);
if (!obj)
return false;
@@ -6660,8 +6666,7 @@
aligned_height = intel_align_height(dev, crtc->base.primary->fb->height,
plane_config->tiled);
- plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] *
- aligned_height);
+ plane_config->size = crtc->base.primary->fb->pitches[0] * aligned_height;
DRM_DEBUG_KMS("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe, plane, crtc->base.primary->fb->width,
@@ -7711,8 +7716,7 @@
aligned_height = intel_align_height(dev, crtc->base.primary->fb->height,
plane_config->tiled);
- plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] *
- aligned_height);
+ plane_config->size = crtc->base.primary->fb->pitches[0] * aligned_height;
DRM_DEBUG_KMS("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe, plane, crtc->base.primary->fb->width,