From: Javier Martinez Canillas <javierm@redhat.com>
To: Ryosuke Yasuoka <ryasuoka@redhat.com>,
drawat.floss@gmail.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
simona@ffwll.ch, jfalempe@redhat.com
Cc: Ryosuke Yasuoka <ryasuoka@redhat.com>,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH drm-next v2] drm/hyperv: Replace simple-KMS with regular atomic helpers
Date: Fri, 25 Apr 2025 09:15:29 +0200 [thread overview]
Message-ID: <87wmb8yani.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <20250425063234.757344-1-ryasuoka@redhat.com>
Ryosuke Yasuoka <ryasuoka@redhat.com> writes:
Hello Ryosuke,
> Drop simple-KMS in favor of regular atomic helpers to make the code more
> modular. The simple-KMS helper mix up plane and CRTC state, so it is
> obsolete and should go away [1]. Since it just split the simple-pipe
> functions into per-plane and per-CRTC, no functional changes is
> expected.
>
> [1] https://lore.kernel.org/lkml/dae5089d-e214-4518-b927-5c4149babad8@suse.de/
>
> Signed-off-by: Ryosuke Yasuoka <ryasuoka@redhat.com>
>
> -static void hyperv_pipe_enable(struct drm_simple_display_pipe *pipe,
> - struct drm_crtc_state *crtc_state,
> - struct drm_plane_state *plane_state)
> +static const uint32_t hyperv_formats[] = {
> + DRM_FORMAT_XRGB8888,
> +};
> +
> +static const uint64_t hyperv_modifiers[] = {
> + DRM_FORMAT_MOD_LINEAR,
> + DRM_FORMAT_MOD_INVALID
> +};
> +
I think the kernel u32 and u64 types are preferred ?
> +static void hyperv_crtc_helper_atomic_enable(struct drm_crtc *crtc,
> + struct drm_atomic_state *state)
> {
> - struct hyperv_drm_device *hv = to_hv(pipe->crtc.dev);
> - struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(plane_state);
> + struct hyperv_drm_device *hv = to_hv(crtc->dev);
> + struct drm_plane *plane = &hv->plane;
> + struct drm_plane_state *plane_state = plane->state;
> + struct drm_crtc_state *crtc_state = crtc->state;
>
> hyperv_hide_hw_ptr(hv->hdev);
> hyperv_update_situation(hv->hdev, 1, hv->screen_depth,
> crtc_state->mode.hdisplay,
> crtc_state->mode.vdisplay,
> plane_state->fb->pitches[0]);
> - hyperv_blit_to_vram_fullscreen(plane_state->fb, &shadow_plane_state->data[0]);
> }
>
> -static int hyperv_pipe_check(struct drm_simple_display_pipe *pipe,
> - struct drm_plane_state *plane_state,
> - struct drm_crtc_state *crtc_state)
> +static void hyperv_crtc_helper_atomic_disable(struct drm_crtc *crtc,
> + struct drm_atomic_state *state)
> +{ }
> +
Why do you need an empty CRTC atomic disable callback? Can you just not
set it instead?
>
> -static void hyperv_pipe_update(struct drm_simple_display_pipe *pipe,
> - struct drm_plane_state *old_state)
> +static void hyperv_plane_atomic_update(struct drm_plane *plane,
> + struct drm_atomic_state *old_state)
> {
> - struct hyperv_drm_device *hv = to_hv(pipe->crtc.dev);
> - struct drm_plane_state *state = pipe->plane.state;
> + struct drm_plane_state *old_pstate = drm_atomic_get_old_plane_state(old_state, plane);
> + struct hyperv_drm_device *hv = to_hv(plane->dev);
> + struct drm_plane_state *state = plane->state;
You should never access the plane->state directly, instead the helper
drm_atomic_get_new_plane_state() should be used. You can also rename
the old_state paramete to just state, since it will be used to lookup
both the old and new atomic states.
More info is in the following email from Ville:
https://lore.kernel.org/dri-devel/Yx9pij4LmFHrq81V@intel.com/
> struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state);
> struct drm_rect rect;
>
> - if (drm_atomic_helper_damage_merged(old_state, state, &rect)) {
> + if (drm_atomic_helper_damage_merged(old_pstate, state, &rect)) {
I know that most of the simple-KMS drivers do this but since this driver
enables FB damage clips support, it is better to iterate over the damage
areas. For example:
struct drm_atomic_helper_damage_iter iter;
struct drm_rect dst_clip;
struct drm_rect damage;
drm_atomic_helper_damage_iter_init(&iter, old_pstate, state);
drm_atomic_for_each_plane_damage(&iter, &damage) {
dst_clip = state->dst;
if (!drm_rect_intersect(&dst_clip, &damage))
continue;
hyperv_blit_to_vram_rect(state->fb, &shadow_plane_state->data[0], &damage);
hyperv_update_dirt(hv->hdev, &damage);
}
Other than these small comments, the patch looks good to me. So if you take
into account my suggestions, feel free to add:
Acked-by: Javier Martinez Canillas <javierm@redhat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
next prev parent reply other threads:[~2025-04-25 7:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 6:32 [PATCH drm-next v2] drm/hyperv: Replace simple-KMS with regular atomic helpers Ryosuke Yasuoka
2025-04-25 7:15 ` Javier Martinez Canillas [this message]
2025-04-26 12:13 ` Ryosuke Yasuoka
2025-04-27 7:29 ` Javier Martinez Canillas
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=87wmb8yani.fsf@minerva.mail-host-address-is-not-set \
--to=javierm@redhat.com \
--cc=airlied@gmail.com \
--cc=drawat.floss@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jfalempe@redhat.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ryasuoka@redhat.com \
--cc=simona@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).