From: Marcus Lorentzon <marcus.xm.lorentzon@stericsson.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 1/4] drm: add plane support
Date: Thu, 9 Jun 2011 11:16:02 +0200 [thread overview]
Message-ID: <4DF08F52.9080603@stericsson.com> (raw)
In-Reply-To: <20110608115456.3eea4ef4@jbarnes-desktop>
On 06/08/2011 08:54 PM, Jesse Barnes wrote:
> On Wed, 8 Jun 2011 11:41:17 +0200
> Marcus Lorentzon<marcus.xm.lorentzon@stericsson.com> wrote:
>
>
>> On 06/07/2011 11:01 PM, Jesse Barnes wrote:
>>
>>> On Tue, 7 Jun 2011 13:07:39 -0700
>>> Jesse Barnes<jbarnes@virtuousgeek.org> wrote:
>>>
>>>
>>>
>>>> +/* Planes blend with or override other bits on the CRTC */
>>>> +struct drm_mode_set_plane {
>>>> + __u32 plane_id;
>>>> + __u32 crtc_id;
>>>> + __u32 fb_id; /* contains surface format type */
>>>> +
>>>> + __u32 crtc_x, crtc_y;
>>>> + __u32 x, y;
>>>> +
>>>> + /* FIXME: color key/mask, scaling, z-order, other? */
>>>> +};
>>>>
>>>>
>>> Forgot to add the scaling factors to this. Would:
>>> __u32 scaling_x; /* fixed 16.16 format */
>>> __u32 scaling_y;
>>> work for people?
>>>
>>>
>> If you want to pan around in zoomed in video/viewfinder/snapshots it
>> might be better to have a fixed 16.16 source rectangle and a integer
>> destination rectangle. That way you can move around the zoomed in source
>> rectangle in small increments and upscale it to destination rectangle
>> (and skip fractions if HW don't support it). For example, if you zoom 4x
>> and have only fixed 16.16 scaling factor, you still get the the integer
>> fb (x, y) position in the top left corner (crtc_x, crtc_y) of the
>> overlay. And when you pan in the overlay, you will have to move source
>> rectangle in 4 destination pixel increments. So what about this instead:
>>
>> __u32 x, y, src_w, src_h; /* fixed 16.16 */
>> __u32 crtc_x, crtc_y, crtc_w, crtc_h;
>>
>> Maybe rename x, y to src_x, src_y? crtc_w/h is needed to define zoom
>> factor (scaling_[wh] = crtc_[wh] / src_[wh]).
>>
>> So the "zoom transform" would be defined by (src_x, src_y, src_w, src_h)
>> => (crtc_x, crtc_y, crtc_w, crtc_h)
>>
>> It also gets rid of how to handle corner cases where scaling factor
>> defines a source area outside source fb. Now you can just say both rect
>> has to be inside crtc/fb. And you can also animate/move/clip a zoomed
>> overlay off screen without picture jumping (fb and display coords don't
>> align when zoomed).
>>
>> Summary, rectangles allow more precise representation of zoom factor,
>> and 16.16 source coords for stable image when moving overlay off screen
>> (clipping) or panning overlay content.
>>
>> BTW. Why not just add "__s32 z;" too? drm_mode_set_plane seems to be
>> plane position setup.
>>
> Yeah, all good points. I was thinking the source info could be mostly
> gleaned from the associated fb, but if you have hw that can source just
> a rect and scale it, passing rects around makes the most sense.
>
> And z-order is a trivial addition, so I have no problem with that. But
> communicating plane blending restrictions (including z-order) still has
> to be done with a separate ioctl. But that should probably be added by
> someone who has crazy hardware and the ability to test it!
>
> Thanks,
>
After a nights sleep I think a better solution to the clipped jumping
image would be to actually allow to position the dest rect outside the
"crtc rect". That way the user never have to calculate any fixed point
position of the source rect in the non zoomed case. Instead the driver
can clip at the best possible position to limit the jumping. Because the
dest rect will always be aligned on integer pixels.
But it might still be worth keeping fixed position for source rect when
doing pan and zoom, to be used by capable HW.
So to allow simpler user code when moving/animating overlay off screen.
It would be good to allow off screen coord for dest rect. That is, make
crtc_[xy] into signed __s32.
Will try to add the commit and the blend ioctl later including tests,
but first I need to finish and push the base KMS driver :)
/BR
/Marcus
next prev parent reply other threads:[~2011-06-09 9:16 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 20:07 [RFC] Updated DRM plane handling patches Jesse Barnes
2011-06-07 20:07 ` [PATCH 1/4] drm: add plane support Jesse Barnes
2011-06-07 21:01 ` Jesse Barnes
2011-06-08 9:41 ` Marcus Lorentzon
2011-06-08 18:54 ` Jesse Barnes
2011-06-09 9:16 ` Marcus Lorentzon [this message]
2011-06-07 21:05 ` Jesse Barnes
2011-06-07 20:07 ` [PATCH 2/4] drm: add an fb creation ioctl that takes a pixel format Jesse Barnes
2011-06-09 4:05 ` Dave Airlie
2011-06-09 8:21 ` Alan Cox
2011-06-09 10:40 ` Dave Airlie
2011-06-09 11:55 ` Alan Cox
2011-06-21 9:48 ` Laurent Pinchart
2011-06-07 20:07 ` [PATCH 3/4] drm/i915: rename existing overlay support to "legacy" Jesse Barnes
2011-06-07 20:59 ` [Intel-gfx] " Chris Wilson
2011-06-07 20:07 ` [PATCH 4/4] drm/i915: add SNB video sprite support Jesse Barnes
2011-06-07 21:01 ` Chris Wilson
2011-06-15 17:29 ` [RFC] Updated DRM plane handling patches Jesse Barnes
2011-07-21 10:15 ` Joonyoung Shim
2011-07-21 17:15 ` Jesse Barnes
-- strict thread matches above, loose matches on Subject: below --
2011-06-20 20:11 [RFC] Updated plane support v3 Jesse Barnes
2011-06-20 20:11 ` [PATCH 1/4] drm: add plane support Jesse Barnes
2011-06-20 20:11 ` Jesse Barnes
2011-07-21 10:30 ` Joonyoung Shim
2011-07-21 17:14 ` Jesse Barnes
2011-07-25 8:18 ` Joonyoung Shim
2011-07-25 14:57 ` Rob Clark
2011-07-26 4:21 ` Joonyoung Shim
2011-07-22 13:52 ` Rob Clark
2011-07-22 15:30 ` Jesse Barnes
2011-07-22 15:57 ` Rob Clark
2011-07-22 22:18 ` Alan Cox
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=4DF08F52.9080603@stericsson.com \
--to=marcus.xm.lorentzon@stericsson.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.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.