diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_stolen.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 18 |
2 files changed, 14 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index a2045848bd1a..9c6f93ec886b 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -485,10 +485,8 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, | |||
485 | stolen_offset, gtt_offset, size); | 485 | stolen_offset, gtt_offset, size); |
486 | 486 | ||
487 | /* KISS and expect everything to be page-aligned */ | 487 | /* KISS and expect everything to be page-aligned */ |
488 | BUG_ON(stolen_offset & 4095); | 488 | if (WARN_ON(size == 0) || WARN_ON(size & 4095) || |
489 | BUG_ON(size & 4095); | 489 | WARN_ON(stolen_offset & 4095)) |
490 | |||
491 | if (WARN_ON(size == 0)) | ||
492 | return NULL; | 490 | return NULL; |
493 | 491 | ||
494 | stolen = kzalloc(sizeof(*stolen), GFP_KERNEL); | 492 | stolen = kzalloc(sizeof(*stolen), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 2adedee7e52a..bf19a5cce4a8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2371,13 +2371,19 @@ intel_alloc_plane_obj(struct intel_crtc *crtc, | |||
2371 | struct drm_device *dev = crtc->base.dev; | 2371 | struct drm_device *dev = crtc->base.dev; |
2372 | struct drm_i915_gem_object *obj = NULL; | 2372 | struct drm_i915_gem_object *obj = NULL; |
2373 | struct drm_mode_fb_cmd2 mode_cmd = { 0 }; | 2373 | struct drm_mode_fb_cmd2 mode_cmd = { 0 }; |
2374 | u32 base = plane_config->base; | 2374 | u32 base_aligned = round_down(plane_config->base, PAGE_SIZE); |
2375 | u32 size_aligned = round_up(plane_config->base + plane_config->size, | ||
2376 | PAGE_SIZE); | ||
2377 | |||
2378 | size_aligned -= base_aligned; | ||
2375 | 2379 | ||
2376 | if (plane_config->size == 0) | 2380 | if (plane_config->size == 0) |
2377 | return false; | 2381 | return false; |
2378 | 2382 | ||
2379 | obj = i915_gem_object_create_stolen_for_preallocated(dev, base, base, | 2383 | obj = i915_gem_object_create_stolen_for_preallocated(dev, |
2380 | plane_config->size); | 2384 | base_aligned, |
2385 | base_aligned, | ||
2386 | size_aligned); | ||
2381 | if (!obj) | 2387 | if (!obj) |
2382 | return false; | 2388 | return false; |
2383 | 2389 | ||
@@ -6636,7 +6642,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, | |||
6636 | aligned_height = intel_fb_align_height(dev, fb->height, | 6642 | aligned_height = intel_fb_align_height(dev, fb->height, |
6637 | plane_config->tiling); | 6643 | plane_config->tiling); |
6638 | 6644 | ||
6639 | plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height); | 6645 | plane_config->size = fb->pitches[0] * aligned_height; |
6640 | 6646 | ||
6641 | DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", | 6647 | DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", |
6642 | pipe_name(pipe), plane, fb->width, fb->height, | 6648 | pipe_name(pipe), plane, fb->width, fb->height, |
@@ -7673,7 +7679,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7673 | aligned_height = intel_fb_align_height(dev, fb->height, | 7679 | aligned_height = intel_fb_align_height(dev, fb->height, |
7674 | plane_config->tiling); | 7680 | plane_config->tiling); |
7675 | 7681 | ||
7676 | plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE); | 7682 | plane_config->size = fb->pitches[0] * aligned_height; |
7677 | 7683 | ||
7678 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", | 7684 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", |
7679 | pipe_name(pipe), fb->width, fb->height, | 7685 | pipe_name(pipe), fb->width, fb->height, |
@@ -7764,7 +7770,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7764 | aligned_height = intel_fb_align_height(dev, fb->height, | 7770 | aligned_height = intel_fb_align_height(dev, fb->height, |
7765 | plane_config->tiling); | 7771 | plane_config->tiling); |
7766 | 7772 | ||
7767 | plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height); | 7773 | plane_config->size = fb->pitches[0] * aligned_height; |
7768 | 7774 | ||
7769 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", | 7775 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", |
7770 | pipe_name(pipe), fb->width, fb->height, | 7776 | pipe_name(pipe), fb->width, fb->height, |