[PATCH 03/14] drm: imx: ipuv3 plane: Check different types of plane separately

Ying Liu gnuiyl at gmail.com
Wed May 25 09:21:39 UTC 2016


On Tue, May 24, 2016 at 10:20 PM, Philipp Zabel <p.zabel at pengutronix.de> wrote:
> Am Dienstag, den 24.05.2016, 18:10 +0800 schrieb Liu Ying:
>> The IPUv3 primary plane doesn't support partial off screen.
>> So, this patch separates plane check logics for primary plane and overlay
>> plane and adds more limitations on the primary plane.
>>
>> Signed-off-by: Liu Ying <gnuiyl at gmail.com>
>> ---
>>  drivers/gpu/drm/imx/ipuv3-plane.c | 72 ++++++++++++++++++++++-----------------
>>  1 file changed, 41 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
>> index e6ec8eb..8f91b2e 100644
>> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
>> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
>> @@ -190,44 +190,54 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
>>                      uint32_t src_x, uint32_t src_y,
>>                      uint32_t src_w, uint32_t src_h, bool interlaced)
>>  {
>> -     struct device *dev = ipu_plane->base.dev->dev;
>> +     struct drm_plane plane = ipu_plane->base;
>
> Why make a copy of the drm_plane here?
>
>> +     struct device *dev = plane.dev->dev;
>>       int ret;
>>
>>       /* no scaling */
>>       if (src_w != crtc_w || src_h != crtc_h)
>>               return -EINVAL;
>>
>> -     /* clip to crtc bounds */
>> -     if (crtc_x < 0) {
>> -             if (-crtc_x > crtc_w)
>> +     if (plane.type == DRM_PLANE_TYPE_PRIMARY) {
>> +             /* full plane doesn't support partial off screen */
>> +             if (crtc_x || crtc_y || crtc_w != mode->hdisplay ||
>> +                     crtc_h != mode->vdisplay)
>
> As long as the requested plane is large enough to cover the whole base
> plane, we can fix the crtc_x/y/w/h up by clipping to the base plane
> boundaries. There is no need to return -EINVAL here as long as the IDMAC
> is capable to start reading at src_x/y = -crtc_x/y.

For the primary plane, we really need to look at mode->v/hdisplay
to make sure no partial off screen happens(plane partial off CRTC).
The clip is tricky, so for primary plane, I just take the simple way
to avoid the clip.

Eventually, we'll use atomic check to simply accept or reject
the user's request instead of changing the state to do clip.
This makes the driver simpler.

Regards,
Liu Ying

>
> regards
> Philipp
>


More information about the dri-devel mailing list