From: "Noralf Trønnes via B4 Submission Endpoint" <devnull+noralf.tronnes.org@kernel.org> To: "Thomas Zimmermann" <tzimmermann@suse.de>, "Javier Martinez Canillas" <javierm@redhat.com>, dri-devel@lists.freedesktop.org, "Maxime Ripard" <mripard@kernel.org>, stable@kernel.org, Noralf =?unknown-8bit?q?Tr=C3=B8nnes?= <noralf@tronnes.org> Subject: [PATCH v2 3/6] drm/gud: Split up gud_flush_work() Date: Wed, 30 Nov 2022 20:26:51 +0100 [thread overview] Message-ID: <20221122-gud-shadow-plane-v2-3-435037990a83@tronnes.org> (raw) In-Reply-To: <20221122-gud-shadow-plane-v2-0-435037990a83@tronnes.org> From: Noralf Trønnes <noralf@tronnes.org> In preparation for inlining synchronous flushing split out the part of gud_flush_work() that can be shared by the sync and async code paths. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- drivers/gpu/drm/gud/gud_pipe.c | 72 +++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/gud/gud_pipe.c b/drivers/gpu/drm/gud/gud_pipe.c index ff1358815af5..d2af9947494f 100644 --- a/drivers/gpu/drm/gud/gud_pipe.c +++ b/drivers/gpu/drm/gud/gud_pipe.c @@ -333,15 +333,49 @@ void gud_clear_damage(struct gud_device *gdrm) gdrm->damage.y2 = 0; } +static void gud_flush_damage(struct gud_device *gdrm, struct drm_framebuffer *fb, + struct drm_rect *damage) +{ + const struct drm_format_info *format; + unsigned int i, lines; + size_t pitch; + int ret; + + format = fb->format; + if (format->format == DRM_FORMAT_XRGB8888 && gdrm->xrgb8888_emulation_format) + format = gdrm->xrgb8888_emulation_format; + + /* Split update if it's too big */ + pitch = drm_format_info_min_pitch(format, 0, drm_rect_width(damage)); + lines = drm_rect_height(damage); + + if (gdrm->bulk_len < lines * pitch) + lines = gdrm->bulk_len / pitch; + + for (i = 0; i < DIV_ROUND_UP(drm_rect_height(damage), lines); i++) { + struct drm_rect rect = *damage; + + rect.y1 += i * lines; + rect.y2 = min_t(u32, rect.y1 + lines, damage->y2); + + ret = gud_flush_rect(gdrm, fb, format, &rect); + if (ret) { + if (ret != -ENODEV && ret != -ECONNRESET && + ret != -ESHUTDOWN && ret != -EPROTO) + dev_err_ratelimited(fb->dev->dev, + "Failed to flush framebuffer: error=%d\n", ret); + gdrm->prev_flush_failed = true; + break; + } + } +} + void gud_flush_work(struct work_struct *work) { struct gud_device *gdrm = container_of(work, struct gud_device, work); - const struct drm_format_info *format; struct drm_framebuffer *fb; struct drm_rect damage; - unsigned int i, lines; - int idx, ret = 0; - size_t pitch; + int idx; if (!drm_dev_enter(&gdrm->drm, &idx)) return; @@ -356,35 +390,7 @@ void gud_flush_work(struct work_struct *work) if (!fb) goto out; - format = fb->format; - if (format->format == DRM_FORMAT_XRGB8888 && gdrm->xrgb8888_emulation_format) - format = gdrm->xrgb8888_emulation_format; - - /* Split update if it's too big */ - pitch = drm_format_info_min_pitch(format, 0, drm_rect_width(&damage)); - lines = drm_rect_height(&damage); - - if (gdrm->bulk_len < lines * pitch) - lines = gdrm->bulk_len / pitch; - - for (i = 0; i < DIV_ROUND_UP(drm_rect_height(&damage), lines); i++) { - struct drm_rect rect = damage; - - rect.y1 += i * lines; - rect.y2 = min_t(u32, rect.y1 + lines, damage.y2); - - ret = gud_flush_rect(gdrm, fb, format, &rect); - if (ret) { - if (ret != -ENODEV && ret != -ECONNRESET && - ret != -ESHUTDOWN && ret != -EPROTO) - dev_err_ratelimited(fb->dev->dev, - "Failed to flush framebuffer: error=%d\n", ret); - gdrm->prev_flush_failed = true; - break; - } - - gdrm->prev_flush_failed = false; - } + gud_flush_damage(gdrm, fb, &damage); drm_framebuffer_put(fb); out: -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Noralf Trønnes <noralf@tronnes.org> To: Thomas Zimmermann <tzimmermann@suse.de>, Javier Martinez Canillas <javierm@redhat.com>, dri-devel@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org>, stable@vger.kernel.org, Noralf Trønnes <noralf@tronnes.org> Subject: [PATCH v2 3/6] drm/gud: Split up gud_flush_work() Date: Wed, 30 Nov 2022 20:26:51 +0100 [thread overview] Message-ID: <20221122-gud-shadow-plane-v2-3-435037990a83@tronnes.org> (raw) In-Reply-To: <20221122-gud-shadow-plane-v2-0-435037990a83@tronnes.org> In preparation for inlining synchronous flushing split out the part of gud_flush_work() that can be shared by the sync and async code paths. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> --- drivers/gpu/drm/gud/gud_pipe.c | 72 +++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/gud/gud_pipe.c b/drivers/gpu/drm/gud/gud_pipe.c index ff1358815af5..d2af9947494f 100644 --- a/drivers/gpu/drm/gud/gud_pipe.c +++ b/drivers/gpu/drm/gud/gud_pipe.c @@ -333,15 +333,49 @@ void gud_clear_damage(struct gud_device *gdrm) gdrm->damage.y2 = 0; } +static void gud_flush_damage(struct gud_device *gdrm, struct drm_framebuffer *fb, + struct drm_rect *damage) +{ + const struct drm_format_info *format; + unsigned int i, lines; + size_t pitch; + int ret; + + format = fb->format; + if (format->format == DRM_FORMAT_XRGB8888 && gdrm->xrgb8888_emulation_format) + format = gdrm->xrgb8888_emulation_format; + + /* Split update if it's too big */ + pitch = drm_format_info_min_pitch(format, 0, drm_rect_width(damage)); + lines = drm_rect_height(damage); + + if (gdrm->bulk_len < lines * pitch) + lines = gdrm->bulk_len / pitch; + + for (i = 0; i < DIV_ROUND_UP(drm_rect_height(damage), lines); i++) { + struct drm_rect rect = *damage; + + rect.y1 += i * lines; + rect.y2 = min_t(u32, rect.y1 + lines, damage->y2); + + ret = gud_flush_rect(gdrm, fb, format, &rect); + if (ret) { + if (ret != -ENODEV && ret != -ECONNRESET && + ret != -ESHUTDOWN && ret != -EPROTO) + dev_err_ratelimited(fb->dev->dev, + "Failed to flush framebuffer: error=%d\n", ret); + gdrm->prev_flush_failed = true; + break; + } + } +} + void gud_flush_work(struct work_struct *work) { struct gud_device *gdrm = container_of(work, struct gud_device, work); - const struct drm_format_info *format; struct drm_framebuffer *fb; struct drm_rect damage; - unsigned int i, lines; - int idx, ret = 0; - size_t pitch; + int idx; if (!drm_dev_enter(&gdrm->drm, &idx)) return; @@ -356,35 +390,7 @@ void gud_flush_work(struct work_struct *work) if (!fb) goto out; - format = fb->format; - if (format->format == DRM_FORMAT_XRGB8888 && gdrm->xrgb8888_emulation_format) - format = gdrm->xrgb8888_emulation_format; - - /* Split update if it's too big */ - pitch = drm_format_info_min_pitch(format, 0, drm_rect_width(&damage)); - lines = drm_rect_height(&damage); - - if (gdrm->bulk_len < lines * pitch) - lines = gdrm->bulk_len / pitch; - - for (i = 0; i < DIV_ROUND_UP(drm_rect_height(&damage), lines); i++) { - struct drm_rect rect = damage; - - rect.y1 += i * lines; - rect.y2 = min_t(u32, rect.y1 + lines, damage.y2); - - ret = gud_flush_rect(gdrm, fb, format, &rect); - if (ret) { - if (ret != -ENODEV && ret != -ECONNRESET && - ret != -ESHUTDOWN && ret != -EPROTO) - dev_err_ratelimited(fb->dev->dev, - "Failed to flush framebuffer: error=%d\n", ret); - gdrm->prev_flush_failed = true; - break; - } - - gdrm->prev_flush_failed = false; - } + gud_flush_damage(gdrm, fb, &damage); drm_framebuffer_put(fb); out: -- 2.34.1
next prev parent reply other threads:[~2022-11-30 19:27 UTC|newest] Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-30 19:26 [PATCH v2 0/6] drm/gud: Use the shadow plane helper Noralf Trønnes via B4 Submission Endpoint 2022-11-30 19:26 ` Noralf Trønnes 2022-11-30 19:26 ` [PATCH v2 1/6] drm/gud: Fix UBSAN warning Noralf Trønnes via B4 Submission Endpoint 2022-11-30 19:26 ` Noralf Trønnes 2022-11-30 19:26 ` [PATCH v2 2/6] drm/gud: Don't retry a failed framebuffer flush Noralf Trønnes via B4 Submission Endpoint 2022-11-30 19:26 ` Noralf Trønnes 2022-11-30 19:26 ` Noralf Trønnes via B4 Submission Endpoint [this message] 2022-11-30 19:26 ` [PATCH v2 3/6] drm/gud: Split up gud_flush_work() Noralf Trønnes 2022-11-30 19:26 ` [PATCH v2 4/6] drm/gud: Prepare buffer for CPU access in gud_flush_work() Noralf Trønnes via B4 Submission Endpoint 2022-11-30 19:26 ` Noralf Trønnes 2022-12-01 8:51 ` Thomas Zimmermann 2022-11-30 19:26 ` [PATCH v2 5/6] drm/gud: Use the shadow plane helper Noralf Trønnes via B4 Submission Endpoint 2022-11-30 19:26 ` Noralf Trønnes 2022-12-01 8:55 ` Thomas Zimmermann 2022-11-30 19:26 ` [PATCH v2 6/6] drm/gud: Enable synchronous flushing by default Noralf Trønnes via B4 Submission Endpoint 2022-11-30 19:26 ` Noralf Trønnes 2022-12-01 8:57 ` Thomas Zimmermann 2022-12-01 5:55 ` [PATCH v2 0/6] drm/gud: Use the shadow plane helper Greg KH 2022-12-01 10:00 ` Noralf Trønnes 2022-12-01 10:00 ` Noralf Trønnes 2022-12-01 12:12 ` Greg KH 2022-12-01 12:12 ` Greg KH 2022-12-01 13:14 ` Noralf Trønnes 2022-12-01 13:14 ` Noralf Trønnes 2022-12-01 13:21 ` Greg KH 2022-12-01 13:21 ` Greg KH 2022-12-01 13:34 ` Javier Martinez Canillas 2022-12-01 13:34 ` Javier Martinez Canillas 2022-12-01 14:16 ` Konstantin Ryabitsev 2022-12-01 14:16 ` Konstantin Ryabitsev 2022-12-01 14:20 ` Javier Martinez Canillas 2022-12-01 14:20 ` Javier Martinez Canillas 2022-12-01 14:27 ` Vlastimil Babka 2022-12-01 14:27 ` Vlastimil Babka 2022-12-01 14:32 ` Mark Brown 2022-12-01 14:32 ` Mark Brown 2023-01-05 12:35 ` Daniel Vetter 2023-01-05 12:35 ` Daniel Vetter 2023-01-05 16:00 ` Konstantin Ryabitsev 2023-01-05 16:00 ` Konstantin Ryabitsev 2022-12-01 20:52 ` Noralf Trønnes 2022-12-01 20:52 ` Noralf Trønnes 2022-12-06 15:57 ` Noralf Trønnes
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=20221122-gud-shadow-plane-v2-3-435037990a83@tronnes.org \ --to=devnull+noralf.tronnes.org@kernel.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=javierm@redhat.com \ --cc=mripard@kernel.org \ --cc=noralf@tronnes.org \ --cc=stable@kernel.org \ --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: linkBe 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.