From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: "Simon Ser" <contact@emersion.fr>,
"Jonas Ådahl" <jadahl@redhat.com>,
"Daniel Stone" <daniel@fooishbar.org>,
"Sameer Lattannavar" <sameer.lattannavar@intel.com>,
"Sebastian Wick" <sebastian.wick@redhat.com>,
"Harry Wentland" <harry.wentland@amd.com>,
"Pekka Paalanen" <pekka.paalanen@collabora.com>
Subject: [PATCH v3 2/2] drm/i915: Add SIZE_HINTS property for cursors
Date: Mon, 18 Mar 2024 22:44:08 +0200 [thread overview]
Message-ID: <20240318204408.9687-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240318204408.9687-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Advertize more suitable cursor sizes via the new SIZE_HINTS
plane property.
We can't really enumerate all supported cursor sizes on
the platforms where the cursor height can vary freely, so
for simplicity we'll just expose all square+POT sizes between
each platform's min and max cursor limits.
Depending on the platform this will give us one of three
results:
- 64x64,128x128,256x256,512x512
- 64x64,128x128,256x256
- 64x64
Cc: Simon Ser <contact@emersion.fr>
Cc: Jonas Ådahl <jadahl@redhat.com>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Sameer Lattannavar <sameer.lattannavar@intel.com>
Cc: Sebastian Wick <sebastian.wick@redhat.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_cursor.c | 24 +++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
index f8b33999d43f..49e9b9be2235 100644
--- a/drivers/gpu/drm/i915/display/intel_cursor.c
+++ b/drivers/gpu/drm/i915/display/intel_cursor.c
@@ -823,6 +823,28 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = {
.format_mod_supported = intel_cursor_format_mod_supported,
};
+static void intel_cursor_add_size_hints_property(struct intel_plane *plane)
+{
+ struct drm_i915_private *i915 = to_i915(plane->base.dev);
+ const struct drm_mode_config *config = &i915->drm.mode_config;
+ struct drm_plane_size_hint hints[4];
+ int size, max_size, num_hints = 0;
+
+ max_size = min(config->cursor_width, config->cursor_height);
+
+ /* for simplicity only enumerate the supported square+POT sizes */
+ for (size = 64; size <= max_size; size *= 2) {
+ if (drm_WARN_ON(&i915->drm, num_hints >= ARRAY_SIZE(hints)))
+ break;
+
+ hints[num_hints].width = size;
+ hints[num_hints].height = size;
+ num_hints++;
+ }
+
+ drm_plane_add_size_hints_property(&plane->base, hints, num_hints);
+}
+
struct intel_plane *
intel_cursor_plane_create(struct drm_i915_private *dev_priv,
enum pipe pipe)
@@ -881,6 +903,8 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv,
DRM_MODE_ROTATE_0 |
DRM_MODE_ROTATE_180);
+ intel_cursor_add_size_hints_property(cursor);
+
zpos = DISPLAY_RUNTIME_INFO(dev_priv)->num_sprites[pipe] + 1;
drm_plane_create_zpos_immutable_property(&cursor->base, zpos);
--
2.43.2
next prev parent reply other threads:[~2024-03-18 20:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 20:44 [PATCH v3 0/2] drm: Add plane SIZE_HINTS property Ville Syrjala
2024-03-18 20:44 ` [PATCH v3 1/2] drm: Introduce " Ville Syrjala
2024-03-19 6:51 ` kernel test robot
2024-03-18 20:44 ` Ville Syrjala [this message]
2024-03-20 15:55 ` [PATCH v3 2/2] drm/i915: Add SIZE_HINTS property for cursors Juha-Pekka Heikkila
2024-03-18 23:19 ` ✗ Fi.CI.SPARSE: warning for drm: Add plane SIZE_HINTS property (rev6) Patchwork
2024-03-18 23:37 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-03-19 9:28 ` [PATCH v3 0/2] drm: Add plane SIZE_HINTS property Ville Syrjälä
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=20240318204408.9687-3-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=contact@emersion.fr \
--cc=daniel@fooishbar.org \
--cc=harry.wentland@amd.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jadahl@redhat.com \
--cc=pekka.paalanen@collabora.com \
--cc=sameer.lattannavar@intel.com \
--cc=sebastian.wick@redhat.com \
/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