From: Ben Widawsky <ben@bwidawsk.net>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Intel GFX <intel-gfx@lists.freedesktop.org>,
"Kristian H . Kristensen" <hoegsberg@gmail.com>,
DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v5 3/3] drm/i915: Add format modifiers for Intel
Date: Wed, 17 May 2017 18:14:29 -0700 [thread overview]
Message-ID: <20170518011429.GD2334@mail.bwidawsk.net> (raw)
In-Reply-To: <CACvgo513CNhsm96vzoAq9pHtypc=Yjrr-hnPrX17Y8x8rRaS0A@mail.gmail.com>
On 17-05-17 01:20:50, Emil Velikov wrote:
>Hi Ben,
>
>A couple of small questions/suggestions that I hope you find useful.
>Please don't block any of this work based on my comments.
>
>On 16 May 2017 at 22:31, Ben Widawsky <ben@bwidawsk.net> wrote:
>
>> +static bool intel_primary_plane_format_mod_supported(struct drm_plane *plane,
>> + uint32_t format,
>> + uint64_t modifier)
>> +{
>> + struct drm_i915_private *dev_priv = to_i915(plane->dev);
>> +
>> + if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID))
>> + return false;
>> +
>> + if (INTEL_GEN(dev_priv) >= 9)
>> + return skl_mod_supported(format, modifier);
>> + else if (INTEL_GEN(dev_priv) >= 4)
>> + return i965_mod_supported(format, modifier);
>> + else
>> + return i8xx_mod_supported(format, modifier);
>> +
>Nit: if you rewrite this as below, the control flow should be clearer.
>Thus the 'return false;' at the end, will be [more] obvious that it's
>unreachable ;-)
>
> if (INTEL_GEN(dev_priv) >= 9)
> return skl_mod_supported(format, modifier);
>
> if (INTEL_GEN(dev_priv) >= 4)
> return i965_mod_supported(format, modifier);
>
> return i8xx_mod_supported(format, modifier);
>
>
It's a good point, however many other blocks of code do the same thing, and I
think the nature of if/else if/else implies unreachable. I can add
unreachable()... In fact, I just did.
>> + return false;
>> +}
>> +
>
>
>> --- a/drivers/gpu/drm/i915/intel_sprite.c
>> +++ b/drivers/gpu/drm/i915/intel_sprite.c
>
>> +static bool intel_sprite_plane_format_mod_supported(struct drm_plane *plane,
>> + uint32_t format,
>> + uint64_t modifier)
>> +{
>> + struct drm_i915_private *dev_priv = to_i915(plane->dev);
>> +
>> + if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID))
>> + return false;
>> +
>> + BUG_ON(plane->base.type != DRM_PLANE_TYPE_OVERLAY);
>> +
>> + switch (format) {
>> + case DRM_FORMAT_XBGR2101010:
>> + case DRM_FORMAT_ABGR2101010:
>> + if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
>> + return true;
>> + break;
>> + case DRM_FORMAT_RGB565:
>> + case DRM_FORMAT_ABGR8888:
>> + case DRM_FORMAT_ARGB8888:
>> + if (INTEL_GEN(dev_priv) >= 9 || IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
>> + return true;
>> + break;
>> + case DRM_FORMAT_XBGR8888:
>> + if (INTEL_GEN(dev_priv) >= 6)
>> + return true;
>> + break;
>> + case DRM_FORMAT_XRGB8888:
>> + case DRM_FORMAT_YUYV:
>> + case DRM_FORMAT_YVYU:
>> + case DRM_FORMAT_UYVY:
>> + case DRM_FORMAT_VYUY:
>> + return true;
>> + }
>> +
>> + return false;
>> +}
>> +
>> +const struct drm_plane_funcs intel_sprite_plane_funcs = {
>> + .update_plane = drm_atomic_helper_update_plane,
>> + .disable_plane = drm_atomic_helper_disable_plane,
>> + .destroy = intel_plane_destroy,
>> + .set_property = drm_atomic_helper_plane_set_property,
>> + .atomic_get_property = intel_plane_atomic_get_property,
>> + .atomic_set_property = intel_plane_atomic_set_property,
>> + .atomic_duplicate_state = intel_plane_duplicate_state,
>> + .atomic_destroy_state = intel_plane_destroy_state,
>> + .format_mod_supported = intel_sprite_plane_format_mod_supported,
>> +};
>> +
>Having a dull moment - is intel_sprite_plane_funcs (+
>intel_sprite_plane_format_mod_supported) unused or I'm seeing things?
>If one is to keep it, for future work, perhaps it's worth adding a 2-3
>word comment,
>
>Regards,
>Emil
Not sure how this happened, it is a mistake. Thanks for spotting it. Here's what
I got locally:
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3519c10abcc3..a8f4c5783ec2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13479,7 +13479,7 @@ static bool intel_primary_plane_format_mod_supported(struct drm_plane *plane,
else
return i8xx_mod_supported(format, modifier);
- return false;
+ unreachable();
}
static bool intel_cursor_plane_format_mod_supported(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index e7c5c0a94bbd..1d582b436b59 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1233,7 +1233,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
if (INTEL_GEN(dev_priv) >= 9)
ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base,
- possible_crtcs, &intel_plane_funcs,
+ possible_crtcs, &intel_sprite_plane_funcs,
plane_formats, num_plane_formats,
modifiers,
DRM_PLANE_TYPE_OVERLAY,
--
Ben Widawsky, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-05-18 1:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 21:31 [PATCH v3 1/3] drm: Plumb modifiers through plane init Ben Widawsky
2017-05-16 21:31 ` [PATCH v2 2/3] drm: Create a format/modifier blob Ben Widawsky
2017-05-16 23:24 ` Liviu Dudau
2017-05-17 0:06 ` Emil Velikov
2017-05-18 0:46 ` [Intel-gfx] " Ben Widawsky
2017-05-18 9:02 ` Ville Syrjälä
2017-05-18 9:49 ` Emil Velikov
2017-05-23 16:39 ` Daniel Stone
2017-05-16 21:31 ` [PATCH v5 3/3] drm/i915: Add format modifiers for Intel Ben Widawsky
2017-05-17 0:20 ` Emil Velikov
2017-05-18 1:14 ` Ben Widawsky [this message]
2017-05-18 9:55 ` Emil Velikov
2017-05-16 21:51 ` ✗ Fi.CI.BAT: failure for series starting with [v3,1/3] drm: Plumb modifiers through plane init Patchwork
2017-05-17 10:17 ` [PATCH v3 1/3] " Liviu Dudau
2017-05-18 0:26 ` Ben Widawsky
2017-05-18 8:45 ` Liviu Dudau
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=20170518011429.GD2334@mail.bwidawsk.net \
--to=ben@bwidawsk.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--cc=hoegsberg@gmail.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 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.