drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2)
Subsystems (3)
v2 cover drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2)
From: Ville Syrjälä <[email protected]>
This is the new version of [1]. I already sent a bunch of the earlir patches as separate prep series [2] and [3]. [2] was already pushed fully, but most of the patches from [3] didn't get reviewed yet, so I've included them in this series so that the CI machinery might actually apply the patches and test the thing. So you can consider the last prep series superceced by this one.
What's changed from the original:
* The big patch got split up a bit
* I tried to avoid some of the bytes vs. pixels confusion
* Reordered the patches a bit
* Tried to account various other review comments
The series (+ a bit of extra) available here:git://github.com/vsyrjala/linux.git fb_offsets_7
[1] http://lists.freedesktop.org/archives/intel-gfx/2015-October/078050.html
[2] http://lists.freedesktop.org/archives/intel-gfx/2016-January/085064.html
[3] http://lists.freedesktop.org/archives/intel-gfx/2016-January/085327.html
Ville Syrjälä (18):
drm/i915: Rename the rotated gtt view member to 'rotated' drm/i915: Pass stride to rotate_pages()
drm/i915: Pass rotation_info to intel_rotate_fb_obj_pages() drm/i915: Make display gtt offsets u32
drm/i915: Standardize on 'cpp' for bytes per pixel
drm: Add drm_format_plane_width() and drm_format_plane_height() drm/i915: Fix intel_tile_width() parameters
drm/i915: Pass 90/270 vs. 0/180 rotation info for
intel_gen4_compute_page_offset()
drm/i915: Support for extra alignment for tiled surfaces drm/i915: Don't pass plane+plane_state to intel_pin_and_fence_fb_obj() drm/i915: Pass drm_frambuffer to intel_compute_page_offset() drm/i915: Reorganize intel_rotation_info
drm/i915: Move the NULL sg handling out from rotate_pages() drm/i915: Embed rotation_info under intel_framebuffer drm/i915: Rewrite fb rotation GTT handling
drm/i915: Don't pass pitch to intel_compute_page_offset() drm/i915: Pass around plane_state instead of fb+rotation drm/i915: Make sure fb offset is (macro)pixel aligned
drivers/gpu/drm/i915/i915_gem_gtt.c | 70 ++--- drivers/gpu/drm/i915/i915_gem_gtt.h | 16 +- drivers/gpu/drm/i915/intel_display.c | 587 ++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_drv.h | 35 ++- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- drivers/gpu/drm/i915/intel_pm.c | 128 ++++---- drivers/gpu/drm/i915/intel_sprite.c | 136 ++++---- include/drm/drm_crtc.h | 30 ++ 8 files changed, 613 insertions(+), 391 deletions(-)
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/18 drm/i915: Rename the rotated gtt view member to 'rotated'
From: Ville Syrjälä <[email protected]>
Also rename 'rotation_info' to 'rotated' to match the view type exactly, this should avoid confusion which union members is valid for each view type.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
@@ -3366,7 +3366,7 @@ static struct sg_table * intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, struct drm_i915_gem_object *obj) { - struct intel_rotation_info *rot_info = &ggtt_view->params.rotation_info; + struct intel_rotation_info *rot_info = &ggtt_view->params.rotated;unsigned int size_pages = rot_info->size >>PAGE_SHIFT ;unsigned int size_pages_uv;struct sg_page_iter sg_iter;
@@ -3598,7 +3598,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,if (view->type ==I915_GGTT_VIEW_NORMAL ) {return obj->base.size; }else if (view->type ==I915_GGTT_VIEW_ROTATED ) { -return view->params.rotation_info.size; +return view->params.rotated.size; }else if (view->type ==I915_GGTT_VIEW_PARTIAL ) {return view->params.partial.size <<PAGE_SHIFT ; }else {
drivers/gpu/drm/i915/i915_gem_gtt.h +1 -1
@@ -155,7 +155,7 @@ struct i915_ggtt_view {u64 offset;unsigned int size; } partial; -struct intel_rotation_info rotation_info; +struct intel_rotation_info rotated; } params;struct sg_table *pages;
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -2284,7 +2284,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, const struct drm_plane_state *plane_state) {struct drm_i915_private *dev_priv =to_i915 (fb->dev); -struct intel_rotation_info *info = &view->params.rotation_info; +struct intel_rotation_info *info = &view->params.rotated;unsigned int tile_size, tile_width, tile_height, cpp; *view = i915_ggtt_view_normal;
@@ -2951,7 +2951,7 @@ u32 intel_plane_obj_offset(struct intel_plane *intel_plane, offset = vma->node.start;if (plane ==1 ) { - offset += vma->ggtt_view.params.rotation_info.uv_start_page * + offset += vma->ggtt_view.params.rotated.uv_start_page *PAGE_SIZE ; }
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/18] drm/i915: Rename the rotated gtt view member to 'rotated'
Quoted 7 lines · On Wed, Jan 20, 2016 at 09:05:22PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Also rename '
rotation_info' to 'rotated' to match the view type exactly, this should avoid confusion which union members is valid for each view type.Signed-off-by Ville Syrjälä <[email protected]>
Assuming gcc is happy: Reviewed-by: Daniel Vetter <[email protected]>
Quoted 70 lines
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2@@ -3366,7 +3366,7 @@ static struct sg_table * intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, struct drm_i915_gem_object *obj) { - struct intel_rotation_info *rot_info = &ggtt_view->params.rotation_info; + struct intel_rotation_info *rot_info = &ggtt_view->params.rotated;unsigned int size_pages = rot_info->size >>PAGE_SHIFT ;unsigned int size_pages_uv;struct sg_page_iter sg_iter;@@ -3598,7 +3598,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,if (view->type ==I915_GGTT_VIEW_NORMAL ) {return obj->base.size; }else if (view->type ==I915_GGTT_VIEW_ROTATED ) { -return view->params.rotation_info.size; +return view->params.rotated.size; }else if (view->type ==I915_GGTT_VIEW_PARTIAL ) {return view->params.partial.size <<PAGE_SHIFT ; }else {drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -155,7 +155,7 @@ struct i915_ggtt_view {u64 offset;unsigned int size; } partial; -struct intel_rotation_info rotation_info; +struct intel_rotation_info rotated; } params;struct sg_table *pages;drivers/gpu/drm/i915/intel_display.c +2
-2@@ -2284,7 +2284,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, const struct drm_plane_state *plane_state) {struct drm_i915_private *dev_priv =to_i915 (fb->dev); -struct intel_rotation_info *info = &view->params.rotation_info; +struct intel_rotation_info *info = &view->params.rotated;unsigned int tile_size, tile_width, tile_height, cpp; *view = i915_ggtt_view_normal;@@ -2951,7 +2951,7 @@ u32 intel_plane_obj_offset(struct intel_plane *intel_plane, offset = vma->node.start;if (plane ==1 ) { - offset += vma->ggtt_view.params.rotation_info.uv_start_page * + offset += vma->ggtt_view.params.rotated.uv_start_page *PAGE_SIZE ; }Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/18 drm/i915: Pass stride to rotate_pages()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Pass stride in addition to width and height to rotate_pages(). For now width and stride are the same, but once framebuffer offsets enter the scene that may no longer be the case.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +5 -2
@@ -3333,6 +3333,7 @@ i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj,static struct scatterlist *rotate_pages (const dma_addr_t *in,unsigned int offset,unsigned int width,unsigned int height, +unsigned int stride,struct sg_table *st,struct scatterlist *sg) {unsigned int column, row;
@@ -3344,7 +3345,7 @@ rotate_pages(const dma_addr_t *in, unsigned int offset, }for (column =0 ; column < width; column++) { - src_idx = width * (height -1 ) + column; + src_idx = stride * (height -1 ) + column;for (row =0 ; row < height; row++) { st->nents++;/* We don't need the pages, but need to initialize
@@ -3355,7 +3356,7 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,sg_dma_address (sg) = in[offset + src_idx];sg_dma_len (sg) =PAGE_SIZE ; sg =sg_next (sg); - src_idx -= width; + src_idx -= stride; } }
@@ -3408,6 +3409,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,/* Rotate the pages. */ sg =rotate_pages (page_addr_list,0 , rot_info->width_pages, rot_info->height_pages, + rot_info->width_pages, st,NULL );/* Append the UV plane if NV12. */
@@ -3423,6 +3425,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,rotate_pages (page_addr_list, uv_start_page, rot_info->width_pages_uv, rot_info->height_pages_uv, + rot_info->width_pages_uv, st, sg); }
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 02/18] drm/i915: Pass stride to rotate_pages()
Quoted 7 lines · On Wed, Jan 20, 2016 at 09:05:23PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Pass stride in addition to width and height to
rotate_pages(). For now width and stride are the same, but once framebuffer offsets enter the scene that may no longer be the case.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 57 lines
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +5
-2@@ -3333,6 +3333,7 @@ i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj,static struct scatterlist *rotate_pages (const dma_addr_t *in,unsigned int offset,unsigned int width,unsigned int height, +unsigned int stride,struct sg_table *st,struct scatterlist *sg) {unsigned int column, row;@@ -3344,7 +3345,7 @@ rotate_pages(const dma_addr_t *in, unsigned int offset, }for (column =0 ; column < width; column++) { - src_idx = width * (height -1 ) + column; + src_idx = stride * (height -1 ) + column;for (row =0 ; row < height; row++) { st->nents++;/* We don't need the pages, but need to initialize @@ -3355,7 +3356,7 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,sg_dma_address (sg) = in[offset + src_idx];sg_dma_len (sg) =PAGE_SIZE ; sg =sg_next (sg); - src_idx -= width; + src_idx -= stride; } }@@ -3408,6 +3409,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,/* Rotate the pages. */ sg =rotate_pages (page_addr_list,0 , rot_info->width_pages, rot_info->height_pages, + rot_info->width_pages, st,NULL );/* Append the UV plane if NV12. */ @@ -3423,6 +3425,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,rotate_pages (page_addr_list, uv_start_page, rot_info->width_pages_uv, rot_info->height_pages_uv, + rot_info->width_pages_uv, st, sg); }Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/18 drm/i915: Pass rotation_info to intel_rotate_fb_obj_pages()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_rotate_fb_obj_pages() doens't need the entire gtt view, just the rotation info suffices.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -3
@@ -3364,10 +3364,9 @@ rotate_pages(const dma_addr_t *in, unsigned int offset, }static struct sg_table * -intel_rotate_fb_obj_pages (struct i915_ggtt_view *ggtt_view, +intel_rotate_fb_obj_pages (struct intel_rotation_info *rot_info,struct drm_i915_gem_object *obj) { -struct intel_rotation_info *rot_info = &ggtt_view->params.rotated;unsigned int size_pages = rot_info->size >>PAGE_SHIFT ;unsigned int size_pages_uv;struct sg_page_iter sg_iter;
@@ -3507,7 +3506,7 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma) vma->ggtt_view.pages = vma->obj->pages; else if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED) vma->ggtt_view.pages = -intel_rotate_fb_obj_pages (&vma->ggtt_view, vma->obj); +intel_rotate_fb_obj_pages (&vma->ggtt_view.params.rotated, vma->obj); else if (vma->ggtt_view.type == I915_GGTT_VIEW_PARTIAL) vma->ggtt_view.pages =intel_partial_pages (&vma->ggtt_view, vma->obj);
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/18] drm/i915: Pass rotation_info to intel_rotate_fb_obj_pages()
Quoted 6 lines · On Wed, Jan 20, 2016 at 09:05:24PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
intel_rotate_fb_obj_pages()doens't need the entire gtt view, just the rotation info suffices.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 36 lines
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +2
-3@@ -3364,10 +3364,9 @@ rotate_pages(const dma_addr_t *in, unsigned int offset, }static struct sg_table * -intel_rotate_fb_obj_pages (struct i915_ggtt_view *ggtt_view, +intel_rotate_fb_obj_pages (struct intel_rotation_info *rot_info,struct drm_i915_gem_object *obj) { -struct intel_rotation_info *rot_info = &ggtt_view->params.rotated;unsigned int size_pages = rot_info->size >>PAGE_SHIFT ;unsigned int size_pages_uv;struct sg_page_iter sg_iter;@@ -3507,7 +3506,7 @@ i915_get_ggtt_vma_pages(struct i915_vma *vma) vma->ggtt_view.pages = vma->obj->pages; else if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED) vma->ggtt_view.pages = -intel_rotate_fb_obj_pages (&vma->ggtt_view, vma->obj); +intel_rotate_fb_obj_pages (&vma->ggtt_view.params.rotated, vma->obj); else if (vma->ggtt_view.type == I915_GGTT_VIEW_PARTIAL) vma->ggtt_view.pages =intel_partial_pages (&vma->ggtt_view, vma->obj);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/18 drm/i915: Make display gtt offsets u32
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Using 'unsigned long' for ggtt offsets doesn't make much sense. Use 'u32' instead since we've not yet seen a >4GiB ggtt.
--- drivers/gpu/drm/i915/intel_display.c | 22 ++++++++++------------ drivers/gpu/drm/i915/intel_drv.h | 12 ++++++------ drivers/gpu/drm/i915/intel_sprite.c | 6 +++--- 3 files changed, 19 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_display.c +10 -12
@@ -2448,11 +2448,11 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel * is assumed to be a power-of-two. */ -unsigned long intel_compute_tile_offset (struct drm_i915_private *dev_priv, -int *x,int *y, -uint64_t fb_modifier, -unsigned int cpp, -unsigned int pitch) +u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv, +int *x,int *y, +uint64_t fb_modifier, +unsigned int cpp, +unsigned int pitch) {if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height;
@@ -2706,14 +2706,12 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,struct drm_framebuffer *fb = plane_state->base.fb;struct drm_i915_gem_object *obj =intel_fb_obj (fb);int plane = intel_crtc->plane; -unsigned long linear_offset; -int x = plane_state->src.x1 >>16 ; -int y = plane_state->src.y1 >>16 ; +u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); -int pixel_size; - - pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int x = plane_state->src.x1 >>16 ; +int y = plane_state->src.y1 >>16 ; dspcntr =DISPPLANE_GAMMA_ENABLE ;
@@ -2839,7 +2837,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,struct drm_framebuffer *fb = plane_state->base.fb;struct drm_i915_gem_object *obj =intel_fb_obj (fb);int plane = intel_crtc->plane; -unsigned long linear_offset; +u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane);int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );
drivers/gpu/drm/i915/intel_drv.h +6 -6
@@ -575,7 +575,7 @@ struct intel_crtc {/* Display surface base address adjustement for pageflips. Note that on * gen4+ this only adjusts up to a tile, offsets within a tile are * handled in the hw itself (with the TILEOFF register). */ -unsigned long dspaddr_offset; +u32 dspaddr_offset;int adjusted_x;int adjusted_y;
@@ -1172,11 +1172,11 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,void assert_pipe (struct drm_i915_private *dev_priv,enum pipe pipe,bool state);#define assert_pipe_enabled (d, p) assert_pipe(d, p, true)#define assert_pipe_disabled (d, p) assert_pipe(d, p, false) -unsigned long intel_compute_tile_offset (struct drm_i915_private *dev_priv, -int *x,int *y, -uint64_t fb_modifier, -unsigned int cpp, -unsigned int pitch); +u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv, +int *x,int *y, +uint64_t fb_modifier, +unsigned int cpp, +unsigned int pitch);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_sprite.c +3 -3
@@ -350,7 +350,7 @@ vlv_update_plane(struct drm_plane *dplane,int pipe = intel_plane->pipe;int plane = intel_plane->plane;u32 sprctl; -unsigned long sprsurf_offset, linear_offset; +u32 sprsurf_offset, linear_offset;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;
@@ -493,7 +493,7 @@ ivb_update_plane(struct drm_plane *plane,struct drm_i915_gem_object *obj =intel_fb_obj (fb);enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ; -unsigned long sprsurf_offset, linear_offset; +u32 sprsurf_offset, linear_offset;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;
@@ -635,8 +635,8 @@ ilk_update_plane(struct drm_plane *plane,struct drm_framebuffer *fb = plane_state->base.fb;struct drm_i915_gem_object *obj =intel_fb_obj (fb);int pipe = intel_plane->pipe; -unsigned long dvssurf_offset, linear_offset;u32 dvscntr, dvsscale; +u32 dvssurf_offset, linear_offset;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/18] drm/i915: Make display gtt offsets u32
Quoted 6 lines · On Wed, Jan 20, 2016 at 09:05:25PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Using 'unsigned long' for ggtt offsets doesn't make much sense. Use 'u32' instead since we've not yet seen a >4GiB ggtt.
Signed-off-by Ville Syrjälä <[email protected]>
I hunted down every occurenve of _offset in intel_display.c and intel_sprite.c and could indeed not find any other worthy of conversion.
Quoted 124 lines
--- drivers/gpu/drm/i915/intel_display.c | 22 ++++++++++------------ drivers/gpu/drm/i915/intel_drv.h | 12 ++++++------ drivers/gpu/drm/i915/intel_sprite.c | 6 +++--- 3 files changed, 19 insertions(+), 21 deletions(-)drivers/gpu/drm/i915/intel_display.c +10
-12@@ -2448,11 +2448,11 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel * is assumed to be a power-of-two. */ -unsigned long intel_compute_tile_offset (struct drm_i915_private *dev_priv, -int *x,int *y, -uint64_t fb_modifier, -unsigned int cpp, -unsigned int pitch) +u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv, +int *x,int *y, +uint64_t fb_modifier, +unsigned int cpp, +unsigned int pitch) {if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height;@@ -2706,14 +2706,12 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,struct drm_framebuffer *fb = plane_state->base.fb;struct drm_i915_gem_object *obj =intel_fb_obj (fb);int plane = intel_crtc->plane; -unsigned long linear_offset; -int x = plane_state->src.x1 >>16 ; -int y = plane_state->src.y1 >>16 ; +u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); -int pixel_size; - - pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int x = plane_state->src.x1 >>16 ; +int y = plane_state->src.y1 >>16 ; dspcntr =DISPPLANE_GAMMA_ENABLE ;@@ -2839,7 +2837,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,struct drm_framebuffer *fb = plane_state->base.fb;struct drm_i915_gem_object *obj =intel_fb_obj (fb);int plane = intel_crtc->plane; -unsigned long linear_offset; +u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane);int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );drivers/gpu/drm/i915/intel_drv.h +6
-6@@ -575,7 +575,7 @@ struct intel_crtc {/* Display surface base address adjustement for pageflips. Note that on * gen4+ this only adjusts up to a tile, offsets within a tile are * handled in the hw itself (with the TILEOFF register). */ -unsigned long dspaddr_offset; +u32 dspaddr_offset;int adjusted_x;int adjusted_y;@@ -1172,11 +1172,11 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,void assert_pipe (struct drm_i915_private *dev_priv,enum pipe pipe,bool state);#define assert_pipe_enabled (d, p) assert_pipe(d, p, true)#define assert_pipe_disabled (d, p) assert_pipe(d, p, false) -unsigned long intel_compute_tile_offset (struct drm_i915_private *dev_priv, -int *x,int *y, -uint64_t fb_modifier, -unsigned int cpp, -unsigned int pitch); +u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv, +int *x,int *y, +uint64_t fb_modifier, +unsigned int cpp, +unsigned int pitch);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_sprite.c +3
-3@@ -350,7 +350,7 @@ vlv_update_plane(struct drm_plane *dplane,int pipe = intel_plane->pipe;int plane = intel_plane->plane;u32 sprctl; -unsigned long sprsurf_offset, linear_offset; +u32 sprsurf_offset, linear_offset;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -493,7 +493,7 @@ ivb_update_plane(struct drm_plane *plane,struct drm_i915_gem_object *obj =intel_fb_obj (fb);enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ; -unsigned long sprsurf_offset, linear_offset; +u32 sprsurf_offset, linear_offset;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -635,8 +635,8 @@ ilk_update_plane(struct drm_plane *plane,struct drm_framebuffer *fb = plane_state->base.fb;struct drm_i915_gem_object *obj =intel_fb_obj (fb);int pipe = intel_plane->pipe; -unsigned long dvssurf_offset, linear_offset;u32 dvscntr, dvsscale; +u32 dvssurf_offset, linear_offset;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 5/18 drm/i915: Standardize on 'cpp' for bytes per pixel
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We more or less randomly call the "bytes per pixel" value 'cpp', 'bytes_per_pixel', 'pixel_size', or even 'bpp'. Let's just pick one and stick to it. I've chosen 'cpp'.
--- drivers/gpu/drm/i915/intel_display.c | 22 +++--- drivers/gpu/drm/i915/intel_pm.c | 128 +++++++++++++++++------------------ drivers/gpu/drm/i915/intel_sprite.c | 34 ++++------ 3 files changed, 87 insertions(+), 97 deletions(-)
drivers/gpu/drm/i915/intel_display.c +11 -11
@@ -2709,7 +2709,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;
@@ -2769,13 +2769,12 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,if (IS_G4X (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp;if (INTEL_INFO (dev)->gen >=4 ) { intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= intel_crtc->dspaddr_offset; }else {
@@ -2792,7 +2791,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,data and adding to linear_offset*/ linear_offset += (crtc_state->pipe_src_h -1 ) * fb->pitches[0 ] + - (crtc_state->pipe_src_w -1 ) * pixel_size; + (crtc_state->pipe_src_w -1 ) * cpp; } intel_crtc->adjusted_x = x;
@@ -2840,7 +2839,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;
@@ -2879,11 +2878,10 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= intel_crtc->dspaddr_offset;if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) {
@@ -2897,7 +2895,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,data and adding to linear_offset*/ linear_offset += (crtc_state->pipe_src_h -1 ) * fb->pitches[0 ] + - (crtc_state->pipe_src_w -1 ) * pixel_size; + (crtc_state->pipe_src_w -1 ) * cpp; } }
@@ -14680,10 +14678,12 @@ u32 intel_fb_pitch_limit(struct drm_device *dev, uint64_t fb_modifier,u32 gen =INTEL_INFO (dev)->gen;if (gen >=9 ) { +int cpp =drm_format_plane_cpp (pixel_format,0 ); +/* "The stride in bytes must not exceed the of the size of 8K * pixels and 32K bytes." */ -return min (8192 *drm_format_plane_cpp (pixel_format,0 ),32768 ); +return min (8192 * cpp,32768 ); }else if (gen >=5 && !IS_VALLEYVIEW (dev) && !IS_CHERRYVIEW (dev)) {return 32 *1024 ; }else if (gen >=4 ) {
drivers/gpu/drm/i915/intel_pm.c +62 -66
433 lines not on this page · raw message
drivers/gpu/drm/i915/intel_sprite.c +14 -20
@@ -351,7 +351,7 @@ vlv_update_plane(struct drm_plane *dplane,int plane = intel_plane->plane;u32 sprctl;u32 sprsurf_offset, linear_offset; -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;
@@ -422,10 +422,9 @@ vlv_update_plane(struct drm_plane *dplane, crtc_w--; crtc_h--; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= sprsurf_offset;
@@ -434,7 +433,7 @@ vlv_update_plane(struct drm_plane *dplane, x += src_w; y += src_h; - linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + linear_offset += src_h * fb->pitches[0 ] + src_w * cpp; }if (key->flags) {
@@ -494,7 +493,7 @@ ivb_update_plane(struct drm_plane *plane,enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;u32 sprsurf_offset, linear_offset; -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;
@@ -556,10 +555,9 @@ ivb_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) sprscale =SPRITE_SCALE_ENABLE | (src_w <<16 ) | src_h; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= sprsurf_offset;
@@ -570,8 +568,7 @@ ivb_update_plane(struct drm_plane *plane,if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) { x += src_w; y += src_h; - linear_offset += src_h * fb->pitches[0 ] + - src_w * pixel_size; + linear_offset += src_h * fb->pitches[0 ] + src_w * cpp; } }
@@ -637,7 +634,7 @@ ilk_update_plane(struct drm_plane *plane,int pipe = intel_plane->pipe;u32 dvscntr, dvsscale;u32 dvssurf_offset, linear_offset; -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;
@@ -695,10 +692,9 @@ ilk_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) dvsscale =DVS_SCALE_ENABLE | (src_w <<16 ) | src_h; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; dvssurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= dvssurf_offset;
@@ -707,7 +703,7 @@ ilk_update_plane(struct drm_plane *plane, x += src_w; y += src_h; - linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + linear_offset += src_h * fb->pitches[0 ] + src_w * cpp; }if (key->flags) {
@@ -772,7 +768,6 @@ intel_check_sprite_plane(struct drm_plane *plane,int hscale, vscale;int max_scale, min_scale;bool can_scale; -int pixel_size;if (!fb) { state->visible = false;
@@ -894,6 +889,7 @@ intel_check_sprite_plane(struct drm_plane *plane,/* Check size restrictions when scaling */ if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {unsigned int width_bytes; +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );WARN_ON (!can_scale);
@@ -905,9 +901,7 @@ intel_check_sprite_plane(struct drm_plane *plane,if (src_w <3 || src_h <3 ) state->visible = false; - pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); - width_bytes = ((src_x * pixel_size) &63 ) + - src_w * pixel_size; + width_bytes = ((src_x * cpp) &63 ) + src_w * cpp;if (INTEL_INFO (dev)->gen <9 && (src_w >2048 || src_h >2048 || width_bytes >4096 || fb->pitches[0 ] >4096 )) {
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 05/18] drm/i915: Standardize on 'cpp' for bytes per pixel
Quoted 7 lines · On Wed, Jan 20, 2016 at 09:05:26PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We more or less randomly call the "bytes per pixel" value 'cpp', '
bytes_per_pixel', 'pixel_size', or even 'bpp'. Let's just pick one and stick to it. I've chosen 'cpp'.Signed-off-by Ville Syrjälä <[email protected]>
Concurred on the cpp bikeshed, and reviewed all the changes in this patch. I didn't apply&check that you caught them all though this time around.
Quoted 696 lines
--- drivers/gpu/drm/i915/intel_display.c | 22 +++--- drivers/gpu/drm/i915/intel_pm.c | 128 +++++++++++++++++------------------ drivers/gpu/drm/i915/intel_sprite.c | 34 ++++------ 3 files changed, 87 insertions(+), 97 deletions(-)drivers/gpu/drm/i915/intel_display.c +11
-11@@ -2709,7 +2709,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2769,13 +2769,12 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,if (IS_G4X (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp;if (INTEL_INFO (dev)->gen >=4 ) { intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= intel_crtc->dspaddr_offset; }else {@@ -2792,7 +2791,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,data and adding to linear_offset*/ linear_offset += (crtc_state->pipe_src_h -1 ) * fb->pitches[0 ] + - (crtc_state->pipe_src_w -1 ) * pixel_size; + (crtc_state->pipe_src_w -1 ) * cpp; } intel_crtc->adjusted_x = x;@@ -2840,7 +2839,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2879,11 +2878,10 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= intel_crtc->dspaddr_offset;if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) {@@ -2897,7 +2895,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,data and adding to linear_offset*/ linear_offset += (crtc_state->pipe_src_h -1 ) * fb->pitches[0 ] + - (crtc_state->pipe_src_w -1 ) * pixel_size; + (crtc_state->pipe_src_w -1 ) * cpp; } }@@ -14680,10 +14678,12 @@ u32 intel_fb_pitch_limit(struct drm_device *dev, uint64_t fb_modifier,u32 gen =INTEL_INFO (dev)->gen;if (gen >=9 ) { +int cpp =drm_format_plane_cpp (pixel_format,0 ); +/* "The stride in bytes must not exceed the of the size of 8K * pixels and 32K bytes." */ -return min (8192 *drm_format_plane_cpp (pixel_format,0 ),32768 ); +return min (8192 * cpp,32768 ); }else if (gen >=5 && !IS_VALLEYVIEW (dev) && !IS_CHERRYVIEW (dev)) {return 32 *1024 ; }else if (gen >=4 ) {drivers/gpu/drm/i915/intel_pm.c +62
-66@@ -548,7 +548,7 @@ static const struct intel_watermark_params i845_wm_info = {* intel_calculate_wm - calculate watermark level * @clock_in_khz: pixel clock * @wm: chip FIFO params -* @pixel_size: display pixel size +* @cpp: bytes per pixel * @latency_ns: memory latency for the platform * * Calculate the watermark level (the level at which the display plane will @@ -564,8 +564,7 @@ static const struct intel_watermark_params i845_wm_info = {*/ static unsigned long intel_calculate_wm (unsigned long clock_in_khz,const struct intel_watermark_params *wm, -int fifo_size, -int pixel_size, +int fifo_size,int cpp,unsigned long latency_ns) {long entries_required, wm_size;@@ -576,7 +575,7 @@ static unsigned long intel_calculate_wm(unsigned long clock_in_khz,* clocks go from a few thousand to several hundred thousand. * latency is usually a few thousand */ - entries_required = ((clock_in_khz /1000 ) * pixel_size * latency_ns) / + entries_required = ((clock_in_khz /1000 ) * cpp * latency_ns) /1000 ; entries_required =DIV_ROUND_UP (entries_required, wm->cacheline_size);@@ -640,13 +639,13 @@ static void pineview_update_wm(struct drm_crtc *unused_crtc) crtc =single_enabled_crtc (dev);if (crtc) {const struct drm_display_mode *adjusted_mode = &to_intel_crtc (crtc)->config->base.adjusted_mode; -int pixel_size = crtc->primary->state->fb->bits_per_pixel /8 ; +int cpp =drm_format_plane_cpp (crtc->primary->state->fb->pixel_format,0 );int clock = adjusted_mode->crtc_clock;/* Display SR */ wm =intel_calculate_wm (clock, &pineview_display_wm, pineview_display_wm.fifo_size, - pixel_size, latency->display_sr); + cpp, latency->display_sr); reg =I915_READ (DSPFW1 ); reg &= ~DSPFW_SR_MASK ; reg |=FW_WM (wm,SR );@@ -656,7 +655,7 @@ static void pineview_update_wm(struct drm_crtc *unused_crtc)/* cursor SR */ wm =intel_calculate_wm (clock, &pineview_cursor_wm, pineview_display_wm.fifo_size, - pixel_size, latency->cursor_sr); + cpp, latency->cursor_sr); reg =I915_READ (DSPFW3 ); reg &= ~DSPFW_CURSOR_SR_MASK ; reg |=FW_WM (wm,CURSOR_SR );@@ -665,7 +664,7 @@ static void pineview_update_wm(struct drm_crtc *unused_crtc)/* Display HPLL off SR */ wm =intel_calculate_wm (clock, &pineview_display_hplloff_wm, pineview_display_hplloff_wm.fifo_size, - pixel_size, latency->display_hpll_disable); + cpp, latency->display_hpll_disable); reg =I915_READ (DSPFW3 ); reg &= ~DSPFW_HPLL_SR_MASK ; reg |=FW_WM (wm,HPLL_SR );@@ -674,7 +673,7 @@ static void pineview_update_wm(struct drm_crtc *unused_crtc)/* cursor HPLL off SR */ wm =intel_calculate_wm (clock, &pineview_cursor_hplloff_wm, pineview_display_hplloff_wm.fifo_size, - pixel_size, latency->cursor_hpll_disable); + cpp, latency->cursor_hpll_disable); reg =I915_READ (DSPFW3 ); reg &= ~DSPFW_HPLL_CURSOR_MASK ; reg |=FW_WM (wm,HPLL_CURSOR );@@ -698,7 +697,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, {struct drm_crtc *crtc;const struct drm_display_mode *adjusted_mode; -int htotal, hdisplay, clock, pixel_size; +int htotal, hdisplay, clock, cpp;int line_time_us, line_count;int entries, tlb_miss;@@ -713,10 +712,10 @@ static bool g4x_compute_wm0(struct drm_device *dev, clock = adjusted_mode->crtc_clock; htotal = adjusted_mode->crtc_htotal; hdisplay =to_intel_crtc (crtc)->config->pipe_src_w; - pixel_size = crtc->primary->state->fb->bits_per_pixel /8 ; + cpp =drm_format_plane_cpp (crtc->primary->state->fb->pixel_format,0 );/* Use the small buffer method to calculate plane watermark */ - entries = ((clock * pixel_size /1000 ) * display_latency_ns) /1000 ; + entries = ((clock * cpp /1000 ) * display_latency_ns) /1000 ; tlb_miss = display->fifo_size*display->cacheline_size - hdisplay *8 ;if (tlb_miss >0 ) entries += tlb_miss;@@ -728,7 +727,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,/* Use the large buffer method to calculate cursor watermark */ line_time_us =max (htotal *1000 / clock,1 ); line_count = (cursor_latency_ns / line_time_us +1000 ) /1000 ; - entries = line_count * crtc->cursor->state->crtc_w * pixel_size; + entries = line_count * crtc->cursor->state->crtc_w * cpp; tlb_miss = cursor->fifo_size*cursor->cacheline_size - hdisplay *8 ;if (tlb_miss >0 ) entries += tlb_miss;@@ -784,7 +783,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, {struct drm_crtc *crtc;const struct drm_display_mode *adjusted_mode; -int hdisplay, htotal, pixel_size, clock; +int hdisplay, htotal, cpp, clock;unsigned long line_time_us;int line_count, line_size;int small, large;@@ -800,21 +799,21 @@ static bool g4x_compute_srwm(struct drm_device *dev, clock = adjusted_mode->crtc_clock; htotal = adjusted_mode->crtc_htotal; hdisplay =to_intel_crtc (crtc)->config->pipe_src_w; - pixel_size = crtc->primary->state->fb->bits_per_pixel /8 ; + cpp =drm_format_plane_cpp (crtc->primary->state->fb->pixel_format,0 ); line_time_us =max (htotal *1000 / clock,1 ); line_count = (latency_ns / line_time_us +1000 ) /1000 ; - line_size = hdisplay * pixel_size; + line_size = hdisplay * cpp;/* Use the minimum of the small and large buffer method for primary */ - small = ((clock * pixel_size /1000 ) * latency_ns) /1000 ; + small = ((clock * cpp /1000 ) * latency_ns) /1000 ; large = line_count * line_size; entries =DIV_ROUND_UP (min (small, large), display->cacheline_size); *display_wm = entries + display->guard_size;/* calculate the self-refresh watermark for display cursor */ - entries = line_count * pixel_size * crtc->cursor->state->crtc_w; + entries = line_count * cpp * crtc->cursor->state->crtc_w; entries =DIV_ROUND_UP (entries, cursor->cacheline_size); *cursor_wm = entries + cursor->guard_size;@@ -906,13 +905,13 @@ enum vlv_wm_level {static unsigned int vlv_wm_method2 (unsigned int pixel_rate,unsigned int pipe_htotal,unsigned int horiz_pixels, -unsigned int bytes_per_pixel, +unsigned int cpp,unsigned int latency) {unsigned int ret; ret = (latency * pixel_rate) / (pipe_htotal *10000 ); - ret = (ret +1 ) * horiz_pixels * bytes_per_pixel; + ret = (ret +1 ) * horiz_pixels * cpp; ret =DIV_ROUND_UP (ret,64 );return ret;@@ -941,7 +940,7 @@ static uint16_t vlv_compute_wm_level(struct intel_plane *plane, int level) {struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -int clock, htotal, pixel_size, width, wm; +int clock, htotal, cpp, width, wm;if (dev_priv->wm.pri_latency[level] ==0 )return USHRT_MAX ;@@ -949,7 +948,7 @@ static uint16_t vlv_compute_wm_level(struct intel_plane *plane,if (!state->visible)return 0 ; - pixel_size =drm_format_plane_cpp (state->base.fb->pixel_format,0 ); + cpp =drm_format_plane_cpp (state->base.fb->pixel_format,0 ); clock = crtc->config->base.adjusted_mode.crtc_clock; htotal = crtc->config->base.adjusted_mode.crtc_htotal; width = crtc->config->pipe_src_w;@@ -965,7 +964,7 @@ static uint16_t vlv_compute_wm_level(struct intel_plane *plane,*/ wm =63 ; }else { - wm =vlv_wm_method2 (clock, htotal, width, pixel_size, + wm =vlv_wm_method2 (clock, htotal, width, cpp, dev_priv->wm.pri_latency[level] *10 ); }@@ -1439,7 +1438,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)int clock = adjusted_mode->crtc_clock;int htotal = adjusted_mode->crtc_htotal;int hdisplay =to_intel_crtc (crtc)->config->pipe_src_w; -int pixel_size = crtc->primary->state->fb->bits_per_pixel /8 ; +int cpp =drm_format_plane_cpp (crtc->primary->state->fb->pixel_format,0 );unsigned long line_time_us;int entries;@@ -1447,7 +1446,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)/* Use ns/us then divide to preserve precision */ entries = (((sr_latency_ns / line_time_us) +1000 ) /1000 ) * - pixel_size * hdisplay; + cpp * hdisplay; entries =DIV_ROUND_UP (entries,I915_FIFO_LINE_SIZE ); srwm =I965_FIFO_SIZE - entries;if (srwm <0 )@@ -1457,7 +1456,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc) entries, srwm); entries = (((sr_latency_ns / line_time_us) +1000 ) /1000 ) * - pixel_size * crtc->cursor->state->crtc_w; + cpp * crtc->cursor->state->crtc_w; entries =DIV_ROUND_UP (entries, i965_cursor_wm_info.cacheline_size); cursor_sr = i965_cursor_wm_info.fifo_size -@@ -1518,7 +1517,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) crtc =intel_get_crtc_for_plane (dev,0 );if (intel_crtc_active (crtc)) {const struct drm_display_mode *adjusted_mode; -int cpp = crtc->primary->state->fb->bits_per_pixel /8 ; +int cpp =drm_format_plane_cpp (crtc->primary->state->fb->pixel_format,0 );if (IS_GEN2 (dev)) cpp =4 ;@@ -1540,7 +1539,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) crtc =intel_get_crtc_for_plane (dev,1 );if (intel_crtc_active (crtc)) {const struct drm_display_mode *adjusted_mode; -int cpp = crtc->primary->state->fb->bits_per_pixel /8 ; +int cpp =drm_format_plane_cpp (crtc->primary->state->fb->pixel_format,0 );if (IS_GEN2 (dev)) cpp =4 ;@@ -1586,7 +1585,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)int clock = adjusted_mode->crtc_clock;int htotal = adjusted_mode->crtc_htotal;int hdisplay =to_intel_crtc (enabled)->config->pipe_src_w; -int pixel_size = enabled->primary->state->fb->bits_per_pixel /8 ; +int cpp =drm_format_plane_cpp (enabled->primary->state->fb->pixel_format,0 );unsigned long line_time_us;int entries;@@ -1594,7 +1593,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)/* Use ns/us then divide to preserve precision */ entries = (((sr_latency_ns / line_time_us) +1000 ) /1000 ) * - pixel_size * hdisplay; + cpp * hdisplay; entries =DIV_ROUND_UP (entries, wm_info->cacheline_size);DRM_DEBUG_KMS ("self-refresh entries: %d\n" , entries); srwm = wm_info->fifo_size - entries;@@ -1685,15 +1684,14 @@ uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config) }/* latency must be in 0.1us units. */ -static uint32_t ilk_wm_method1 (uint32_t pixel_rate,uint8_t bytes_per_pixel, -uint32_t latency) +static uint32_t ilk_wm_method1 (uint32_t pixel_rate,uint8_t cpp,uint32_t latency) {uint64_t ret;if (WARN (latency ==0 ,"Latency value missing\n" ))return UINT_MAX ; - ret = (uint64_t ) pixel_rate * bytes_per_pixel * latency; + ret = (uint64_t ) pixel_rate * cpp * latency; ret =DIV_ROUND_UP_ULL (ret,64 *10000 ) +2 ;return ret;@@ -1701,7 +1699,7 @@ static uint32_t ilk_wm_method1(uint32_t pixel_rate, uint8_t bytes_per_pixel,/* latency must be in 0.1us units. */ static uint32_t ilk_wm_method2 (uint32_t pixel_rate,uint32_t pipe_htotal, -uint32_t horiz_pixels,uint8_t bytes_per_pixel, +uint32_t horiz_pixels,uint8_t cpp,uint32_t latency) {uint32_t ret;@@ -1712,13 +1710,13 @@ static uint32_t ilk_wm_method2(uint32_t pixel_rate, uint32_t pipe_htotal,return UINT_MAX ; ret = (latency * pixel_rate) / (pipe_htotal *10000 ); - ret = (ret +1 ) * horiz_pixels * bytes_per_pixel; + ret = (ret +1 ) * horiz_pixels * cpp; ret =DIV_ROUND_UP (ret,64 ) +2 ;return ret; }static uint32_t ilk_wm_fbc (uint32_t pri_val,uint32_t horiz_pixels, -uint8_t bytes_per_pixel) +uint8_t cpp) {/* * Neither of these should be possible since this function shouldn't be @@ -1726,12 +1724,12 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels,* extra paranoid to avoid a potential divide-by-zero if we screw up * elsewhere in the driver. */ -if (WARN_ON (!bytes_per_pixel)) +if (WARN_ON (!cpp))return 0 ;if (WARN_ON (!horiz_pixels))return 0 ; -return DIV_ROUND_UP (pri_val *64 , horiz_pixels * bytes_per_pixel) +2 ; +return DIV_ROUND_UP (pri_val *64 , horiz_pixels * cpp) +2 ; }struct ilk_wm_maximums {@@ -1750,13 +1748,14 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate,uint32_t mem_value, bool is_lp) { - int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0; + int cpp = pstate->base.fb ? +drm_format_plane_cpp (pstate->base.fb->pixel_format,0 ) :0 ;uint32_t method1, method2;if (!cstate->base.active || !pstate->visible)return 0 ; - method1 =ilk_wm_method1 (ilk_pipe_pixel_rate (cstate), bpp, mem_value); + method1 =ilk_wm_method1 (ilk_pipe_pixel_rate (cstate), cpp, mem_value);if (!is_lp)return method1;@@ -1764,8 +1763,7 @@ static uint32_t ilk_compute_pri_wm(const struct intel_crtc_state *cstate, method2 =ilk_wm_method2 (ilk_pipe_pixel_rate (cstate), cstate->base.adjusted_mode.crtc_htotal,drm_rect_width (&pstate->dst), - bpp, - mem_value); + cpp, mem_value);return min (method1, method2); }@@ -1778,18 +1776,18 @@ static uint32_t ilk_compute_spr_wm(const struct intel_crtc_state *cstate,const struct intel_plane_state *pstate, uint32_t mem_value) { - int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0; + int cpp = pstate->base.fb ? +drm_format_plane_cpp (pstate->base.fb->pixel_format,0 ) :0 ;uint32_t method1, method2;if (!cstate->base.active || !pstate->visible)return 0 ; - method1 =ilk_wm_method1 (ilk_pipe_pixel_rate (cstate), bpp, mem_value); + method1 =ilk_wm_method1 (ilk_pipe_pixel_rate (cstate), cpp, mem_value); method2 =ilk_wm_method2 (ilk_pipe_pixel_rate (cstate), cstate->base.adjusted_mode.crtc_htotal,drm_rect_width (&pstate->dst), - bpp, - mem_value); + cpp, mem_value);return min (method1, method2); }@@ -1801,7 +1799,8 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,const struct intel_plane_state *pstate, uint32_t mem_value) { - int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0; + int cpp = pstate->base.fb ? +drm_format_plane_cpp (pstate->base.fb->pixel_format,0 ) :0 ;if (!cstate->base.active || !pstate->visible)return 0 ;@@ -1809,8 +1808,7 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,return ilk_wm_method2 (ilk_pipe_pixel_rate (cstate), cstate->base.adjusted_mode.crtc_htotal,drm_rect_width (&pstate->dst), - bpp, - mem_value); + cpp, mem_value); }/* Only for WM_LP. */ @@ -1818,12 +1816,13 @@ static uint32_t ilk_compute_fbc_wm(const struct intel_crtc_state *cstate,const struct intel_plane_state *pstate, uint32_t pri_val) { - int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0; + int cpp = pstate->base.fb ? +drm_format_plane_cpp (pstate->base.fb->pixel_format,0 ) :0 ;if (!cstate->base.active || !pstate->visible)return 0 ; -return ilk_wm_fbc (pri_val,drm_rect_width (&pstate->dst), bpp); +return ilk_wm_fbc (pri_val,drm_rect_width (&pstate->dst), cpp); }static unsigned int ilk_display_fifo_size (const struct drm_device *dev)@@ -3042,26 +3041,25 @@ static uint32_t skl_pipe_pixel_rate(const struct intel_crtc_state *config)/* * The max latency should be 257 (max the punit can code is 255 and we add 2us -* for the read latency) and bytes_per_pixel should always be <= 8, so that +* for the read latency) and cpp should always be <= 8, so that * should allow pixel_rate up to ~2 GHz which seems sufficient since max * 2xcdclk is 1350 MHz and the pixel rate should never exceed that. */ -static uint32_t skl_wm_method1 (uint32_t pixel_rate,uint8_t bytes_per_pixel, -uint32_t latency) +static uint32_t skl_wm_method1 (uint32_t pixel_rate,uint8_t cpp,uint32_t latency) {uint32_t wm_intermediate_val, ret;if (latency ==0 )return UINT_MAX ; - wm_intermediate_val = latency * pixel_rate * bytes_per_pixel /512 ; + wm_intermediate_val = latency * pixel_rate * cpp /512 ; ret =DIV_ROUND_UP (wm_intermediate_val,1000 );return ret; }static uint32_t skl_wm_method2 (uint32_t pixel_rate,uint32_t pipe_htotal, -uint32_t horiz_pixels,uint8_t bytes_per_pixel, +uint32_t horiz_pixels,uint8_t cpp,uint64_t tiling,uint32_t latency) {uint32_t ret;@@ -3071,7 +3069,7 @@ static uint32_t skl_wm_method2(uint32_t pixel_rate, uint32_t pipe_htotal,if (latency ==0 )return UINT_MAX ; - plane_bytes_per_line = horiz_pixels * bytes_per_pixel; + plane_bytes_per_line = horiz_pixels * cpp;if (tiling ==I915_FORMAT_MOD_Y_TILED || tiling == I915_FORMAT_MOD_Yf_TILED) {@@ -3121,23 +3119,21 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,uint32_t plane_bytes_per_line, plane_blocks_per_line;uint32_t res_blocks, res_lines;uint32_t selected_result; -uint8_t bytes_per_pixel; +uint8_t cpp;if (latency ==0 || !cstate->base.active || !fb)return false; - bytes_per_pixel =drm_format_plane_cpp (fb->pixel_format,0 ); + cpp =drm_format_plane_cpp (fb->pixel_format,0 ); method1 =skl_wm_method1 (skl_pipe_pixel_rate (cstate), - bytes_per_pixel, - latency); + cpp, latency); method2 =skl_wm_method2 (skl_pipe_pixel_rate (cstate), cstate->base.adjusted_mode.crtc_htotal, cstate->pipe_src_w, - bytes_per_pixel, - fb->modifier[0 ], + cpp, fb->modifier[0 ], latency); - plane_bytes_per_line = cstate->pipe_src_w * bytes_per_pixel; + plane_bytes_per_line = cstate->pipe_src_w * cpp; plane_blocks_per_line =DIV_ROUND_UP (plane_bytes_per_line,512 ); if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||@@ -3145,11 +3141,11 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,uint32_t min_scanlines =4 ;uint32_t y_tile_minimum;if (intel_rotation_90_or_270 (plane->state->rotation)) { -int bpp = (fb->pixel_format ==DRM_FORMAT_NV12 ) ? +int cpp = (fb->pixel_format ==DRM_FORMAT_NV12 ) ?drm_format_plane_cpp (fb->pixel_format,1 ) :drm_format_plane_cpp (fb->pixel_format,0 ); -switch (bpp) { +switch (cpp) {case 1 : min_scanlines =16 ;break ;drivers/gpu/drm/i915/intel_sprite.c +14
-20@@ -351,7 +351,7 @@ vlv_update_plane(struct drm_plane *dplane,int plane = intel_plane->plane;u32 sprctl;u32 sprsurf_offset, linear_offset; -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;@@ -422,10 +422,9 @@ vlv_update_plane(struct drm_plane *dplane, crtc_w--; crtc_h--; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= sprsurf_offset;@@ -434,7 +433,7 @@ vlv_update_plane(struct drm_plane *dplane, x += src_w; y += src_h; - linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + linear_offset += src_h * fb->pitches[0 ] + src_w * cpp; }if (key->flags) {@@ -494,7 +493,7 @@ ivb_update_plane(struct drm_plane *plane,enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;u32 sprsurf_offset, linear_offset; -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;@@ -556,10 +555,9 @@ ivb_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) sprscale =SPRITE_SCALE_ENABLE | (src_w <<16 ) | src_h; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= sprsurf_offset;@@ -570,8 +568,7 @@ ivb_update_plane(struct drm_plane *plane,if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) { x += src_w; y += src_h; - linear_offset += src_h * fb->pitches[0 ] + - src_w * pixel_size; + linear_offset += src_h * fb->pitches[0 ] + src_w * cpp; } }@@ -637,7 +634,7 @@ ilk_update_plane(struct drm_plane *plane,int pipe = intel_plane->pipe;u32 dvscntr, dvsscale;u32 dvssurf_offset, linear_offset; -int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;@@ -695,10 +692,9 @@ ilk_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) dvsscale =DVS_SCALE_ENABLE | (src_w <<16 ) | src_h; - linear_offset = y * fb->pitches[0 ] + x * pixel_size; + linear_offset = y * fb->pitches[0 ] + x * cpp; dvssurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], - pixel_size, + fb->modifier[0 ], cpp, fb->pitches[0 ]); linear_offset -= dvssurf_offset;@@ -707,7 +703,7 @@ ilk_update_plane(struct drm_plane *plane, x += src_w; y += src_h; - linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + linear_offset += src_h * fb->pitches[0 ] + src_w * cpp; }if (key->flags) {@@ -772,7 +768,6 @@ intel_check_sprite_plane(struct drm_plane *plane,int hscale, vscale;int max_scale, min_scale;bool can_scale; -int pixel_size;if (!fb) { state->visible = false;@@ -894,6 +889,7 @@ intel_check_sprite_plane(struct drm_plane *plane,/* Check size restrictions when scaling */ if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {unsigned int width_bytes; +int cpp =drm_format_plane_cpp (fb->pixel_format,0 );WARN_ON (!can_scale);@@ -905,9 +901,7 @@ intel_check_sprite_plane(struct drm_plane *plane,if (src_w <3 || src_h <3 ) state->visible = false; - pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); - width_bytes = ((src_x * pixel_size) &63 ) + - src_w * pixel_size; + width_bytes = ((src_x * cpp) &63 ) + src_w * cpp;if (INTEL_INFO (dev)->gen <9 && (src_w >2048 || src_h >2048 || width_bytes >4096 || fb->pitches[0 ] >4096 )) {Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 6/18 drm: Add drm_format_plane_width() and drm_format_plane_height()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add a few helpers to get the dimensions of the chroma plane(s).
v2: Add kernel-doc (Daniel)
--- include/drm/drm_crtc.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
include/drm/drm_crtc.h +30 -0
@@ -2482,6 +2482,36 @@ extern int drm_format_num_planes(uint32_t format);extern int drm_format_plane_cpp (uint32_t format,int plane);extern int drm_format_horz_chroma_subsampling (uint32_t format);extern int drm_format_vert_chroma_subsampling (uint32_t format); +/** +* drm_format_plane_width - width of the plane given the first plane +* @width: width of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns the width of @plane, given that the width of the first plane +* is @width. +*/ +static inline int drm_format_plane_width (int width,uint32_t format,int plane) +{ +if (plane ==0 ) +return width; +return width /drm_format_horz_chroma_subsampling (format); +} +/** +* drm_format_plane_height - height of the plane given the first plane +* @height: height of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns the height of @plane, given that the height of the first plane +* is @height. +*/ +static inline int drm_format_plane_height (int height,uint32_t format,int plane) +{ +if (plane ==0 ) +return height; +return height /drm_format_vert_chroma_subsampling (format); +}extern const char *drm_get_format_name (uint32_t format);extern struct drm_property *drm_mode_create_rotation_property (struct drm_device *dev,unsigned int supported_rotations);
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 06/18] drm: Add drm_format_plane_width() and drm_format_plane_height()
Quoted 18 lines · On Wed, Jan 20, 2016 at 09:05:27PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Add a few helpers to get the dimensions of the chroma plane(s).
v2: Add kernel-doc (Daniel)
Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- include/drm/drm_crtc.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)include/drm/drm_crtc.h +0
-0
include/drm/drm_crtc.h extern int drm_format_num_planes(uint32_t format); · line 2490
Quoted 9 lines
include/drm/drm_crtc.h +6
-0@@ -2482,6 +2482,36 @@ extern int drm_format_num_planes(uint32_t format);extern int drm_format_plane_cpp (uint32_t format,int plane);extern int drm_format_horz_chroma_subsampling (uint32_t format);extern int drm_format_vert_chroma_subsampling (uint32_t format); +/** +* drm_format_plane_width - width of the plane given the first plane +* @width: width of the first plane +* @format: pixel format +* @plane: plane index +*
kerneldoc style is
+ * Returns:
+ * blabla
include/drm/drm_crtc.h extern int drm_format_num_planes(uint32_t format); · line 2495
Quoted 5 lines
include/drm/drm_crtc.h +5
-0+* Returns the width of @plane, given that the width of the first plane +* is @width. +*/ +static inline int drm_format_plane_width (int width,uint32_t format,int plane) +{
For consistency with other helpers I think we should put an
if (plane >= drm_format_num_planes(format)) return 0;
here. Also I think static inline is overkill for these, and grouping them together with the others in drm_crtc.c will make it easier to extract them into a new file (since drm_crtc.c is kinda sprawling a bit).
With those nitpicks applied: Reviewed-by: Daniel Vetter <[email protected]>
Quoted 29 lines
include/drm/drm_crtc.h +19
-0+if (plane ==0 ) +return width; +return width /drm_format_horz_chroma_subsampling (format); +} +/** +* drm_format_plane_height - height of the plane given the first plane +* @height: height of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns the height of @plane, given that the height of the first plane +* is @height. +*/ +static inline int drm_format_plane_height (int height,uint32_t format,int plane) +{ +if (plane ==0 ) +return height; +return height /drm_format_vert_chroma_subsampling (format); +}extern const char *drm_get_format_name (uint32_t format);extern struct drm_property *drm_mode_create_rotation_property (struct drm_device *dev,unsigned int supported_rotations);Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 06/18] drm: Add drm_format_plane_width() and drm_format_plane_height()
Quoted 31 lines · Daniel Vetter
Quoted 18 lines · On Wed, Jan 20, 2016 at 09:05:27PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Add a few helpers to get the dimensions of the chroma plane(s).
v2: Add kernel-doc (Daniel)
Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- include/drm/drm_crtc.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)include/drm/drm_crtc.h +0
-0include/drm/drm_crtc.h extern int drm_format_num_planes(uint32_t format); · line 2490
Quoted 9 lines
include/drm/drm_crtc.h +6
-0@@ -2482,6 +2482,36 @@ extern int drm_format_num_planes(uint32_t format);extern int drm_format_plane_cpp (uint32_t format,int plane);extern int drm_format_horz_chroma_subsampling (uint32_t format);extern int drm_format_vert_chroma_subsampling (uint32_t format); +/** +* drm_format_plane_width - width of the plane given the first plane +* @width: width of the first plane +* @format: pixel format +* @plane: plane index +* kerneldoc style is
Quoted 2 lines
+ * Returns:
+ * blabla
Hmm. I guess I should read some kind of manual of style or whatever.
Quoted 9 lines
include/drm/drm_crtc.h extern int drm_format_num_planes(uint32_t format); · line 2495
Quoted 6 lines
include/drm/drm_crtc.h +5
-0+* Returns the width of @plane, given that the width of the first plane +* is @width. +*/ +static inline int drm_format_plane_width (int width,uint32_t format,int plane) +{For consistency with other helpers I think we should put an
Quoted 6 lines
if (plane >= drm_format_num_planes(format)) return 0;here. Also I think static inline is overkill for these, and grouping them together with the others in
drm_crtc.cwill make it easier to extract them into a new file (sincedrm_crtc.cis kinda sprawling a bit).
Well with the static inline I was aiming for the compiler to eliminate the function calls entirely for the typical plane==0 constant case. But if we add the num_planes check, then it's pretty much going to do that function call anyway.
Quoted 37 lines
With those nitpicks applied: Reviewed-by: Daniel Vetter <[email protected]>
Quoted 29 lines
include/drm/drm_crtc.h +19
-0+if (plane ==0 ) +return width; +return width /drm_format_horz_chroma_subsampling (format); +} +/** +* drm_format_plane_height - height of the plane given the first plane +* @height: height of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns the height of @plane, given that the height of the first plane +* is @height. +*/ +static inline int drm_format_plane_height (int height,uint32_t format,int plane) +{ +if (plane ==0 ) +return height; +return height /drm_format_vert_chroma_subsampling (format); +}extern const char *drm_get_format_name (uint32_t format);extern struct drm_property *drm_mode_create_rotation_property (struct drm_device *dev,unsigned int supported_rotations);Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 6/18 drm: Add drm_format_plane_width() and drm_format_plane_height()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add a few helpers to get the dimensions of the chroma plane(s).
v2: Add kernel-doc (Daniel)
v3: Fix kerneldoc "Returns:" style (Daniel)
Uninline the functions and check for num_planes (Daniel)
--- drivers/gpu/drm/drm_crtc.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 2 ++ 2 files changed, 42 insertions(+)
drivers/gpu/drm/drm_crtc.c +40 -0
@@ -5715,6 +5715,46 @@ int drm_format_vert_chroma_subsampling(uint32_t format)EXPORT_SYMBOL (drm_format_vert_chroma_subsampling);/** +* drm_format_plane_width - width of the plane given the first plane +* @width: width of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns: +* The width of @plane, given that the width of the first plane is @width. +*/ +int drm_format_plane_width (int width,uint32_t format,int plane) +{ +if (plane >=drm_format_num_planes (format)) +return 0 ; + +if (plane ==0 ) +return width; + +return width /drm_format_horz_chroma_subsampling (format); +} + +/** +* drm_format_plane_height - height of the plane given the first plane +* @height: height of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns: +* The height of @plane, given that the height of the first plane is @height. +*/ +int drm_format_plane_height (int height,uint32_t format,int plane) +{ +if (plane >=drm_format_num_planes (format)) +return 0 ; + +if (plane ==0 ) +return height; + +return height /drm_format_vert_chroma_subsampling (format); +} + +/** * drm_rotation_simplify() - Try to simplify the rotation * @rotation: Rotation to be simplified * @supported_rotations: Supported rotations
include/drm/drm_crtc.h +2 -0
@@ -2482,6 +2482,8 @@ extern int drm_format_num_planes(uint32_t format);extern int drm_format_plane_cpp (uint32_t format,int plane);extern int drm_format_horz_chroma_subsampling (uint32_t format);extern int drm_format_vert_chroma_subsampling (uint32_t format); +extern int drm_format_plane_width (int width,uint32_t format,int plane); +extern int drm_format_plane_height (int height,uint32_t format,int plane);extern const char *drm_get_format_name (uint32_t format);extern struct drm_property *drm_mode_create_rotation_property (struct drm_device *dev,unsigned int supported_rotations);
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedRe: [PATCH v3 06/18] drm: Add drm_format_plane_width() and drm_format_plane_height()
Quoted 11 lines · On Fri, Jan 29, 2016 at 08:01:19PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Add a few helpers to get the dimensions of the chroma plane(s).
v2: Add kernel-doc (Daniel)
v3: Fix kerneldoc "Returns:" style (Daniel)
Uninline the functions and check fornum_planes(Daniel)Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>
Applied to drm-misc, thanks.
-Daniel
Quoted 76 lines
--- drivers/gpu/drm/drm_crtc.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/drm_crtc.c +40
-0@@ -5715,6 +5715,46 @@ int drm_format_vert_chroma_subsampling(uint32_t format)EXPORT_SYMBOL (drm_format_vert_chroma_subsampling);/** +* drm_format_plane_width - width of the plane given the first plane +* @width: width of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns: +* The width of @plane, given that the width of the first plane is @width. +*/ +int drm_format_plane_width (int width,uint32_t format,int plane) +{ +if (plane >=drm_format_num_planes (format)) +return 0 ; + +if (plane ==0 ) +return width; + +return width /drm_format_horz_chroma_subsampling (format); +} + +/** +* drm_format_plane_height - height of the plane given the first plane +* @height: height of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns: +* The height of @plane, given that the height of the first plane is @height. +*/ +int drm_format_plane_height (int height,uint32_t format,int plane) +{ +if (plane >=drm_format_num_planes (format)) +return 0 ; + +if (plane ==0 ) +return height; + +return height /drm_format_vert_chroma_subsampling (format); +} + +/** * drm_rotation_simplify() - Try to simplify the rotation * @rotation: Rotation to be simplified * @supported_rotations: Supported rotations include/drm/drm_crtc.h +2
-0@@ -2482,6 +2482,8 @@ extern int drm_format_num_planes(uint32_t format);extern int drm_format_plane_cpp (uint32_t format,int plane);extern int drm_format_horz_chroma_subsampling (uint32_t format);extern int drm_format_vert_chroma_subsampling (uint32_t format); +extern int drm_format_plane_width (int width,uint32_t format,int plane); +extern int drm_format_plane_height (int height,uint32_t format,int plane);extern const char *drm_get_format_name (uint32_t format);extern struct drm_property *drm_mode_create_rotation_property (struct drm_device *dev,unsigned int supported_rotations);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 6/18 drm: Add drm_format_plane_width() and drm_format_plane_height()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add a few helpers to get the dimensions of the chroma plane(s).
v2: Add kernel-doc (Daniel)
v3: Fix kerneldoc "Returns:" style (Daniel)
Uninline the functions and check for num_planes (Daniel)
v4: Add the required EXPORT_SYMBOL()s
--- drivers/gpu/drm/drm_crtc.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 2 ++ 2 files changed, 44 insertions(+)
drivers/gpu/drm/drm_crtc.c +42 -0
@@ -5715,6 +5715,48 @@ int drm_format_vert_chroma_subsampling(uint32_t format)EXPORT_SYMBOL (drm_format_vert_chroma_subsampling);/** +* drm_format_plane_width - width of the plane given the first plane +* @width: width of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns: +* The width of @plane, given that the width of the first plane is @width. +*/ +int drm_format_plane_width (int width,uint32_t format,int plane) +{ +if (plane >=drm_format_num_planes (format)) +return 0 ; + +if (plane ==0 ) +return width; + +return width /drm_format_horz_chroma_subsampling (format); +} +EXPORT_SYMBOL (drm_format_plane_width); + +/** +* drm_format_plane_height - height of the plane given the first plane +* @height: height of the first plane +* @format: pixel format +* @plane: plane index +* +* Returns: +* The height of @plane, given that the height of the first plane is @height. +*/ +int drm_format_plane_height (int height,uint32_t format,int plane) +{ +if (plane >=drm_format_num_planes (format)) +return 0 ; + +if (plane ==0 ) +return height; + +return height /drm_format_vert_chroma_subsampling (format); +} +EXPORT_SYMBOL (drm_format_plane_height); + +/** * drm_rotation_simplify() - Try to simplify the rotation * @rotation: Rotation to be simplified * @supported_rotations: Supported rotations
include/drm/drm_crtc.h +2 -0
@@ -2482,6 +2482,8 @@ extern int drm_format_num_planes(uint32_t format);extern int drm_format_plane_cpp (uint32_t format,int plane);extern int drm_format_horz_chroma_subsampling (uint32_t format);extern int drm_format_vert_chroma_subsampling (uint32_t format); +extern int drm_format_plane_width (int width,uint32_t format,int plane); +extern int drm_format_plane_height (int height,uint32_t format,int plane);extern const char *drm_get_format_name (uint32_t format);extern struct drm_property *drm_mode_create_rotation_property (struct drm_device *dev,unsigned int supported_rotations);
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 7/18 drm/i915: Fix intel_tile_width() parameters
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The fb_modifiers and cpp arguments passed to intel_tile_width() in intel_fill_fb_ggtt_view() got accidentally swapped around. I'm pretty sure I fixed this already, but could be I lost the fix accidentally during some rebases or something. Anyway, fix it up for real.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -2306,7 +2306,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, cpp, fb->modifier[0 ]); + tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); tile_height = tile_size / tile_width; info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width);
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/18] drm/i915: Fix intel_tile_width() parameters
Quoted 9 lines · On Wed, Jan 20, 2016 at 09:05:28PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The
fb_modifiersand cpp arguments passed tointel_tile_width()inintel_fill_fb_ggtt_view()got accidentally swapped around. I'm pretty sure I fixed this already, but could be I lost the fix accidentally during some rebases or something. Anyway, fix it up for real.Fixes d9b3288ecf2f ("drm/i915: change intel_fill_fb_ggtt_view() to use the real tile size")Signed-off-by Ville Syrjälä <[email protected]>
Just to check my understanding: We did blow up in the MISSING_CASE in tile_width for this in some igt, right? Please add a Testcase: igt/foo/bar line for the one that makes it go boom. With that
Quoted 24 lines
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +1
-1@@ -2306,7 +2306,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, cpp, fb->modifier[0 ]); + tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); tile_height = tile_size / tile_width; info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/18] drm/i915: Fix intel_tile_width() parameters
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · On Wed, Jan 20, 2016 at 09:05:28PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The
fb_modifiersand cpp arguments passed tointel_tile_width()inintel_fill_fb_ggtt_view()got accidentally swapped around. I'm pretty sure I fixed this already, but could be I lost the fix accidentally during some rebases or something. Anyway, fix it up for real.
Quoted 6 lines
Quoted 2 lines
Fixes d9b3288ecf2f ("drm/i915: change intel_fill_fb_ggtt_view() to use the real tile size")Signed-off-by Ville Syrjälä <[email protected]>Just to check my understanding: We did blow up in the
MISSING_CASEintile_widthfor this in some igt, right? Please add a Testcase: igt/foo/bar line for the one that makes it go boom. With that
This will do for example:
Testcase: igt/kms_rotation_crc/primary-rotation-90
Quoted 33 lines
Reviewed-by Daniel Vetter <[email protected]>Quoted 24 lines
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +1
-1@@ -2306,7 +2306,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, cpp, fb->modifier[0 ]); + tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); tile_height = tile_size / tile_width; info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/18] drm/i915: Fix intel_tile_width() parameters
Quoted 12 lines · Ville Syrjälä
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · On Wed, Jan 20, 2016 at 09:05:28PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The
fb_modifiersand cpp arguments passed tointel_tile_width()inintel_fill_fb_ggtt_view()got accidentally swapped around. I'm pretty sure I fixed this already, but could be I lost the fix accidentally during some rebases or something. Anyway, fix it up for real.Fixes d9b3288ecf2f ("drm/i915: change intel_fill_fb_ggtt_view() to use the real tile size")Signed-off-by Ville Syrjälä <[email protected]>
Quoted 6 lines
Quoted 3 lines
Just to check my understanding: We did blow up in the
MISSING_CASEintile_widthfor this in some igt, right? Please add a Testcase: igt/foo/bar line for the one that makes it go boom. With thatThis will do for example:
Testcase: igt/kms_rotation_crc/primary-rotation-90
And pushed up to this patch (except for the drm_format_plane_width/height patch, which I skipped for now), thanks for the reviews.
Quoted 38 lines
Quoted 34 lines
Reviewed-by Daniel Vetter <[email protected]>Quoted 24 lines
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +1
-1@@ -2306,7 +2306,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, cpp, fb->modifier[0 ]); + tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); tile_height = tile_size / tile_width; info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.chSignature · 2 lines
Ville Syrjälä Intel OTC
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 8/18 drm/i915: Pass 90/270 vs. 0/180 rotation info for intel_gen4_compute_page_offset()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The page aligned surface address calculation needs to know which way things are rotated. The contract now says that the caller must pass the rotate x/y coordinates, as well as the tile_height aligned stride in the tile_height direction. This will make it fairly simple to deal with 90/270 degree rotation on SKL+ where we have to deal with the rotated view into the GTT.
v2: Pass rotation instead of bool even thoughwe only care about 0/180 vs. 90/270
v3: Introduce intel_tile_dims(), and don't mix up different units so much
--- drivers/gpu/drm/i915/intel_display.c | 66 +++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_sprite.c | 18 +++++----- 3 files changed, 59 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/intel_display.c +47 -19
@@ -2269,6 +2269,18 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,intel_tile_width (dev_priv, fb_modifier, cpp); } +/* Return the tile dimensions in pixel units */ +static void intel_tile_dims (const struct drm_i915_private *dev_priv, +unsigned int *tile_width, +unsigned int *tile_height, +uint64_t fb_modifier, +unsigned int cpp) +{ + *tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); + *tile_height =intel_tile_size (dev_priv) / *tile_width; + *tile_width /= cpp; +} +unsigned int intel_fb_align_height (struct drm_device *dev,unsigned int height,uint32_t pixel_format,uint64_t fb_modifier)
@@ -2306,19 +2318,19 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[0 ], cpp); - info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width); + info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); info->height_pages =DIV_ROUND_UP (fb->height, tile_height); info->size = info->width_pages * info->height_pages * tile_size;if (info->pixel_format ==DRM_FORMAT_NV12 ) { cpp =drm_format_plane_cpp (fb->pixel_format,1 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[1 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[1 ], cpp); - info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width); + info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); info->height_pages_uv =DIV_ROUND_UP (fb->height /2 , tile_height); info->size_uv = info->width_pages_uv * info->height_pages_uv * tile_size; }
@@ -2446,29 +2458,43 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,i915_gem_object_unpin_from_display_plane (obj, &view); } -/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel -* is assumed to be a power-of-two. */ +/* +* Computes the linear offset to the base tile and adjusts +* x, y. bytes per pixel is assumed to be a power-of-two. +* +* In the 90/270 rotated case, x and y are assumed +* to be already rotated to match the rotated GTT view, and +* pitch is the tile_height aligned framebuffer height. +*/ u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv,int *x,int *y,uint64_t fb_modifier,unsigned int cpp, -unsigned int pitch) +unsigned int pitch, +unsigned int rotation) {if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height; -unsigned int tile_rows, tiles; +unsigned int tile_rows, tiles, pitch_tiles; tile_size =intel_tile_size (dev_priv); - tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb_modifier, cpp); + +if (intel_rotation_90_or_270 (rotation)) { + pitch_tiles = pitch / tile_height; +swap (tile_width, tile_height); + }else { + pitch_tiles = pitch / (tile_width * cpp); + } tile_rows = *y / tile_height; *y %= tile_height; - tiles = *x / (tile_width/cpp); - *x %= tile_width/cpp; + tiles = *x / tile_width; + *x %= tile_width; -return tile_rows * pitch * tile_height + tiles * tile_size; +return (tile_rows * pitch_tiles + tiles) * tile_size; }else {unsigned int alignment =intel_linear_alignment (dev_priv) -1 ;unsigned int offset;
@@ -2709,6 +2735,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;
@@ -2775,13 +2802,13 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; }else { intel_crtc->dspaddr_offset = linear_offset; } -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ; x += (crtc_state->pipe_src_w -1 );
@@ -2839,6 +2866,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;
@@ -2882,9 +2910,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) {
drivers/gpu/drm/i915/intel_drv.h +2 -1
@@ -1176,7 +1176,8 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, int *x, int *y, uint64_t fb_modifier, unsigned int cpp, - unsigned int pitch); + unsigned int pitch, + unsigned int rotation);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_sprite.c +10 -8
@@ -193,7 +193,7 @@ skl_update_plane(struct drm_plane *drm_plane,const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr;u32 tile_height, plane_offset, plane_size; -unsigned int rotation; +unsigned int rotation = plane_state->base.rotation;int x_offset, y_offset;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;
@@ -213,7 +213,6 @@ skl_update_plane(struct drm_plane *drm_plane, plane_ctl |=skl_plane_ctl_format (fb->pixel_format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier[0 ]); - rotation = plane_state->base.rotation; plane_ctl |=skl_plane_ctl_rotation (rotation); stride_div = intel_fb_stride_alignment(dev_priv, fb->modifier[0],
@@ -351,6 +350,7 @@ vlv_update_plane(struct drm_plane *dplane,int plane = intel_plane->plane;u32 sprctl;u32 sprsurf_offset, linear_offset; +unsigned int rotation = dplane->state->rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;
@@ -425,10 +425,10 @@ vlv_update_plane(struct drm_plane *dplane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ; x += src_w;
@@ -493,6 +493,7 @@ ivb_update_plane(struct drm_plane *plane,enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;u32 sprsurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;
@@ -558,10 +559,10 @@ ivb_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;/* HSW and BDW does this automagically in hardware */
@@ -634,6 +635,7 @@ ilk_update_plane(struct drm_plane *plane,int pipe = intel_plane->pipe;u32 dvscntr, dvsscale;u32 dvssurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;
@@ -695,10 +697,10 @@ ilk_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; dvssurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= dvssurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ; x += src_w;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 08/18] drm/i915: Pass 90/270 vs. 0/180 rotation info for intel_gen4_compute_page_offset()
Quoted 28 lines · On Wed, Jan 20, 2016 at 09:05:29PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The page aligned surface address calculation needs to know which way things are rotated. The contract now says that the caller must pass the rotate x/y coordinates, as well as the
tile_heightaligned stride in thetile_heightdirection. This will make it fairly simple to deal with 90/270 degree rotation on SKL+ where we have to deal with the rotated view into the GTT.v2: Pass rotation instead of bool even thoughwe only care about 0/180 vs. 90/270
v3: Introduceintel_tile_dims(), and don't mix up different units so muchSigned-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]> (v2)--- drivers/gpu/drm/i915/intel_display.c | 66 +++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_sprite.c | 18 +++++----- 3 files changed, 59 insertions(+), 28 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -2269,6 +2269,18 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,intel_tile_width (dev_priv, fb_modifier, cpp); }
drivers/gpu/drm/i915/intel_display.c unsigned int intel_tile_height(const struct drm_i915_private *dev_priv, · line 2281
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+/* Return the tile dimensions in pixel units */ +static void intel_tile_dims (const struct drm_i915_private *dev_priv, +unsigned int *tile_width, +unsigned int *tile_height, +uint64_t fb_modifier, +unsigned int cpp) +{ + *tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); + *tile_height =intel_tile_size (dev_priv) / *tile_width; + *tile_width /= cpp;
Seems like my suggestion to use tile_width in cpp wasn't that awesome, at least we still have a big confusion right here. Not sure what to do, especially since these kind of changes are super-painful to review. Could we perhaps go back to the old versions and untangle this mess afterwards? Iirc I've follow-up with r-b tags to all patches in the old series for that approach.
No idea really what would be best here ...
-Daniel
Quoted 233 lines
drivers/gpu/drm/i915/intel_display.c +37
-19+} +unsigned int intel_fb_align_height (struct drm_device *dev,unsigned int height,uint32_t pixel_format,uint64_t fb_modifier)@@ -2306,19 +2318,19 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[0 ], cpp); - info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width); + info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); info->height_pages =DIV_ROUND_UP (fb->height, tile_height); info->size = info->width_pages * info->height_pages * tile_size;if (info->pixel_format ==DRM_FORMAT_NV12 ) { cpp =drm_format_plane_cpp (fb->pixel_format,1 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[1 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[1 ], cpp); - info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width); + info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); info->height_pages_uv =DIV_ROUND_UP (fb->height /2 , tile_height); info->size_uv = info->width_pages_uv * info->height_pages_uv * tile_size; }@@ -2446,29 +2458,43 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,i915_gem_object_unpin_from_display_plane (obj, &view); } -/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel -* is assumed to be a power-of-two. */ +/* +* Computes the linear offset to the base tile and adjusts +* x, y. bytes per pixel is assumed to be a power-of-two. +* +* In the 90/270 rotated case, x and y are assumed +* to be already rotated to match the rotated GTT view, and +* pitch is the tile_height aligned framebuffer height. +*/ u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv,int *x,int *y,uint64_t fb_modifier,unsigned int cpp, -unsigned int pitch) +unsigned int pitch, +unsigned int rotation) {if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height; -unsigned int tile_rows, tiles; +unsigned int tile_rows, tiles, pitch_tiles; tile_size =intel_tile_size (dev_priv); - tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb_modifier, cpp); + +if (intel_rotation_90_or_270 (rotation)) { + pitch_tiles = pitch / tile_height; +swap (tile_width, tile_height); + }else { + pitch_tiles = pitch / (tile_width * cpp); + } tile_rows = *y / tile_height; *y %= tile_height; - tiles = *x / (tile_width/cpp); - *x %= tile_width/cpp; + tiles = *x / tile_width; + *x %= tile_width; -return tile_rows * pitch * tile_height + tiles * tile_size; +return (tile_rows * pitch_tiles + tiles) * tile_size; }else {unsigned int alignment =intel_linear_alignment (dev_priv) -1 ;unsigned int offset;@@ -2709,6 +2735,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2775,13 +2802,13 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; }else { intel_crtc->dspaddr_offset = linear_offset; } -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ; x += (crtc_state->pipe_src_w -1 );@@ -2839,6 +2866,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2882,9 +2910,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) {drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -1176,7 +1176,8 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, int *x, int *y, uint64_t fb_modifier, unsigned int cpp, - unsigned int pitch); + unsigned int pitch, + unsigned int rotation);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_sprite.c +10
-8@@ -193,7 +193,7 @@ skl_update_plane(struct drm_plane *drm_plane,const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr;u32 tile_height, plane_offset, plane_size; -unsigned int rotation; +unsigned int rotation = plane_state->base.rotation;int x_offset, y_offset;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;@@ -213,7 +213,6 @@ skl_update_plane(struct drm_plane *drm_plane, plane_ctl |=skl_plane_ctl_format (fb->pixel_format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier[0 ]); - rotation = plane_state->base.rotation; plane_ctl |=skl_plane_ctl_rotation (rotation); stride_div = intel_fb_stride_alignment(dev_priv, fb->modifier[0],@@ -351,6 +350,7 @@ vlv_update_plane(struct drm_plane *dplane,int plane = intel_plane->plane;u32 sprctl;u32 sprsurf_offset, linear_offset; +unsigned int rotation = dplane->state->rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -425,10 +425,10 @@ vlv_update_plane(struct drm_plane *dplane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ; x += src_w;@@ -493,6 +493,7 @@ ivb_update_plane(struct drm_plane *plane,enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;u32 sprsurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -558,10 +559,10 @@ ivb_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;/* HSW and BDW does this automagically in hardware */ @@ -634,6 +635,7 @@ ilk_update_plane(struct drm_plane *plane,int pipe = intel_plane->pipe;u32 dvscntr, dvsscale;u32 dvssurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -695,10 +697,10 @@ ilk_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; dvssurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= dvssurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ; x += src_w;Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 08/18] drm/i915: Pass 90/270 vs. 0/180 rotation info for intel_gen4_compute_page_offset()
Quoted 38 lines · Daniel Vetter
Quoted 37 lines · On Wed, Jan 20, 2016 at 09:05:29PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The page aligned surface address calculation needs to know which way things are rotated. The contract now says that the caller must pass the rotate x/y coordinates, as well as the
tile_heightaligned stride in thetile_heightdirection. This will make it fairly simple to deal with 90/270 degree rotation on SKL+ where we have to deal with the rotated view into the GTT.v2: Pass rotation instead of bool even thoughwe only care about 0/180 vs. 90/270
v3: Introduceintel_tile_dims(), and don't mix up different units so muchSigned-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]> (v2)--- drivers/gpu/drm/i915/intel_display.c | 66 +++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_sprite.c | 18 +++++----- 3 files changed, 59 insertions(+), 28 deletions(-)drivers/gpu/drm/i915/intel_display.c +9
-0@@ -2269,6 +2269,18 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,intel_tile_width (dev_priv, fb_modifier, cpp); } +/* Return the tile dimensions in pixel units */ +static void intel_tile_dims (const struct drm_i915_private *dev_priv, +unsigned int *tile_width, +unsigned int *tile_height, +uint64_t fb_modifier, +unsigned int cpp) +{ + *tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); + *tile_height =intel_tile_size (dev_priv) / *tile_width;
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c unsigned int intel_tile_height(const struct drm_i915_private *dev_priv, · line 2281
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ *tile_width /= cpp;Seems like my suggestion to use
tile_widthin cpp wasn't that awesome, at least we still have a big confusion right here. Not sure what to do, especially since these kind of changes are super-painful to review. Could we perhaps go back to the old versions and untangle this mess afterwards? Iirc I've follow-up with r-b tags to all patches in the old series for that approach.
Hmm. What did I do differently in the old approach again? Other than not having the confusion isolated to this one function. One step forward and two back doens't sound productive. Plus I have some more patches on top of this one already, so not pleasant at all.
Anyway, to avoid more confusion I suppose one thing that could be done is this:
- intel_tile_width
+ intel_tile_width_bytes
intel_tile_dims()
{
tile_width_bytes = intel_tile_width_bytes()
*tile_height = tile_size / tile_width_bytes;
*tile_width = tile_width_bytes / cpp;
}Quoted 242 lines
No idea really what would be best here ...
-DanielQuoted 233 lines
drivers/gpu/drm/i915/intel_display.c +37
-19+} +unsigned int intel_fb_align_height (struct drm_device *dev,unsigned int height,uint32_t pixel_format,uint64_t fb_modifier)@@ -2306,19 +2318,19 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[0 ], cpp); - info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width); + info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); info->height_pages =DIV_ROUND_UP (fb->height, tile_height); info->size = info->width_pages * info->height_pages * tile_size;if (info->pixel_format ==DRM_FORMAT_NV12 ) { cpp =drm_format_plane_cpp (fb->pixel_format,1 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[1 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[1 ], cpp); - info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width); + info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); info->height_pages_uv =DIV_ROUND_UP (fb->height /2 , tile_height); info->size_uv = info->width_pages_uv * info->height_pages_uv * tile_size; }@@ -2446,29 +2458,43 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,i915_gem_object_unpin_from_display_plane (obj, &view); } -/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel -* is assumed to be a power-of-two. */ +/* +* Computes the linear offset to the base tile and adjusts +* x, y. bytes per pixel is assumed to be a power-of-two. +* +* In the 90/270 rotated case, x and y are assumed +* to be already rotated to match the rotated GTT view, and +* pitch is the tile_height aligned framebuffer height. +*/ u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv,int *x,int *y,uint64_t fb_modifier,unsigned int cpp, -unsigned int pitch) +unsigned int pitch, +unsigned int rotation) {if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height; -unsigned int tile_rows, tiles; +unsigned int tile_rows, tiles, pitch_tiles; tile_size =intel_tile_size (dev_priv); - tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb_modifier, cpp); + +if (intel_rotation_90_or_270 (rotation)) { + pitch_tiles = pitch / tile_height; +swap (tile_width, tile_height); + }else { + pitch_tiles = pitch / (tile_width * cpp); + } tile_rows = *y / tile_height; *y %= tile_height; - tiles = *x / (tile_width/cpp); - *x %= tile_width/cpp; + tiles = *x / tile_width; + *x %= tile_width; -return tile_rows * pitch * tile_height + tiles * tile_size; +return (tile_rows * pitch_tiles + tiles) * tile_size; }else {unsigned int alignment =intel_linear_alignment (dev_priv) -1 ;unsigned int offset;@@ -2709,6 +2735,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2775,13 +2802,13 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; }else { intel_crtc->dspaddr_offset = linear_offset; } -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ; x += (crtc_state->pipe_src_w -1 );@@ -2839,6 +2866,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2882,9 +2910,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) {drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -1176,7 +1176,8 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, int *x, int *y, uint64_t fb_modifier, unsigned int cpp, - unsigned int pitch); + unsigned int pitch, + unsigned int rotation);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_sprite.c +10
-8@@ -193,7 +193,7 @@ skl_update_plane(struct drm_plane *drm_plane,const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr;u32 tile_height, plane_offset, plane_size; -unsigned int rotation; +unsigned int rotation = plane_state->base.rotation;int x_offset, y_offset;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;@@ -213,7 +213,6 @@ skl_update_plane(struct drm_plane *drm_plane, plane_ctl |=skl_plane_ctl_format (fb->pixel_format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier[0 ]); - rotation = plane_state->base.rotation; plane_ctl |=skl_plane_ctl_rotation (rotation); stride_div = intel_fb_stride_alignment(dev_priv, fb->modifier[0],@@ -351,6 +350,7 @@ vlv_update_plane(struct drm_plane *dplane,int plane = intel_plane->plane;u32 sprctl;u32 sprsurf_offset, linear_offset; +unsigned int rotation = dplane->state->rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -425,10 +425,10 @@ vlv_update_plane(struct drm_plane *dplane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ; x += src_w;@@ -493,6 +493,7 @@ ivb_update_plane(struct drm_plane *plane,enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;u32 sprsurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -558,10 +559,10 @@ ivb_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;/* HSW and BDW does this automagically in hardware */ @@ -634,6 +635,7 @@ ilk_update_plane(struct drm_plane *plane,int pipe = intel_plane->pipe;u32 dvscntr, dvsscale;u32 dvssurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -695,10 +697,10 @@ ilk_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; dvssurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= dvssurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ; x += src_w;Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 08/18] drm/i915: Pass 90/270 vs. 0/180 rotation info for intel_gen4_compute_page_offset()
Quoted 48 lines · Ville Syrjälä
Quoted 38 lines · Daniel Vetter
Quoted 37 lines · On Wed, Jan 20, 2016 at 09:05:29PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The page aligned surface address calculation needs to know which way things are rotated. The contract now says that the caller must pass the rotate x/y coordinates, as well as the
tile_heightaligned stride in thetile_heightdirection. This will make it fairly simple to deal with 90/270 degree rotation on SKL+ where we have to deal with the rotated view into the GTT.v2: Pass rotation instead of bool even thoughwe only care about 0/180 vs. 90/270
v3: Introduceintel_tile_dims(), and don't mix up different units so muchSigned-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]> (v2)--- drivers/gpu/drm/i915/intel_display.c | 66 +++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_sprite.c | 18 +++++----- 3 files changed, 59 insertions(+), 28 deletions(-)drivers/gpu/drm/i915/intel_display.c +9
-0@@ -2269,6 +2269,18 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,intel_tile_width (dev_priv, fb_modifier, cpp); } +/* Return the tile dimensions in pixel units */ +static void intel_tile_dims (const struct drm_i915_private *dev_priv, +unsigned int *tile_width, +unsigned int *tile_height, +uint64_t fb_modifier, +unsigned int cpp) +{ + *tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); + *tile_height =intel_tile_size (dev_priv) / *tile_width;Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c unsigned int intel_tile_height(const struct drm_i915_private *dev_priv, · line 2281
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ *tile_width /= cpp;Seems like my suggestion to use
tile_widthin cpp wasn't that awesome, at least we still have a big confusion right here. Not sure what to do, especially since these kind of changes are super-painful to review. Could we perhaps go back to the old versions and untangle this mess afterwards? Iirc I've follow-up with r-b tags to all patches in the old series for that approach.
Quoted 4 lines
Hmm. What did I do differently in the old approach again? Other than not having the confusion isolated to this one function. One step forward and two back doens't sound productive. Plus I have some more patches on top of this one already, so not pleasant at all.
Old patch reused the same variables for values both in bytes and pixels (and the conversion happened deep down in some function call, without any comments). This here looks better, but still suffers a bit from confusing naming.
Quoted 6 lines
Anyway, to avoid more confusion I suppose one thing that could be done is this:
-intel_tile_width
+intel_tile_width_bytes
Quoted 6 lines
intel_tile_dims(){ tile_width_bytes = intel_tile_width_bytes() *tile_height = tile_size / tile_width_bytes; *tile_width = tile_width_bytes / cpp; }
Yeah that sounds reasonable I think.
-Daniel
Quoted 247 lines
Quoted 243 lines
No idea really what would be best here ...
-DanielQuoted 233 lines
drivers/gpu/drm/i915/intel_display.c +37
-19+} +unsigned int intel_fb_align_height (struct drm_device *dev,unsigned int height,uint32_t pixel_format,uint64_t fb_modifier)@@ -2306,19 +2318,19 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, tile_size =intel_tile_size (dev_priv); cpp =drm_format_plane_cpp (fb->pixel_format,0 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[0 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[0 ], cpp); - info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width); + info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); info->height_pages =DIV_ROUND_UP (fb->height, tile_height); info->size = info->width_pages * info->height_pages * tile_size;if (info->pixel_format ==DRM_FORMAT_NV12 ) { cpp =drm_format_plane_cpp (fb->pixel_format,1 ); - tile_width =intel_tile_width (dev_priv, fb->modifier[1 ], cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb->modifier[1 ], cpp); - info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width); + info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); info->height_pages_uv =DIV_ROUND_UP (fb->height /2 , tile_height); info->size_uv = info->width_pages_uv * info->height_pages_uv * tile_size; }@@ -2446,29 +2458,43 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb,i915_gem_object_unpin_from_display_plane (obj, &view); } -/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel -* is assumed to be a power-of-two. */ +/* +* Computes the linear offset to the base tile and adjusts +* x, y. bytes per pixel is assumed to be a power-of-two. +* +* In the 90/270 rotated case, x and y are assumed +* to be already rotated to match the rotated GTT view, and +* pitch is the tile_height aligned framebuffer height. +*/ u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv,int *x,int *y,uint64_t fb_modifier,unsigned int cpp, -unsigned int pitch) +unsigned int pitch, +unsigned int rotation) {if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height; -unsigned int tile_rows, tiles; +unsigned int tile_rows, tiles, pitch_tiles; tile_size =intel_tile_size (dev_priv); - tile_width =intel_tile_width (dev_priv, fb_modifier, cpp); - tile_height = tile_size / tile_width; +intel_tile_dims (dev_priv, &tile_width, &tile_height, + fb_modifier, cpp); + +if (intel_rotation_90_or_270 (rotation)) { + pitch_tiles = pitch / tile_height; +swap (tile_width, tile_height); + }else { + pitch_tiles = pitch / (tile_width * cpp); + } tile_rows = *y / tile_height; *y %= tile_height; - tiles = *x / (tile_width/cpp); - *x %= tile_width/cpp; + tiles = *x / tile_width; + *x %= tile_width; -return tile_rows * pitch * tile_height + tiles * tile_size; +return (tile_rows * pitch_tiles + tiles) * tile_size; }else {unsigned int alignment =intel_linear_alignment (dev_priv) -1 ;unsigned int offset;@@ -2709,6 +2735,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2775,13 +2802,13 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; }else { intel_crtc->dspaddr_offset = linear_offset; } -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ; x += (crtc_state->pipe_src_w -1 );@@ -2839,6 +2866,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,u32 linear_offset;u32 dspcntr;i915_reg_t reg =DSPCNTR (plane); +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );int x = plane_state->src.x1 >>16 ;int y = plane_state->src.y1 >>16 ;@@ -2882,9 +2910,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, intel_crtc->dspaddr_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) {drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -1176,7 +1176,8 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, int *x, int *y, uint64_t fb_modifier, unsigned int cpp, - unsigned int pitch); + unsigned int pitch, + unsigned int rotation);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_sprite.c +10
-8@@ -193,7 +193,7 @@ skl_update_plane(struct drm_plane *drm_plane,const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr;u32 tile_height, plane_offset, plane_size; -unsigned int rotation; +unsigned int rotation = plane_state->base.rotation;int x_offset, y_offset;int crtc_x = plane_state->dst.x1;int crtc_y = plane_state->dst.y1;@@ -213,7 +213,6 @@ skl_update_plane(struct drm_plane *drm_plane, plane_ctl |=skl_plane_ctl_format (fb->pixel_format); plane_ctl |=skl_plane_ctl_tiling (fb->modifier[0 ]); - rotation = plane_state->base.rotation; plane_ctl |=skl_plane_ctl_rotation (rotation); stride_div = intel_fb_stride_alignment(dev_priv, fb->modifier[0],@@ -351,6 +350,7 @@ vlv_update_plane(struct drm_plane *dplane,int plane = intel_plane->plane;u32 sprctl;u32 sprsurf_offset, linear_offset; +unsigned int rotation = dplane->state->rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -425,10 +425,10 @@ vlv_update_plane(struct drm_plane *dplane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ; x += src_w;@@ -493,6 +493,7 @@ ivb_update_plane(struct drm_plane *plane,enum pipe pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;u32 sprsurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -558,10 +559,10 @@ ivb_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;/* HSW and BDW does this automagically in hardware */ @@ -634,6 +635,7 @@ ilk_update_plane(struct drm_plane *plane,int pipe = intel_plane->pipe;u32 dvscntr, dvsscale;u32 dvssurf_offset, linear_offset; +unsigned int rotation = plane_state->base.rotation;int cpp =drm_format_plane_cpp (fb->pixel_format,0 );const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;int crtc_x = plane_state->dst.x1;@@ -695,10 +697,10 @@ ilk_update_plane(struct drm_plane *plane, linear_offset = y * fb->pitches[0 ] + x * cpp; dvssurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, fb->modifier[0 ], cpp, - fb->pitches[0 ]); + fb->pitches[0 ], rotation); linear_offset -= dvssurf_offset; -if (plane_state->base.rotation ==BIT (DRM_ROTATE_180 )) { +if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ; x += src_w;Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.chSignature · 2 lines
Ville Syrjälä Intel OTC
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 9/18 drm/i915: Support for extra alignment for tiled surfaces
In reply to [email protected]From: Ville Syrjälä <[email protected]>
SKL+ needs >4K alignment for tiled surfaces, so make intel_compute_page_offset() handle it.
The way we do it is first we compute the closest tile boundary as before, and then figure out how many tiles we need to go to reach the desired alignment. The difference in the offset is then added into the x/y offsets.
v2: Be less confusing wrt. units (pixels vs. bytes) (Daniel)
--- drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +42 -5
@@ -2459,6 +2459,35 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb, }/* +* Adjust the tile offset by moving the difference into +* the x/y offsets. +* +* Input tile dimensions and pitch must already be +* rotated to match x and y, and in pixel units. +*/ +static void intel_adjust_tile_offset (int *x,int *y, +unsigned int tile_width, +unsigned int tile_height, +unsigned int tile_size, +unsigned int pitch_tiles, +unsigned int old_offset, +unsigned int new_offset) +{ +unsigned int tiles; + +WARN_ON (old_offset & (tile_size -1 )); +WARN_ON (new_offset & (tile_size -1 )); +WARN_ON (new_offset > old_offset); + + tiles = (old_offset - new_offset) / tile_size; +if (tiles ==0 ) +return ; + + *y += tiles / pitch_tiles * tile_height; + *x += tiles % pitch_tiles * tile_width; +} + +/* * Computes the linear offset to the base tile and adjusts * x, y. bytes per pixel is assumed to be a power-of-two. *
@@ -2473,6 +2502,12 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, unsigned int pitch, unsigned int rotation) { +unsigned int offset, alignment; + + alignment =intel_surf_alignment (dev_priv, fb_modifier); +if (alignment) + alignment--; +if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height;unsigned int tile_rows, tiles, pitch_tiles;
@@ -2494,16 +2529,18 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, tiles = *x / tile_width; *x %= tile_width; -return (tile_rows * pitch_tiles + tiles) * tile_size; - }else { -unsigned int alignment =intel_linear_alignment (dev_priv) -1 ; -unsigned int offset; + offset = (tile_rows * pitch_tiles + tiles) * tile_size; +intel_adjust_tile_offset (x, y, tile_width, tile_height, + tile_size, pitch_tiles, + offset, offset & ~alignment); + }else { offset = *y * pitch + *x * cpp; *y = (offset & alignment) / pitch; *x = ((offset & alignment) - *y * pitch) / cpp; -return offset & ~alignment; } + +return offset & ~alignment; }static int i9xx_format_to_fourcc (int format)
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 09/18] drm/i915: Support for extra alignment for tiled surfaces
Quoted 58 lines · On Wed, Jan 20, 2016 at 09:05:30PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
SKL+ needs >4K alignment for tiled surfaces, so make
intel_compute_page_offset()handle it.The way we do it is first we compute the closest tile boundary as before, and then figure out how many tiles we need to go to reach the desired alignment. The difference in the offset is then added into the x/y offsets.
v2: Be less confusing wrt. units (pixels vs. bytes) (Daniel)
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_display.c +29
-0@@ -2459,6 +2459,35 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb, }/* +* Adjust the tile offset by moving the difference into +* the x/y offsets. +* +* Input tile dimensions and pitch must already be +* rotated to match x and y, and in pixel units. +*/ +static void intel_adjust_tile_offset (int *x,int *y, +unsigned int tile_width, +unsigned int tile_height, +unsigned int tile_size, +unsigned int pitch_tiles, +unsigned int old_offset, +unsigned int new_offset) +{ +unsigned int tiles; + +WARN_ON (old_offset & (tile_size -1 )); +WARN_ON (new_offset & (tile_size -1 )); +WARN_ON (new_offset > old_offset); + + tiles = (old_offset - new_offset) / tile_size; +if (tiles ==0 ) +return ; + + *y += tiles / pitch_tiles * tile_height; + *x += tiles % pitch_tiles * tile_width; +} + +/* * Computes the linear offset to the base tile and adjusts * x, y. bytes per pixel is assumed to be a power-of-two. *
drivers/gpu/drm/i915/intel_display.c u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, · line 2509
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +5
-0@@ -2473,6 +2502,12 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, unsigned int pitch, unsigned int rotation) { +unsigned int offset, alignment; + + alignment =intel_surf_alignment (dev_priv, fb_modifier); +if (alignment) + alignment--;
Still voting for offset_aligned = ALIGN(offset, ...) per
http://article.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/72294
(at the very bottom, with the r-b for this patch).
drivers/gpu/drm/i915/intel_display.c u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, · line 2532
Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c +2
-4+if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height;unsigned int tile_rows, tiles, pitch_tiles;@@ -2494,16 +2529,18 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, tiles = *x / tile_width; *x %= tile_width; -return (tile_rows * pitch_tiles + tiles) * tile_size; - }else { -unsigned int alignment =intel_linear_alignment (dev_priv) -1 ; -unsigned int offset; + offset = (tile_rows * pitch_tiles + tiles) * tile_size;
pitch_tiles seems undefined here, does this compile? -Daniel
Quoted 22 lines
drivers/gpu/drm/i915/intel_display.c +6
-1+intel_adjust_tile_offset (x, y, tile_width, tile_height, + tile_size, pitch_tiles, + offset, offset & ~alignment); + }else { offset = *y * pitch + *x * cpp; *y = (offset & alignment) / pitch; *x = ((offset & alignment) - *y * pitch) / cpp; -return offset & ~alignment; } + +return offset & ~alignment; }static int i9xx_format_to_fourcc (int format)Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 09/18] drm/i915: Support for extra alignment for tiled surfaces
Quoted 70 lines · Daniel Vetter
Quoted 58 lines · On Wed, Jan 20, 2016 at 09:05:30PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
SKL+ needs >4K alignment for tiled surfaces, so make
intel_compute_page_offset()handle it.The way we do it is first we compute the closest tile boundary as before, and then figure out how many tiles we need to go to reach the desired alignment. The difference in the offset is then added into the x/y offsets.
v2: Be less confusing wrt. units (pixels vs. bytes) (Daniel)
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_display.c +29
-0@@ -2459,6 +2459,35 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb, }/* +* Adjust the tile offset by moving the difference into +* the x/y offsets. +* +* Input tile dimensions and pitch must already be +* rotated to match x and y, and in pixel units. +*/ +static void intel_adjust_tile_offset (int *x,int *y, +unsigned int tile_width, +unsigned int tile_height, +unsigned int tile_size, +unsigned int pitch_tiles, +unsigned int old_offset, +unsigned int new_offset) +{ +unsigned int tiles; + +WARN_ON (old_offset & (tile_size -1 )); +WARN_ON (new_offset & (tile_size -1 )); +WARN_ON (new_offset > old_offset); + + tiles = (old_offset - new_offset) / tile_size; +if (tiles ==0 ) +return ; + + *y += tiles / pitch_tiles * tile_height; + *x += tiles % pitch_tiles * tile_width; +} + +/* * Computes the linear offset to the base tile and adjusts * x, y. bytes per pixel is assumed to be a power-of-two. * drivers/gpu/drm/i915/intel_display.c u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, · line 2509
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +5
-0@@ -2473,6 +2502,12 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, unsigned int pitch, unsigned int rotation) { +unsigned int offset, alignment; + + alignment =intel_surf_alignment (dev_priv, fb_modifier); +if (alignment) + alignment--;Still voting for
offset_aligned=ALIGN(offset, ...)per
Quoted 3 lines
http://article.gmane.org/gmane.comp.freedesktop.xorg.drivers.intel/72294
(at the very bottom, with the r-b for this patch).
And as I replied there, ALIGN doesn't do what we want.
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+if (fb_modifier !=DRM_FORMAT_MOD_NONE ) {unsigned int tile_size, tile_width, tile_height;unsigned int tile_rows, tiles, pitch_tiles;@@ -2494,16 +2529,18 @@ u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, tiles = *x / tile_width; *x %= tile_width;
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c u32 intel_compute_tile_offset(struct drm_i915_private *dev_priv, · line 2532
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-4-return (tile_rows * pitch_tiles + tiles) * tile_size; - }else { -unsigned int alignment =intel_linear_alignment (dev_priv) -1 ; -unsigned int offset; + offset = (tile_rows * pitch_tiles + tiles) * tile_size;
pitch_tilesseems undefined here, does this compile?
Yes. Diff just likes to make patches hard to read.
Quoted 29 lines
-Daniel
Quoted 22 lines
drivers/gpu/drm/i915/intel_display.c +6
-1+intel_adjust_tile_offset (x, y, tile_width, tile_height, + tile_size, pitch_tiles, + offset, offset & ~alignment); + }else { offset = *y * pitch + *x * cpp; *y = (offset & alignment) / pitch; *x = ((offset & alignment) - *y * pitch) / cpp; -return offset & ~alignment; } + +return offset & ~alignment; }static int i9xx_format_to_fourcc (int format)Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 10/18 drm/i915: Don't pass plane+plane_state to intel_pin_and_fence_fb_obj()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_pin_and_fence_fb_obj() only needs the framebuffer, and the desird rotation (to find the right GTT view for it), so no need to pass all kinds of plane stuff.
The main motivation is to get rid of the uggy NULL plane_state handling due to fbdev.
v2: Add a note why I really want this
--- drivers/gpu/drm/i915/intel_display.c | 41 +++++++++++++++--------------------- drivers/gpu/drm/i915/intel_drv.h | 5 ++--- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- 3 files changed, 20 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/intel_display.c +17 -24
@@ -2292,8 +2292,9 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height, }static void -intel_fill_fb_ggtt_view (struct i915_ggtt_view *view,struct drm_framebuffer *fb, -const struct drm_plane_state *plane_state) +intel_fill_fb_ggtt_view (struct i915_ggtt_view *view, +const struct drm_framebuffer *fb, +unsigned int rotation) {struct drm_i915_private *dev_priv =to_i915 (fb->dev);struct intel_rotation_info *info = &view->params.rotated;
@@ -2301,10 +2302,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, *view = i915_ggtt_view_normal; -if (!plane_state) -return ; - -if (!intel_rotation_90_or_270 (plane_state->rotation)) +if (!intel_rotation_90_or_270 (rotation))return ; *view = i915_ggtt_view_rotated;
@@ -2369,9 +2367,8 @@ static unsigned int intel_surf_alignment(const struct drm_i915_private *dev_priv }int -intel_pin_and_fence_fb_obj (struct drm_plane *plane, -struct drm_framebuffer *fb, -const struct drm_plane_state *plane_state) +intel_pin_and_fence_fb_obj (struct drm_framebuffer *fb, +unsigned int rotation) {struct drm_device *dev = fb->dev;struct drm_i915_private *dev_priv = dev->dev_private;
@@ -2384,7 +2381,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane, alignment =intel_surf_alignment (dev_priv, fb->modifier[0 ]); -intel_fill_fb_ggtt_view (&view, fb, plane_state); +intel_fill_fb_ggtt_view (&view, fb, rotation);/* Note that the w/a also requires 64 PTE of padding following the * bo. We currently fill all unused PTE with the shadow page and so
@@ -2442,15 +2439,14 @@ err_pm:return ret; } -static void intel_unpin_fb_obj (struct drm_framebuffer *fb, -const struct drm_plane_state *plane_state) +static void intel_unpin_fb_obj (struct drm_framebuffer *fb,unsigned int rotation) {struct drm_i915_gem_object *obj =intel_fb_obj (fb);struct i915_ggtt_view view;WARN_ON (!mutex_is_locked (&obj->base.dev->struct_mutex)); -intel_fill_fb_ggtt_view (&view, fb, plane_state); +intel_fill_fb_ggtt_view (&view, fb, rotation);if (view.type ==I915_GGTT_VIEW_NORMAL )i915_gem_object_unpin_fence (obj);
@@ -3002,7 +2998,7 @@ u32 intel_plane_obj_offset(struct intel_plane *intel_plane,u64 offset;intel_fill_fb_ggtt_view (&view, intel_plane->base.state->fb, - intel_plane->base.state); + intel_plane->base.state->rotation); vma =i915_gem_obj_to_ggtt_view (obj, &view); if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n",
@@ -10969,7 +10965,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)struct drm_plane *primary = crtc->base.primary;mutex_lock (&dev->struct_mutex); -intel_unpin_fb_obj (work->old_fb, primary->state); +intel_unpin_fb_obj (work->old_fb, primary->state->rotation);drm_gem_object_unreference (&work->pending_flip_obj->base);if (work->flip_queued_req)
@@ -11733,8 +11729,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, goto cleanup_pending; } - ret =intel_pin_and_fence_fb_obj (crtc->primary, fb, - crtc->primary->state); + ret =intel_pin_and_fence_fb_obj (fb, primary->state->rotation);if (ret) goto cleanup_pending;
@@ -11783,7 +11778,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,return 0 ; cleanup_unpin: -intel_unpin_fb_obj (fb, crtc->primary->state); +intel_unpin_fb_obj (fb, crtc->primary->state->rotation); cleanup_pending:if (request)i915_gem_request_cancel (request);
@@ -13924,7 +13919,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,if (ret)DRM_DEBUG_KMS ("failed to attach phys object\n" ); }else { - ret =intel_pin_and_fence_fb_obj (plane, fb, new_state); + ret =intel_pin_and_fence_fb_obj (fb, new_state->rotation); }if (ret ==0 ) {
@@ -13968,7 +13963,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,if (old_obj && (plane->type !=DRM_PLANE_TYPE_CURSOR || !INTEL_INFO (dev)->cursor_needs_physical)) -intel_unpin_fb_obj (old_state->fb, old_state); +intel_unpin_fb_obj (old_state->fb, old_state->rotation);/* prepare_fb aborted? */ if ((old_obj && (old_obj->frontbuffer_bits & intel_plane->frontbuffer_bit)) ||
@@ -13976,7 +13971,6 @@ intel_cleanup_plane_fb(struct drm_plane *plane,i915_gem_track_fb (old_obj, obj, intel_plane->frontbuffer_bit);i915_gem_request_assign (&old_intel_state->wait_req,NULL ); - }int
@@ -16073,9 +16067,8 @@ void intel_modeset_gem_init(struct drm_device *dev)continue ;mutex_lock (&dev->struct_mutex); - ret =intel_pin_and_fence_fb_obj (c->primary, - c->primary->fb, - c->primary->state); + ret =intel_pin_and_fence_fb_obj (c->primary->fb, + c->primary->state->rotation);mutex_unlock (&dev->struct_mutex);if (ret) { DRM_ERROR("failed to pin boot fb on pipe %d\n",
drivers/gpu/drm/i915/intel_drv.h +2 -3
@@ -1106,9 +1106,8 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector,void intel_release_load_detect_pipe (struct drm_connector *connector,struct intel_load_detect_pipe *old,struct drm_modeset_acquire_ctx *ctx); -int intel_pin_and_fence_fb_obj (struct drm_plane *plane, -struct drm_framebuffer *fb, -const struct drm_plane_state *plane_state); +int intel_pin_and_fence_fb_obj (struct drm_framebuffer *fb, +unsigned int rotation);struct drm_framebuffer * __intel_framebuffer_create(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd,
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
@@ -220,7 +220,7 @@ static int intelfb_create(struct drm_fb_helper *helper,* This also validates that any existing fb inherited from the * BIOS is suitable for own access. */ - ret =intel_pin_and_fence_fb_obj (NULL , &ifbdev->fb->base,NULL ); + ret =intel_pin_and_fence_fb_obj (&ifbdev->fb->base,BIT (DRM_ROTATE_0 ));if (ret) goto out_unlock;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 11/18 drm/i915: Pass drm_frambuffer to intel_compute_page_offset()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_compute_page_offsets() gets passed a bunch of the framebuffer metadate sepearately. Just pass the framebuffer itself to make life simpler for the caller, and make it less likely they would make a mistake in the order of the arguments (as most as just unsigned ints and such).
We still pass the pitch explicitly since for 90/270 degree rotation the caller has to pass in the right thing.
--- drivers/gpu/drm/i915/intel_display.c | 15 +++++++-------- drivers/gpu/drm/i915/intel_drv.h | 6 ++---- drivers/gpu/drm/i915/intel_sprite.c | 9 +++------ 3 files changed, 12 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -8
@@ -2491,13 +2491,14 @@ static void intel_adjust_tile_offset(int *x, int *y,* to be already rotated to match the rotated GTT view, and * pitch is the tile_height aligned framebuffer height. */ -u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv, -int *x,int *y, -uint64_t fb_modifier, -unsigned int cpp, +u32 intel_compute_tile_offset (int *x,int *y, +const struct drm_framebuffer *fb,int plane,unsigned int pitch,unsigned int rotation) { +const struct drm_i915_private *dev_priv =to_i915 (fb->dev); +uint64_t fb_modifier = fb->modifier[plane]; +unsigned int cpp =drm_format_plane_cpp (fb->pixel_format, plane);unsigned int offset, alignment; alignment =intel_surf_alignment (dev_priv, fb_modifier);
@@ -2833,8 +2834,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,if (INTEL_INFO (dev)->gen >=4 ) { intel_crtc->dspaddr_offset = -intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], cpp, +intel_compute_tile_offset (&x, &y, fb,0 , fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset; }else {
@@ -2941,8 +2941,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, linear_offset = y * fb->pitches[0 ] + x * cpp; intel_crtc->dspaddr_offset = -intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], cpp, +intel_compute_tile_offset (&x, &y, fb,0 , fb->pitches[0 ], rotation); linear_offset -= intel_crtc->dspaddr_offset;if (rotation ==BIT (DRM_ROTATE_180 )) {
drivers/gpu/drm/i915/intel_drv.h +2 -4
@@ -1171,10 +1171,8 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,void assert_pipe (struct drm_i915_private *dev_priv,enum pipe pipe,bool state);#define assert_pipe_enabled (d, p) assert_pipe(d, p, true)#define assert_pipe_disabled (d, p) assert_pipe(d, p, false) -u32 intel_compute_tile_offset (struct drm_i915_private *dev_priv, -int *x,int *y, -uint64_t fb_modifier, -unsigned int cpp, +u32 intel_compute_tile_offset (int *x,int *y, +const struct drm_framebuffer *fb,int plane,unsigned int pitch,unsigned int rotation);void intel_prepare_reset (struct drm_device *dev);
drivers/gpu/drm/i915/intel_sprite.c +3 -6
@@ -423,8 +423,7 @@ vlv_update_plane(struct drm_plane *dplane, crtc_h--; linear_offset = y * fb->pitches[0 ] + x * cpp; - sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], cpp, + sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset;
@@ -557,8 +556,7 @@ ivb_update_plane(struct drm_plane *plane, sprscale =SPRITE_SCALE_ENABLE | (src_w <<16 ) | src_h; linear_offset = y * fb->pitches[0 ] + x * cpp; - sprsurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], cpp, + sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , fb->pitches[0 ], rotation); linear_offset -= sprsurf_offset;
@@ -695,8 +693,7 @@ ilk_update_plane(struct drm_plane *plane, dvsscale =DVS_SCALE_ENABLE | (src_w <<16 ) | src_h; linear_offset = y * fb->pitches[0 ] + x * cpp; - dvssurf_offset =intel_compute_tile_offset (dev_priv, &x, &y, - fb->modifier[0 ], cpp, + dvssurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , fb->pitches[0 ], rotation); linear_offset -= dvssurf_offset;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 12/18 drm/i915: Reorganize intel_rotation_info
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Throw out a bunch of unnecessary stuff from struct intel_rotation_info, and pull most of the remaining stuff to live under an array of per-color plane sub-structures.
What still remains outside the sub-structure will be reorgranized later as well, but that requires more work elsewhere so leave it be for now.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 35 +++++++++++++++-------------------- drivers/gpu/drm/i915/i915_gem_gtt.h | 11 ++++------- drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++---------- drivers/gpu/drm/i915/intel_drv.h | 1 + 4 files changed, 35 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +15 -20
@@ -3367,7 +3367,7 @@ static struct sg_table * intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, struct drm_i915_gem_object *obj) { - unsigned int size_pages = rot_info->size >> PAGE_SHIFT; + unsigned int size_pages = rot_info->plane[0].width * rot_info->plane[0].height;unsigned int size_pages_uv;struct sg_page_iter sg_iter;unsigned long i;
@@ -3385,7 +3385,7 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info,/* Account for UV plane with NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) - size_pages_uv = rot_info->size_uv >>PAGE_SHIFT ; + size_pages_uv = rot_info->plane[1 ].width * rot_info->plane[1 ].height;else size_pages_uv =0 ;
@@ -3407,9 +3407,9 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info,/* Rotate the pages. */ sg =rotate_pages (page_addr_list,0 , - rot_info->width_pages, rot_info->height_pages, - rot_info->width_pages, - st,NULL ); + rot_info->plane[0 ].width, rot_info->plane[0 ].height, + rot_info->plane[0 ].width, + st,NULL );/* Append the UV plane if NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) {
@@ -3421,18 +3421,15 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, rot_info->uv_start_page = uv_start_page; -rotate_pages (page_addr_list, uv_start_page, - rot_info->width_pages_uv, - rot_info->height_pages_uv, - rot_info->width_pages_uv, +rotate_pages (page_addr_list, rot_info->uv_start_page, + rot_info->plane[1 ].width, rot_info->plane[1 ].height, + rot_info->plane[1 ].width, st, sg); } -DRM_DEBUG_KMS ( -"Created rotated page mapping for object size %zu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0)).\n" , - obj->base.size, rot_info->pitch, rot_info->height, - rot_info->pixel_format, rot_info->width_pages, - rot_info->height_pages, size_pages + size_pages_uv, +DRM_DEBUG_KMS ("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages (%u plane 0)).\n" , + obj->base.size, rot_info->plane[0 ].width, + rot_info->plane[0 ].height, size_pages + size_pages_uv, size_pages);drm_free_large (page_addr_list);
@@ -3444,11 +3441,9 @@ err_sg_alloc: err_st_alloc:drm_free_large (page_addr_list); -DRM_DEBUG_KMS ( -"Failed to create rotated mapping for object size %zu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0))\n" , - obj->base.size, ret, rot_info->pitch, rot_info->height, - rot_info->pixel_format, rot_info->width_pages, - rot_info->height_pages, size_pages + size_pages_uv, +DRM_DEBUG_KMS ("Failed to create rotated mapping for object size %zu! (%d) (%ux%u tiles, %u pages (%u plane 0))\n" , + obj->base.size, ret, rot_info->plane[0 ].width, + rot_info->plane[0 ].height, size_pages + size_pages_uv, size_pages);return ERR_PTR (ret); }
@@ -3600,7 +3595,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,if (view->type ==I915_GGTT_VIEW_NORMAL ) {return obj->base.size; }else if (view->type ==I915_GGTT_VIEW_ROTATED ) { -return view->params.rotated.size; +return intel_rotation_info_size (&view->params.rotated) <<PAGE_SHIFT ; }else if (view->type ==I915_GGTT_VIEW_PARTIAL ) {return view->params.partial.size <<PAGE_SHIFT ; }else {
drivers/gpu/drm/i915/i915_gem_gtt.h +4 -7
@@ -135,16 +135,13 @@ 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; -unsigned int width_pages, height_pages; -uint64_t size; -unsigned int width_pages_uv, height_pages_uv; -uint64_t size_uv;unsigned int uv_start_page; +struct { +/* tiles */ +unsigned int width, height; + } plane[2 ]; };struct i915_ggtt_view {
drivers/gpu/drm/i915/intel_display.c +15 -10
@@ -2291,6 +2291,17 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,return ALIGN (height, tile_height); } +unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info) +{ +unsigned int size =0 ; +int i; + +for (i =0 ; i <ARRAY_SIZE (rot_info->plane); i++) + size += rot_info->plane[i].width * rot_info->plane[i].height; + +return size; +} + static void intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, const struct drm_framebuffer *fb,
@@ -2307,11 +2318,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, *view = i915_ggtt_view_rotated; - info->height = fb->height; - info->pixel_format = fb->pixel_format; - info->pitch = fb->pitches[0 ]; info->uv_offset = fb->offsets[1 ]; - info->fb_modifier = fb->modifier[0 ]; tile_size =intel_tile_size (dev_priv);
@@ -2319,18 +2326,16 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[0 ], cpp); - info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); - info->height_pages =DIV_ROUND_UP (fb->height, tile_height); - info->size = info->width_pages * info->height_pages * tile_size; + info->plane[0 ].width =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); + info->plane[0 ].height =DIV_ROUND_UP (fb->height, tile_height);if (info->pixel_format ==DRM_FORMAT_NV12 ) { cpp =drm_format_plane_cpp (fb->pixel_format,1 );intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[1 ], cpp); - info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); - info->height_pages_uv =DIV_ROUND_UP (fb->height /2 , tile_height); - info->size_uv = info->width_pages_uv * info->height_pages_uv * tile_size; + info->plane[1 ].width =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); + info->plane[1 ].height =DIV_ROUND_UP (fb->height /2 , tile_height); } }
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1059,6 +1059,7 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);/* intel_display.c */ extern const struct drm_plane_funcs intel_plane_funcs; +unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info);bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);int intel_hrawclk (struct drm_device *dev);
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/18] drm/i915: Reorganize intel_rotation_info
Quoted 93 lines · On Wed, Jan 20, 2016 at 09:05:33PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Throw out a bunch of unnecessary stuff from struct
intel_rotation_info, and pull most of the remaining stuff to live under an array of per-color plane sub-structures.What still remains outside the sub-structure will be reorgranized later as well, but that requires more work elsewhere so leave it be for now.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 35 +++++++++++++++-------------------- drivers/gpu/drm/i915/i915_gem_gtt.h | 11 ++++------- drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++---------- drivers/gpu/drm/i915/intel_drv.h | 1 + 4 files changed, 35 insertions(+), 37 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +14
-19@@ -3367,7 +3367,7 @@ static struct sg_table * intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, struct drm_i915_gem_object *obj) { - unsigned int size_pages = rot_info->size >> PAGE_SHIFT; + unsigned int size_pages = rot_info->plane[0].width * rot_info->plane[0].height;unsigned int size_pages_uv;struct sg_page_iter sg_iter;unsigned long i;@@ -3385,7 +3385,7 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info,/* Account for UV plane with NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) - size_pages_uv = rot_info->size_uv >>PAGE_SHIFT ; + size_pages_uv = rot_info->plane[1 ].width * rot_info->plane[1 ].height;else size_pages_uv =0 ;@@ -3407,9 +3407,9 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info,/* Rotate the pages. */ sg =rotate_pages (page_addr_list,0 , - rot_info->width_pages, rot_info->height_pages, - rot_info->width_pages, - st,NULL ); + rot_info->plane[0 ].width, rot_info->plane[0 ].height, + rot_info->plane[0 ].width, + st,NULL );/* Append the UV plane if NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) {@@ -3421,18 +3421,15 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, rot_info->uv_start_page = uv_start_page; -rotate_pages (page_addr_list, uv_start_page, - rot_info->width_pages_uv, - rot_info->height_pages_uv, - rot_info->width_pages_uv, +rotate_pages (page_addr_list, rot_info->uv_start_page, + rot_info->plane[1 ].width, rot_info->plane[1 ].height, + rot_info->plane[1 ].width, st, sg); } -DRM_DEBUG_KMS ( -"Created rotated page mapping for object size %zu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0)).\n" , - obj->base.size, rot_info->pitch, rot_info->height, - rot_info->pixel_format, rot_info->width_pages, - rot_info->height_pages, size_pages + size_pages_uv, +DRM_DEBUG_KMS ("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages (%u plane 0)).\n" , + obj->base.size, rot_info->plane[0 ].width, + rot_info->plane[0 ].height, size_pages + size_pages_uv, size_pages);drm_free_large (page_addr_list);@@ -3444,11 +3441,9 @@ err_sg_alloc: err_st_alloc:drm_free_large (page_addr_list); -DRM_DEBUG_KMS ( -"Failed to create rotated mapping for object size %zu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0))\n" , - obj->base.size, ret, rot_info->pitch, rot_info->height, - rot_info->pixel_format, rot_info->width_pages, - rot_info->height_pages, size_pages + size_pages_uv, +DRM_DEBUG_KMS ("Failed to create rotated mapping for object size %zu! (%d) (%ux%u tiles, %u pages (%u plane 0))\n" , + obj->base.size, ret, rot_info->plane[0 ].width, + rot_info->plane[0 ].height, size_pages + size_pages_uv, size_pages);return ERR_PTR (ret); }
drivers/gpu/drm/i915/i915_gem_gtt.c i915_ggtt_view_size(struct drm_i915_gem_object *obj, · line 3598
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-1@@ -3600,7 +3595,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,if (view->type ==I915_GGTT_VIEW_NORMAL ) {return obj->base.size; }else if (view->type ==I915_GGTT_VIEW_ROTATED ) { -return view->params.rotated.size; +return intel_rotation_info_size (&view->params.rotated) <<PAGE_SHIFT ;
Isn't this a hidden bugfix? before this was size, now it's size+size_uv.
If you agree then please add a blurb to the commit message (or better, split this out into a tiny prep patch). Otherwise didn't spot anything, with either approach
Quoted 104 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0}else if (view->type ==I915_GGTT_VIEW_PARTIAL ) {return view->params.partial.size <<PAGE_SHIFT ; }else {drivers/gpu/drm/i915/i915_gem_gtt.h +4
-7@@ -135,16 +135,13 @@ 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; -unsigned int width_pages, height_pages; -uint64_t size; -unsigned int width_pages_uv, height_pages_uv; -uint64_t size_uv;unsigned int uv_start_page; +struct { +/* tiles */ +unsigned int width, height; + } plane[2 ]; };struct i915_ggtt_view {drivers/gpu/drm/i915/intel_display.c +15
-10@@ -2291,6 +2291,17 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,return ALIGN (height, tile_height); } +unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info) +{ +unsigned int size =0 ; +int i; + +for (i =0 ; i <ARRAY_SIZE (rot_info->plane); i++) + size += rot_info->plane[i].width * rot_info->plane[i].height; + +return size; +} + static void intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, const struct drm_framebuffer *fb,@@ -2307,11 +2318,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, *view = i915_ggtt_view_rotated; - info->height = fb->height; - info->pixel_format = fb->pixel_format; - info->pitch = fb->pitches[0 ]; info->uv_offset = fb->offsets[1 ]; - info->fb_modifier = fb->modifier[0 ]; tile_size =intel_tile_size (dev_priv);@@ -2319,18 +2326,16 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[0 ], cpp); - info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); - info->height_pages =DIV_ROUND_UP (fb->height, tile_height); - info->size = info->width_pages * info->height_pages * tile_size; + info->plane[0 ].width =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); + info->plane[0 ].height =DIV_ROUND_UP (fb->height, tile_height);if (info->pixel_format ==DRM_FORMAT_NV12 ) { cpp =drm_format_plane_cpp (fb->pixel_format,1 );intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[1 ], cpp); - info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); - info->height_pages_uv =DIV_ROUND_UP (fb->height /2 , tile_height); - info->size_uv = info->width_pages_uv * info->height_pages_uv * tile_size; + info->plane[1 ].width =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); + info->plane[1 ].height =DIV_ROUND_UP (fb->height /2 , tile_height); } }drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1059,6 +1059,7 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);/* intel_display.c */ extern const struct drm_plane_funcs intel_plane_funcs; +unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info);bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);int intel_hrawclk (struct drm_device *dev);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/18] drm/i915: Reorganize intel_rotation_info
Quoted 93 lines · Daniel Vetter
Quoted 92 lines · On Wed, Jan 20, 2016 at 09:05:33PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Throw out a bunch of unnecessary stuff from struct
intel_rotation_info, and pull most of the remaining stuff to live under an array of per-color plane sub-structures.What still remains outside the sub-structure will be reorgranized later as well, but that requires more work elsewhere so leave it be for now.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 35 +++++++++++++++-------------------- drivers/gpu/drm/i915/i915_gem_gtt.h | 11 ++++------- drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++---------- drivers/gpu/drm/i915/intel_drv.h | 1 + 4 files changed, 35 insertions(+), 37 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +14
-19@@ -3367,7 +3367,7 @@ static struct sg_table * intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, struct drm_i915_gem_object *obj) { - unsigned int size_pages = rot_info->size >> PAGE_SHIFT; + unsigned int size_pages = rot_info->plane[0].width * rot_info->plane[0].height;unsigned int size_pages_uv;struct sg_page_iter sg_iter;unsigned long i;@@ -3385,7 +3385,7 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info,/* Account for UV plane with NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) - size_pages_uv = rot_info->size_uv >>PAGE_SHIFT ; + size_pages_uv = rot_info->plane[1 ].width * rot_info->plane[1 ].height;else size_pages_uv =0 ;@@ -3407,9 +3407,9 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info,/* Rotate the pages. */ sg =rotate_pages (page_addr_list,0 , - rot_info->width_pages, rot_info->height_pages, - rot_info->width_pages, - st,NULL ); + rot_info->plane[0 ].width, rot_info->plane[0 ].height, + rot_info->plane[0 ].width, + st,NULL );/* Append the UV plane if NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) {@@ -3421,18 +3421,15 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, rot_info->uv_start_page = uv_start_page; -rotate_pages (page_addr_list, uv_start_page, - rot_info->width_pages_uv, - rot_info->height_pages_uv, - rot_info->width_pages_uv, +rotate_pages (page_addr_list, rot_info->uv_start_page, + rot_info->plane[1 ].width, rot_info->plane[1 ].height, + rot_info->plane[1 ].width, st, sg); } -DRM_DEBUG_KMS ( -"Created rotated page mapping for object size %zu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0)).\n" , - obj->base.size, rot_info->pitch, rot_info->height, - rot_info->pixel_format, rot_info->width_pages, - rot_info->height_pages, size_pages + size_pages_uv, +DRM_DEBUG_KMS ("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages (%u plane 0)).\n" , + obj->base.size, rot_info->plane[0 ].width, + rot_info->plane[0 ].height, size_pages + size_pages_uv, size_pages);drm_free_large (page_addr_list);@@ -3444,11 +3441,9 @@ err_sg_alloc: err_st_alloc:drm_free_large (page_addr_list); -DRM_DEBUG_KMS ( -"Failed to create rotated mapping for object size %zu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0))\n" , - obj->base.size, ret, rot_info->pitch, rot_info->height, - rot_info->pixel_format, rot_info->width_pages, - rot_info->height_pages, size_pages + size_pages_uv, +DRM_DEBUG_KMS ("Failed to create rotated mapping for object size %zu! (%d) (%ux%u tiles, %u pages (%u plane 0))\n" , + obj->base.size, ret, rot_info->plane[0 ].width, + rot_info->plane[0 ].height, size_pages + size_pages_uv, size_pages);return ERR_PTR (ret); }
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem_gtt.c i915_ggtt_view_size(struct drm_i915_gem_object *obj, · line 3598
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +1
-1@@ -3600,7 +3595,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,if (view->type ==I915_GGTT_VIEW_NORMAL ) {return obj->base.size; }else if (view->type ==I915_GGTT_VIEW_ROTATED ) { -return view->params.rotated.size; +return intel_rotation_info_size (&view->params.rotated) <<PAGE_SHIFT ;Isn't this a hidden bugfix? before this was size, now it's size+size_uv.
Hmm. I suppose. TBH didn't even notice that myself.
Quoted 116 lines
If you agree then please add a blurb to the commit message (or better, split this out into a tiny prep patch). Otherwise didn't spot anything, with either approach
Reviewed-by Daniel Vetter <[email protected]>Quoted 104 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0}else if (view->type ==I915_GGTT_VIEW_PARTIAL ) {return view->params.partial.size <<PAGE_SHIFT ; }else {drivers/gpu/drm/i915/i915_gem_gtt.h +4
-7@@ -135,16 +135,13 @@ 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; -unsigned int width_pages, height_pages; -uint64_t size; -unsigned int width_pages_uv, height_pages_uv; -uint64_t size_uv;unsigned int uv_start_page; +struct { +/* tiles */ +unsigned int width, height; + } plane[2 ]; };struct i915_ggtt_view {drivers/gpu/drm/i915/intel_display.c +15
-10@@ -2291,6 +2291,17 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height,return ALIGN (height, tile_height); } +unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info) +{ +unsigned int size =0 ; +int i; + +for (i =0 ; i <ARRAY_SIZE (rot_info->plane); i++) + size += rot_info->plane[i].width * rot_info->plane[i].height; + +return size; +} + static void intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, const struct drm_framebuffer *fb,@@ -2307,11 +2318,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, *view = i915_ggtt_view_rotated; - info->height = fb->height; - info->pixel_format = fb->pixel_format; - info->pitch = fb->pitches[0 ]; info->uv_offset = fb->offsets[1 ]; - info->fb_modifier = fb->modifier[0 ]; tile_size =intel_tile_size (dev_priv);@@ -2319,18 +2326,16 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[0 ], cpp); - info->width_pages =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); - info->height_pages =DIV_ROUND_UP (fb->height, tile_height); - info->size = info->width_pages * info->height_pages * tile_size; + info->plane[0 ].width =DIV_ROUND_UP (fb->pitches[0 ], tile_width * cpp); + info->plane[0 ].height =DIV_ROUND_UP (fb->height, tile_height);if (info->pixel_format ==DRM_FORMAT_NV12 ) { cpp =drm_format_plane_cpp (fb->pixel_format,1 );intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[1 ], cpp); - info->width_pages_uv =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); - info->height_pages_uv =DIV_ROUND_UP (fb->height /2 , tile_height); - info->size_uv = info->width_pages_uv * info->height_pages_uv * tile_size; + info->plane[1 ].width =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); + info->plane[1 ].height =DIV_ROUND_UP (fb->height /2 , tile_height); } }drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1059,6 +1059,7 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);/* intel_display.c */ extern const struct drm_plane_funcs intel_plane_funcs; +unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info);bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);int intel_hrawclk (struct drm_device *dev);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 13/18 drm/i915: Move the NULL sg handling out from rotate_pages()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
rotate_pages() checks to see if it got called with a NULL sg, and then goes to extract it from sg->sgl. It always gets called with a NULL sg for the first plane, so moving the initial 'sg=st->sgl' assignment out into intel_rotate_fb_obj_pages() seems less special-casey.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +8 -10
@@ -3339,11 +3339,6 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,unsigned int column, row;unsigned int src_idx; -if (!sg) { - st->nents =0 ; - sg = st->sgl; - } -for (column =0 ; column < width; column++) { src_idx = stride * (height -1 ) + column;for (row =0 ; row < height; row++) {
@@ -3405,11 +3400,14 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, i++; } + st->nents =0 ; + sg = st->sgl; +/* Rotate the pages. */ sg =rotate_pages (page_addr_list,0 , rot_info->plane[0 ].width, rot_info->plane[0 ].height, rot_info->plane[0 ].width, - st,NULL ); + st, sg);/* Append the UV plane if NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) {
@@ -3421,10 +3419,10 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, rot_info->uv_start_page = uv_start_page; -rotate_pages (page_addr_list, rot_info->uv_start_page, - rot_info->plane[1 ].width, rot_info->plane[1 ].height, - rot_info->plane[1 ].width, - st, sg); + sg =rotate_pages (page_addr_list, rot_info->uv_start_page, + rot_info->plane[1 ].width, rot_info->plane[1 ].height, + rot_info->plane[1 ].width, + st, sg); } DRM_DEBUG_KMS("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages (%u plane 0)).\n",
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/18] drm/i915: Move the NULL sg handling out from rotate_pages()
Quoted 8 lines · On Wed, Jan 20, 2016 at 09:05:34PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
rotate_pages()checks to see if it got called with a NULL sg, and then goes to extract it fromsg->sgl. It always gets called with a NULL sg for the first plane, so moving the initial 'sg=st->sgl' assignment out intointel_rotate_fb_obj_pages()seems less special-casey.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 58 lines
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +8
-10@@ -3339,11 +3339,6 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,unsigned int column, row;unsigned int src_idx; -if (!sg) { - st->nents =0 ; - sg = st->sgl; - } -for (column =0 ; column < width; column++) { src_idx = stride * (height -1 ) + column;for (row =0 ; row < height; row++) {@@ -3405,11 +3400,14 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, i++; } + st->nents =0 ; + sg = st->sgl; +/* Rotate the pages. */ sg =rotate_pages (page_addr_list,0 , rot_info->plane[0 ].width, rot_info->plane[0 ].height, rot_info->plane[0 ].width, - st,NULL ); + st, sg);/* Append the UV plane if NV12. */ if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) {@@ -3421,10 +3419,10 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, rot_info->uv_start_page = uv_start_page; -rotate_pages (page_addr_list, rot_info->uv_start_page, - rot_info->plane[1 ].width, rot_info->plane[1 ].height, - rot_info->plane[1 ].width, - st, sg); + sg =rotate_pages (page_addr_list, rot_info->uv_start_page, + rot_info->plane[1 ].width, rot_info->plane[1 ].height, + rot_info->plane[1 ].width, + st, sg); } DRM_DEBUG_KMS("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages (%u plane 0)).\n",Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 14/18 drm/i915: Embed rotation_info under intel_framebuffer
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Instead of repopulatin the rotation_info struct for the fb every time we try to use the fb, we can just populate it once when creating the fb, and later we can just copy the pre-populate struct into the gtt_view.
--- drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++++----------- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_display.c +16 -11
@@ -2307,18 +2307,20 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,const struct drm_framebuffer *fb, unsigned int rotation) { -struct drm_i915_private *dev_priv =to_i915 (fb->dev); -struct intel_rotation_info *info = &view->params.rotated; -unsigned int tile_size, tile_width, tile_height, cpp; - - *view = i915_ggtt_view_normal; - -if (!intel_rotation_90_or_270 (rotation)) -return ; - - *view = i915_ggtt_view_rotated; + if (intel_rotation_90_or_270(rotation)) { + *view = i915_ggtt_view_rotated; + view->params.rotated =to_intel_framebuffer (fb)->rot_info; + } else { + *view = i915_ggtt_view_normal; + } +} - info->uv_offset = fb->offsets[1 ]; +static void +intel_fill_fb_info (struct drm_i915_private *dev_priv, +struct drm_framebuffer *fb) +{ +struct intel_rotation_info *info = &to_intel_framebuffer (fb)->rot_info; +unsigned int tile_size, tile_width, tile_height, cpp; tile_size =intel_tile_size (dev_priv);
@@ -2334,6 +2336,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[1 ], cpp); + info->uv_offset = fb->offsets[1 ]; info->plane[1 ].width =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); info->plane[1 ].height =DIV_ROUND_UP (fb->height /2 , tile_height); }
@@ -14906,6 +14909,8 @@ static int intel_framebuffer_init(struct drm_device *dev,drm_helper_mode_fill_fb_struct (&intel_fb->base, mode_cmd); intel_fb->obj = obj; +intel_fill_fb_info (dev_priv, &intel_fb->base); + ret =drm_framebuffer_init (dev, &intel_fb->base, &intel_fb_funcs);if (ret) {DRM_ERROR ("framebuffer init failed %d\n" , ret);
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -118,6 +118,7 @@ enum intel_output_type {struct intel_framebuffer {struct drm_framebuffer base;struct drm_i915_gem_object *obj; +struct intel_rotation_info rot_info; };struct intel_fbdev {
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/18] drm/i915: Embed rotation_info under intel_framebuffer
Quoted 5 lines · On Wed, Jan 20, 2016 at 09:05:35PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Instead of repopulatin the
rotation_infostruct for the fb every time we try to use the fb, we can just populate it once when creating the fb, and later we can just copy the pre-populate struct into thegtt_view.
But the rotation state isn't tied to the fb, but to the plane+fb. i.e. I can show the same fb on an unrotated pipe at the same time as showing it rotated, right?
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/18] drm/i915: Embed rotation_info under intel_framebuffer
Quoted 10 lines · Chris Wilson
Quoted 5 lines · On Wed, Jan 20, 2016 at 09:05:35PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Instead of repopulatin the
rotation_infostruct for the fb every time we try to use the fb, we can just populate it once when creating the fb, and later we can just copy the pre-populate struct into thegtt_view.But the rotation state isn't tied to the fb, but to the plane+fb. i.e. I can show the same fb on an unrotated pipe at the same time as showing it rotated, right?
Yep. The rotation info basically just tells us how we need to shuffle the pages for this particular fb if we want to scan it out in the 90/270 degree orientation.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/18] drm/i915: Embed rotation_info under intel_framebuffer
Quoted 8 lines · Ville Syrjälä
Quoted 7 lines · Chris Wilson
Quoted 5 lines · On Wed, Jan 20, 2016 at 09:05:35PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Instead of repopulatin the
rotation_infostruct for the fb every time we try to use the fb, we can just populate it once when creating the fb, and later we can just copy the pre-populate struct into thegtt_view.
Quoted 7 lines
Quoted 3 lines
But the rotation state isn't tied to the fb, but to the plane+fb. i.e. I can show the same fb on an unrotated pipe at the same time as showing it rotated, right?
Yep. The rotation info basically just tells us how we need to shuffle the pages for this particular fb if we want to scan it out in the 90/270 degree orientation.
Ah, gotcha, thanks for the clarification.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/18] drm/i915: Embed rotation_info under intel_framebuffer
In reply to [email protected]Quoted 7 lines · On Wed, Jan 20, 2016 at 09:05:35PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Instead of repopulatin the
rotation_infostruct for the fb every time we try to use the fb, we can just populate it once when creating the fb, and later we can just copy the pre-populate struct into thegtt_view.Signed-off-by Ville Syrjälä <[email protected]>
Let's hope this doesn't balloon too badly in the future, but I think that's unlikely given how rotation works currently (and on other hw).
Quoted 77 lines
--- drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++++----------- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_display.c +16
-11@@ -2307,18 +2307,20 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,const struct drm_framebuffer *fb, unsigned int rotation) { -struct drm_i915_private *dev_priv =to_i915 (fb->dev); -struct intel_rotation_info *info = &view->params.rotated; -unsigned int tile_size, tile_width, tile_height, cpp; - - *view = i915_ggtt_view_normal; - -if (!intel_rotation_90_or_270 (rotation)) -return ; - - *view = i915_ggtt_view_rotated; + if (intel_rotation_90_or_270(rotation)) { + *view = i915_ggtt_view_rotated; + view->params.rotated =to_intel_framebuffer (fb)->rot_info; + } else { + *view = i915_ggtt_view_normal; + } +} - info->uv_offset = fb->offsets[1 ]; +static void +intel_fill_fb_info (struct drm_i915_private *dev_priv, +struct drm_framebuffer *fb) +{ +struct intel_rotation_info *info = &to_intel_framebuffer (fb)->rot_info; +unsigned int tile_size, tile_width, tile_height, cpp; tile_size =intel_tile_size (dev_priv);@@ -2334,6 +2336,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,intel_tile_dims (dev_priv, &tile_width, &tile_height, fb->modifier[1 ], cpp); + info->uv_offset = fb->offsets[1 ]; info->plane[1 ].width =DIV_ROUND_UP (fb->pitches[1 ], tile_width * cpp); info->plane[1 ].height =DIV_ROUND_UP (fb->height /2 , tile_height); }@@ -14906,6 +14909,8 @@ static int intel_framebuffer_init(struct drm_device *dev,drm_helper_mode_fill_fb_struct (&intel_fb->base, mode_cmd); intel_fb->obj = obj; +intel_fill_fb_info (dev_priv, &intel_fb->base); + ret =drm_framebuffer_init (dev, &intel_fb->base, &intel_fb_funcs);if (ret) {DRM_ERROR ("framebuffer init failed %d\n" , ret);drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -118,6 +118,7 @@ enum intel_output_type {struct intel_framebuffer {struct drm_framebuffer base;struct drm_i915_gem_object *obj; +struct intel_rotation_info rot_info; };struct intel_fbdev {Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 15/18 drm/i915: Rewrite fb rotation GTT handling
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Redo the fb rotation handling in order to:
- eliminate the NV12 special casing
- handle fb->offsets[] properly
- make the rotation handling reasier for the plane code
To achieve these goals we reduce intel_rotation_info to only contain (for each plane) the rotated view width,height,stride in tile units, and the page offset into the object where the plane starts. Each plane is handled exactly the same way, no special casing for NV12 or other formats. We then store the computed rotation_info under intel_framebuffer so that we don't have to recompute it again.
To handle fb->offsets[] we treat them as a linear offsets and convert them to x/y offsets from the start of the relevant GTT mapping (either normal or rotated). We store the x/y offsets under intel_framebuffer, and for some extra convenience we also store the rotated pitch (ie. tile aligned plane height). So for each plane we have the normal x/y offsets, rotated x/y offsets, and the rotated pitch. The normal pitch is available already in fb->pitches[].
While we're gathering up all that extra information, we can also easily compute the storage requirements for the framebuffer, so that we can check that the object is big enough to hold it.
When it comes time to deal with the plane source coordinates, we first rotate the clipped src coordinates to match the relevant GTT view orientation, then add to them the fb x/y offsets. Next we compute the aligned surface page offset, and as a result we're left with some residual x/y offsets. Finally, if required by the hardware, we convert the remaining x/y offsets into a linear offset.
For gen2/3 we simply skip computing the final page offset, and just convert the src+fb x/y offsets directly into a linear offset since that's what the hardware wants.
After this all platforms, incluing SKL+, compute these things in exactly the same way (excluding alignemnt differences).
v2: Use BIT(DRM_ROTATE_270) instead of ROTATE_270 when rotating
plane src coordinates
Drop some spurious changes that got left behind during development
v3: Split out more changes to prep patches (Daniel)
s/intel_fb->plane[].foo.bar/intel_fb->foo[].bar/ for brevity Rename intel_surf_gtt_offset to intel_fb_gtt_offset Kill the pointless 'plane' parameter from intel_fb_gtt_offset()
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 51 ++--- drivers/gpu/drm/i915/i915_gem_gtt.h | 5 +- drivers/gpu/drm/i915/intel_display.c | 376 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_drv.h | 19 +- drivers/gpu/drm/i915/intel_sprite.c | 97 ++++----- 5 files changed, 331 insertions(+), 217 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +12 -39
@@ -3359,16 +3359,14 @@ rotate_pages(const dma_addr_t *in, unsigned int offset, }static struct sg_table * -intel_rotate_fb_obj_pages (struct intel_rotation_info *rot_info, +intel_rotate_fb_obj_pages (const struct intel_rotation_info *rot_info,struct drm_i915_gem_object *obj) { -unsigned int size_pages = rot_info->plane[0 ].width * rot_info->plane[0 ].height; -unsigned int size_pages_uv; +unsigned int size =intel_rotation_info_size (rot_info);struct sg_page_iter sg_iter;unsigned long i;dma_addr_t *page_addr_list;struct sg_table *st; -unsigned int uv_start_page;struct scatterlist *sg;int ret = -ENOMEM ;
@@ -3378,18 +3376,12 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info,if (!page_addr_list)return ERR_PTR (ret); -/* Account for UV plane with NV12. */ -if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) - size_pages_uv = rot_info->plane[1 ].width * rot_info->plane[1 ].height; -else - size_pages_uv =0 ; -/* Allocate target SG list. */ st =kmalloc (sizeof (*st),GFP_KERNEL );if (!st) goto err_st_alloc; - ret =sg_alloc_table (st, size_pages + size_pages_uv,GFP_KERNEL ); + ret =sg_alloc_table (st, size,GFP_KERNEL );if (ret) goto err_sg_alloc;
@@ -3403,32 +3395,14 @@ intel_rotate_fb_obj_pages(struct intel_rotation_info *rot_info, st->nents =0 ; sg = st->sgl; -/* Rotate the pages. */ - sg =rotate_pages (page_addr_list,0 , - rot_info->plane[0 ].width, rot_info->plane[0 ].height, - rot_info->plane[0 ].width, - st, sg); - -/* Append the UV plane if NV12. */ -if (rot_info->pixel_format ==DRM_FORMAT_NV12 ) { - uv_start_page = size_pages; - -/* Check for tile-row un-alignment. */ -if (offset_in_page (rot_info->uv_offset)) - uv_start_page--; - - rot_info->uv_start_page = uv_start_page; - - sg =rotate_pages (page_addr_list, rot_info->uv_start_page, - rot_info->plane[1 ].width, rot_info->plane[1 ].height, - rot_info->plane[1 ].width, - st, sg); +for (i =0 ; i <ARRAY_SIZE (rot_info->plane); i++) { + sg =rotate_pages (page_addr_list, rot_info->plane[i].offset, + rot_info->plane[i].width, rot_info->plane[i].height, + rot_info->plane[i].stride, st, sg); } -DRM_DEBUG_KMS ("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages (%u plane 0)).\n" , - obj->base.size, rot_info->plane[0 ].width, - rot_info->plane[0 ].height, size_pages + size_pages_uv, - size_pages); +DRM_DEBUG_KMS ("Created rotated page mapping for object size %zu (%ux%u tiles, %u pages)\n" , + obj->base.size, rot_info->plane[0 ].width, rot_info->plane[0 ].height, size);drm_free_large (page_addr_list);
@@ -3439,10 +3413,9 @@ err_sg_alloc: err_st_alloc:drm_free_large (page_addr_list); -DRM_DEBUG_KMS ("Failed to create rotated mapping for object size %zu! (%d) (%ux%u tiles, %u pages (%u plane 0))\n" , - obj->base.size, ret, rot_info->plane[0 ].width, - rot_info->plane[0 ].height, size_pages + size_pages_uv, - size_pages); +DRM_DEBUG_KMS ("Failed to create rotated mapping for object size %zu! (%ux%u tiles, %u pages)\n" , + obj->base.size, rot_info->plane[0 ].width, rot_info->plane[0 ].height, size); +return ERR_PTR (ret); }
drivers/gpu/drm/i915/i915_gem_gtt.h +1 -4
@@ -135,12 +135,9 @@ enum i915_ggtt_view_type { };struct intel_rotation_info { -unsigned int uv_offset; -uint32_t pixel_format; -unsigned int uv_start_page;struct {/* tiles */ -unsigned int width, height; +unsigned int width, height, stride, offset; } plane[2 ]; };
drivers/gpu/drm/i915/intel_display.c +252 -124
536 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +16 -3
@@ -119,6 +119,16 @@ struct intel_framebuffer {struct drm_framebuffer base;struct drm_i915_gem_object *obj;struct intel_rotation_info rot_info; + +/* for each plane in the normal GTT view */ +struct { +unsigned int x, y; + } normal[2 ]; +/* for each plane in the rotated GTT view */ +struct { +unsigned int x, y; +unsigned int pitch;/* pixels */ + } rotated[2 ]; };struct intel_fbdev {
@@ -1060,6 +1070,11 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);/* intel_display.c */ extern const struct drm_plane_funcs intel_plane_funcs; +unsigned int intel_fb_xy_to_linear (int x,int y, +const struct drm_framebuffer *fb,int plane); +void intel_add_fb_offsets (int *x,int *y, +const struct drm_framebuffer *fb,int plane, +unsigned int rotation);unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info);bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);
@@ -1217,9 +1232,7 @@ void intel_modeset_preclose(struct drm_device *dev, struct drm_file *file);int skl_update_scaler_crtc (struct intel_crtc_state *crtc_state);int skl_max_scale (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state); -u32 intel_plane_obj_offset (struct intel_plane *intel_plane, -struct drm_i915_gem_object *obj, -unsigned int plane); +u32 intel_fb_gtt_offset (struct drm_framebuffer *fb,unsigned int rotation);u32 skl_plane_ctl_format (uint32_t pixel_format);u32 skl_plane_ctl_tiling (uint64_t fb_modifier);
drivers/gpu/drm/i915/intel_sprite.c +50 -47
216 lines not on this page · raw message
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 16/18 drm/i915: Don't pass pitch to intel_compute_page_offset()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_compute_page_offset() can dig up the correct pitch from the fb itself, no need for the caller to pass it in.
A bit of extra care is needed for the lower level _intel_compute_page_offset() since that one gets called before the rotated pitch under intel_fb is populated. Note that we don't actually call it with anything but DRM_ROTATE_0 there so we wouldn't actually look up the rotated pitch there, but still, leave the pitch as something the caller has to pass to _intel_compute_page_offset() as an indicator that something is a bit special.
This leaves 'stride_div' in the skl plane update hooks as a mostly useless variable so just get rid of it.
v2: Add a note why stride_div got nuked
--- drivers/gpu/drm/i915/intel_display.c | 30 ++++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 1 - drivers/gpu/drm/i915/intel_sprite.c | 26 +++++++++++--------------- 3 files changed, 27 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/intel_display.c +16 -14
@@ -2562,11 +2562,16 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,unsigned int intel_compute_tile_offset (int *x,int *y,const struct drm_framebuffer *fb,int plane, -unsigned int pitch,unsigned int rotation) {const struct drm_i915_private *dev_priv =to_i915 (fb->dev);unsigned int alignment =intel_surf_alignment (dev_priv, fb->modifier[plane]); +unsigned int pitch; + +if (intel_rotation_90_or_270 (rotation)) + pitch =to_intel_framebuffer (fb)->rotated[plane].pitch; +else + pitch = fb->pitches[plane];return _intel_compute_tile_offset (dev_priv, x, y, fb, plane, pitch, rotation, alignment ? (alignment -1 ) :0 );
@@ -2988,8 +2993,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,if (INTEL_INFO (dev)->gen >=4 ) intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); +intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;
@@ -3091,8 +3095,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,intel_add_fb_offsets (&x, &y, fb,0 , rotation); intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); +intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;
@@ -3263,7 +3266,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane,struct intel_crtc *intel_crtc =to_intel_crtc (crtc_state->base.crtc);struct drm_framebuffer *fb = plane_state->base.fb;int pipe = intel_crtc->pipe; -u32 plane_ctl, stride_div, stride; +u32 plane_ctl, stride;unsigned int rotation = plane_state->base.rotation;u32 surf_addr;int scaler_id = plane_state->scaler_id;
@@ -3303,17 +3306,16 @@ static void skylake_update_primary_plane(struct drm_plane *plane, src_w =drm_rect_width (&r); src_h =drm_rect_height (&r); - stride_div =intel_tile_height (dev_priv, fb->modifier[0 ], cpp); - stride = intel_fb->rotated[0 ].pitch; + stride = intel_fb->rotated[0 ].pitch / +intel_tile_height (dev_priv, fb->modifier[0 ], cpp); }else { - stride_div =intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], - fb->pixel_format); - stride = fb->pitches[0 ]; + stride = fb->pitches[0 ] / +intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], + fb->pixel_format); }intel_add_fb_offsets (&src_x, &src_y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&src_x, &src_y, fb,0 , - stride, rotation); + surf_addr =intel_compute_tile_offset (&src_x, &src_y, fb,0 , rotation);/* Sizes are 0 based */ src_w--;
@@ -3326,7 +3328,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane,I915_WRITE (PLANE_CTL (pipe,0 ), plane_ctl);I915_WRITE (PLANE_OFFSET (pipe,0 ), (src_y <<16 ) | src_x); -I915_WRITE (PLANE_STRIDE (pipe,0 ), stride / stride_div); +I915_WRITE (PLANE_STRIDE (pipe,0 ), stride);I915_WRITE (PLANE_SIZE (pipe,0 ), (src_h <<16 ) | src_w);if (scaler_id >=0 ) {
drivers/gpu/drm/i915/intel_drv.h +0 -1
@@ -1190,7 +1190,6 @@ void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);#define assert_pipe_disabled (d, p) assert_pipe(d, p, false)u32 intel_compute_tile_offset (int *x,int *y,const struct drm_framebuffer *fb,int plane, -unsigned int pitch,unsigned int rotation);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);
drivers/gpu/drm/i915/intel_sprite.c +11 -15
@@ -189,7 +189,7 @@ skl_update_plane(struct drm_plane *drm_plane,struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb);const int pipe = intel_plane->pipe;const int plane = intel_plane->plane +1 ; -u32 plane_ctl, stride_div, stride; +u32 plane_ctl, stride;const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr;unsigned int rotation = plane_state->base.rotation;
@@ -241,17 +241,16 @@ skl_update_plane(struct drm_plane *drm_plane, src_w =drm_rect_width (&r); src_h =drm_rect_height (&r); - stride_div =intel_tile_height (dev_priv, fb->modifier[0 ], cpp); - stride = intel_fb->rotated[0 ].pitch; + stride = intel_fb->rotated[0 ].pitch / +intel_tile_height (dev_priv, fb->modifier[0 ], cpp); }else { - stride_div =intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], - fb->pixel_format); - stride = fb->pitches[0 ]; + stride = fb->pitches[0 ] / +intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], + fb->pixel_format); }intel_add_fb_offsets (&x, &y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&x, &y, fb,0 , - stride, rotation); + surf_addr =intel_compute_tile_offset (&x, &y, fb,0 , rotation);/* Sizes are 0 based */ src_w--;
@@ -260,7 +259,7 @@ skl_update_plane(struct drm_plane *drm_plane, crtc_h--;I915_WRITE (PLANE_OFFSET (pipe, plane), (y <<16 ) | x); -I915_WRITE (PLANE_STRIDE (pipe, plane), stride / stride_div); +I915_WRITE (PLANE_STRIDE (pipe, plane), stride);I915_WRITE (PLANE_SIZE (pipe, plane), (src_h <<16 ) | src_w);/* program plane scaler */
@@ -428,8 +427,7 @@ vlv_update_plane(struct drm_plane *dplane, crtc_h--;intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); + sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ;
@@ -560,8 +558,7 @@ ivb_update_plane(struct drm_plane *plane, sprscale =SPRITE_SCALE_ENABLE | (src_w <<16 ) | src_h;intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); + sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;
@@ -696,8 +693,7 @@ ilk_update_plane(struct drm_plane *plane, dvsscale =DVS_SCALE_ENABLE | (src_w <<16 ) | src_h;intel_add_fb_offsets (&x, &y, fb,0 , rotation); - dvssurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); + dvssurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 16/18] drm/i915: Don't pass pitch to intel_compute_page_offset()
Quoted 13 lines · On Wed, Jan 20, 2016 at 09:05:37PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
intel_compute_page_offset()can dig up the correct pitch from the fb itself, no need for the caller to pass it in.A bit of extra care is needed for the lower level
_intel_compute_page_offset()since that one gets called before the rotated pitch underintel_fbis populated. Note that we don't actually call it with anything butDRM_ROTATE_0there so we wouldn't actually look up the rotated pitch there, but still, leave the pitch as something the caller has to pass to_intel_compute_page_offset()as an indicator that something is a bit special.
Quoted 6 lines
This leaves '
stride_div' in the skl plane update hooks as a mostly useless variable so just get rid of it.v2: Add a note why
stride_divgot nukedSigned-off-by Ville Syrjälä <[email protected]>
Quoted 185 lines
--- drivers/gpu/drm/i915/intel_display.c | 30 ++++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 1 - drivers/gpu/drm/i915/intel_sprite.c | 26 +++++++++++--------------- 3 files changed, 27 insertions(+), 30 deletions(-)drivers/gpu/drm/i915/intel_display.c +16
-14@@ -2562,11 +2562,16 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,unsigned int intel_compute_tile_offset (int *x,int *y,const struct drm_framebuffer *fb,int plane, -unsigned int pitch,unsigned int rotation) {const struct drm_i915_private *dev_priv =to_i915 (fb->dev);unsigned int alignment =intel_surf_alignment (dev_priv, fb->modifier[plane]); +unsigned int pitch; + +if (intel_rotation_90_or_270 (rotation)) + pitch =to_intel_framebuffer (fb)->rotated[plane].pitch; +else + pitch = fb->pitches[plane];return _intel_compute_tile_offset (dev_priv, x, y, fb, plane, pitch, rotation, alignment ? (alignment -1 ) :0 );@@ -2988,8 +2993,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,if (INTEL_INFO (dev)->gen >=4 ) intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); +intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;@@ -3091,8 +3095,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,intel_add_fb_offsets (&x, &y, fb,0 , rotation); intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); +intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;@@ -3263,7 +3266,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane,struct intel_crtc *intel_crtc =to_intel_crtc (crtc_state->base.crtc);struct drm_framebuffer *fb = plane_state->base.fb;int pipe = intel_crtc->pipe; -u32 plane_ctl, stride_div, stride; +u32 plane_ctl, stride;unsigned int rotation = plane_state->base.rotation;u32 surf_addr;int scaler_id = plane_state->scaler_id;@@ -3303,17 +3306,16 @@ static void skylake_update_primary_plane(struct drm_plane *plane, src_w =drm_rect_width (&r); src_h =drm_rect_height (&r); - stride_div =intel_tile_height (dev_priv, fb->modifier[0 ], cpp); - stride = intel_fb->rotated[0 ].pitch; + stride = intel_fb->rotated[0 ].pitch / +intel_tile_height (dev_priv, fb->modifier[0 ], cpp); }else { - stride_div =intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], - fb->pixel_format); - stride = fb->pitches[0 ]; + stride = fb->pitches[0 ] / +intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], + fb->pixel_format); }intel_add_fb_offsets (&src_x, &src_y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&src_x, &src_y, fb,0 , - stride, rotation); + surf_addr =intel_compute_tile_offset (&src_x, &src_y, fb,0 , rotation);/* Sizes are 0 based */ src_w--;@@ -3326,7 +3328,7 @@ static void skylake_update_primary_plane(struct drm_plane *plane,I915_WRITE (PLANE_CTL (pipe,0 ), plane_ctl);I915_WRITE (PLANE_OFFSET (pipe,0 ), (src_y <<16 ) | src_x); -I915_WRITE (PLANE_STRIDE (pipe,0 ), stride / stride_div); +I915_WRITE (PLANE_STRIDE (pipe,0 ), stride);I915_WRITE (PLANE_SIZE (pipe,0 ), (src_h <<16 ) | src_w);if (scaler_id >=0 ) {drivers/gpu/drm/i915/intel_drv.h +0
-1@@ -1190,7 +1190,6 @@ void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);#define assert_pipe_disabled (d, p) assert_pipe(d, p, false)u32 intel_compute_tile_offset (int *x,int *y,const struct drm_framebuffer *fb,int plane, -unsigned int pitch,unsigned int rotation);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);drivers/gpu/drm/i915/intel_sprite.c +11
-15@@ -189,7 +189,7 @@ skl_update_plane(struct drm_plane *drm_plane,struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb);const int pipe = intel_plane->pipe;const int plane = intel_plane->plane +1 ; -u32 plane_ctl, stride_div, stride; +u32 plane_ctl, stride;const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;u32 surf_addr;unsigned int rotation = plane_state->base.rotation;@@ -241,17 +241,16 @@ skl_update_plane(struct drm_plane *drm_plane, src_w =drm_rect_width (&r); src_h =drm_rect_height (&r); - stride_div =intel_tile_height (dev_priv, fb->modifier[0 ], cpp); - stride = intel_fb->rotated[0 ].pitch; + stride = intel_fb->rotated[0 ].pitch / +intel_tile_height (dev_priv, fb->modifier[0 ], cpp); }else { - stride_div =intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], - fb->pixel_format); - stride = fb->pitches[0 ]; + stride = fb->pitches[0 ] / +intel_fb_stride_alignment (dev_priv, fb->modifier[0 ], + fb->pixel_format); }intel_add_fb_offsets (&x, &y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&x, &y, fb,0 , - stride, rotation); + surf_addr =intel_compute_tile_offset (&x, &y, fb,0 , rotation);/* Sizes are 0 based */ src_w--;@@ -260,7 +259,7 @@ skl_update_plane(struct drm_plane *drm_plane, crtc_h--;I915_WRITE (PLANE_OFFSET (pipe, plane), (y <<16 ) | x); -I915_WRITE (PLANE_STRIDE (pipe, plane), stride / stride_div); +I915_WRITE (PLANE_STRIDE (pipe, plane), stride);I915_WRITE (PLANE_SIZE (pipe, plane), (src_h <<16 ) | src_w);/* program plane scaler */ @@ -428,8 +427,7 @@ vlv_update_plane(struct drm_plane *dplane, crtc_h--;intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); + sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ;@@ -560,8 +558,7 @@ ivb_update_plane(struct drm_plane *plane, sprscale =SPRITE_SCALE_ENABLE | (src_w <<16 ) | src_h;intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); + sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;@@ -696,8 +693,7 @@ ilk_update_plane(struct drm_plane *plane, dvsscale =DVS_SCALE_ENABLE | (src_w <<16 ) | src_h;intel_add_fb_offsets (&x, &y, fb,0 , rotation); - dvssurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , - fb->pitches[0 ], rotation); + dvssurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation);if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ;Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 17/18 drm/i915: Pass around plane_state instead of fb+rotation
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_compute_tile_offset() and intel_add_fb_offsets() get passed the fb and the rotation. As both of those come from the plane state we can just pass that in instead.
For extra consitency pass the plane state to intel_fb_xy_to_linear() as well even though it only really needs the fb.
--- drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++--------------- drivers/gpu/drm/i915/intel_drv.h | 9 ++++----- drivers/gpu/drm/i915/intel_sprite.c | 22 +++++++++++----------- 3 files changed, 35 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/intel_display.c +20 -15
@@ -2442,8 +2442,10 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation* with gen2/3, and 90/270 degree rotations isn't supported on any of them. */ unsigned int intel_fb_xy_to_linear (int x,int y, -const struct drm_framebuffer *fb,int plane) +const struct intel_plane_state *state, +int plane) { +const struct drm_framebuffer *fb = state->base.fb;unsigned int cpp =drm_format_plane_cpp (fb->pixel_format, plane);unsigned int pitch = fb->pitches[plane];
@@ -2456,11 +2458,12 @@ unsigned int intel_fb_xy_to_linear(int x, int y,* specify the start of scanout from the beginning of the gtt mapping. */ void intel_add_fb_offsets (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation) +const struct intel_plane_state *state, +int plane) { -const struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); +const struct intel_framebuffer *intel_fb =to_intel_framebuffer (state->base.fb); +unsigned int rotation = state->base.rotation;if (intel_rotation_90_or_270 (rotation)) { *x += intel_fb->rotated[plane].x;
@@ -2561,10 +2564,12 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv, }unsigned int intel_compute_tile_offset (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation) +const struct intel_plane_state *state, +int plane) { -const struct drm_i915_private *dev_priv =to_i915 (fb->dev); +const struct drm_i915_private *dev_priv =to_i915 (state->base.plane->dev); +const struct drm_framebuffer *fb = state->base.fb; +unsigned int rotation = state->base.rotation;unsigned int alignment =intel_surf_alignment (dev_priv, fb->modifier[plane]);unsigned int pitch;
@@ -2989,11 +2994,11 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,if (IS_G4X (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 );if (INTEL_INFO (dev)->gen >=4 ) intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;
@@ -3002,7 +3007,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, y += (crtc_state->pipe_src_h -1 ); } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (INTEL_INFO (dev)->gen <4 ) intel_crtc->dspaddr_offset = linear_offset;
@@ -3092,10 +3097,10 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;
@@ -3106,7 +3111,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, } } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 ); intel_crtc->adjusted_x = x; intel_crtc->adjusted_y = y;
@@ -3314,8 +3319,8 @@ static void skylake_update_primary_plane(struct drm_plane *plane, fb->pixel_format); } -intel_add_fb_offsets (&src_x, &src_y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&src_x, &src_y, fb,0 , rotation); +intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); + surf_addr =intel_compute_tile_offset (&src_x, &src_y, plane_state,0 );/* Sizes are 0 based */ src_w--;
drivers/gpu/drm/i915/intel_drv.h +4 -5
@@ -1071,10 +1071,10 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);/* intel_display.c */ extern const struct drm_plane_funcs intel_plane_funcs;unsigned int intel_fb_xy_to_linear (int x,int y, -const struct drm_framebuffer *fb,int plane); +const struct intel_plane_state *state, +int plane);void intel_add_fb_offsets (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation); +const struct intel_plane_state *state,int plane);unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info);bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);
@@ -1189,8 +1189,7 @@ void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);#define assert_pipe_enabled (d, p) assert_pipe(d, p, true)#define assert_pipe_disabled (d, p) assert_pipe(d, p, false)u32 intel_compute_tile_offset (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation); +const struct intel_plane_state *state,int plane);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_sprite.c +11 -11
@@ -249,8 +249,8 @@ skl_update_plane(struct drm_plane *drm_plane, fb->pixel_format); } -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + surf_addr =intel_compute_tile_offset (&x, &y, plane_state,0 );/* Sizes are 0 based */ src_w--;
@@ -426,8 +426,8 @@ vlv_update_plane(struct drm_plane *dplane, crtc_w--; crtc_h--; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + sprsurf_offset =intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ;
@@ -436,7 +436,7 @@ vlv_update_plane(struct drm_plane *dplane, y += src_h; } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (key->flags) {I915_WRITE (SPKEYMINVAL (pipe, plane), key->min_value);
@@ -557,8 +557,8 @@ ivb_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) sprscale =SPRITE_SCALE_ENABLE | (src_w <<16 ) | src_h; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + sprsurf_offset =intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;
@@ -570,7 +570,7 @@ ivb_update_plane(struct drm_plane *plane, } } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (key->flags) {I915_WRITE (SPRKEYVAL (pipe), key->min_value);
@@ -692,8 +692,8 @@ ilk_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) dvsscale =DVS_SCALE_ENABLE | (src_w <<16 ) | src_h; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - dvssurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + dvssurf_offset =intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ;
@@ -702,7 +702,7 @@ ilk_update_plane(struct drm_plane *plane, y += src_h; } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (key->flags) {I915_WRITE (DVSKEYVAL (pipe), key->min_value);
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 17/18] drm/i915: Pass around plane_state instead of fb+rotation
Quoted 10 lines · On Wed, Jan 20, 2016 at 09:05:38PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
intel_compute_tile_offset()andintel_add_fb_offsets()get passed the fb and the rotation. As both of those come from the plane state we can just pass that in instead.For extra consitency pass the plane state to
intel_fb_xy_to_linear()as well even though it only really needs the fb.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 220 lines
--- drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++--------------- drivers/gpu/drm/i915/intel_drv.h | 9 ++++----- drivers/gpu/drm/i915/intel_sprite.c | 22 +++++++++++----------- 3 files changed, 35 insertions(+), 31 deletions(-)drivers/gpu/drm/i915/intel_display.c +20
-15@@ -2442,8 +2442,10 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation* with gen2/3, and 90/270 degree rotations isn't supported on any of them. */ unsigned int intel_fb_xy_to_linear (int x,int y, -const struct drm_framebuffer *fb,int plane) +const struct intel_plane_state *state, +int plane) { +const struct drm_framebuffer *fb = state->base.fb;unsigned int cpp =drm_format_plane_cpp (fb->pixel_format, plane);unsigned int pitch = fb->pitches[plane];@@ -2456,11 +2458,12 @@ unsigned int intel_fb_xy_to_linear(int x, int y,* specify the start of scanout from the beginning of the gtt mapping. */ void intel_add_fb_offsets (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation) +const struct intel_plane_state *state, +int plane) { -const struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); +const struct intel_framebuffer *intel_fb =to_intel_framebuffer (state->base.fb); +unsigned int rotation = state->base.rotation;if (intel_rotation_90_or_270 (rotation)) { *x += intel_fb->rotated[plane].x;@@ -2561,10 +2564,12 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv, }unsigned int intel_compute_tile_offset (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation) +const struct intel_plane_state *state, +int plane) { -const struct drm_i915_private *dev_priv =to_i915 (fb->dev); +const struct drm_i915_private *dev_priv =to_i915 (state->base.plane->dev); +const struct drm_framebuffer *fb = state->base.fb; +unsigned int rotation = state->base.rotation;unsigned int alignment =intel_surf_alignment (dev_priv, fb->modifier[plane]);unsigned int pitch;@@ -2989,11 +2994,11 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,if (IS_G4X (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 );if (INTEL_INFO (dev)->gen >=4 ) intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;@@ -3002,7 +3007,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, y += (crtc_state->pipe_src_h -1 ); } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (INTEL_INFO (dev)->gen <4 ) intel_crtc->dspaddr_offset = linear_offset;@@ -3092,10 +3097,10 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); intel_crtc->dspaddr_offset = -intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;@@ -3106,7 +3111,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, } } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 ); intel_crtc->adjusted_x = x; intel_crtc->adjusted_y = y;@@ -3314,8 +3319,8 @@ static void skylake_update_primary_plane(struct drm_plane *plane, fb->pixel_format); } -intel_add_fb_offsets (&src_x, &src_y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&src_x, &src_y, fb,0 , rotation); +intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); + surf_addr =intel_compute_tile_offset (&src_x, &src_y, plane_state,0 );/* Sizes are 0 based */ src_w--;drivers/gpu/drm/i915/intel_drv.h +4
-5@@ -1071,10 +1071,10 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);/* intel_display.c */ extern const struct drm_plane_funcs intel_plane_funcs;unsigned int intel_fb_xy_to_linear (int x,int y, -const struct drm_framebuffer *fb,int plane); +const struct intel_plane_state *state, +int plane);void intel_add_fb_offsets (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation); +const struct intel_plane_state *state,int plane);unsigned int intel_rotation_info_size (const struct intel_rotation_info *rot_info);bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);@@ -1189,8 +1189,7 @@ void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);#define assert_pipe_enabled (d, p) assert_pipe(d, p, true)#define assert_pipe_disabled (d, p) assert_pipe(d, p, false)u32 intel_compute_tile_offset (int *x,int *y, -const struct drm_framebuffer *fb,int plane, -unsigned int rotation); +const struct intel_plane_state *state,int plane);void intel_prepare_reset (struct drm_device *dev);void intel_finish_reset (struct drm_device *dev);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_sprite.c +11
-11@@ -249,8 +249,8 @@ skl_update_plane(struct drm_plane *drm_plane, fb->pixel_format); } -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - surf_addr =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + surf_addr =intel_compute_tile_offset (&x, &y, plane_state,0 );/* Sizes are 0 based */ src_w--;@@ -426,8 +426,8 @@ vlv_update_plane(struct drm_plane *dplane, crtc_w--; crtc_h--; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + sprsurf_offset =intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ;@@ -436,7 +436,7 @@ vlv_update_plane(struct drm_plane *dplane, y += src_h; } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (key->flags) {I915_WRITE (SPKEYMINVAL (pipe, plane), key->min_value);@@ -557,8 +557,8 @@ ivb_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) sprscale =SPRITE_SCALE_ENABLE | (src_w <<16 ) | src_h; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - sprsurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + sprsurf_offset =intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;@@ -570,7 +570,7 @@ ivb_update_plane(struct drm_plane *plane, } } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (key->flags) {I915_WRITE (SPRKEYVAL (pipe), key->min_value);@@ -692,8 +692,8 @@ ilk_update_plane(struct drm_plane *plane,if (crtc_w != src_w || crtc_h != src_h) dvsscale =DVS_SCALE_ENABLE | (src_w <<16 ) | src_h; -intel_add_fb_offsets (&x, &y, fb,0 , rotation); - dvssurf_offset =intel_compute_tile_offset (&x, &y, fb,0 , rotation); +intel_add_fb_offsets (&x, &y, plane_state,0 ); + dvssurf_offset =intel_compute_tile_offset (&x, &y, plane_state,0 );if (rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ;@@ -702,7 +702,7 @@ ilk_update_plane(struct drm_plane *plane, y += src_h; } - linear_offset =intel_fb_xy_to_linear (x, y, fb,0 ); + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 );if (key->flags) {I915_WRITE (DVSKEYVAL (pipe), key->min_value);Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 18/18 drm/i915: Make sure fb offset is (macro)pixel aligned
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We convert the fb->offsets[] into x/y offsets, so they must be (macro)pixel aligned. Check for this, and if things look good allow fb->offsets[] != 0 when creating fbs since we now handle them correctly.
v2: Move to last place in the series and improve the commit message
--- drivers/gpu/drm/i915/intel_display.c | 37 +++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +34 -3
@@ -14909,6 +14909,37 @@ u32 intel_fb_pitch_limit(struct drm_device *dev, uint64_t fb_modifier, } } +static int intel_fb_check_offsets (const struct drm_mode_fb_cmd2 *mode_cmd) +{ +uint32_t format = mode_cmd->pixel_format; +int num_planes =drm_format_num_planes (format); +int i; + +for (i =0 ; i < num_planes; i++) { +unsigned int cpp; + +switch (format) { +case DRM_FORMAT_YUYV : +case DRM_FORMAT_UYVY : +case DRM_FORMAT_YVYU : +case DRM_FORMAT_VYUY : + cpp =4 ; +break ; +default : + cpp =drm_format_plane_cpp (format, i); +break ; + } + +if (mode_cmd->offsets[i] % cpp) { +DRM_DEBUG ("fb plane %d offset 0x%08x not (macro)pixel aligned\n" , + i, mode_cmd->offsets[i]); +return -EINVAL ; + } + } + +return 0 ; +} + static int intel_framebuffer_init(struct drm_device *dev, struct intel_framebuffer *intel_fb, struct drm_mode_fb_cmd2 *mode_cmd,
@@ -15035,9 +15066,9 @@ static int intel_framebuffer_init(struct drm_device *dev,return -EINVAL ; } -/* FIXME need to adjust LINOFF/TILEOFF accordingly. */ -if (mode_cmd->offsets[0 ] !=0 ) -return -EINVAL ; + ret =intel_fb_check_offsets (mode_cmd); +if (ret) +return ret;drm_helper_mode_fill_fb_struct (&intel_fb->base, mode_cmd); intel_fb->obj = obj;
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2)
In reply to [email protected]== Summary ==
== Summary ==
Built on 8fe9e785ae04fa7c37f7935cff12d62e38054b60 drm-intel-nightly: 2016y-01m-21d-11h-02m-42s UTC integration manifest
bdw-nuci7 total:140 pass:131 dwarn:0 dfail:0 fail:0 skip:9 bdw-ultra total:143 pass:137 dwarn:0 dfail:0 fail:0 skip:6 bsw-nuc-2 total:143 pass:119 dwarn:0 dfail:0 fail:0 skip:24 byt-nuc total:143 pass:128 dwarn:0 dfail:0 fail:0 skip:15 hsw-brixbox total:143 pass:136 dwarn:0 dfail:0 fail:0 skip:7 hsw-gt2 total:143 pass:139 dwarn:0 dfail:0 fail:0 skip:4 ilk-hp8440p total:143 pass:104 dwarn:1 dfail:0 fail:0 skip:38 ivb-t430s total:143 pass:137 dwarn:0 dfail:0 fail:0 skip:6 skl-i5k-2 total:143 pass:134 dwarn:1 dfail:0 fail:0 skip:8 skl-i7k-2 total:143 pass:134 dwarn:1 dfail:0 fail:0 skip:8 snb-dellxps total:143 pass:129 dwarn:0 dfail:0 fail:0 skip:14 snb-x220t total:143 pass:129 dwarn:0 dfail:0 fail:1 skip:13
Results at /archive/results/CI_IGT_test/Patchwork_1235/
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2) (rev2)
In reply to [email protected]== Summary ==
== Summary ==
Series 2679v2 drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2)
2016-01-29T18:01:25.652420 http://patchwork.freedesktop.org/api/1.0/series/2679/revisions/2/mbox/
Applying: drm/i915: Rename the rotated gtt view member to 'rotated' Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_gem_gtt.c
M drivers/gpu/drm/i915/i915_gem_gtt.h
M drivers/gpu/drm/i915/intel_display.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_gem_gtt.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_gem_gtt.c Patch failed at 0001 drm/i915: Rename the rotated gtt view member to 'rotated'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2) (rev2)
In reply to [email protected]== Summary ==
== Summary ==
Series 2679v2 drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2)
2016-01-29T18:01:25.652420 http://patchwork.freedesktop.org/api/1.0/series/2679/revisions/2/mbox/
Applying: drm/i915: Rename the rotated gtt view member to 'rotated' Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_gem_gtt.c
M drivers/gpu/drm/i915/i915_gem_gtt.h
M drivers/gpu/drm/i915/intel_display.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_gem_gtt.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_gem_gtt.c Patch failed at 0001 drm/i915: Rename the rotated gtt view member to 'rotated'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2) (rev3)
In reply to [email protected]== Summary ==
== Summary ==
Series 2679v3 drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v2)
2016-02-09T15:30:40.543598 http://patchwork.freedesktop.org/api/1.0/series/2679/revisions/3/mbox/
Applying: drm/i915: Rename the rotated gtt view member to 'rotated' Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_gem_gtt.c
M drivers/gpu/drm/i915/i915_gem_gtt.h
M drivers/gpu/drm/i915/intel_display.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_gem_gtt.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_gem_gtt.c Patch failed at 0001 drm/i915: Rename the rotated gtt view member to 'rotated'
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx