Skylake primary plane read-out v2
Subsystems (2)
cover Skylake primary plane read-out v2
Follow up of:
http://lists.freedesktop.org/archives/intel-gfx/2015-January/058607.html
With the following changes:
- Rebased on top of today's -nightly
- Added the r-b tags
Signature · 26 lines
Damien Damien Lespiau (9): drm/i915: Change plane_config to store a tiling_mode drm/i915: Use a common function for computing the fb height alignment drm/i915: Unclutter the get_plane() functions drm/i915: Don't use crtc->plane in ILK+ get_config() drm/i915: Use pipe_name() in the get_plane_config() functions drm/i915: Make intel_format_to_fourcc() static drm/i915/skl: intel_format_to_fourcc() doesn't work for SKL planes drm/i915/skl: Provide a Skylake version of get_plane_config() drm/i915: Rename plane_config to initial_plane_config drivers/gpu/drm/i915/i915_drv.h | 6 +- drivers/gpu/drm/i915/intel_display.c | 257 +++++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_drv.h | 9 +- drivers/gpu/drm/i915/intel_fbdev.c | 5 +- 4 files changed, 193 insertions(+), 84 deletions(-) -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/9 drm/i915: Change plane_config to store a tiling_mode
Rather than having "tiled" meaning "is it X-tiled?" convert the field to explicitely store the tiling mode. The code doesn't have to change much as 1 is conveniently I915_TILING_X.
This is to accommodate future changes around tiling modes and scannout buffers.
v2: Rebase on top of Ander's "Make intel_crtc->config a pointer"
--- drivers/gpu/drm/i915/intel_display.c | 17 ++++++++--------- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -9
@@ -2352,10 +2352,9 @@ static bool intel_alloc_plane_obj(struct intel_crtc *crtc,if (!obj)return false; -if (plane_config->tiled) { - obj->tiling_mode =I915_TILING_X ; + obj->tiling_mode = plane_config->tiling; +if (obj->tiling_mode ==I915_TILING_X ) obj->stride = crtc->base.primary->fb->pitches[0 ]; - } mode_cmd.pixel_format = crtc->base.primary->fb->pixel_format; mode_cmd.width = crtc->base.primary->fb->width;
@@ -6565,7 +6564,7 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc,if (INTEL_INFO (dev)->gen >=4 )if (val &DISPPLANE_TILED ) - plane_config->tiled = true; + plane_config->tiling =I915_TILING_X ; pixel_format = val &DISPPLANE_PIXFORMAT_MASK ; fourcc =intel_format_to_fourcc (pixel_format);
@@ -6574,7 +6573,7 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc,drm_format_plane_cpp (fourcc,0 ) *8 ;if (INTEL_INFO (dev)->gen >=4 ) { -if (plane_config->tiled) +if (plane_config->tiling) offset =I915_READ (DSPTILEOFF (plane));else offset =I915_READ (DSPLINOFF (plane));
@@ -6592,7 +6591,7 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, crtc->base.primary->fb->pitches[0 ] = val &0xffffffc0 ; aligned_height =intel_align_height (dev, crtc->base.primary->fb->height, - plane_config->tiled); + plane_config->tiling); plane_config->size =PAGE_ALIGN (crtc->base.primary->fb->pitches[0 ] * aligned_height);
@@ -7619,7 +7618,7 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc,if (INTEL_INFO (dev)->gen >=4 )if (val &DISPPLANE_TILED ) - plane_config->tiled = true; + plane_config->tiling =I915_TILING_X ; pixel_format = val &DISPPLANE_PIXFORMAT_MASK ; fourcc =intel_format_to_fourcc (pixel_format);
@@ -7631,7 +7630,7 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc,if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) { offset =I915_READ (DSPOFFSET (plane)); }else { -if (plane_config->tiled) +if (plane_config->tiling) offset =I915_READ (DSPTILEOFF (plane));else offset =I915_READ (DSPLINOFF (plane));
@@ -7646,7 +7645,7 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, crtc->base.primary->fb->pitches[0 ] = val &0xffffffc0 ; aligned_height =intel_align_height (dev, crtc->base.primary->fb->height, - plane_config->tiled); + plane_config->tiling); plane_config->size =PAGE_ALIGN (crtc->base.primary->fb->pitches[0 ] * aligned_height);
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -258,7 +258,7 @@ struct intel_plane_state { };struct intel_plane_config { -bool tiled; +unsigned int tiling;int size;u32 base; };
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
@@ -593,7 +593,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, } cur_size = intel_crtc->config->base.adjusted_mode.crtc_vdisplay; - cur_size =ALIGN (cur_size, plane_config->tiled ? (IS_GEN2 (dev) ?16 :8 ) :1 ); + cur_size =ALIGN (cur_size, plane_config->tiling ? (IS_GEN2 (dev) ?16 :8 ) :1 ); cur_size *= fb->base.pitches[0 ]; DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n", pipe_name(intel_crtc->pipe),
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/9 drm/i915: Use a common function for computing the fb height alignment
In reply to Damien LespiauIf we need to change the fb height constraints, it sounds like a good idea to have to do it in one place only.
v2: v2: Rebase on top of Ander's "Make intel_crtc->config a pointer"
--- drivers/gpu/drm/i915/intel_display.c | 19 +++++++++++-------- drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_fbdev.c | 3 ++- 3 files changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +11 -8
@@ -2188,11 +2188,12 @@ static bool need_vtd_wa(struct drm_device *dev)return false; } -static int intel_align_height (struct drm_device *dev,int height,bool tiled) +int +intel_fb_align_height (struct drm_device *dev,int height,unsigned int tiling) {int tile_height; - tile_height = tiled ? (IS_GEN2 (dev) ?16 :8 ) :1 ; + tile_height = tiling ? (IS_GEN2 (dev) ?16 :8 ) :1 ;return ALIGN (height, tile_height); }
@@ -6590,8 +6591,9 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, val =I915_READ (DSPSTRIDE (pipe)); crtc->base.primary->fb->pitches[0 ] = val &0xffffffc0 ; - aligned_height =intel_align_height (dev, crtc->base.primary->fb->height, - plane_config->tiling); + aligned_height =intel_fb_align_height (dev, + crtc->base.primary->fb->height, + plane_config->tiling); plane_config->size =PAGE_ALIGN (crtc->base.primary->fb->pitches[0 ] * aligned_height);
@@ -7644,8 +7646,9 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, val =I915_READ (DSPSTRIDE (pipe)); crtc->base.primary->fb->pitches[0 ] = val &0xffffffc0 ; - aligned_height =intel_align_height (dev, crtc->base.primary->fb->height, - plane_config->tiling); + aligned_height =intel_fb_align_height (dev, + crtc->base.primary->fb->height, + plane_config->tiling); plane_config->size =PAGE_ALIGN (crtc->base.primary->fb->pitches[0 ] * aligned_height);
@@ -12609,8 +12612,8 @@ static int intel_framebuffer_init(struct drm_device *dev,if (mode_cmd->offsets[0 ] !=0 )return -EINVAL ; - aligned_height =intel_align_height (dev, mode_cmd->height, - obj->tiling_mode); + aligned_height =intel_fb_align_height (dev, mode_cmd->height, + obj->tiling_mode);/* FIXME drm helper for size checks (especially planar formats)? */ if (obj->base.size < aligned_height * mode_cmd->pitches[0 ])return -EINVAL ;
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -872,6 +872,8 @@ void intel_frontbuffer_flip(struct drm_device *dev,intel_frontbuffer_flush (dev, frontbuffer_bits); } +int intel_fb_align_height (struct drm_device *dev,int height, +unsigned int tiling);void intel_fb_obj_flush (struct drm_i915_gem_object *obj,bool retire);
drivers/gpu/drm/i915/intel_fbdev.c +2 -1
@@ -593,7 +593,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, } cur_size = intel_crtc->config->base.adjusted_mode.crtc_vdisplay; - cur_size =ALIGN (cur_size, plane_config->tiling ? (IS_GEN2 (dev) ?16 :8 ) :1 ); + cur_size =intel_fb_align_height (dev, cur_size, + plane_config->tiling); cur_size *= fb->base.pitches[0 ]; DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n", pipe_name(intel_crtc->pipe),
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/9 drm/i915: Unclutter the get_plane() functions
In reply to Damien Lespiaucrtc->base.primary->fb was used everywhere. Use fb to temporarily point there and don't forget to assign fb to its final destination at the end.
v2: Rebase on top of misc changes (mask of DSPSURF, PAGE_ALIGN)
--- drivers/gpu/drm/i915/intel_display.c | 61 ++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/intel_display.c +27 -34
@@ -6554,9 +6554,10 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc,int pipe = crtc->pipe, plane = crtc->plane;int fourcc, pixel_format;int aligned_height; +struct drm_framebuffer *fb; - crtc->base.primary->fb =kzalloc (sizeof (struct intel_framebuffer ),GFP_KERNEL ); -if (!crtc->base.primary->fb) { + fb =kzalloc (sizeof (struct intel_framebuffer ),GFP_KERNEL ); +if (!fb) {DRM_DEBUG_KMS ("failed to alloc fb\n" );return ; }
@@ -6569,9 +6570,8 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, pixel_format = val &DISPPLANE_PIXFORMAT_MASK ; fourcc =intel_format_to_fourcc (pixel_format); - crtc->base.primary->fb->pixel_format = fourcc; - crtc->base.primary->fb->bits_per_pixel = -drm_format_plane_cpp (fourcc,0 ) *8 ; + fb->pixel_format = fourcc; + fb->bits_per_pixel =drm_format_plane_cpp (fourcc,0 ) *8 ;if (INTEL_INFO (dev)->gen >=4 ) {if (plane_config->tiling)
@@ -6585,26 +6585,22 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, plane_config->base = base; val =I915_READ (PIPESRC (pipe)); - crtc->base.primary->fb->width = ((val >>16 ) &0xfff ) +1 ; - crtc->base.primary->fb->height = ((val >>0 ) &0xfff ) +1 ; + fb->width = ((val >>16 ) &0xfff ) +1 ; + fb->height = ((val >>0 ) &0xfff ) +1 ; val =I915_READ (DSPSTRIDE (pipe)); - crtc->base.primary->fb->pitches[0 ] = val &0xffffffc0 ; + fb->pitches[0 ] = val &0xffffffc0 ; - aligned_height =intel_fb_align_height (dev, - crtc->base.primary->fb->height, + aligned_height =intel_fb_align_height (dev, fb->height, plane_config->tiling); - plane_config->size =PAGE_ALIGN (crtc->base.primary->fb->pitches[0 ] * - aligned_height); + plane_config->size =PAGE_ALIGN (fb->pitches[0 ] * aligned_height);DRM_DEBUG_KMS ("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , - pipe, plane, crtc->base.primary->fb->width, - crtc->base.primary->fb->height, - crtc->base.primary->fb->bits_per_pixel, base, - crtc->base.primary->fb->pitches[0 ], - plane_config->size); + pipe, plane, fb->width, fb->height, fb->bits_per_pixel, + base, fb->pitches[0 ], plane_config->size); + crtc->base.primary->fb = fb; } static void chv_crtc_clock_get(struct intel_crtc *crtc,
@@ -7609,9 +7605,10 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc,int pipe = crtc->pipe, plane = crtc->plane;int fourcc, pixel_format;int aligned_height; +struct drm_framebuffer *fb; - crtc->base.primary->fb =kzalloc (sizeof (struct intel_framebuffer ),GFP_KERNEL ); -if (!crtc->base.primary->fb) { + fb =kzalloc (sizeof (struct intel_framebuffer ),GFP_KERNEL ); +if (!fb) {DRM_DEBUG_KMS ("failed to alloc fb\n" );return ; }
@@ -7624,9 +7621,8 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, pixel_format = val &DISPPLANE_PIXFORMAT_MASK ; fourcc =intel_format_to_fourcc (pixel_format); - crtc->base.primary->fb->pixel_format = fourcc; - crtc->base.primary->fb->bits_per_pixel = -drm_format_plane_cpp (fourcc,0 ) *8 ; + fb->pixel_format = fourcc; + fb->bits_per_pixel =drm_format_plane_cpp (fourcc,0 ) *8 ; base =I915_READ (DSPSURF (plane)) &0xfffff000 ;if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {
@@ -7640,25 +7636,22 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, plane_config->base = base; val =I915_READ (PIPESRC (pipe)); - crtc->base.primary->fb->width = ((val >>16 ) &0xfff ) +1 ; - crtc->base.primary->fb->height = ((val >>0 ) &0xfff ) +1 ; + fb->width = ((val >>16 ) &0xfff ) +1 ; + fb->height = ((val >>0 ) &0xfff ) +1 ; val =I915_READ (DSPSTRIDE (pipe)); - crtc->base.primary->fb->pitches[0 ] = val &0xffffffc0 ; + fb->pitches[0 ] = val &0xffffffc0 ; - aligned_height =intel_fb_align_height (dev, - crtc->base.primary->fb->height, + aligned_height =intel_fb_align_height (dev, fb->height, plane_config->tiling); - plane_config->size =PAGE_ALIGN (crtc->base.primary->fb->pitches[0 ] * - aligned_height); + plane_config->size =PAGE_ALIGN (fb->pitches[0 ] * aligned_height);DRM_DEBUG_KMS ("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , - pipe, plane, crtc->base.primary->fb->width, - crtc->base.primary->fb->height, - crtc->base.primary->fb->bits_per_pixel, base, - crtc->base.primary->fb->pitches[0 ], - plane_config->size); + pipe, plane, fb->width, fb->height, fb->bits_per_pixel, + base, fb->pitches[0 ], plane_config->size); + + crtc->base.primary->fb = fb; } static bool ironlake_get_pipe_config(struct intel_crtc *crtc,
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/9 drm/i915: Don't use crtc->plane in ILK+ get_config()
In reply to Damien Lespiaucrtc->plane can only be different from crtc->pipe pre-Gen4. Don't use it in new-ish code.
--- drivers/gpu/drm/i915/intel_display.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -8
@@ -7602,7 +7602,7 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc,struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv = dev->dev_private;u32 val, base, offset; -int pipe = crtc->pipe, plane = crtc->plane; +int pipe = crtc->pipe;int fourcc, pixel_format;int aligned_height;struct drm_framebuffer *fb;
@@ -7613,7 +7613,7 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc,return ; } - val =I915_READ (DSPCNTR (plane)); + val =I915_READ (DSPCNTR (pipe));if (INTEL_INFO (dev)->gen >=4 )if (val &DISPPLANE_TILED )
@@ -7624,14 +7624,14 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, fb->pixel_format = fourcc; fb->bits_per_pixel =drm_format_plane_cpp (fourcc,0 ) *8 ; - base =I915_READ (DSPSURF (plane)) &0xfffff000 ; + base =I915_READ (DSPSURF (pipe)) &0xfffff000 ;if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) { - offset =I915_READ (DSPOFFSET (plane)); + offset =I915_READ (DSPOFFSET (pipe)); }else {if (plane_config->tiling) - offset =I915_READ (DSPTILEOFF (plane)); + offset =I915_READ (DSPTILEOFF (pipe));else - offset =I915_READ (DSPLINOFF (plane)); + offset =I915_READ (DSPLINOFF (pipe)); } plane_config->base = base;
@@ -7647,8 +7647,8 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, plane_config->size =PAGE_ALIGN (fb->pitches[0 ] * aligned_height); -DRM_DEBUG_KMS ("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , - pipe, plane, fb->width, fb->height, fb->bits_per_pixel, +DRM_DEBUG_KMS ("pipe %d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , + pipe, fb->width, fb->height, fb->bits_per_pixel, base, fb->pitches[0 ], plane_config->size); crtc->base.primary->fb = fb;
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/9 drm/i915: Use pipe_name() in the get_plane_config() functions
In reply to Damien LespiauWe may as well try to be consistent everywhere and know the pipes by their name.
--- drivers/gpu/drm/i915/intel_display.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -6
@@ -6596,9 +6596,10 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, plane_config->size =PAGE_ALIGN (fb->pitches[0 ] * aligned_height); -DRM_DEBUG_KMS ("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , - pipe, plane, fb->width, fb->height, fb->bits_per_pixel, - base, fb->pitches[0 ], plane_config->size); +DRM_DEBUG_KMS ("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , +pipe_name (pipe), plane, fb->width, fb->height, + fb->bits_per_pixel, base, fb->pitches[0 ], + plane_config->size); crtc->base.primary->fb = fb; }
@@ -7647,9 +7648,10 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, plane_config->size =PAGE_ALIGN (fb->pitches[0 ] * aligned_height); -DRM_DEBUG_KMS ("pipe %d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , - pipe, fb->width, fb->height, fb->bits_per_pixel, - base, fb->pitches[0 ], plane_config->size); +DRM_DEBUG_KMS ("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , +pipe_name (pipe), fb->width, fb->height, + fb->bits_per_pixel, base, fb->pitches[0 ], + plane_config->size); crtc->base.primary->fb = fb; }
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/9 drm/i915: Make intel_format_to_fourcc() static
In reply to Damien Lespiauv2: Fix conflict caused by the introduction of struct intel_crtc_state
--- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -2316,7 +2316,7 @@ unsigned long intel_gen4_compute_page_offset(int *x, int *y, } } -int intel_format_to_fourcc (int format) +static int intel_format_to_fourcc (int format) {switch (format) {case DISPPLANE_8BPP :
drivers/gpu/drm/i915/intel_drv.h +0 -1
@@ -991,7 +991,6 @@ enum intel_display_power_domain intel_display_port_power_domain(struct intel_encoder *intel_encoder);void intel_mode_from_pipe_config (struct drm_display_mode *mode,struct intel_crtc_state *pipe_config); -int intel_format_to_fourcc (int format);void intel_crtc_wait_for_pending_flips (struct drm_crtc *crtc);void intel_modeset_preclose (struct drm_device *dev,struct drm_file *file);
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/9 drm/i915/skl: intel_format_to_fourcc() doesn't work for SKL planes
In reply to Damien LespiauWe will have a skl_ version shortly!
--- drivers/gpu/drm/i915/intel_display.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -3
@@ -2316,7 +2316,7 @@ unsigned long intel_gen4_compute_page_offset(int *x, int *y, } } -static int intel_format_to_fourcc (int format) +static int i9xx_format_to_fourcc (int format) {switch (format) {case DISPPLANE_8BPP :
@@ -6569,7 +6569,7 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc, plane_config->tiling =I915_TILING_X ; pixel_format = val &DISPPLANE_PIXFORMAT_MASK ; - fourcc =intel_format_to_fourcc (pixel_format); + fourcc =i9xx_format_to_fourcc (pixel_format); fb->pixel_format = fourcc; fb->bits_per_pixel =drm_format_plane_cpp (fourcc,0 ) *8 ;
@@ -7621,7 +7621,7 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc, plane_config->tiling =I915_TILING_X ; pixel_format = val &DISPPLANE_PIXFORMAT_MASK ; - fourcc =intel_format_to_fourcc (pixel_format); + fourcc =i9xx_format_to_fourcc (pixel_format); fb->pixel_format = fourcc; fb->bits_per_pixel =drm_format_plane_cpp (fourcc,0 ) *8 ;
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/9 drm/i915/skl: Provide a Skylake version of get_plane_config()
In reply to Damien LespiauUniversal planes have changed a bit the register organization.
v2: Rebase on top of the latest drm-intel-nightly
v3: Use PLANE_SIZE to retrieve the fb size (Tvrtko)
Don't use BUG() (Tvrtko)
v4: Use MISSING_CASE (Daniel)
--- drivers/gpu/drm/i915/intel_display.c | 114 ++++++++++++++++++++++++++++++++--- 1 file changed, 107 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_display.c +107 -7
@@ -2337,6 +2337,32 @@ static int i9xx_format_to_fourcc(int format) } } +static int skl_format_to_fourcc (int format,bool rgb_order,bool alpha) +{ +switch (format) { +case PLANE_CTL_FORMAT_RGB_565 : +return DRM_FORMAT_RGB565 ; +default : +case PLANE_CTL_FORMAT_XRGB_8888 : +if (rgb_order) { +if (alpha) +return DRM_FORMAT_ABGR8888 ; +else +return DRM_FORMAT_XBGR8888 ; + }else { +if (alpha) +return DRM_FORMAT_ARGB8888 ; +else +return DRM_FORMAT_XRGB8888 ; + } +case PLANE_CTL_FORMAT_XRGB_2101010 : +if (rgb_order) +return DRM_FORMAT_XBGR2101010 ; +else +return DRM_FORMAT_XRGB2101010 ; + } +} +static bool intel_alloc_plane_obj (struct intel_crtc *crtc,struct intel_plane_config *plane_config) {
@@ -7573,6 +7599,74 @@ static void skylake_get_pfit_config(struct intel_crtc *crtc, } } +static void skylake_get_plane_config (struct intel_crtc *crtc, +struct intel_plane_config *plane_config) +{ +struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +u32 val, base, offset, stride_mult; +int pipe = crtc->pipe; +int fourcc, pixel_format; +int aligned_height; +struct drm_framebuffer *fb; + + fb =kzalloc (sizeof (struct intel_framebuffer ),GFP_KERNEL ); +if (!fb) { +DRM_DEBUG_KMS ("failed to alloc fb\n" ); +return ; + } + + val =I915_READ (PLANE_CTL (pipe,0 )); +if (val &PLANE_CTL_TILED_MASK ) + plane_config->tiling =I915_TILING_X ; + + pixel_format = val &PLANE_CTL_FORMAT_MASK ; + fourcc =skl_format_to_fourcc (pixel_format, + val &PLANE_CTL_ORDER_RGBX , + val &PLANE_CTL_ALPHA_MASK ); + fb->pixel_format = fourcc; + fb->bits_per_pixel =drm_format_plane_cpp (fourcc,0 ) *8 ; + + base =I915_READ (PLANE_SURF (pipe,0 )) &0xfffff000 ; + plane_config->base = base; + + offset =I915_READ (PLANE_OFFSET (pipe,0 )); + + val =I915_READ (PLANE_SIZE (pipe,0 )); + fb->height = ((val >>16 ) &0xfff ) +1 ; + fb->width = ((val >>0 ) &0x1fff ) +1 ; + + val =I915_READ (PLANE_STRIDE (pipe,0 )); +switch (plane_config->tiling) { +case I915_TILING_NONE : + stride_mult =64 ; +break ; +case I915_TILING_X : + stride_mult =512 ; +break ; +default : +MISSING_CASE (plane_config->tiling); + goto error; + } + fb->pitches[0 ] = (val &0x3ff ) * stride_mult; + + aligned_height =intel_fb_align_height (dev, fb->height, + plane_config->tiling); + + plane_config->size =ALIGN (fb->pitches[0 ] * aligned_height,PAGE_SIZE ); + +DRM_DEBUG_KMS ("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n" , +pipe_name (pipe), fb->width, fb->height, + fb->bits_per_pixel, base, fb->pitches[0 ], + plane_config->size); + + crtc->base.primary->fb = fb; +return ; + +error: +kfree (fb); +} +static void ironlake_get_pfit_config (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config) {
@@ -12668,7 +12762,17 @@ static void intel_init_display(struct drm_device *dev)else dev_priv->display.find_dpll = i9xx_find_best_dpll; -if (HAS_DDI (dev)) { +if (INTEL_INFO (dev)->gen >=9 ) { + dev_priv->display.get_pipe_config = haswell_get_pipe_config; + dev_priv->display.get_plane_config = skylake_get_plane_config; + dev_priv->display.crtc_compute_clock = + haswell_crtc_compute_clock; + dev_priv->display.crtc_enable = haswell_crtc_enable; + dev_priv->display.crtc_disable = haswell_crtc_disable; + dev_priv->display.off = ironlake_crtc_off; + dev_priv->display.update_primary_plane = + skylake_update_primary_plane; + }else if (HAS_DDI (dev)) { dev_priv->display.get_pipe_config = haswell_get_pipe_config; dev_priv->display.get_plane_config = ironlake_get_plane_config; dev_priv->display.crtc_compute_clock =
@@ -12676,12 +12780,8 @@ static void intel_init_display(struct drm_device *dev) dev_priv->display.crtc_enable = haswell_crtc_enable; dev_priv->display.crtc_disable = haswell_crtc_disable; dev_priv->display.off = ironlake_crtc_off; -if (INTEL_INFO (dev)->gen >=9 ) - dev_priv->display.update_primary_plane = - skylake_update_primary_plane; -else - dev_priv->display.update_primary_plane = - ironlake_update_primary_plane; + dev_priv->display.update_primary_plane = + ironlake_update_primary_plane; }else if (HAS_PCH_SPLIT (dev)) { dev_priv->display.get_pipe_config = ironlake_get_pipe_config; dev_priv->display.get_plane_config = ironlake_get_plane_config;
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/9 drm/i915: Rename plane_config to initial_plane_config
In reply to Damien LespiauThis vfunc and related structure are only used for fast boot, so let's rename them to not take them as general purpose ones.
v2: Fix conflicts caused by the introduction of struct intel_crtc_state
--- drivers/gpu/drm/i915/i915_drv.h | 6 ++--- drivers/gpu/drm/i915/intel_display.c | 44 ++++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- 4 files changed, 33 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +3 -3
@@ -500,7 +500,7 @@ struct drm_i915_error_state {struct intel_connector ;struct intel_encoder ;struct intel_crtc_state ; -struct intel_plane_config ; +struct intel_initial_plane_config ;struct intel_crtc ;struct intel_limit ;struct dpll ;
@@ -539,8 +539,8 @@ struct drm_i915_display_funcs {* fills out the pipe-config with the hw state. */ bool (*get_pipe_config)(struct intel_crtc *,struct intel_crtc_state *); -void (*get_plane_config)(struct intel_crtc *, -struct intel_plane_config *); +void (*get_initial_plane_config)(struct intel_crtc *, +struct intel_initial_plane_config *);int (*crtc_compute_clock)(struct intel_crtc *crtc,struct intel_crtc_state *crtc_state);void (*crtc_enable)(struct drm_crtc *crtc);
drivers/gpu/drm/i915/intel_display.c +27 -17
110 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +2 -2
@@ -257,7 +257,7 @@ struct intel_plane_state {bool hides_primary; }; -struct intel_plane_config { +struct intel_initial_plane_config {unsigned int tiling;int size;u32 base;
@@ -468,7 +468,7 @@ struct intel_crtc {uint32_t cursor_size;uint32_t cursor_base; -struct intel_plane_config plane_config; +struct intel_initial_plane_config plane_config;struct intel_crtc_state *config;struct intel_crtc_state *new_config;bool new_enabled;
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
@@ -531,7 +531,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,struct intel_framebuffer *fb =NULL ;struct drm_crtc *crtc;struct intel_crtc *intel_crtc; -struct intel_plane_config *plane_config =NULL ; +struct intel_initial_plane_config *plane_config =NULL ;unsigned int max_size =0 ;if (!i915.fastboot)
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx