Enabling 180 degree rotation for sprite and crtc planes
Subsystems (4)
cover Enabling 180 degree rotation for sprite and crtc planes
From: Sagar Kamble <[email protected]>
With these patches 180 degree rotation for crtc and sprite planes will be exposed through drm rotation properties implemented by Ville few days back. I have added CRTC rotation support on top of Ville's 9 patches that includes sprite rotation. Omapdrm changes, rotation_simplify, drm_rect functions are also included in this list. Functionality has been tested with i-g-t test "intel_plane_rotate".
Sagar Kamble (11):
drm: Move DRM_ROTATE bits out of omapdrm into drm_crtc.h
drm: Add drm_mode_create_rotation_property()
drm/omap: Switch omapdrm over to drm_mode_create_rotation_property()
drm: Add drm_rotation_simplify()
drm/i915: Add 180 degree sprite rotation support drm/i915: Make intel_plane_restore() return an error drm/i915: Add rotation property for sprites
drm: Add support_bits parameter to drm_property_create_bitmask()
drm: Add drm_rect rotation functions
drm/i915: Add 180 degree primary plane rotation support
drm: Set property to return invalid for unsupported arguments for
bitmask property
drivers/gpu/drm/drm_crtc.c | 72 +++++++++++++++++- drivers/gpu/drm/drm_rect.c | 140 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 4 + drivers/gpu/drm/i915/intel_display.c | 54 +++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_sprite.c | 90 ++++++++++++++++++++-- drivers/gpu/drm/omapdrm/omap_drv.h | 7 -- drivers/gpu/drm/omapdrm/omap_plane.c | 17 ++--- include/drm/drm_crtc.h | 16 +++- include/drm/drm_rect.h | 6 ++ 11 files changed, 382 insertions(+), 30 deletions(-)
Signature · 1 line
1.8.5
PATCH 1/11 drm: Move DRM_ROTATE bits out of omapdrm into drm_crtc.h
From: Sagar Kamble <[email protected]>
The rotation property stuff should be standardized among all drivers. Move the bits to drm_crtc.h from omap_drv.h.
--- drivers/gpu/drm/omapdrm/omap_drv.h | 7 ------- include/drm/drm_crtc.h | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.h +0 -7
@@ -119,13 +119,6 @@ struct omap_drm_private {struct omap_drm_irq error_handler; }; -/* this should probably be in drm-core to standardize amongst drivers */ -#define DRM_ROTATE_0 0 -#define DRM_ROTATE_90 1 -#define DRM_ROTATE_180 2 -#define DRM_ROTATE_270 3 -#define DRM_REFLECT_X 4 -#define DRM_REFLECT_Y 5#ifdef CONFIG_DEBUG_FS int omap_debugfs_init (struct drm_minor *minor);
include/drm/drm_crtc.h +8 -0
@@ -65,6 +65,14 @@ struct drm_object_properties {uint64_t values[DRM_OBJECT_MAX_PROPERTY ]; }; +/* rotation property bits */ +#define DRM_ROTATE_0 0 +#define DRM_ROTATE_90 1 +#define DRM_ROTATE_180 2 +#define DRM_ROTATE_270 3 +#define DRM_REFLECT_X 4 +#define DRM_REFLECT_Y 5 +/* * Note on terminology: here, for brevity and convenience, we refer to connector * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,
Signature · 1 line
1.8.5
PATCH 2/11 drm: Add drm_mode_create_rotation_property()
In reply to [email protected]From: Sagar Kamble <[email protected]>
Add a function to create a standards compliant rotation property.
--- drivers/gpu/drm/drm_crtc.c | 18 ++++++++++++++++++ include/drm/drm_crtc.h | 2 ++ 2 files changed, 20 insertions(+)
drivers/gpu/drm/drm_crtc.c +18 -0
@@ -4114,3 +4114,21 @@ void drm_mode_config_cleanup(struct drm_device *dev)idr_destroy (&dev->mode_config.crtc_idr); }EXPORT_SYMBOL (drm_mode_config_cleanup); + +struct drm_property *drm_mode_create_rotation_property (struct drm_device *dev, +unsigned int supported_rotations) +{ +static const struct drm_prop_enum_list props[] = { + {DRM_ROTATE_0 ,"rotate-0" }, + {DRM_ROTATE_90 ,"rotate-90" }, + {DRM_ROTATE_180 ,"rotate-180" }, + {DRM_ROTATE_270 ,"rotate-270" }, + {DRM_REFLECT_X ,"reflect-x" }, + {DRM_REFLECT_Y ,"reflect-y" }, + }; + +return drm_property_create_bitmask (dev,0 ,"rotation" , + props,ARRAY_SIZE (props), + supported_rotations); +} +EXPORT_SYMBOL (drm_mode_create_rotation_property);
include/drm/drm_crtc.h +2 -0
@@ -1182,6 +1182,8 @@ 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 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);/* Helpers */ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
Signature · 1 line
1.8.5
PATCH 3/11 drm/omap: Switch omapdrm over to drm_mode_create_rotation_property()
In reply to [email protected]From: Sagar Kamble <[email protected]>
Use the new drm_mode_create_rotation_property() in omapdrm.
--- drivers/gpu/drm/omapdrm/omap_plane.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/gpu/drm/omapdrm/omap_plane.c +7 -10
@@ -300,16 +300,13 @@ void omap_plane_install_properties(struct drm_plane *plane,if (priv->has_dmm) { prop = priv->rotation_prop;if (!prop) { -const struct drm_prop_enum_list props[] = { - {DRM_ROTATE_0 ,"rotate-0" }, - {DRM_ROTATE_90 ,"rotate-90" }, - {DRM_ROTATE_180 ,"rotate-180" }, - {DRM_ROTATE_270 ,"rotate-270" }, - {DRM_REFLECT_X ,"reflect-x" }, - {DRM_REFLECT_Y ,"reflect-y" }, - }; - prop =drm_property_create_bitmask (dev,0 ,"rotation" , - props,ARRAY_SIZE (props)); + prop =drm_mode_create_rotation_property (dev, +BIT (DRM_ROTATE_0 ) | +BIT (DRM_ROTATE_90 ) | +BIT (DRM_ROTATE_180 ) | +BIT (DRM_ROTATE_270 ) | +BIT (DRM_REFLECT_X ) | +BIT (DRM_REFLECT_Y ));if (prop ==NULL )return ; priv->rotation_prop = prop;
Signature · 1 line
1.8.5
PATCH 4/11 drm: Add drm_rotation_simplify()
In reply to [email protected]From: Sagar Kamble <[email protected]>
drm_rotation_simplify() can be used to eliminate unsupported rotation flags. It will check if any unsupported flags are present, and if so it will modify the rotation to an alternate form by adding 180 degrees to rotation angle, and flipping the reflect x and y bits. The hope is that this identity transform will eliminate the unsupported flags.
Of course that might not result in any more supported rotation, so the caller is still responsible for checking the result afterwards.
--- drivers/gpu/drm/drm_crtc.c | 30 ++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 3 +++ 2 files changed, 33 insertions(+)
drivers/gpu/drm/drm_crtc.c +30 -0
@@ -4002,6 +4002,36 @@ int drm_format_vert_chroma_subsampling(uint32_t format)EXPORT_SYMBOL (drm_format_vert_chroma_subsampling);/** +* drm_rotation_simplify() - Try to simplify the rotation +* @rotation: Rotation to be simplified +* @supported_rotations: Supported rotations +* +* Attempt to simplify the rotation to a form that is supported. +* Eg. if the hardware supports everything except DRM_REFLECT_X +* one could call this function like this: +* +* drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) | +* BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) | +* BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y)); +* +* to eliminate the DRM_ROTATE_X flag. Depending on what kind of +* transforms the hardware supports, this function may not +* be able to produce a supported transform, so the caller should +* check the result afterwards. +*/ +unsigned int drm_rotation_simplify (unsigned int rotation, +unsigned int supported_rotations) +{ +if (rotation & ~supported_rotations) { + rotation ^=BIT (DRM_REFLECT_X ) |BIT (DRM_REFLECT_Y ); + rotation = (rotation & ~0xf ) |BIT ((ffs (rotation &0xf ) +1 ) %4 ); + } + +return rotation; +} +EXPORT_SYMBOL (drm_rotation_simplify); + +/** * drm_mode_config_init - initialize DRM mode_configuration structure * @dev: DRM device *
include/drm/drm_crtc.h +3 -0
@@ -1184,6 +1184,9 @@ extern int drm_format_vert_chroma_subsampling(uint32_t 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); +extern unsigned int drm_rotation_simplify (unsigned int rotation, +unsigned int supported_rotations); +/* Helpers */ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
Signature · 1 line
1.8.5
PATCH 5/11 drm/i915: Add 180 degree sprite rotation support
In reply to [email protected]From: Sagar Kamble <[email protected]>
The sprite planes (in fact all display planes starting from gen4) support 180 degree rotation. Add the relevant low level bits to the sprite code to make use of that feature.
The upper layers are not yet plugged in.
--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -3637,6 +3637,7 @@#define DVS_YUV_ORDER_UYVY (1<<16)#define DVS_YUV_ORDER_YVYU (2<<16)#define DVS_YUV_ORDER_VYUY (3<<16) +#define DVS_ROTATE_180 (1<<15)#define DVS_DEST_KEY (1<<2)#define DVS_TRICKLE_FEED_DISABLE (1<<14)#define DVS_TILED (1<<10)
@@ -3707,6 +3708,7 @@#define SPRITE_YUV_ORDER_UYVY (1<<16)#define SPRITE_YUV_ORDER_YVYU (2<<16)#define SPRITE_YUV_ORDER_VYUY (3<<16) +#define SPRITE_ROTATE_180 (1<<15)#define SPRITE_TRICKLE_FEED_DISABLE (1<<14)#define SPRITE_INT_GAMMA_ENABLE (1<<13)#define SPRITE_TILED (1<<10)
@@ -3780,6 +3782,7 @@#define SP_YUV_ORDER_UYVY (1<<16)#define SP_YUV_ORDER_YVYU (2<<16)#define SP_YUV_ORDER_VYUY (3<<16) +#define SP_ROTATE_180 (1<<15)#define SP_TILED (1<<10)#define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184)#define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188)
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -397,6 +397,7 @@ struct intel_plane {unsigned int crtc_w, crtc_h;uint32_t src_x, src_y;uint32_t src_w, src_h; +unsigned int rotation;/* Since we need to change the watermarks before/after * enabling/disabling the planes, we need to store the parameters here
drivers/gpu/drm/i915/intel_sprite.c +34 -0
@@ -60,6 +60,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, sprctl &= ~SP_PIXFORMAT_MASK ; sprctl &= ~SP_YUV_BYTE_ORDER_MASK ; sprctl &= ~SP_TILED ; + sprctl &= ~SP_ROTATE_180 ;switch (fb->pixel_format) {case DRM_FORMAT_YUYV :
@@ -131,6 +132,14 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, fb->pitches[0]); linear_offset -= sprsurf_offset; +if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { + sprctl |=SP_ROTATE_180 ; + + x += src_w; + y += src_h; + linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + } +I915_WRITE (SPSTRIDE (pipe, plane), fb->pitches[0 ]);I915_WRITE (SPPOS (pipe, plane), (crtc_y <<16 ) | crtc_x);
@@ -238,6 +247,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, sprctl &= ~SPRITE_RGB_ORDER_RGBX ; sprctl &= ~SPRITE_YUV_BYTE_ORDER_MASK ; sprctl &= ~SPRITE_TILED ; + sprctl &= ~SPRITE_ROTATE_180 ;switch (fb->pixel_format) {case DRM_FORMAT_XBGR8888 :
@@ -299,6 +309,14 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= sprsurf_offset; +if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { + sprctl |=SPRITE_ROTATE_180 ; + + x += src_w; + y += src_h; + linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + } +I915_WRITE (SPRSTRIDE (pipe), fb->pitches[0 ]);I915_WRITE (SPRPOS (pipe), (crtc_y <<16 ) | crtc_x);
@@ -422,6 +440,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, dvscntr &= ~DVS_RGB_ORDER_XBGR ; dvscntr &= ~DVS_YUV_BYTE_ORDER_MASK ; dvscntr &= ~DVS_TILED ; + dvscntr &= ~DVS_ROTATE_180 ;switch (fb->pixel_format) {case DRM_FORMAT_XBGR8888 :
@@ -478,6 +497,14 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= dvssurf_offset; +if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { + dvscntr |=DVS_ROTATE_180 ; + + x += src_w; + y += src_h; + linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + } +I915_WRITE (DVSSTRIDE (pipe), fb->pitches[0 ]);I915_WRITE (DVSPOS (pipe), (crtc_y <<16 ) | crtc_x);
@@ -739,6 +766,9 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, max_scale = intel_plane->max_downscale <<16 ; min_scale = intel_plane->can_scale ?1 : (1 <<16 ); +drm_rect_rotate (&src, fb->width <<16 , fb->height <<16 , + intel_plane->rotation); + hscale =drm_rect_calc_hscale_relaxed (&src, &dst, min_scale, max_scale);BUG_ON (hscale <0 );
@@ -777,6 +807,9 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,drm_rect_width (&dst) * hscale -drm_rect_width (&src), drm_rect_height(&dst) * vscale - drm_rect_height(&src)); +drm_rect_rotate_inv (&src, fb->width <<16 , fb->height <<16 , + intel_plane->rotation); +/* sanity check to make sure the src viewport wasn't enlarged */ WARN_ON(src.x1 < (int) src_x || src.y1 < (int) src_y ||
@@ -1141,6 +1174,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) intel_plane->pipe = pipe; intel_plane->plane = plane; + intel_plane->rotation =BIT (DRM_ROTATE_0 ); possible_crtcs = (1 << pipe); ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs, &intel_plane_funcs,
Signature · 1 line
1.8.5
Re: [PATCH 05/11] drm/i915: Add 180 degree sprite rotation support
Quoted 10 lines · On Sat, Feb 01, 2014 at 12:40:41AM +0530, [email protected] wrote:
From: Sagar Kamble <[email protected]>
The sprite planes (in fact all display planes starting from gen4) support 180 degree rotation. Add the relevant low level bits to the sprite code to make use of that feature.
The upper layers are not yet plugged in.
Signed-off-by Ville Syrjala<[email protected]>Tested-by Sagar Kamble <[email protected]>
I actually posted a v2 of this patch, which fixes HSW. But I guess now we really need a v3 which extends that fix for BDW. Assuming BDW is like HSW here.
Quoted 149 lines
--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+)drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -3637,6 +3637,7 @@#define DVS_YUV_ORDER_UYVY (1<<16)#define DVS_YUV_ORDER_YVYU (2<<16)#define DVS_YUV_ORDER_VYUY (3<<16) +#define DVS_ROTATE_180 (1<<15)#define DVS_DEST_KEY (1<<2)#define DVS_TRICKLE_FEED_DISABLE (1<<14)#define DVS_TILED (1<<10)@@ -3707,6 +3708,7 @@#define SPRITE_YUV_ORDER_UYVY (1<<16)#define SPRITE_YUV_ORDER_YVYU (2<<16)#define SPRITE_YUV_ORDER_VYUY (3<<16) +#define SPRITE_ROTATE_180 (1<<15)#define SPRITE_TRICKLE_FEED_DISABLE (1<<14)#define SPRITE_INT_GAMMA_ENABLE (1<<13)#define SPRITE_TILED (1<<10)@@ -3780,6 +3782,7 @@#define SP_YUV_ORDER_UYVY (1<<16)#define SP_YUV_ORDER_YVYU (2<<16)#define SP_YUV_ORDER_VYUY (3<<16) +#define SP_ROTATE_180 (1<<15)#define SP_TILED (1<<10)#define _SPALINOFF (VLV_DISPLAY_BASE + 0x72184)#define _SPASTRIDE (VLV_DISPLAY_BASE + 0x72188)drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -397,6 +397,7 @@ struct intel_plane {unsigned int crtc_w, crtc_h;uint32_t src_x, src_y;uint32_t src_w, src_h; +unsigned int rotation;/* Since we need to change the watermarks before/after * enabling/disabling the planes, we need to store the parameters here drivers/gpu/drm/i915/intel_sprite.c +34
-0@@ -60,6 +60,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, sprctl &= ~SP_PIXFORMAT_MASK ; sprctl &= ~SP_YUV_BYTE_ORDER_MASK ; sprctl &= ~SP_TILED ; + sprctl &= ~SP_ROTATE_180 ;switch (fb->pixel_format) {case DRM_FORMAT_YUYV :@@ -131,6 +132,14 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, fb->pitches[0]); linear_offset -= sprsurf_offset; +if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { + sprctl |=SP_ROTATE_180 ; + + x += src_w; + y += src_h; + linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + } +I915_WRITE (SPSTRIDE (pipe, plane), fb->pitches[0 ]);I915_WRITE (SPPOS (pipe, plane), (crtc_y <<16 ) | crtc_x);@@ -238,6 +247,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, sprctl &= ~SPRITE_RGB_ORDER_RGBX ; sprctl &= ~SPRITE_YUV_BYTE_ORDER_MASK ; sprctl &= ~SPRITE_TILED ; + sprctl &= ~SPRITE_ROTATE_180 ;switch (fb->pixel_format) {case DRM_FORMAT_XBGR8888 :@@ -299,6 +309,14 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= sprsurf_offset; +if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { + sprctl |=SPRITE_ROTATE_180 ; + + x += src_w; + y += src_h; + linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + } +I915_WRITE (SPRSTRIDE (pipe), fb->pitches[0 ]);I915_WRITE (SPRPOS (pipe), (crtc_y <<16 ) | crtc_x);@@ -422,6 +440,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, dvscntr &= ~DVS_RGB_ORDER_XBGR ; dvscntr &= ~DVS_YUV_BYTE_ORDER_MASK ; dvscntr &= ~DVS_TILED ; + dvscntr &= ~DVS_ROTATE_180 ;switch (fb->pixel_format) {case DRM_FORMAT_XBGR8888 :@@ -478,6 +497,14 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= dvssurf_offset; +if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { + dvscntr |=DVS_ROTATE_180 ; + + x += src_w; + y += src_h; + linear_offset += src_h * fb->pitches[0 ] + src_w * pixel_size; + } +I915_WRITE (DVSSTRIDE (pipe), fb->pitches[0 ]);I915_WRITE (DVSPOS (pipe), (crtc_y <<16 ) | crtc_x);@@ -739,6 +766,9 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, max_scale = intel_plane->max_downscale <<16 ; min_scale = intel_plane->can_scale ?1 : (1 <<16 ); +drm_rect_rotate (&src, fb->width <<16 , fb->height <<16 , + intel_plane->rotation); + hscale =drm_rect_calc_hscale_relaxed (&src, &dst, min_scale, max_scale);BUG_ON (hscale <0 );@@ -777,6 +807,9 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,drm_rect_width (&dst) * hscale -drm_rect_width (&src), drm_rect_height(&dst) * vscale - drm_rect_height(&src)); +drm_rect_rotate_inv (&src, fb->width <<16 , fb->height <<16 , + intel_plane->rotation); +/* sanity check to make sure the src viewport wasn't enlarged */ WARN_ON(src.x1 < (int) src_x || src.y1 < (int) src_y ||@@ -1141,6 +1174,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) intel_plane->pipe = pipe; intel_plane->plane = plane; + intel_plane->rotation =BIT (DRM_ROTATE_0 ); possible_crtcs = (1 << pipe); ret = drm_plane_init(dev, &intel_plane->base, possible_crtcs, &intel_plane_funcs,Signature · 1 line
1.8.5
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH 6/11 drm/i915: Make intel_plane_restore() return an error
In reply to [email protected]From: Sagar Kamble <[email protected]>
Propagate the error from intel_update_plane() up through intel_plane_restore() to the caller. This will be used for rollback purposes when setting properties fails.
--- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_sprite.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -897,7 +897,7 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob);int intel_plane_init (struct drm_device *dev,enum pipe pipe,int plane);void intel_flush_primary_plane (struct drm_i915_private *dev_priv,enum plane plane); -void intel_plane_restore (struct drm_plane *plane); +int intel_plane_restore (struct drm_plane *plane);void intel_plane_disable (struct drm_plane *plane);int intel_sprite_set_colorkey (struct drm_device *dev,void *data,struct drm_file *file_priv);
drivers/gpu/drm/i915/intel_sprite.c +7 -7
@@ -1044,18 +1044,18 @@ out_unlock:return ret; } -void intel_plane_restore (struct drm_plane *plane) +int intel_plane_restore (struct drm_plane *plane) {struct intel_plane *intel_plane =to_intel_plane (plane);if (!plane->crtc || !plane->fb) -return ; +return 0 ; -intel_update_plane (plane, plane->crtc, plane->fb, - intel_plane->crtc_x, intel_plane->crtc_y, - intel_plane->crtc_w, intel_plane->crtc_h, - intel_plane->src_x, intel_plane->src_y, - intel_plane->src_w, intel_plane->src_h); +return intel_update_plane (plane, plane->crtc, plane->fb, + intel_plane->crtc_x, intel_plane->crtc_y, + intel_plane->crtc_w, intel_plane->crtc_h, + intel_plane->src_x, intel_plane->src_y, + intel_plane->src_w, intel_plane->src_h); }void intel_plane_disable (struct drm_plane *plane)
Signature · 1 line
1.8.5
PATCH 7/11 drm/i915: Add rotation property for sprites
In reply to [email protected]From: Sagar Kamble <[email protected]>
Sprite planes support 180 degree rotation. The lower layers are now in place, so hook in the standard rotation property to expose the feature to the users.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 42 ++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1548,6 +1548,7 @@ typedef struct drm_i915_private {struct drm_property *broadcast_rgb_property;struct drm_property *force_audio_property; +struct drm_property *rotation_property;uint32_t hw_context_size;struct list_head context_list;
drivers/gpu/drm/i915/intel_sprite.c +41 -1
67 lines not on this page · raw message
Signature · 1 line
1.8.5
PATCH 8/11 drm: Add support_bits parameter to drm_property_create_bitmask()
In reply to [email protected]From: Sagar Kamble <[email protected]>
Make drm_property_create_bitmask() a bit more generic by allowing the caller to specify which bits are in fact supported. This allows multiple callers to use the same enum list, but still create different versions of the same property with different list of supported bits.
--- drivers/gpu/drm/drm_crtc.c | 6 +++++- include/drm/drm_crtc.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_crtc.c +5 -1
@@ -2906,7 +2906,8 @@ EXPORT_SYMBOL(drm_property_create_enum);struct drm_property *drm_property_create_bitmask (struct drm_device *dev,int flags,const char *name,const struct drm_prop_enum_list *props, -int num_values) +int num_values, +unsigned int supported_bits) {struct drm_property *property;int i, ret;
@@ -2918,6 +2919,9 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,return NULL ;for (i =0 ; i < num_values; i++) { +if (!(supported_bits & (1 << i))) +continue ; + ret =drm_property_add_enum (property, i, props[i].type, props[i].name);
include/drm/drm_crtc.h +2 -1
@@ -1070,7 +1070,8 @@ extern struct drm_property *drm_property_create_enum(struct drm_device *dev, intstruct drm_property *drm_property_create_bitmask (struct drm_device *dev,int flags,const char *name,const struct drm_prop_enum_list *props, -int num_values); +int num_values, +unsigned int supported_bits);struct drm_property *drm_property_create_range (struct drm_device *dev,int flags,const char *name,uint64_t min,uint64_t max);
Signature · 1 line
1.8.5
PATCH 9/11 drm: Add drm_rect rotation functions
In reply to [email protected]From: Sagar Kamble <[email protected]>
Add some helper functions to move drm_rects between different rotated coordinate spaces. One function does the forward transform and another does the inverse.
--- drivers/gpu/drm/drm_rect.c | 140 +++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_rect.h | 6 ++ 2 files changed, 146 insertions(+)
drivers/gpu/drm/drm_rect.c +140 -0
@@ -293,3 +293,143 @@ void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point)DRM_DEBUG_KMS ("%dx%d%+d%+d\n" , w, h, r->x1, r->y1); }EXPORT_SYMBOL (drm_rect_debug_print); + +/** +* drm_rect_rotate - Rotate the rectangle +* @r: rectangle to be rotated +* @width: Width of the coordinate space +* @height: Height of the coordinate space +* @rotation: Transformation to be applied +* +* Apply @rotation to the coordinates of rectangle @r. +* +* @width and @height combined with @rotation define +* the location of the new origin. +* +* @width correcsponds to the horizontal and @height +* to the vertical axis of the untransformed coordinate +* space. +*/ +void drm_rect_rotate (struct drm_rect *r, +int width,int height, +unsigned int rotation) +{ +struct drm_rect tmp; + +if (rotation & (BIT (DRM_REFLECT_X ) |BIT (DRM_REFLECT_Y ))) { + tmp = *r; + +if (rotation &BIT (DRM_REFLECT_X )) { + r->x1 = width - tmp.x2; + r->x2 = width - tmp.x1; + } + +if (rotation &BIT (DRM_REFLECT_Y )) { + r->y1 = height - tmp.y2; + r->y2 = height - tmp.y1; + } + } + +switch (rotation &0xf ) { +case BIT (DRM_ROTATE_0 ): +break ; +case BIT (DRM_ROTATE_90 ): + tmp = *r; + r->x1 = tmp.y1; + r->x2 = tmp.y2; + r->y1 = width - tmp.x2; + r->y2 = width - tmp.x1; +break ; +case BIT (DRM_ROTATE_180 ): + tmp = *r; + r->x1 = width - tmp.x2; + r->x2 = width - tmp.x1; + r->y1 = height - tmp.y2; + r->y2 = height - tmp.y1; +break ; +case BIT (DRM_ROTATE_270 ): + tmp = *r; + r->x1 = height - tmp.y2; + r->x2 = height - tmp.y1; + r->y1 = tmp.x1; + r->y2 = tmp.x2; +break ; +default : +break ; + } +} +EXPORT_SYMBOL (drm_rect_rotate); + +/** +* drm_rect_rotate_inv - Inverse rotate the rectangle +* @r: rectangle to be rotated +* @width: Width of the coordinate space +* @height: Height of the coordinate space +* @rotation: Transformation whose inverse is to be applied +* +* Apply the inverse of @rotation to the coordinates +* of rectangle @r. +* +* @width and @height combined with @rotation define +* the location of the new origin. +* +* @width correcsponds to the horizontal and @height +* to the vertical axis of the original untransformed +* coordinate space, so that you never have to flip +* them when doing a rotatation and its inverse. +* That is, if you do: +* +* drm_rotate(&r, width, height, rotation); +* drm_rotate_inv(&r, width, height, rotation); +* +* you will always get back the original rectangle. +*/ +void drm_rect_rotate_inv (struct drm_rect *r, +int width,int height, +unsigned int rotation) +{ +struct drm_rect tmp; + +switch (rotation &0xf ) { +case BIT (DRM_ROTATE_0 ): +break ; +case BIT (DRM_ROTATE_90 ): + tmp = *r; + r->x1 = width - tmp.y2; + r->x2 = width - tmp.y1; + r->y1 = tmp.x1; + r->y2 = tmp.x2; +break ; +case BIT (DRM_ROTATE_180 ): + tmp = *r; + r->x1 = width - tmp.x2; + r->x2 = width - tmp.x1; + r->y1 = height - tmp.y2; + r->y2 = height - tmp.y1; +break ; +case BIT (DRM_ROTATE_270 ): + tmp = *r; + r->x1 = tmp.y1; + r->x2 = tmp.y2; + r->y1 = height - tmp.x2; + r->y2 = height - tmp.x1; +break ; +default : +break ; + } + +if (rotation & (BIT (DRM_REFLECT_X ) |BIT (DRM_REFLECT_Y ))) { + tmp = *r; + +if (rotation &BIT (DRM_REFLECT_X )) { + r->x1 = width - tmp.x2; + r->x2 = width - tmp.x1; + } + +if (rotation &BIT (DRM_REFLECT_Y )) { + r->y1 = height - tmp.y2; + r->y2 = height - tmp.y1; + } + } +} +EXPORT_SYMBOL (drm_rect_rotate_inv);
include/drm/drm_rect.h +6 -0
@@ -163,5 +163,11 @@ int drm_rect_calc_vscale_relaxed(struct drm_rect *src,struct drm_rect *dst, int min_vscale, int max_vscale);void drm_rect_debug_print (const struct drm_rect *r,bool fixed_point); +void drm_rect_rotate (struct drm_rect *r, +int width,int height, +unsigned int rotation); +void drm_rect_rotate_inv (struct drm_rect *r, +int width,int height, +unsigned int rotation);#endif
Signature · 1 line
1.8.5
PATCH 10/11 drm/i915: Add 180 degree primary plane rotation support
In reply to [email protected]From: Sagar Kamble <[email protected]>
Primary planes support 180 degree rotation. Expose the feature through rotation drm property.
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 54 ++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 3 files changed, 55 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -3553,6 +3553,7 @@#define DISPPLANE_NO_LINE_DOUBLE 0#define DISPPLANE_STEREO_POLARITY_FIRST 0#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) +#define DISPPLANE_ROTATE_180 (1<<15)#define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14)/* Ironlake */ #define DISPPLANE_TILED (1<<10)#define _DSPAADDR (dev_priv->info->display_mmio_offset + 0x70184)
drivers/gpu/drm/i915/intel_display.c +52 -2
108 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -331,6 +331,8 @@ struct intel_crtc {struct drm_crtc base;enum pipe pipe;enum plane plane; +unsigned int rotation; +u8 lut_r[256 ], lut_g[256 ], lut_b[256 ];/* * Whether the crtc and the connected output pipeline is active. Implies
Signature · 1 line
1.8.5
Re: [PATCH 10/11] drm/i915: Add 180 degree primary plane rotation support
Quoted 66 lines · On Sat, Feb 01, 2014 at 12:40:46AM +0530, [email protected] wrote:
From: Sagar Kamble <[email protected]>
Primary planes support 180 degree rotation. Expose the feature through rotation drm property.
Signed-off-by Uma Shankar <[email protected]>Signed-off-by Sagar Kamble <[email protected]>Tested-by Sagar Kamble <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 54 ++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 3 files changed, 55 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -3553,6 +3553,7 @@#define DISPPLANE_NO_LINE_DOUBLE 0#define DISPPLANE_STEREO_POLARITY_FIRST 0#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) +#define DISPPLANE_ROTATE_180 (1<<15)#define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14)/* Ironlake */ #define DISPPLANE_TILED (1<<10)#define _DSPAADDR (dev_priv->info->display_mmio_offset + 0x70184)drivers/gpu/drm/i915/intel_display.c +4
-2@@ -2037,6 +2037,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,unsigned long linear_offset;u32 dspcntr;u32 reg; +int pixel_size;switch (plane) {case 0 :@@ -2047,6 +2048,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,return -EINVAL ; } + pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); intel_fb =to_intel_framebuffer (fb); obj = intel_fb->obj;@@ -2054,6 +2056,8 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, dspcntr =I915_READ (reg);/* Mask out pixel format bits in case we change it */ dspcntr &= ~DISPPLANE_PIXFORMAT_MASK ; + dspcntr &= ~DISPPLANE_ROTATE_180 ; +switch (fb->pixel_format) {case DRM_FORMAT_C8 : dspcntr |=DISPPLANE_8BPP ;@@ -2095,8 +2099,6 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,if (IS_G4X (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; -I915_WRITE (reg, dspcntr); - linear_offset = y * fb->pitches[0 ] + x * (fb->bits_per_pixel /8 );if (INTEL_INFO (dev)->gen >=4 ) {@@ -2109,6 +2111,17 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, intel_crtc->dspaddr_offset = linear_offset;
drivers/gpu/drm/i915/intel_display.c static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, · line 2121
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +8
-0} +if (intel_crtc->rotation ==BIT (DRM_ROTATE_180 )) { + dspcntr |=DISPPLANE_ROTATE_180 ; + + x += (fb->width -1 ); + y += (fb->height -1 ); + linear_offset += (fb->height -1 ) * fb->pitches[0 ] + + fb->width * pixel_size; + }
This isn't quite right. We need something like:
x += pipe_src_w - 1;
y += pipe_src_h - 1;
That suggests your tests don't check if panning works correctly when rotated.
I was also going to say we need to do this before stashing the result into intel_crtc->dspaddr_offset on gen2/3, but it actually looks like rotation is a gen4+ feature, so this place looks OK for this code.
You've also forgotten to add the rotation bits to ironlake_update_plane(). That one will need additional HSW/BDW checks I think.
Quoted 57 lines
drivers/gpu/drm/i915/intel_display.c +30
-0+ +I915_WRITE (reg, dspcntr); +DRM_DEBUG_KMS ("Writing base %08lX %08lX %d %d %d\n" ,i915_gem_obj_ggtt_offset (obj), linear_offset, x, y, fb->pitches[0 ]);@@ -8748,6 +8761,31 @@ free_work:return ret; } +static int intel_crtc_set_property (struct drm_crtc *crtc, +struct drm_property *prop, +uint64_t val) +{ +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +uint64_t old_val; +int ret = -ENOENT ; + +if (prop == dev_priv->rotation_property) { +/* exactly one rotation angle please */ +if (hweight32 (val &0xf ) !=1 ) +return -EINVAL ; + + old_val = intel_crtc->rotation; + intel_crtc->rotation = val; + ret = dev_priv->display.update_plane (crtc, crtc->fb,0 ,0 ); +if (ret) + intel_crtc->rotation = old_val; + } + +return ret; +} +static struct drm_crtc_helper_funcs intel_helper_funcs = { .mode_set_base_atomic = intel_pipe_set_base_atomic, .load_lut = intel_crtc_load_lut,@@ -10160,6 +10198,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { .set_config = intel_crtc_set_config, .destroy = intel_crtc_destroy, .page_flip = intel_crtc_page_flip, + .set_property = intel_crtc_set_property };static void intel_cpu_pll_init (struct drm_device *dev)@@ -10288,6 +10327,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)*/ intel_crtc->pipe = pipe; intel_crtc->plane = pipe; + intel_crtc->rotation =BIT (DRM_ROTATE_0 );if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <4 ) {DRM_DEBUG_KMS ("swapping pipes & planes for FBC\n" ); intel_crtc->plane = !pipe;@@ -10298,6 +10338,16 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base;
drivers/gpu/drm/i915/intel_display.c static void intel_crtc_init(struct drm_device *dev, int pipe) · line 10349
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+if (!dev_priv->rotation_property) + dev_priv->rotation_property = +drm_mode_create_rotation_property (dev, +BIT (DRM_ROTATE_0 ) | +BIT (DRM_ROTATE_180 )); +if (dev_priv->rotation_property) +drm_object_attach_property (&intel_crtc->base.base, + dev_priv->rotation_property, + intel_crtc->rotation);
As I mentioned it looks like rotation is only supported starting from gen4. So we need to check for that here before we add the props.
Quoted 24 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+drm_crtc_helper_add (&intel_crtc->base, &intel_helper_funcs); }drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -331,6 +331,8 @@ struct intel_crtc {struct drm_crtc base;enum pipe pipe;enum plane plane; +unsigned int rotation; +u8 lut_r[256 ], lut_g[256 ], lut_b[256 ];/* * Whether the crtc and the connected output pipeline is active. Implies Signature · 6 lines
1.8.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 10/11] drm/i915: Add 180 degree primary plane rotation support
In reply to [email protected]Quoted 93 lines · On Sat, Feb 01, 2014 at 12:40:46AM +0530, [email protected] wrote:
From: Sagar Kamble <[email protected]>
Primary planes support 180 degree rotation. Expose the feature through rotation drm property.
Signed-off-by Uma Shankar <[email protected]>Signed-off-by Sagar Kamble <[email protected]>Tested-by Sagar Kamble <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 54 ++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 3 files changed, 55 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -3553,6 +3553,7 @@#define DISPPLANE_NO_LINE_DOUBLE 0#define DISPPLANE_STEREO_POLARITY_FIRST 0#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) +#define DISPPLANE_ROTATE_180 (1<<15)#define DISPPLANE_TRICKLE_FEED_DISABLE (1<<14)/* Ironlake */ #define DISPPLANE_TILED (1<<10)#define _DSPAADDR (dev_priv->info->display_mmio_offset + 0x70184)drivers/gpu/drm/i915/intel_display.c +22
-2@@ -2037,6 +2037,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,unsigned long linear_offset;u32 dspcntr;u32 reg; +int pixel_size;switch (plane) {case 0 :@@ -2047,6 +2048,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,return -EINVAL ; } + pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); intel_fb =to_intel_framebuffer (fb); obj = intel_fb->obj;@@ -2054,6 +2056,8 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, dspcntr =I915_READ (reg);/* Mask out pixel format bits in case we change it */ dspcntr &= ~DISPPLANE_PIXFORMAT_MASK ; + dspcntr &= ~DISPPLANE_ROTATE_180 ; +switch (fb->pixel_format) {case DRM_FORMAT_C8 : dspcntr |=DISPPLANE_8BPP ;@@ -2095,8 +2099,6 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,if (IS_G4X (dev)) dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; -I915_WRITE (reg, dspcntr); - linear_offset = y * fb->pitches[0 ] + x * (fb->bits_per_pixel /8 );if (INTEL_INFO (dev)->gen >=4 ) {@@ -2109,6 +2111,17 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb, intel_crtc->dspaddr_offset = linear_offset; } +if (intel_crtc->rotation ==BIT (DRM_ROTATE_180 )) { + dspcntr |=DISPPLANE_ROTATE_180 ; + + x += (fb->width -1 ); + y += (fb->height -1 ); + linear_offset += (fb->height -1 ) * fb->pitches[0 ] + + fb->width * pixel_size; + } + +I915_WRITE (reg, dspcntr); +DRM_DEBUG_KMS ("Writing base %08lX %08lX %d %d %d\n" ,i915_gem_obj_ggtt_offset (obj), linear_offset, x, y, fb->pitches[0 ]);@@ -8748,6 +8761,31 @@ free_work:return ret; } +static int intel_crtc_set_property (struct drm_crtc *crtc, +struct drm_property *prop, +uint64_t val) +{ +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc);
drivers/gpu/drm/i915/intel_display.c free_work: · line 8780
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+uint64_t old_val; +int ret = -ENOENT ; + +if (prop == dev_priv->rotation_property) { +/* exactly one rotation angle please */ +if (hweight32 (val &0xf ) !=1 ) +return -EINVAL ; + + old_val = intel_crtc->rotation; + intel_crtc->rotation = val;
Couple of other things we'd need to do here is check if the crtc is even active, since calling .update_plane() on an inactive crtc would oops.
Also we need to wait for pending page flips to make sure we don't overtake them.
Additionall the FBC code would need some rotation checks since FBC doesn't work with a rotated plane on certain generations.
Quoted 64 lines
drivers/gpu/drm/i915/intel_display.c +20
-0+ ret = dev_priv->display.update_plane (crtc, crtc->fb,0 ,0 ); +if (ret) + intel_crtc->rotation = old_val; + } + +return ret; +} +static struct drm_crtc_helper_funcs intel_helper_funcs = { .mode_set_base_atomic = intel_pipe_set_base_atomic, .load_lut = intel_crtc_load_lut,@@ -10160,6 +10198,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { .set_config = intel_crtc_set_config, .destroy = intel_crtc_destroy, .page_flip = intel_crtc_page_flip, + .set_property = intel_crtc_set_property };static void intel_cpu_pll_init (struct drm_device *dev)@@ -10288,6 +10327,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)*/ intel_crtc->pipe = pipe; intel_crtc->plane = pipe; + intel_crtc->rotation =BIT (DRM_ROTATE_0 );if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <4 ) {DRM_DEBUG_KMS ("swapping pipes & planes for FBC\n" ); intel_crtc->plane = !pipe;@@ -10298,6 +10338,16 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; +if (!dev_priv->rotation_property) + dev_priv->rotation_property = +drm_mode_create_rotation_property (dev, +BIT (DRM_ROTATE_0 ) | +BIT (DRM_ROTATE_180 )); +if (dev_priv->rotation_property) +drm_object_attach_property (&intel_crtc->base.base, + dev_priv->rotation_property, + intel_crtc->rotation); +drm_crtc_helper_add (&intel_crtc->base, &intel_helper_funcs); }drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -331,6 +331,8 @@ struct intel_crtc {struct drm_crtc base;enum pipe pipe;enum plane plane; +unsigned int rotation; +u8 lut_r[256 ], lut_g[256 ], lut_b[256 ];/* * Whether the crtc and the connected output pipeline is active. Implies Signature · 6 lines
1.8.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH 11/11 drm: Set property to return invalid for unsupported arguments for bitmask property
In reply to [email protected]From: Sagar Kamble <[email protected]>
DRM will not propagate the set_property call for bitmask drm properties if they are not supported by underlying driver.
--- drivers/gpu/drm/drm_crtc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/drm_crtc.c +18 -0
@@ -3420,6 +3420,8 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,struct drm_mode_object *arg_obj;struct drm_mode_object *prop_obj;struct drm_property *property; +struct drm_property_enum *prop_enum; +bool supported_val = false;int ret = -EINVAL ;int i;
@@ -3451,6 +3453,22 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, } property =obj_to_property (prop_obj); +if (property->flags |DRM_MODE_PROP_BITMASK ) { +if (!list_empty (&property->enum_blob_list)) { +list_for_each_entry (prop_enum, + &property->enum_blob_list, head) { +if (BIT (prop_enum->value) == arg->value) { + supported_val = true; +break ; + } + } + } +if (!supported_val) { + ret = -EINVAL ; + goto out; + } + } +if (!drm_property_change_is_valid (property, arg->value)) goto out;
Signature · 1 line
1.8.5
Quoted 11 lines · On Sat, Feb 01, 2014 at 12:40:36AM +0530, [email protected] wrote:
From: Sagar Kamble <[email protected]>
With these patches 180 degree rotation for crtc and sprite planes will be exposed through drm rotation properties implemented by Ville few days back. I have added CRTC rotation support on top of Ville's 9 patches that includes sprite rotation. Omapdrm changes,
rotation_simplify,drm_rectfunctions are also included in this list. Functionality has been tested with i-g-t test "intel_plane_rotate".Sagar Kamble (11):
Somehow you've managed to change the authorship information of most of the patches. Please don't do that.
Quoted 33 lines
drm: Move
DRM_ROTATEbits out of omapdrm intodrm_crtc.h
drm: Adddrm_mode_create_rotation_property()
drm/omap: Switch omapdrm over todrm_mode_create_rotation_property()
drm: Adddrm_rotation_simplify()
drm/i915: Add 180 degree sprite rotation support drm/i915: Makeintel_plane_restore()return an error drm/i915: Add rotation property for sprites
drm: Addsupport_bitsparameter todrm_property_create_bitmask()
drm: Adddrm_rectrotation functions
drm/i915: Add 180 degree primary plane rotation support
drm: Set property to return invalid for unsupported arguments for
bitmask propertydrivers/gpu/drm/drm_crtc.c | 72 +++++++++++++++++- drivers/gpu/drm/drm_rect.c | 140 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 4 + drivers/gpu/drm/i915/intel_display.c | 54 +++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_sprite.c | 90 ++++++++++++++++++++-- drivers/gpu/drm/omapdrm/omap_drv.h | 7 -- drivers/gpu/drm/omapdrm/omap_plane.c | 17 ++--- include/drm/drm_crtc.h | 16 +++- include/drm/drm_rect.h | 6 ++ 11 files changed, 382 insertions(+), 30 deletions(-)Signature · 6 lines
1.8.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · On Sat, Feb 01, 2014 at 12:40:36AM +0530, [email protected] wrote:
From: Sagar Kamble <[email protected]>
With these patches 180 degree rotation for crtc and sprite planes will be exposed through drm rotation properties implemented by Ville few days back. I have added CRTC rotation support on top of Ville's 9 patches that includes sprite rotation. Omapdrm changes,
rotation_simplify,drm_rectfunctions are also included in this list. Functionality has been tested with i-g-t test "intel_plane_rotate".
Quoted 4 lines
Quoted 1 line
Sagar Kamble (11):
Somehow you've managed to change the authorship information of most of the patches. Please don't do that.
Sorry for this mistake. I am new to this. I will send the revised patches for addressing the review comments.
Quoted 27 lines
Quoted 27 lines
drm: Move
DRM_ROTATEbits out of omapdrm intodrm_crtc.h
drm: Adddrm_mode_create_rotation_property()
drm/omap: Switch omapdrm over todrm_mode_create_rotation_property()
drm: Adddrm_rotation_simplify()
drm/i915: Add 180 degree sprite rotation support drm/i915: Makeintel_plane_restore()return an error drm/i915: Add rotation property for sprites
drm: Addsupport_bitsparameter todrm_property_create_bitmask()
drm: Adddrm_rectrotation functions
drm/i915: Add 180 degree primary plane rotation support
drm: Set property to return invalid for unsupported arguments for
bitmask propertydrivers/gpu/drm/drm_crtc.c | 72 +++++++++++++++++- drivers/gpu/drm/drm_rect.c | 140 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 4 + drivers/gpu/drm/i915/intel_display.c | 54 +++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_sprite.c | 90 ++++++++++++++++++++-- drivers/gpu/drm/omapdrm/omap_drv.h | 7 -- drivers/gpu/drm/omapdrm/omap_plane.c | 17 ++--- include/drm/drm_crtc.h | 16 +++- include/drm/drm_rect.h | 6 ++ 11 files changed, 382 insertions(+), 30 deletions(-)
Quoted 8 lines
Quoted 7 lines
Signature · 6 lines
1.8.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 12 lines · Sagar Arun Kamble
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · On Sat, Feb 01, 2014 at 12:40:36AM +0530, [email protected] wrote:
From: Sagar Kamble <[email protected]>
With these patches 180 degree rotation for crtc and sprite planes will be exposed through drm rotation properties implemented by Ville few days back. I have added CRTC rotation support on top of Ville's 9 patches that includes sprite rotation. Omapdrm changes,
rotation_simplify,drm_rectfunctions are also included in this list. Functionality has been tested with i-g-t test "intel_plane_rotate".
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Sagar Kamble (11):
Somehow you've managed to change the authorship information of most of the patches. Please don't do that.
Sorry for this mistake. I am new to this. I will send the revised patches for addressing the review comments.
git gui does by default change the author, git commit --amend doesn't. You can fix this up with git commit --amend --author="..."
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch