public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 05/43] igt_kms: Add support for setting plane rotation
Date: Fri, 11 Jul 2014 08:37:42 +0200	[thread overview]
Message-ID: <20140711063742.GS17271@phenom.ffwll.local> (raw)
In-Reply-To: <1405015244-11370-6-git-send-email-damien.lespiau@intel.com>

On Thu, Jul 10, 2014 at 07:00:06PM +0100, Damien Lespiau wrote:
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  lib/igt_kms.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_kms.h | 11 +++++++++++
>  2 files changed, 65 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 87f5109..69f9977 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -537,6 +537,16 @@ get_plane_property(igt_display_t *display, uint32_t plane_id, const char *name,
>  			    name, prop_id, value);
>  }
>  
> +static void
> +igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
> +{
> +	igt_pipe_t *pipe = plane->pipe;
> +	igt_display_t *display = pipe->display;
> +
> +	drmModeObjectSetProperty(display->drm_fd, plane->drm_plane->plane_id,
> +				 DRM_MODE_OBJECT_PLANE, prop_id, value);
> +}

I wonder whether we shouldn't have interfaces using the property names and
maybe for enum properties also the strings and let igt do it's thing. But
as long as this is just an internal function it should be good enough.
-Daniel

> +
>  /*
>   * Walk a plane's property list to determine its type.  If we don't
>   * find a type property, then the kernel doesn't support universal
> @@ -882,6 +892,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
>  
>  	igt_assert(plane->drm_plane);
>  
> +	/* it's an error to try an unsupported feature */
> +	igt_assert(igt_plane_supports_rotation(plane) ||
> +		   !plane->rotation_changed);
> +
>  	fb_id = igt_plane_get_fb_id(plane);
>  	crtc_id = output->config.crtc->crtc_id;
>  
> @@ -931,6 +945,14 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
>  
>  	plane->fb_changed = false;
>  	plane->position_changed = false;
> +
> +	if (plane->rotation_changed) {
> +		igt_plane_set_property(plane, plane->rotation_property,
> +				       plane->rotation);
> +
> +		plane->rotation_changed = false;
> +	}
> +
>  	return 0;
>  }
>  
> @@ -1013,6 +1035,9 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
>  	/* Primary planes can't be windowed when using a legacy commit */
>  	igt_assert((primary->crtc_x == 0 && primary->crtc_y == 0));
>  
> +	/* nor rotated */
> +	igt_assert(!primary->rotation_changed);
> +
>  	if (!primary->fb_changed && !primary->position_changed &&
>  	    !primary->panning_changed)
>  		return 0;
> @@ -1304,6 +1329,35 @@ void igt_plane_set_panning(igt_plane_t *plane, int x, int y)
>  	plane->panning_changed = true;
>  }
>  
> +static const char *rotation_name(igt_rotation_t rotation)
> +{
> +	switch (rotation) {
> +	case IGT_ROTATION_0:
> +		return "0°";
> +	case IGT_ROTATION_90:
> +		return "90°";
> +	case IGT_ROTATION_180:
> +		return "180°";
> +	case IGT_ROTATION_270:
> +		return "270°";
> +	default:
> +		igt_assert(0);
> +	}
> +}
> +
> +void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation)
> +{
> +	igt_pipe_t *pipe = plane->pipe;
> +	igt_display_t *display = pipe->display;
> +
> +	LOG(display, "%c.%d: plane_set_rotation(%s)\n", pipe_name(pipe->pipe),
> +	    plane->index, rotation_name(rotation));
> +
> +	plane->rotation = rotation;
> +
> +	plane->rotation_changed = true;
> +}
> +
>  void igt_wait_for_vblank(int drm_fd, enum pipe pipe)
>  {
>  	drmVBlank wait_vbl;
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 4f3474e..d34bcee 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -71,6 +71,14 @@ enum igt_commit_style {
>  	/* We'll add atomic here eventually. */
>  };
>  
> +typedef enum {
> +	/* this maps to the kernel API */
> +	IGT_ROTATION_0   = 1 << 0,
> +	IGT_ROTATION_90  = 1 << 1,
> +	IGT_ROTATION_180 = 1 << 2,
> +	IGT_ROTATION_270 = 1 << 3,
> +} igt_rotation_t;
> +
>  #include "igt_fb.h"
>  
>  struct kmstest_connector_config {
> @@ -116,6 +124,7 @@ typedef struct {
>  	unsigned int fb_changed       : 1;
>  	unsigned int position_changed : 1;
>  	unsigned int panning_changed  : 1;
> +	unsigned int rotation_changed : 1;
>  	/*
>  	 * drm_plane can be NULL for primary and cursor planes (when not
>  	 * using the atomic modeset API)
> @@ -129,6 +138,7 @@ typedef struct {
>  	int crtc_x, crtc_y;
>  	/* panning offset within the fb */
>  	unsigned int pan_x, pan_y;
> +	igt_rotation_t rotation;
>  } igt_plane_t;
>  
>  struct igt_pipe {
> @@ -184,6 +194,7 @@ static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
>  void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>  void igt_plane_set_position(igt_plane_t *plane, int x, int y);
>  void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
> +void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
>  
>  void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
>  
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-07-11  6:37 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10 18:00 [PATCH i-g-t 00/43] Rotation test Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 01/43] igt_kms: Factor out a generic get_property() out of get_drm_plane_type() Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 02/43] igt_kms: Make has_universal_planes a bitfield Damien Lespiau
2014-07-11  6:34   ` Daniel Vetter
2014-07-11 14:13     ` Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 03/43] igt_kms: Provide a get_plane_property() shorthand Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 04/43] igt_kms: Add a way to query of the plane supports rotation Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 05/43] igt_kms: Add support for setting plane rotation Damien Lespiau
2014-07-11  6:37   ` Daniel Vetter [this message]
2014-07-11 14:16     ` Damien Lespiau
2014-07-11  6:40   ` Daniel Vetter
2014-07-11  6:42     ` Chris Wilson
2014-07-11  7:00       ` Daniel Vetter
2014-07-10 18:00 ` [PATCH i-g-t 06/43] igt_kms: Introduce a for_each_pipe() macro Damien Lespiau
2014-07-10 20:36   ` Daniel Vetter
2014-07-10 18:00 ` [PATCH i-g-t 07/43] tests/kms_rotation_crc: IGT for 180 degree HW rotation Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 08/43] kms_rotation_crc: Make check_plane_type() static Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 09/43] kms_rotation_crc: Make more functions static Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 10/43] kms_rotation_crc: Align a few wrapped lines to the opening brace Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 11/43] kms_rotation_crc: Update the copyright to have this year as well Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 12/43] kms_rotation_crc: Test the validity of the output first Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 13/43] kms_rotation_crc: Require universal planes for the testing primary rotation Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 14/43] kms_rotation_crc: Fix style issue: '{' at the end of lines Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 15/43] kms_rotation_crc: Fix style issue: single statement conditionals Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 16/43] kms_rotation_crc: Factor out the square drawing function Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 17/43] kms_rotation_crc: Factor out common primary/sprite code in prepare_crtc() Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 18/43] kms_rotation_crc: Remove useless comments Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 19/43] kms_rotation_crc: Use drm_plane from igt_plane_t Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 20/43] kms_rotation_crc: Style issue: binary operators need spaces before and after Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 21/43] kms_rotation_crc: Skip the tests if rotation is not supported Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 22/43] kms_rotation_crc: Just store the igt_plane_t in data Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 23/43] kms_rotation_crc: Unify the two tests Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 24/43] kms_rotation_crc: Always disable the plane in cleanup Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 25/43] kms_rotation_crc: Don't store rotate in the test state Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 26/43] kms_rotation_crc: Don't store 'pipe' in the state Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 27/43] kms_rotation_crc: Use igt_plane_set_rotation() Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 28/43] kms_rotation_crc: Remove now unnecessary defines Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 29/43] kms_rotation_crc: Use for_each_pipe() Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 30/43] kms_rotation_crc: Remove the test on output->valid Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 31/43] kms_rotation_crc: Remove 'output' from the state Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 32/43] kms_rotation_crc: Remove the sleep(2) Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 33/43] kms_rotation_crc: Remove plane from the state Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 34/43] kms_rotation_crc: No need to test for NULL before freeing the pipe CRC object Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 35/43] kms_rotation_crc: Allow the sprite test to run even without universal planes Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 36/43] kms_rotation_crc: Don't commit with no fb set up Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 37/43] kms_rotation_crc: Properly paint the whole frame buffer Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 38/43] kms_rotation_crc: Add the test to .gitignore Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 39/43] kms_rotation_crc: Don't compile the test on Android with no cairo support Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 40/43] kms_rotation_crc: Document the two steps in prepare_crtc() Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 41/43] kms_rotation_crc: Always use the primary plane to compute the reference CRC Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 42/43] kms_rotation_crc: Remove unnecessary includes Damien Lespiau
2014-07-10 18:00 ` [PATCH i-g-t 43/43] kms_rotation_crc: Use the igt_kms enum to encode the plane rotation Damien Lespiau
2014-07-11 14:19 ` [PATCH i-g-t 00/43] Rotation test Damien Lespiau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140711063742.GS17271@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=damien.lespiau@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox