Re: [PATCH v2 33/46] drm/mediatek: Add support for Display Controller exDMA component
From: AngeloGioacchino Del Regno
Date: Tue Nov 24 2026 - 10:01:06 EST
On 11/24/26 15:28, Daniel Stone wrote:
Hi,
On Tue, 14 Jul 2026 at 12:45, AngeloGioacchino Del Regno
<angelogioacchino.delregno@xxxxxxxxxxxxx> wrote:
+void mtk_exdma_layer_config(struct device *dev, unsigned int idx,
+ struct mtk_plane_state *state,
+ struct cmdq_pkt *cmdq_pkt)
+{
+ struct mtk_disp_exdma *priv = dev_get_drvdata(dev);
+ struct mtk_plane_pending_state *pending = &state->pending;
+ const struct drm_format_info *fmt_info = drm_format_info(pending->format);
+ const u32 blend_mode = mtk_ovl_get_blend_mode(state, MTK_OVL_SUPPORT_BLEND_MODES);
+ const bool csc_enable = (fmt_info) ? fmt_info->is_yuv : false;
+ u32 val;
+
+ if (!pending->enable || pending->height == 0 || pending->width == 0 ||
+ pending->x > OVL_EXDMA_MAX_SIZE || pending->y > OVL_EXDMA_MAX_SIZE) {
Definitely don't do this please. If exdma is asked to do something it
can't (and I'm assuming that these last two checks are intended to be
on w/h rather than x/y?), then you need to reject that in
atomic_check. Getting here with pending->enable == true and then not
enabling it, is not OK.
That was done because mediatek-drm isn't in the best shape, and atomic_check is too
late for this check... adding support for those components is done on top of a big
restructuring, which still is not complete, as the entire mediatek-drm driver can,
and needs to, improve quite a bit.
(P.S.: yes the check was to be done on w/h)
That said, I think at this point the best I can do, without going for continuing
the entire restructuring here (I have no time for that right now, sorry) is to
duplicate this check in .atomic_check(), so that when the entire thing will be
ready, the right thing is already there waiting for the additional check to be
simply removed.
I have to recheck if there's anything "fast" I can do to make this completely
right without double checks, but I'm afraid I can't.
Relatedly, most of mtk_plane_pending_state should be deleted as
duplicative of drm_plane_state and it would be great to see a patch
series very soon to clean that up.
Again, I agree mediatek-drm needs a rather big cleanup.
Lately, upstream has been a bit slow in reviewing etc for many reasons, which is
why this series has been there for months now (though things are getting unblocked
lately at least for this specific series, so that's good).
Anyway - let me see what I can do, but I can't make *big* promises - the only thing
I can say is that further *big* cleanups/restructuring is something I can do in the
next iteration (after the partial restructuring that is done in this series gets
merged, but definitely not in this series) whenever I can find some time to.
I'm all for making things perfect, but I only have two hands, unfortunately :-(
It's been that way for the last 10
years, with seemingly no discussion ever of why it exists (my guess is
that it's a holdover from pre-atomic code), but no reason to
perpetuate the badness.
It's there because the mediatek-drm codebase still nowadays has lots of technical
debt, and because there is this GCE//CMDQ programming that adds up to make things
slightly more complicated.
Same comment applies for the blender.
Noted.
Cheers,
Angelo