All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Expósito" <jose.exposito89@gmail.com>
To: javierm@redhat.com
Cc: dri-devel@lists.freedesktop.org, davidgow@google.com,
	magalilemes00@gmail.com, airlied@linux.ie, maira.canal@usp.br,
	dlatypov@google.com, linux-kernel@vger.kernel.org,
	"Jani Nikula" <jani.nikula@intel.com>,
	"José Expósito" <jose.exposito89@gmail.com>,
	tzimmermann@suse.de, tales.aparecida@gmail.com,
	isabbasso@riseup.net, kunit-dev@googlegroups.com
Subject: [PATCH v4 1/3] drm/rect: Add DRM_RECT_INIT() macro
Date: Mon, 20 Jun 2022 18:06:38 +0200	[thread overview]
Message-ID: <20220620160640.3790-2-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20220620160640.3790-1-jose.exposito89@gmail.com>

Add a helper macro to initialize a rectangle from x, y, width and
height information.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 include/drm/drm_rect.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 6f6e19bd4dac..e8d94fca2703 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -47,6 +47,22 @@ struct drm_rect {
 	int x1, y1, x2, y2;
 };
 
+/**
+ * DRM_RECT_INIT - initialize a rectangle from x/y/w/h
+ * @x: x coordinate
+ * @y: y coordinate
+ * @w: width
+ * @h: height
+ *
+ * RETURNS:
+ * A new rectangle of the specified size.
+ */
+#define DRM_RECT_INIT(x, y, w, h) ((struct drm_rect){ \
+		.x1 = (x), \
+		.y1 = (y), \
+		.x2 = (x) + (w), \
+		.y2 = (y) + (h) })
+
 /**
  * DRM_RECT_FMT - printf string for &struct drm_rect
  */
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: "José Expósito" <jose.exposito89@gmail.com>
To: javierm@redhat.com
Cc: davidgow@google.com, dlatypov@google.com, tzimmermann@suse.de,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@linux.ie, daniel@ffwll.ch, jani.nikula@linux.intel.com,
	maira.canal@usp.br, isabbasso@riseup.net,
	magalilemes00@gmail.com, tales.aparecida@gmail.com,
	dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org,
	"José Expósito" <jose.exposito89@gmail.com>,
	"Jani Nikula" <jani.nikula@intel.com>
Subject: [PATCH v4 1/3] drm/rect: Add DRM_RECT_INIT() macro
Date: Mon, 20 Jun 2022 18:06:38 +0200	[thread overview]
Message-ID: <20220620160640.3790-2-jose.exposito89@gmail.com> (raw)
In-Reply-To: <20220620160640.3790-1-jose.exposito89@gmail.com>

Add a helper macro to initialize a rectangle from x, y, width and
height information.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 include/drm/drm_rect.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 6f6e19bd4dac..e8d94fca2703 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -47,6 +47,22 @@ struct drm_rect {
 	int x1, y1, x2, y2;
 };
 
+/**
+ * DRM_RECT_INIT - initialize a rectangle from x/y/w/h
+ * @x: x coordinate
+ * @y: y coordinate
+ * @w: width
+ * @h: height
+ *
+ * RETURNS:
+ * A new rectangle of the specified size.
+ */
+#define DRM_RECT_INIT(x, y, w, h) ((struct drm_rect){ \
+		.x1 = (x), \
+		.y1 = (y), \
+		.x2 = (x) + (w), \
+		.y2 = (y) + (h) })
+
 /**
  * DRM_RECT_FMT - printf string for &struct drm_rect
  */
-- 
2.25.1


  reply	other threads:[~2022-06-20 16:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 16:06 [PATCH v4 0/3] KUnit tests for drm_format_helper José Expósito
2022-06-20 16:06 ` José Expósito
2022-06-20 16:06 ` José Expósito [this message]
2022-06-20 16:06   ` [PATCH v4 1/3] drm/rect: Add DRM_RECT_INIT() macro José Expósito
2022-06-21  9:38   ` David Gow
2022-06-21  9:38     ` David Gow
2022-06-21 10:02     ` Thomas Zimmermann
2022-06-21 10:02       ` Thomas Zimmermann
2022-06-21 10:13       ` Jani Nikula
2022-06-21 10:13         ` Jani Nikula
2022-06-22  7:12       ` David Gow
2022-06-22  7:12         ` David Gow
2022-06-20 16:06 ` [PATCH v4 2/3] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb332() José Expósito
2022-06-20 16:06   ` José Expósito
2022-06-21  9:38   ` David Gow
2022-06-21  9:38     ` David Gow
2022-06-21 17:37     ` José Expósito
2022-06-21 17:37       ` José Expósito
2022-06-20 16:06 ` [PATCH v4 3/3] drm/doc: Add KUnit documentation José Expósito
2022-06-20 16:06   ` José Expósito
2022-06-21  9:38   ` David Gow
2022-06-21  9:38     ` David Gow
2022-06-21 18:15     ` José Expósito
2022-06-21 18:15       ` José Expósito

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=20220620160640.3790-2-jose.exposito89@gmail.com \
    --to=jose.exposito89@gmail.com \
    --cc=airlied@linux.ie \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=isabbasso@riseup.net \
    --cc=jani.nikula@intel.com \
    --cc=javierm@redhat.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magalilemes00@gmail.com \
    --cc=maira.canal@usp.br \
    --cc=tales.aparecida@gmail.com \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.