diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-04-29 12:08:34 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-05-03 16:04:22 +0200 |
commit | e2d8b4289c937447ab710052f15a18f686db73dc (patch) | |
tree | 684900065bd4de0fc0048fad99effe21ec0dd7a6 /drivers/video/fbdev/broadsheetfb.c | |
parent | e80eec1b871a2acb8f5c92db4c237e9ae6dd322b (diff) | |
download | linux-stable-e2d8b4289c937447ab710052f15a18f686db73dc.tar.gz linux-stable-e2d8b4289c937447ab710052f15a18f686db73dc.tar.bz2 linux-stable-e2d8b4289c937447ab710052f15a18f686db73dc.zip |
fbdev: Use pageref offset for deferred-I/O writeback
Use pageref->offset instead of page->index for deferred-I/O writeback
where appropriate. Distinguishes between file-mapping offset and video-
memory offset. While at it, also remove unnecessary references to
struct page.
Fbdev's deferred-I/O code uses the two related page->index and
pageref->offset. The former is the page offset in the mapped file,
the latter is the byte offset in the video memory (or fbdev screen
buffer). It's the same value for fbdev drivers, but for DRM the values
can be different. Because GEM buffer objects are mapped at an offset
in the DRM device file, page->index has this offset added to it as well.
We currently don't hit this case in DRM, because all affected mappings
of GEM memory are performed with an internal, intermediate shadow buffer.
The value of page->index is required by page_mkclean(), which we
call to reset the mappings during the writeback phase of the deferred
I/O. The value of pageref->offset is for conveniently getting an offset
into video memory in fb helpers.
v4:
* fix commit message (Javier)
Suggested-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220429100834.18898-6-tzimmermann@suse.de
Diffstat (limited to 'drivers/video/fbdev/broadsheetfb.c')
-rw-r--r-- | drivers/video/fbdev/broadsheetfb.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index 883a3ac03189..55e62dd96f9b 100644 --- a/drivers/video/fbdev/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c @@ -932,7 +932,7 @@ static void broadsheetfb_dpy_update(struct broadsheetfb_par *par) static void broadsheetfb_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist) { u16 y1 = 0, h = 0; - int prev_index = -1; + unsigned long prev_offset = ULONG_MAX; struct fb_deferred_io_pageref *pageref; int h_inc; u16 yres = info->var.yres; @@ -943,22 +943,21 @@ static void broadsheetfb_dpy_deferred_io(struct fb_info *info, struct list_head /* walk the written page list and swizzle the data */ list_for_each_entry(pageref, pagereflist, list) { - struct page *cur = pageref->page; - if (prev_index < 0) { + if (prev_offset == ULONG_MAX) { /* just starting so assign first page */ - y1 = (cur->index << PAGE_SHIFT) / xres; + y1 = pageref->offset / xres; h = h_inc; - } else if ((prev_index + 1) == cur->index) { + } else if ((prev_offset + PAGE_SIZE) == pageref->offset) { /* this page is consecutive so increase our height */ h += h_inc; } else { /* page not consecutive, issue previous update first */ broadsheetfb_dpy_update_pages(info->par, y1, y1 + h); /* start over with our non consecutive page */ - y1 = (cur->index << PAGE_SHIFT) / xres; + y1 = pageref->offset / xres; h = h_inc; } - prev_index = cur->index; + prev_offset = pageref->offset; } /* if we still have any pages to update we do so now */ |