* [PATCH 1/8] drm/i915: Remove duplicated intel_tile_height declaration
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-11 10:26 ` Daniel Vetter
2015-05-08 12:02 ` [PATCH 2/8] drm/i915: Support planar formats in tile height calculations Tvrtko Ursulin
` (7 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/intel_drv.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ae551d8..cc2ed60 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1066,9 +1066,6 @@ intel_rotation_90_or_270(unsigned int rotation)
return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
}
-unsigned int
-intel_tile_height(struct drm_device *dev, uint32_t bits_per_pixel,
- uint64_t fb_modifier);
void intel_create_rotation_property(struct drm_device *dev,
struct intel_plane *plane);
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 1/8] drm/i915: Remove duplicated intel_tile_height declaration
2015-05-08 12:02 ` [PATCH 1/8] drm/i915: Remove duplicated intel_tile_height declaration Tvrtko Ursulin
@ 2015-05-11 10:26 ` Daniel Vetter
0 siblings, 0 replies; 13+ messages in thread
From: Daniel Vetter @ 2015-05-11 10:26 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: Intel-gfx
On Fri, May 08, 2015 at 01:02:36PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Queued for -next, thanks for the patch.
-Daniel
> ---
> drivers/gpu/drm/i915/intel_drv.h | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index ae551d8..cc2ed60 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1066,9 +1066,6 @@ intel_rotation_90_or_270(unsigned int rotation)
> return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
> }
>
> -unsigned int
> -intel_tile_height(struct drm_device *dev, uint32_t bits_per_pixel,
> - uint64_t fb_modifier);
> void intel_create_rotation_property(struct drm_device *dev,
> struct intel_plane *plane);
>
> --
> 2.4.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/8] drm/i915: Support planar formats in tile height calculations
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 1/8] drm/i915: Remove duplicated intel_tile_height declaration Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 3/8] drm/i915: Remove pointless calculation in intel_rotate_fb_obj_pages Tvrtko Ursulin
` (6 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
This will be needed for NV12 support.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
drivers/gpu/drm/i915/intel_display.c | 8 ++++----
drivers/gpu/drm/i915/intel_drv.h | 2 +-
drivers/gpu/drm/i915/intel_sprite.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 8fee678..a388670 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2699,7 +2699,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
/* Calculate tiling geometry. */
tile_height = intel_tile_height(dev, rot_info->pixel_format,
- rot_info->fb_modifier);
+ rot_info->fb_modifier, 0);
tile_pitch = PAGE_SIZE / tile_height;
width_pages = DIV_ROUND_UP(rot_info->pitch, tile_pitch);
height_pages = DIV_ROUND_UP(rot_info->height, tile_height);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 307042d..a87faca 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2273,7 +2273,7 @@ static bool need_vtd_wa(struct drm_device *dev)
unsigned int
intel_tile_height(struct drm_device *dev, uint32_t pixel_format,
- uint64_t fb_format_modifier)
+ uint64_t fb_format_modifier, unsigned int plane)
{
unsigned int tile_height;
uint32_t pixel_bytes;
@@ -2289,7 +2289,7 @@ intel_tile_height(struct drm_device *dev, uint32_t pixel_format,
tile_height = 32;
break;
case I915_FORMAT_MOD_Yf_TILED:
- pixel_bytes = drm_format_plane_cpp(pixel_format, 0);
+ pixel_bytes = drm_format_plane_cpp(pixel_format, plane);
switch (pixel_bytes) {
default:
case 1:
@@ -2323,7 +2323,7 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,
uint32_t pixel_format, uint64_t fb_format_modifier)
{
return ALIGN(height, intel_tile_height(dev, pixel_format,
- fb_format_modifier));
+ fb_format_modifier, 0));
}
static int
@@ -3141,7 +3141,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
if (intel_rotation_90_or_270(rotation)) {
/* stride = Surface height in tiles */
tile_height = intel_tile_height(dev, fb->bits_per_pixel,
- fb->modifier[0]);
+ fb->modifier[0], 0);
stride = DIV_ROUND_UP(fb->height, tile_height);
x_offset = stride * tile_height - y - src_h;
y_offset = x;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cc2ed60..01c1ac8 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1058,7 +1058,7 @@ int intel_plane_atomic_set_property(struct drm_plane *plane,
unsigned int
intel_tile_height(struct drm_device *dev, uint32_t pixel_format,
- uint64_t fb_format_modifier);
+ uint64_t fb_format_modifier, unsigned int plane);
static inline bool
intel_rotation_90_or_270(unsigned int rotation)
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 853ff10..4a94529 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -233,7 +233,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
if (intel_rotation_90_or_270(rotation)) {
/* stride: Surface height in tiles */
tile_height = intel_tile_height(dev, fb->bits_per_pixel,
- fb->modifier[0]);
+ fb->modifier[0], 0);
stride = DIV_ROUND_UP(fb->height, tile_height);
plane_size = (src_w << 16) | src_h;
x_offset = stride * tile_height - y - (src_h + 1);
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 3/8] drm/i915: Remove pointless calculation in intel_rotate_fb_obj_pages
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 1/8] drm/i915: Remove duplicated intel_tile_height declaration Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 2/8] drm/i915: Support planar formats in tile height calculations Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 4/8] drm/i915: Extract tiled geometry calculation into a helper function Tvrtko Ursulin
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Leftover from refactoring and it serves no purpose now.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index a388670..f5709d4 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2686,7 +2686,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
{
struct drm_device *dev = obj->base.dev;
struct intel_rotation_info *rot_info = &ggtt_view->rotation_info;
- unsigned long size, pages, rot_pages;
+ unsigned long pages, rot_pages;
struct sg_page_iter sg_iter;
unsigned long i;
dma_addr_t *page_addr_list;
@@ -2704,7 +2704,6 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
width_pages = DIV_ROUND_UP(rot_info->pitch, tile_pitch);
height_pages = DIV_ROUND_UP(rot_info->height, tile_height);
rot_pages = width_pages * height_pages;
- size = rot_pages * PAGE_SIZE;
/* Allocate a temporary list of source pages for random access. */
page_addr_list = drm_malloc_ab(pages, sizeof(dma_addr_t));
@@ -2732,7 +2731,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
DRM_DEBUG_KMS(
"Created rotated page mapping for object size %lu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %lu pages).\n",
- size, rot_info->pitch, rot_info->height,
+ obj->base.size, rot_info->pitch, rot_info->height,
rot_info->pixel_format, width_pages, height_pages,
rot_pages);
@@ -2747,7 +2746,7 @@ err_st_alloc:
DRM_DEBUG_KMS(
"Failed to create rotated mapping for object size %lu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %lu pages)\n",
- size, ret, rot_info->pitch, rot_info->height,
+ obj->base.size, ret, rot_info->pitch, rot_info->height,
rot_info->pixel_format, width_pages, height_pages,
rot_pages);
return ERR_PTR(ret);
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 4/8] drm/i915: Extract tiled geometry calculation into a helper function
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
` (2 preceding siblings ...)
2015-05-08 12:02 ` [PATCH 3/8] drm/i915: Remove pointless calculation in intel_rotate_fb_obj_pages Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 5/8] drm/i915: Support appending to the rotated pages mapping Tvrtko Ursulin
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
It will be used twice with support for planar NV12.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index f5709d4..65c9d36 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2680,6 +2680,24 @@ rotate_pages(dma_addr_t *in, unsigned int width, unsigned int height,
}
}
+static unsigned long
+intel_calc_tiled_geometry(struct drm_device *dev,
+ struct intel_rotation_info *rot_info,
+ unsigned int *width_pages,
+ unsigned int *height_pages,
+ unsigned int plane)
+{
+ unsigned int tile_height, tile_pitch;
+
+ tile_height = intel_tile_height(dev, rot_info->pixel_format,
+ rot_info->fb_modifier, plane);
+ tile_pitch = PAGE_SIZE / tile_height;
+ *width_pages = DIV_ROUND_UP(rot_info->pitch, tile_pitch);
+ *height_pages = DIV_ROUND_UP(rot_info->height, tile_height);
+
+ return (*width_pages) * (*height_pages);
+}
+
static struct sg_table *
intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
struct drm_i915_gem_object *obj)
@@ -2691,19 +2709,14 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
unsigned long i;
dma_addr_t *page_addr_list;
struct sg_table *st;
- unsigned int tile_pitch, tile_height;
unsigned int width_pages, height_pages;
int ret = -ENOMEM;
pages = obj->base.size / PAGE_SIZE;
/* Calculate tiling geometry. */
- tile_height = intel_tile_height(dev, rot_info->pixel_format,
- rot_info->fb_modifier, 0);
- tile_pitch = PAGE_SIZE / tile_height;
- width_pages = DIV_ROUND_UP(rot_info->pitch, tile_pitch);
- height_pages = DIV_ROUND_UP(rot_info->height, tile_height);
- rot_pages = width_pages * height_pages;
+ rot_pages = intel_calc_tiled_geometry(dev, rot_info,
+ &width_pages, &height_pages, 0);
/* Allocate a temporary list of source pages for random access. */
page_addr_list = drm_malloc_ab(pages, sizeof(dma_addr_t));
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 5/8] drm/i915: Support appending to the rotated pages mapping
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
` (3 preceding siblings ...)
2015-05-08 12:02 ` [PATCH 4/8] drm/i915: Extract tiled geometry calculation into a helper function Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 6/8] drm/i915: Support NV12 in rotated GGTT mapping Tvrtko Ursulin
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
By providing a start offset into the source array of pages, and returning the
end position in the scatter-gather table, we will be able to append the UV
plane to the rotated mapping in later patches.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 65c9d36..d7f2e5d 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2653,15 +2653,18 @@ i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj,
}
-static void
-rotate_pages(dma_addr_t *in, unsigned int width, unsigned int height,
- struct sg_table *st)
+static struct scatterlist *
+rotate_pages(dma_addr_t *in, unsigned int offset,
+ unsigned int width, unsigned int height,
+ struct sg_table *st, struct scatterlist *sg)
{
unsigned int column, row;
unsigned int src_idx;
- struct scatterlist *sg = st->sgl;
- st->nents = 0;
+ if (!sg) {
+ st->nents = 0;
+ sg = st->sgl;
+ }
for (column = 0; column < width; column++) {
src_idx = width * (height - 1) + column;
@@ -2672,12 +2675,14 @@ rotate_pages(dma_addr_t *in, unsigned int width, unsigned int height,
* The only thing we need are DMA addresses.
*/
sg_set_page(sg, NULL, PAGE_SIZE, 0);
- sg_dma_address(sg) = in[src_idx];
+ sg_dma_address(sg) = in[offset + src_idx];
sg_dma_len(sg) = PAGE_SIZE;
sg = sg_next(sg);
src_idx -= width;
}
}
+
+ return sg;
}
static unsigned long
@@ -2740,7 +2745,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
}
/* Rotate the pages. */
- rotate_pages(page_addr_list, width_pages, height_pages, st);
+ rotate_pages(page_addr_list, 0, width_pages, height_pages, st, NULL);
DRM_DEBUG_KMS(
"Created rotated page mapping for object size %lu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %lu pages).\n",
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 6/8] drm/i915: Support NV12 in rotated GGTT mapping
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
` (4 preceding siblings ...)
2015-05-08 12:02 ` [PATCH 5/8] drm/i915: Support appending to the rotated pages mapping Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 7/8] drm/i915: Enable querying offset of UV plane with intel_plane_obj_offset Tvrtko Ursulin
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Just adding the rotated UV plane at the end of the rotated Y plane.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 47 ++++++++++++++++++++++++++++++------
drivers/gpu/drm/i915/i915_gem_gtt.h | 1 +
drivers/gpu/drm/i915/intel_display.c | 1 +
3 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index d7f2e5d..bf3ee44 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2693,12 +2693,18 @@ intel_calc_tiled_geometry(struct drm_device *dev,
unsigned int plane)
{
unsigned int tile_height, tile_pitch;
+ unsigned int height;
+
+ if (rot_info->pixel_format == DRM_FORMAT_NV12 && plane == 1)
+ height = rot_info->height / 2;
+ else
+ height = rot_info->height;
tile_height = intel_tile_height(dev, rot_info->pixel_format,
rot_info->fb_modifier, plane);
tile_pitch = PAGE_SIZE / tile_height;
*width_pages = DIV_ROUND_UP(rot_info->pitch, tile_pitch);
- *height_pages = DIV_ROUND_UP(rot_info->height, tile_height);
+ *height_pages = DIV_ROUND_UP(height, tile_height);
return (*width_pages) * (*height_pages);
}
@@ -2709,12 +2715,15 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
{
struct drm_device *dev = obj->base.dev;
struct intel_rotation_info *rot_info = &ggtt_view->rotation_info;
- unsigned long pages, rot_pages;
+ unsigned long pages, rot_pages, rot_pages_uv = 0;
struct sg_page_iter sg_iter;
unsigned long i;
dma_addr_t *page_addr_list;
struct sg_table *st;
unsigned int width_pages, height_pages;
+ unsigned int width_pages_uv, height_pages_uv;
+ unsigned int uv_start_page;
+ struct scatterlist *sg;
int ret = -ENOMEM;
pages = obj->base.size / PAGE_SIZE;
@@ -2723,6 +2732,13 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
rot_pages = intel_calc_tiled_geometry(dev, rot_info,
&width_pages, &height_pages, 0);
+ /* Account for UV plane with NV12. */
+ if (rot_info->pixel_format == DRM_FORMAT_NV12) {
+ rot_pages_uv = intel_calc_tiled_geometry(dev, rot_info,
+ &width_pages_uv,
+ &height_pages_uv, 1);
+ }
+
/* Allocate a temporary list of source pages for random access. */
page_addr_list = drm_malloc_ab(pages, sizeof(dma_addr_t));
if (!page_addr_list)
@@ -2733,7 +2749,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
if (!st)
goto err_st_alloc;
- ret = sg_alloc_table(st, rot_pages, GFP_KERNEL);
+ ret = sg_alloc_table(st, rot_pages + rot_pages_uv, GFP_KERNEL);
if (ret)
goto err_sg_alloc;
@@ -2745,13 +2761,28 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
}
/* Rotate the pages. */
- rotate_pages(page_addr_list, 0, width_pages, height_pages, st, NULL);
+ sg = rotate_pages(page_addr_list, 0,
+ width_pages, height_pages,
+ st, NULL);
+
+ /* Append the UV plane if NV12. */
+ if (rot_info->pixel_format == DRM_FORMAT_NV12) {
+ uv_start_page = rot_pages;
+
+ /* Check for tile-row un-alignment. */
+ if (offset_in_page(rot_info->uv_offset))
+ uv_start_page--;
+
+ rotate_pages(page_addr_list, uv_start_page,
+ width_pages_uv, height_pages_uv,
+ st, sg);
+ }
DRM_DEBUG_KMS(
- "Created rotated page mapping for object size %lu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %lu pages).\n",
+ "Created rotated page mapping for object size %lu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %lu pages (%lu plane 0)).\n",
obj->base.size, rot_info->pitch, rot_info->height,
rot_info->pixel_format, width_pages, height_pages,
- rot_pages);
+ rot_pages + rot_pages_uv, rot_pages);
drm_free_large(page_addr_list);
@@ -2763,10 +2794,10 @@ err_st_alloc:
drm_free_large(page_addr_list);
DRM_DEBUG_KMS(
- "Failed to create rotated mapping for object size %lu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %lu pages)\n",
+ "Failed to create rotated mapping for object size %lu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %lu pages (%lu plane 0))\n",
obj->base.size, ret, rot_info->pitch, rot_info->height,
rot_info->pixel_format, width_pages, height_pages,
- rot_pages);
+ rot_pages + rot_pages_uv, rot_pages);
return ERR_PTR(ret);
}
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 4e6cac5..5118da1 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -123,6 +123,7 @@ enum i915_ggtt_view_type {
struct intel_rotation_info {
unsigned int height;
unsigned int pitch;
+ unsigned int uv_offset;
uint32_t pixel_format;
uint64_t fb_modifier;
};
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a87faca..b4bf998 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2346,6 +2346,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb,
info->pixel_format = fb->pixel_format;
info->pitch = fb->pitches[0];
info->fb_modifier = fb->modifier[0];
+ info->uv_offset = fb->offsets[1];
return 0;
}
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 7/8] drm/i915: Enable querying offset of UV plane with intel_plane_obj_offset
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
` (5 preceding siblings ...)
2015-05-08 12:02 ` [PATCH 6/8] drm/i915: Support NV12 in rotated GGTT mapping Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-08 12:02 ` [PATCH 8/8] drm/i915: Allow NV12 with 90/270 rotation Tvrtko Ursulin
2015-05-08 14:59 ` [PATCH 0/8] NV12 90/270 rotated GGTT mapping Damien Lespiau
8 siblings, 0 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Do we need this?
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 2 ++
drivers/gpu/drm/i915/i915_gem_gtt.h | 2 ++
drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++++++++++-----
drivers/gpu/drm/i915/intel_drv.h | 3 ++-
drivers/gpu/drm/i915/intel_sprite.c | 2 +-
5 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index bf3ee44..0cffa69 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2773,6 +2773,8 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
if (offset_in_page(rot_info->uv_offset))
uv_start_page--;
+ rot_info->uv_start_page = uv_start_page;
+
rotate_pages(page_addr_list, uv_start_page,
width_pages_uv, height_pages_uv,
st, sg);
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 5118da1..d8ae9ee 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -126,6 +126,8 @@ struct intel_rotation_info {
unsigned int uv_offset;
uint32_t pixel_format;
uint64_t fb_modifier;
+
+ unsigned int uv_start_page;
};
struct i915_ggtt_view {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b4bf998..62b92ac 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2933,14 +2933,30 @@ u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier,
}
unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
- struct drm_i915_gem_object *obj)
+ struct drm_i915_gem_object *obj,
+ unsigned int plane)
{
const struct i915_ggtt_view *view = &i915_ggtt_view_normal;
+ struct i915_vma *vma;
+ unsigned char *offset;
+ unsigned long uv_start;
if (intel_rotation_90_or_270(intel_plane->base.state->rotation))
view = &i915_ggtt_view_rotated;
- return i915_gem_obj_ggtt_offset_view(obj, view);
+ vma = i915_gem_obj_to_ggtt_view(obj, view);
+ if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n",
+ view->type))
+ return -1;
+
+ offset = (unsigned char *)vma->node.start;
+
+ if (plane == 1) {
+ uv_start = vma->ggtt_view.rotation_info.uv_start_page;
+ offset += uv_start * PAGE_SIZE;
+ }
+
+ return (unsigned long)offset;
}
/*
@@ -3115,7 +3131,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
obj = intel_fb_obj(fb);
stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
fb->pixel_format);
- surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj);
+ surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj, 0);
/*
* FIXME: intel_plane_state->src, dst aren't set when transitional
@@ -11082,8 +11098,9 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
if (ret)
goto cleanup_pending;
- work->gtt_offset = intel_plane_obj_offset(to_intel_plane(primary), obj)
- + intel_crtc->dspaddr_offset;
+ work->gtt_offset = intel_plane_obj_offset(to_intel_plane(primary),
+ obj, 0);
+ work->gtt_offset += intel_crtc->dspaddr_offset;
if (mmio_flip) {
ret = intel_queue_mmio_flip(dev, crtc, fb, obj, ring,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 01c1ac8..79bee46 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1142,7 +1142,8 @@ int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
uint32_t pixel_format);
unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
- struct drm_i915_gem_object *obj);
+ struct drm_i915_gem_object *obj,
+ unsigned int plane);
u32 skl_plane_ctl_format(uint32_t pixel_format);
u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
u32 skl_plane_ctl_rotation(unsigned int rotation);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 4a94529..fc1505b7 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -228,7 +228,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
else if (key->flags & I915_SET_COLORKEY_SOURCE)
plane_ctl |= PLANE_CTL_KEY_ENABLE_SOURCE;
- surf_addr = intel_plane_obj_offset(intel_plane, obj);
+ surf_addr = intel_plane_obj_offset(intel_plane, obj, 0);
if (intel_rotation_90_or_270(rotation)) {
/* stride: Surface height in tiles */
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 8/8] drm/i915: Allow NV12 with 90/270 rotation
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
` (6 preceding siblings ...)
2015-05-08 12:02 ` [PATCH 7/8] drm/i915: Enable querying offset of UV plane with intel_plane_obj_offset Tvrtko Ursulin
@ 2015-05-08 12:02 ` Tvrtko Ursulin
2015-05-11 3:52 ` shuang.he
2015-05-08 14:59 ` [PATCH 0/8] NV12 90/270 rotated GGTT mapping Damien Lespiau
8 siblings, 1 reply; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 12:02 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/intel_atomic_plane.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 119439d..da82504 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -183,14 +183,13 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
/*
* 90/270 is not allowed with RGB64 16:16:16:16,
- * RGB 16-bit 5:6:5, and Indexed 8-bit.
+ * RGB 16-bit 5:6:5, Indexed 8-bit and NV12.
* TBD: Add RGB64 case once its added in supported format list.
* TBD: Remove NV12, once its 90/270 remapping is supported
*/
switch (state->fb->pixel_format) {
case DRM_FORMAT_C8:
case DRM_FORMAT_RGB565:
- case DRM_FORMAT_NV12:
DRM_DEBUG_KMS("Unsupported pixel format %s for 90/270!\n",
drm_get_format_name(state->fb->pixel_format));
return -EINVAL;
--
2.4.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 8/8] drm/i915: Allow NV12 with 90/270 rotation
2015-05-08 12:02 ` [PATCH 8/8] drm/i915: Allow NV12 with 90/270 rotation Tvrtko Ursulin
@ 2015-05-11 3:52 ` shuang.he
0 siblings, 0 replies; 13+ messages in thread
From: shuang.he @ 2015-05-11 3:52 UTC (permalink / raw)
To: shuang.he, ethan.gao, intel-gfx, tvrtko.ursulin
Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6356
-------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 276/276 276/276
ILK 302/302 302/302
SNB 316/316 316/316
IVB 342/342 342/342
BYT 286/286 286/286
BDW 318/318 318/318
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
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] 13+ messages in thread
* Re: [PATCH 0/8] NV12 90/270 rotated GGTT mapping
2015-05-08 12:02 [PATCH 0/8] NV12 90/270 rotated GGTT mapping Tvrtko Ursulin
` (7 preceding siblings ...)
2015-05-08 12:02 ` [PATCH 8/8] drm/i915: Allow NV12 with 90/270 rotation Tvrtko Ursulin
@ 2015-05-08 14:59 ` Damien Lespiau
2015-05-08 15:05 ` Tvrtko Ursulin
8 siblings, 1 reply; 13+ messages in thread
From: Damien Lespiau @ 2015-05-08 14:59 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: Intel-gfx
On Fri, May 08, 2015 at 01:02:35PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> First attempt at rotated GGTT mapping for the NV12 format.
>
> It compiles and even does not crash on first use. But some parts are
> probably too simplistic at the moment and need further polish.
>
> Sending out early since Chandra needs this to complete his display
> programming patches.
>
> Depends on Chandra's NV12 patch series.
I don't know how you split up the work, but there's also adjustments to
be done in the DDB allocation and WM code for rotated NV12 buffers and I
don't see that in either of your series (I think).
The natural assignee is probably Chandra as he's already working on the
the NV12 DDB/WM code.
--
Damien
> Tvrtko Ursulin (8):
> drm/i915: Remove duplicated intel_tile_height declaration
> drm/i915: Support planar formats in tile height calculations
> drm/i915: Remove pointless calculation in intel_rotate_fb_obj_pages
> drm/i915: Extract tiled geometry calculation into a helper function
> drm/i915: Support appending to the rotated pages mapping
> drm/i915: Support NV12 in rotated GGTT mapping
> drm/i915: Enable querying offset of UV plane with
> intel_plane_obj_offset
> drm/i915: Allow NV12 with 90/270 rotation
>
> drivers/gpu/drm/i915/i915_gem_gtt.c | 96 +++++++++++++++++++++++--------
> drivers/gpu/drm/i915/i915_gem_gtt.h | 3 +
> drivers/gpu/drm/i915/intel_atomic_plane.c | 3 +-
> drivers/gpu/drm/i915/intel_display.c | 36 +++++++++---
> drivers/gpu/drm/i915/intel_drv.h | 8 +--
> drivers/gpu/drm/i915/intel_sprite.c | 4 +-
> 6 files changed, 109 insertions(+), 41 deletions(-)
>
> --
> 2.4.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 0/8] NV12 90/270 rotated GGTT mapping
2015-05-08 14:59 ` [PATCH 0/8] NV12 90/270 rotated GGTT mapping Damien Lespiau
@ 2015-05-08 15:05 ` Tvrtko Ursulin
0 siblings, 0 replies; 13+ messages in thread
From: Tvrtko Ursulin @ 2015-05-08 15:05 UTC (permalink / raw)
To: Damien Lespiau; +Cc: Intel-gfx
On 05/08/2015 03:59 PM, Damien Lespiau wrote:
> On Fri, May 08, 2015 at 01:02:35PM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> First attempt at rotated GGTT mapping for the NV12 format.
>>
>> It compiles and even does not crash on first use. But some parts are
>> probably too simplistic at the moment and need further polish.
>>
>> Sending out early since Chandra needs this to complete his display
>> programming patches.
>>
>> Depends on Chandra's NV12 patch series.
>
> I don't know how you split up the work, but there's also adjustments to
> be done in the DDB allocation and WM code for rotated NV12 buffers and I
> don't see that in either of your series (I think).
>
> The natural assignee is probably Chandra as he's already working on the
> the NV12 DDB/WM code.
Yes that is the plan, I have just the GTT remapping on my plate.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread