From: "Noralf Trønnes" <noralf@tronnes.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
linux-fbdev@vger.kernel.org, tomi.valkeinen@ti.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/8] drm/rect: Add some drm_clip_rect utility functions
Date: Tue, 26 Apr 2016 16:26:47 +0000 [thread overview]
Message-ID: <571F96C7.1060800@tronnes.org> (raw)
In-Reply-To: <1615589.QRyc9Clv2Y@avalon>
Den 25.04.2016 23:13, skrev Laurent Pinchart:
> Hi Noralf,
>
> On Monday 25 Apr 2016 20:35:18 Noralf Trønnes wrote:
>> Den 25.04.2016 18:38, skrev Ville Syrjälä:
>>> On Mon, Apr 25, 2016 at 06:05:20PM +0200, Daniel Vetter wrote:
>>>> On Mon, Apr 25, 2016 at 06:09:44PM +0300, Ville Syrjälä wrote:
>>>>> On Mon, Apr 25, 2016 at 04:03:13PM +0200, Noralf Trønnes wrote:
>>>>>> Den 25.04.2016 15:02, skrev Ville Syrjälä:
>>>>>>> On Mon, Apr 25, 2016 at 02:55:52PM +0200, Noralf Trønnes wrote:
>>>>>>>> Den 25.04.2016 14:39, skrev Ville Syrjälä:
>>>>>>>>> On Sun, Apr 24, 2016 at 10:48:55PM +0200, Noralf Trønnes wrote:
>>>>>>>>>> Add some utility functions for struct drm_clip_rect.
[...]
>> How about we just drop this patch?
>> I couldn't find anyone else that merge these clips, they just loop and
>> handle them individually.
>>
>> The relevant part in drm_fb_helper would become:
>>
>> static void drm_fb_helper_dirty_work(struct work_struct *work)
>> {
>> struct drm_fb_helper *helper = container_of(work, struct drm_fb_helper,
>> dirty_work);
>> struct drm_clip_rect *clip = &helper->dirty_clip;
>> struct drm_clip_rect clip_copy;
>> unsigned long flags;
>>
>> spin_lock_irqsave(&helper->dirty_lock, flags);
>> clip_copy = *clip;
>> clip->x1 = clip->y1 = ~0;
>> clip->x2 = clip->y2 = 0;
>> spin_unlock_irqrestore(&helper->dirty_lock, flags);
>>
>> helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1);
>> }
>>
>> static void drm_fb_helper_dirty_init(struct drm_fb_helper *helper)
>> {
>> spin_lock_init(&helper->dirty_lock);
>> INIT_WORK(&helper->dirty_work, drm_fb_helper_dirty_work);
>> helper->dirty_clip.x1 = helper->dirty_clip.y1 = ~0;
>> }
>>
>> static void drm_fb_helper_dirty(struct fb_info *info, u32 x, u32 y,
>> u32 width, u32 height)
>> {
>> struct drm_fb_helper *helper = info->par;
>> struct drm_clip_rect *clip = &helper->dirty_clip;
>> unsigned long flags;
>>
>> if (!helper->fb->funcs->dirty)
>> return;
>>
>> spin_lock_irqsave(&helper->dirty_lock, flags);
>> clip->x1 = min(clip->x1, x);
>> clip->y1 = min(clip->y1, y);
>> clip->x2 = max(clip->x2, x + width);
>> clip->y2 = max(clip->y2, y + height);
>> spin_unlock_irqrestore(&helper->dirty_lock, flags);
>>
>> schedule_work(&helper->dirty_work);
>> }
>>
>>
>> And the driver would use this tinydrm function:
>>
>> void tinydrm_merge_clips(struct drm_clip_rect *dst,
>> struct drm_clip_rect *src, unsigned num_clips,
>> unsigned flags, u32 width, u32 height)
>> {
>> int i;
> Nitpicking here, as i never takes negative values, could you make it an
> unsigned int ?
Sure.
>> if (!src || !num_clips) {
>> dst->x1 = 0;
>> dst->x2 = width;
>> dst->y1 = 0;
>> dst->y2 = height;
>> return;
>> }
>>
>> dst->x1 = dst->y1 = ~0;
>> dst->x2 = dst->y2 = 0;
>>
>> for (i = 0; i < num_clips; i++) {
>> if (flags & DRM_MODE_FB_DIRTY_ANNOTATE_COPY)
>> i++;
>> dst->x1 = min(dst->x1, src[i].x1);
>> dst->x2 = max(dst->x2, src[i].x2);
>> dst->y1 = min(dst->y1, src[i].y1);
>> dst->y2 = max(dst->y2, src[i].y2);
>> }
>>
>> if (dst->x2 > width || dst->y2 > height ||
>> dst->x1 >= dst->x2 || dst->y1 >= dst->y2) {
>> DRM_DEBUG_KMS("Illegal clip: x1=%u, x2=%u, y1=%u, y2=%u\n",
>> dst->x1, dst->x2, dst->y1, dst->y2);
>> dst->x1 = dst->y1 = 0;
>> dst->x2 = width;
>> dst->y2 = height;
>> }
>> }
>>
>> static int mipi_dbi_dirtyfb(struct drm_framebuffer *fb, void *vmem,
>> unsigned flags, unsigned color,
>> struct drm_clip_rect *clips, unsigned num_clips)
>> {
>> struct drm_clip_rect clip;
>>
>> tinydrm_merge_clips(&clip, clips, num_clips, flags,
>> fb->width, fb->height);
WARNING: multiple messages have this Message-ID (diff)
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
linux-fbdev@vger.kernel.org, tomi.valkeinen@ti.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/8] drm/rect: Add some drm_clip_rect utility functions
Date: Tue, 26 Apr 2016 18:26:47 +0200 [thread overview]
Message-ID: <571F96C7.1060800@tronnes.org> (raw)
In-Reply-To: <1615589.QRyc9Clv2Y@avalon>
Den 25.04.2016 23:13, skrev Laurent Pinchart:
> Hi Noralf,
>
> On Monday 25 Apr 2016 20:35:18 Noralf Trønnes wrote:
>> Den 25.04.2016 18:38, skrev Ville Syrjälä:
>>> On Mon, Apr 25, 2016 at 06:05:20PM +0200, Daniel Vetter wrote:
>>>> On Mon, Apr 25, 2016 at 06:09:44PM +0300, Ville Syrjälä wrote:
>>>>> On Mon, Apr 25, 2016 at 04:03:13PM +0200, Noralf Trønnes wrote:
>>>>>> Den 25.04.2016 15:02, skrev Ville Syrjälä:
>>>>>>> On Mon, Apr 25, 2016 at 02:55:52PM +0200, Noralf Trønnes wrote:
>>>>>>>> Den 25.04.2016 14:39, skrev Ville Syrjälä:
>>>>>>>>> On Sun, Apr 24, 2016 at 10:48:55PM +0200, Noralf Trønnes wrote:
>>>>>>>>>> Add some utility functions for struct drm_clip_rect.
[...]
>> How about we just drop this patch?
>> I couldn't find anyone else that merge these clips, they just loop and
>> handle them individually.
>>
>> The relevant part in drm_fb_helper would become:
>>
>> static void drm_fb_helper_dirty_work(struct work_struct *work)
>> {
>> struct drm_fb_helper *helper = container_of(work, struct drm_fb_helper,
>> dirty_work);
>> struct drm_clip_rect *clip = &helper->dirty_clip;
>> struct drm_clip_rect clip_copy;
>> unsigned long flags;
>>
>> spin_lock_irqsave(&helper->dirty_lock, flags);
>> clip_copy = *clip;
>> clip->x1 = clip->y1 = ~0;
>> clip->x2 = clip->y2 = 0;
>> spin_unlock_irqrestore(&helper->dirty_lock, flags);
>>
>> helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1);
>> }
>>
>> static void drm_fb_helper_dirty_init(struct drm_fb_helper *helper)
>> {
>> spin_lock_init(&helper->dirty_lock);
>> INIT_WORK(&helper->dirty_work, drm_fb_helper_dirty_work);
>> helper->dirty_clip.x1 = helper->dirty_clip.y1 = ~0;
>> }
>>
>> static void drm_fb_helper_dirty(struct fb_info *info, u32 x, u32 y,
>> u32 width, u32 height)
>> {
>> struct drm_fb_helper *helper = info->par;
>> struct drm_clip_rect *clip = &helper->dirty_clip;
>> unsigned long flags;
>>
>> if (!helper->fb->funcs->dirty)
>> return;
>>
>> spin_lock_irqsave(&helper->dirty_lock, flags);
>> clip->x1 = min(clip->x1, x);
>> clip->y1 = min(clip->y1, y);
>> clip->x2 = max(clip->x2, x + width);
>> clip->y2 = max(clip->y2, y + height);
>> spin_unlock_irqrestore(&helper->dirty_lock, flags);
>>
>> schedule_work(&helper->dirty_work);
>> }
>>
>>
>> And the driver would use this tinydrm function:
>>
>> void tinydrm_merge_clips(struct drm_clip_rect *dst,
>> struct drm_clip_rect *src, unsigned num_clips,
>> unsigned flags, u32 width, u32 height)
>> {
>> int i;
> Nitpicking here, as i never takes negative values, could you make it an
> unsigned int ?
Sure.
>> if (!src || !num_clips) {
>> dst->x1 = 0;
>> dst->x2 = width;
>> dst->y1 = 0;
>> dst->y2 = height;
>> return;
>> }
>>
>> dst->x1 = dst->y1 = ~0;
>> dst->x2 = dst->y2 = 0;
>>
>> for (i = 0; i < num_clips; i++) {
>> if (flags & DRM_MODE_FB_DIRTY_ANNOTATE_COPY)
>> i++;
>> dst->x1 = min(dst->x1, src[i].x1);
>> dst->x2 = max(dst->x2, src[i].x2);
>> dst->y1 = min(dst->y1, src[i].y1);
>> dst->y2 = max(dst->y2, src[i].y2);
>> }
>>
>> if (dst->x2 > width || dst->y2 > height ||
>> dst->x1 >= dst->x2 || dst->y1 >= dst->y2) {
>> DRM_DEBUG_KMS("Illegal clip: x1=%u, x2=%u, y1=%u, y2=%u\n",
>> dst->x1, dst->x2, dst->y1, dst->y2);
>> dst->x1 = dst->y1 = 0;
>> dst->x2 = width;
>> dst->y2 = height;
>> }
>> }
>>
>> static int mipi_dbi_dirtyfb(struct drm_framebuffer *fb, void *vmem,
>> unsigned flags, unsigned color,
>> struct drm_clip_rect *clips, unsigned num_clips)
>> {
>> struct drm_clip_rect clip;
>>
>> tinydrm_merge_clips(&clip, clips, num_clips, flags,
>> fb->width, fb->height);
next prev parent reply other threads:[~2016-04-26 16:26 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-24 20:48 [PATCH v2 0/8] drm: Add fbdev deferred io support to helpers Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-24 20:48 ` [PATCH v2 1/8] drm/rect: Add some drm_clip_rect utility functions Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-25 9:02 ` Daniel Vetter
2016-04-25 9:02 ` Daniel Vetter
2016-04-25 9:02 ` Daniel Vetter
2016-04-25 12:39 ` Ville Syrjälä
2016-04-25 12:39 ` Ville Syrjälä
2016-04-25 12:39 ` Ville Syrjälä
2016-04-25 12:55 ` Noralf Trønnes
2016-04-25 12:55 ` Noralf Trønnes
2016-04-25 12:55 ` Noralf Trønnes
2016-04-25 13:02 ` Ville Syrjälä
2016-04-25 13:02 ` Ville Syrjälä
2016-04-25 14:03 ` Noralf Trønnes
2016-04-25 14:03 ` Noralf Trønnes
2016-04-25 14:03 ` Noralf Trønnes
2016-04-25 15:09 ` Ville Syrjälä
2016-04-25 15:09 ` Ville Syrjälä
2016-04-25 15:09 ` Ville Syrjälä
2016-04-25 16:05 ` Daniel Vetter
2016-04-25 16:05 ` Daniel Vetter
2016-04-25 16:05 ` Daniel Vetter
2016-04-25 16:38 ` Ville Syrjälä
2016-04-25 16:38 ` Ville Syrjälä
2016-04-25 16:38 ` Ville Syrjälä
2016-04-25 18:35 ` Noralf Trønnes
2016-04-25 18:35 ` Noralf Trønnes
2016-04-25 18:35 ` Noralf Trønnes
2016-04-25 19:03 ` Daniel Vetter
2016-04-25 19:03 ` Daniel Vetter
2016-04-25 19:03 ` Daniel Vetter
2016-04-25 21:13 ` Laurent Pinchart
2016-04-25 21:13 ` Laurent Pinchart
2016-04-26 16:26 ` Noralf Trønnes [this message]
2016-04-26 16:26 ` Noralf Trønnes
2016-04-24 20:48 ` [PATCH v2 2/8] drm/udl: Change drm_fb_helper_sys_*() calls to sys_*() Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-24 20:48 ` [PATCH v2 3/8] drm/qxl: " Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-25 9:03 ` Daniel Vetter
2016-04-25 9:03 ` Daniel Vetter
2016-04-25 9:03 ` Daniel Vetter
2016-04-24 20:48 ` [PATCH v2 4/8] drm/fb-helper: Add fb_deferred_io support Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-25 9:09 ` Daniel Vetter
2016-04-25 9:09 ` Daniel Vetter
2016-04-26 16:24 ` Noralf Trønnes
2016-04-26 16:24 ` Noralf Trønnes
2016-04-26 16:24 ` Noralf Trønnes
2016-04-26 17:19 ` Daniel Vetter
2016-04-26 17:19 ` Daniel Vetter
2016-04-26 17:19 ` Daniel Vetter
2016-04-27 9:45 ` Noralf Trønnes
2016-04-27 9:45 ` Noralf Trønnes
2016-04-27 9:45 ` Noralf Trønnes
2016-04-27 11:14 ` Daniel Vetter
2016-04-27 11:14 ` Daniel Vetter
2016-04-27 11:14 ` Daniel Vetter
2016-04-24 20:48 ` [PATCH v2 5/8] fbdev: fb_defio: Export fb_deferred_io_mmap Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-24 20:48 ` Noralf Trønnes
2016-04-25 9:11 ` Daniel Vetter
2016-04-25 9:11 ` Daniel Vetter
2016-04-25 9:11 ` Daniel Vetter
2016-04-24 20:49 ` [PATCH v2 6/8] drm/fb-cma-helper: Add fb_deferred_io support Noralf Trønnes
2016-04-24 20:49 ` Noralf Trønnes
2016-04-24 20:49 ` Noralf Trønnes
2016-04-25 9:15 ` Daniel Vetter
2016-04-25 9:15 ` Daniel Vetter
2016-04-25 9:15 ` Daniel Vetter
2016-04-24 20:49 ` [PATCH v2 7/8] drm/qxl: Use drm_fb_helper deferred_io support Noralf Trønnes
2016-04-24 20:49 ` Noralf Trønnes
2016-04-24 20:49 ` Noralf Trønnes
2016-04-25 9:16 ` Daniel Vetter
2016-04-25 9:16 ` Daniel Vetter
2016-04-24 20:49 ` [PATCH v2 8/8] drm/udl: " Noralf Trønnes
2016-04-24 20:49 ` Noralf Trønnes
2016-04-24 20:49 ` Noralf Trønnes
2016-04-25 9:17 ` Daniel Vetter
2016-04-25 9:17 ` Daniel Vetter
2016-04-25 9:17 ` Daniel Vetter
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=571F96C7.1060800@tronnes.org \
--to=noralf@tronnes.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tomi.valkeinen@ti.com \
--cc=ville.syrjala@linux.intel.com \
/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.