* [PATCH] drm/i915: Align initial plane backing objects correctly
@ 2015-02-10 22:10 Daniel Vetter
2015-02-10 22:12 ` Daniel Vetter
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Daniel Vetter @ 2015-02-10 22:10 UTC (permalink / raw)
To: Intel Graphics Development
Cc: Daniel Vetter, stable, Johannes W, Chris Wilson, Jani Nikula,
Daniel Vetter
Some bios really like to joke and start the planes at an offset ...
hooray!
Align start and end to fix this.
v2: Fixup calculation of size, spotted by Chris Wilson.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86883
Cc: stable@vger.kernel.org
Cc: Johannes W <jargon@molb.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Reported-by: Johannes W <jargon@molb.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
--
Johannes, can you please test this patch instead of the one from
Chris?
Thanks, Daniel
---
drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +----
drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 59401f3b902c..4382696087c9 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -485,10 +485,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
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 --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2655b63d65e9..308a620f2594 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2372,13 +2372,19 @@ intel_alloc_plane_obj(struct intel_crtc *crtc,
struct drm_i915_gem_object *obj = NULL;
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
struct drm_framebuffer *fb = &plane_config->fb->base;
- 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;
@@ -6654,7 +6660,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
aligned_height = intel_fb_align_height(dev, fb->height,
plane_config->tiling);
- plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
+ plane_config->size = fb->pitches[0] * aligned_height;
DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe_name(pipe), plane, fb->width, fb->height,
@@ -7694,7 +7700,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
aligned_height = intel_fb_align_height(dev, fb->height,
plane_config->tiling);
- plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE);
+ plane_config->size = fb->pitches[0] * aligned_height, PAGE_SIZE;
DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe_name(pipe), fb->width, fb->height,
@@ -7787,7 +7793,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
aligned_height = intel_fb_align_height(dev, fb->height,
plane_config->tiling);
- plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
+ plane_config->size = fb->pitches[0] * aligned_height;
DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe_name(pipe), fb->width, fb->height,
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] drm/i915: Align initial plane backing objects correctly
2015-02-10 22:10 [PATCH] drm/i915: Align initial plane backing objects correctly Daniel Vetter
@ 2015-02-10 22:12 ` Daniel Vetter
2015-02-11 16:38 ` shuang.he
2015-02-16 8:29 ` Jani Nikula
2015-02-10 22:20 ` Chris Wilson
2015-02-11 14:57 ` shuang.he
2 siblings, 2 replies; 7+ messages in thread
From: Daniel Vetter @ 2015-02-10 22:12 UTC (permalink / raw)
To: Intel Graphics Development
Cc: Daniel Vetter, stable, Daniel Vetter, Johannes W
Some bios really like to joke and start the planes at an offset ...
hooray!
Align start and end to fix this.
v2: Fixup calculation of size, spotted by Chris Wilson.
v3: Fix serious fumble I've just spotted.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86883
Cc: stable@vger.kernel.org
Cc: Johannes W <jargon@molb.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Reported-by: Johannes W <jargon@molb.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
--
Johannes, can you please test this patch instead of the one from
Chris?
Thanks, Daniel
---
drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +----
drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 59401f3b902c..4382696087c9 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -485,10 +485,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
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 --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2655b63d65e9..fc855b9548ec 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2372,13 +2372,19 @@ intel_alloc_plane_obj(struct intel_crtc *crtc,
struct drm_i915_gem_object *obj = NULL;
struct drm_mode_fb_cmd2 mode_cmd = { 0 };
struct drm_framebuffer *fb = &plane_config->fb->base;
- 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;
@@ -6654,7 +6660,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
aligned_height = intel_fb_align_height(dev, fb->height,
plane_config->tiling);
- plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
+ plane_config->size = fb->pitches[0] * aligned_height;
DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe_name(pipe), plane, fb->width, fb->height,
@@ -7694,7 +7700,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
aligned_height = intel_fb_align_height(dev, fb->height,
plane_config->tiling);
- plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE);
+ plane_config->size = fb->pitches[0] * aligned_height;
DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe_name(pipe), fb->width, fb->height,
@@ -7787,7 +7793,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
aligned_height = intel_fb_align_height(dev, fb->height,
plane_config->tiling);
- plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
+ plane_config->size = fb->pitches[0] * aligned_height;
DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
pipe_name(pipe), fb->width, fb->height,
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: Align initial plane backing objects correctly
2015-02-10 22:10 [PATCH] drm/i915: Align initial plane backing objects correctly Daniel Vetter
2015-02-10 22:12 ` Daniel Vetter
@ 2015-02-10 22:20 ` Chris Wilson
2015-02-11 14:57 ` shuang.he
2 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2015-02-10 22:20 UTC (permalink / raw)
To: Daniel Vetter
Cc: Intel Graphics Development, stable, Johannes W, Jani Nikula,
Daniel Vetter
On Tue, Feb 10, 2015 at 11:10:51PM +0100, Daniel Vetter wrote:
> Some bios really like to joke and start the planes at an offset ...
> hooray!
>
> Align start and end to fix this.
>
> v2: Fixup calculation of size, spotted by Chris Wilson.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86883
> Cc: stable@vger.kernel.org
> Cc: Johannes W <jargon@molb.org>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Reported-by: Johannes W <jargon@molb.org>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>
> --
>
> Johannes, can you please test this patch instead of the one from
> Chris?
>
> Thanks, Daniel
> ---
> drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +----
> drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
> 2 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 59401f3b902c..4382696087c9 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -485,10 +485,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
> 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;
I'd vote for keeping these as two separate WARNs, or using a format
string to print the bogus values.
> 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 2655b63d65e9..308a620f2594 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2372,13 +2372,19 @@ intel_alloc_plane_obj(struct intel_crtc *crtc,
> struct drm_i915_gem_object *obj = NULL;
> struct drm_mode_fb_cmd2 mode_cmd = { 0 };
> struct drm_framebuffer *fb = &plane_config->fb->base;
> - 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);
Didn't we used to have a comment here wondering if the 1:1 mapping was
sane. That feels like it might be a factor here. Given that that our
plane_obj does not match the one used by the BIOS, do we have some
mechanism for forcing the modeset (presuming that fastboot is otherwise
successful)?
> + obj = i915_gem_object_create_stolen_for_preallocated(dev,
> + base_aligned,
> + base_aligned,
> + size_aligned);
> if (!obj)
> return false;
> @@ -7694,7 +7700,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
> aligned_height = intel_fb_align_height(dev, fb->height,
> plane_config->tiling);
>
> - plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE);
> + plane_config->size = fb->pitches[0] * aligned_height, PAGE_SIZE;
Stray comma operator.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: Align initial plane backing objects correctly
2015-02-10 22:10 [PATCH] drm/i915: Align initial plane backing objects correctly Daniel Vetter
2015-02-10 22:12 ` Daniel Vetter
2015-02-10 22:20 ` Chris Wilson
@ 2015-02-11 14:57 ` shuang.he
2 siblings, 0 replies; 7+ messages in thread
From: shuang.he @ 2015-02-11 14:57 UTC (permalink / raw)
To: shuang.he, ethan.gao, intel-gfx, daniel.vetter
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 5754
-------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV -4 275/275 271/275
ILK -1 310/310 309/310
SNB +2 320/346 322/346
IVB -2 380/384 378/384
BYT 296/296 296/296
HSW +3-1 422/428 424/428
BDW 318/333 318/333
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*PNV igt_gem_fence_thrash_bo-write-verify-none PASS(5, M7) FAIL(1, M7)
*PNV igt_gem_fence_thrash_bo-write-verify-x PASS(5, M7) FAIL(1, M7)
*PNV igt_gem_fence_thrash_bo-write-verify-y PASS(6, M7) FAIL(1, M7)
*PNV igt_gem_fence_thrash_bo-write-verify-threaded-none PASS(2, M7) CRASH(1, M7)
ILK igt_drv_suspend_fence-restore-tiled2untiled DMESG_WARN(2, M26)PASS(1, M26) DMESG_WARN(1, M26)
*SNB igt_kms_flip_bo-too-big BLACKLIST(1, M35) PASS(1, M35)
*SNB igt_kms_flip_bo-too-big-interruptible BLACKLIST(1, M35) PASS(1, M35)
*IVB igt_kms_cursor_crc_cursor-64x64-random PASS(2, M4) NO_RESULT(1, M4)
*IVB igt_gem_partial_pwrite_pread_reads-snoop PASS(2, M4) NO_RESULT(1, M4)
*HSW igt_gem_fenced_exec_thrash_no-spare-fences-busy-interruptible PASS(2, M40) NO_RESULT(1, M40)
*HSW igt_kms_flip_bo-too-big BLACKLIST(1, M40) PASS(1, M40)
*HSW igt_kms_flip_bo-too-big-interruptible BLACKLIST(1, M40) PASS(1, M40)
HSW igt_kms_flip_plain-flip-fb-recreate-interruptible TIMEOUT(6, M40)PASS(5, M40) PASS(1, M40)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: Align initial plane backing objects correctly
2015-02-10 22:12 ` Daniel Vetter
@ 2015-02-11 16:38 ` shuang.he
2015-02-16 8:29 ` Jani Nikula
1 sibling, 0 replies; 7+ messages in thread
From: shuang.he @ 2015-02-11 16:38 UTC (permalink / raw)
To: shuang.he, ethan.gao, intel-gfx, daniel.vetter
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 5755
-------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV -1 275/275 274/275
ILK -2 310/310 308/310
SNB +2 320/346 322/346
IVB -2 380/380 378/380
BYT 296/296 296/296
HSW +3-1 422/428 424/428
BDW 318/333 318/333
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*PNV igt_gem_tiled_pread_pwrite PASS(5, M7) FAIL(1, M7)
ILK igt_drv_suspend_fence-restore-tiled2untiled DMESG_WARN(3, M26)PASS(1, M26) DMESG_WARN(1, M26)
*ILK igt_kms_flip_rcs-flip-vs-panning PASS(2, M26) DMESG_WARN(1, M26)
*SNB igt_kms_flip_bo-too-big BLACKLIST(1, M35) PASS(1, M35)
*SNB igt_kms_flip_bo-too-big-interruptible BLACKLIST(1, M35) PASS(1, M35)
*IVB igt_gem_pwrite_pread_display-copy-performance PASS(2, M4) DMESG_WARN(1, M4)
*IVB igt_gem_storedw_batches_loop_secure-dispatch PASS(3, M4) DMESG_WARN(1, M4)
*HSW igt_gem_storedw_loop_vebox PASS(2, M40) DMESG_WARN(1, M40)
*HSW igt_kms_flip_bo-too-big BLACKLIST(1, M40) PASS(1, M40)
*HSW igt_kms_flip_bo-too-big-interruptible BLACKLIST(1, M40) PASS(1, M40)
HSW igt_kms_flip_plain-flip-fb-recreate-interruptible TIMEOUT(6, M40)PASS(5, M40) PASS(1, M40)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: Align initial plane backing objects correctly
2015-02-10 22:12 ` Daniel Vetter
2015-02-11 16:38 ` shuang.he
@ 2015-02-16 8:29 ` Jani Nikula
2015-02-24 14:03 ` Jani Nikula
1 sibling, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2015-02-16 8:29 UTC (permalink / raw)
To: Intel Graphics Development
Cc: Daniel Vetter, stable, Johannes W, Chris Wilson, Daniel Vetter
On Wed, 11 Feb 2015, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Some bios really like to joke and start the planes at an offset ...
> hooray!
>
> Align start and end to fix this.
>
> v2: Fixup calculation of size, spotted by Chris Wilson.
>
> v3: Fix serious fumble I've just spotted.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86883
> Cc: stable@vger.kernel.org
> Cc: Johannes W <jargon@molb.org>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Reported-by: Johannes W <jargon@molb.org>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Tested-by: Johannes W <jargon@molb.org>
>
> --
>
> Johannes, can you please test this patch instead of the one from
> Chris?
>
> Thanks, Daniel
> ---
> drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +----
> drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
> 2 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 59401f3b902c..4382696087c9 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -485,10 +485,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
> 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 --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 2655b63d65e9..fc855b9548ec 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2372,13 +2372,19 @@ intel_alloc_plane_obj(struct intel_crtc *crtc,
> struct drm_i915_gem_object *obj = NULL;
> struct drm_mode_fb_cmd2 mode_cmd = { 0 };
> struct drm_framebuffer *fb = &plane_config->fb->base;
> - 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;
>
> @@ -6654,7 +6660,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
> aligned_height = intel_fb_align_height(dev, fb->height,
> plane_config->tiling);
>
> - plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
> + plane_config->size = fb->pitches[0] * aligned_height;
>
> DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
> pipe_name(pipe), plane, fb->width, fb->height,
> @@ -7694,7 +7700,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
> aligned_height = intel_fb_align_height(dev, fb->height,
> plane_config->tiling);
>
> - plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE);
> + plane_config->size = fb->pitches[0] * aligned_height;
>
> DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
> pipe_name(pipe), fb->width, fb->height,
> @@ -7787,7 +7793,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
> aligned_height = intel_fb_align_height(dev, fb->height,
> plane_config->tiling);
>
> - plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
> + plane_config->size = fb->pitches[0] * aligned_height;
>
> DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
> pipe_name(pipe), fb->width, fb->height,
> --
> 2.1.4
>
--
Jani Nikula, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915: Align initial plane backing objects correctly
2015-02-16 8:29 ` Jani Nikula
@ 2015-02-24 14:03 ` Jani Nikula
0 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2015-02-24 14:03 UTC (permalink / raw)
To: Intel Graphics Development
Cc: Daniel Vetter, stable, Johannes W, Chris Wilson, Daniel Vetter
On Mon, 16 Feb 2015, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Wed, 11 Feb 2015, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>> Some bios really like to joke and start the planes at an offset ...
>> hooray!
>>
>> Align start and end to fix this.
>>
>> v2: Fixup calculation of size, spotted by Chris Wilson.
>>
>> v3: Fix serious fumble I've just spotted.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86883
>> Cc: stable@vger.kernel.org
>> Cc: Johannes W <jargon@molb.org>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Reported-by: Johannes W <jargon@molb.org>
>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>
> Tested-by: Johannes W <jargon@molb.org>
Pushed to drm-intel-fixes, with the WARN_ONs split up separately, thanks
for the patch.
BR,
Jani.
>
>>
>> --
>>
>> Johannes, can you please test this patch instead of the one from
>> Chris?
>>
>> Thanks, Daniel
>> ---
>> drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +----
>> drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++------
>> 2 files changed, 13 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
>> index 59401f3b902c..4382696087c9 100644
>> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
>> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
>> @@ -485,10 +485,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
>> 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 --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>> index 2655b63d65e9..fc855b9548ec 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -2372,13 +2372,19 @@ intel_alloc_plane_obj(struct intel_crtc *crtc,
>> struct drm_i915_gem_object *obj = NULL;
>> struct drm_mode_fb_cmd2 mode_cmd = { 0 };
>> struct drm_framebuffer *fb = &plane_config->fb->base;
>> - 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;
>>
>> @@ -6654,7 +6660,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
>> aligned_height = intel_fb_align_height(dev, fb->height,
>> plane_config->tiling);
>>
>> - plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
>> + plane_config->size = fb->pitches[0] * aligned_height;
>>
>> DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
>> pipe_name(pipe), plane, fb->width, fb->height,
>> @@ -7694,7 +7700,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
>> aligned_height = intel_fb_align_height(dev, fb->height,
>> plane_config->tiling);
>>
>> - plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE);
>> + plane_config->size = fb->pitches[0] * aligned_height;
>>
>> DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
>> pipe_name(pipe), fb->width, fb->height,
>> @@ -7787,7 +7793,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
>> aligned_height = intel_fb_align_height(dev, fb->height,
>> plane_config->tiling);
>>
>> - plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height);
>> + plane_config->size = fb->pitches[0] * aligned_height;
>>
>> DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
>> pipe_name(pipe), fb->width, fb->height,
>> --
>> 2.1.4
>>
>
> --
> Jani Nikula, Intel Open Source Technology Center
--
Jani Nikula, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-02-24 14:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-10 22:10 [PATCH] drm/i915: Align initial plane backing objects correctly Daniel Vetter
2015-02-10 22:12 ` Daniel Vetter
2015-02-11 16:38 ` shuang.he
2015-02-16 8:29 ` Jani Nikula
2015-02-24 14:03 ` Jani Nikula
2015-02-10 22:20 ` Chris Wilson
2015-02-11 14:57 ` shuang.he
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox