* [PATCH 1/2] video: udlfb: Fix unaligned access @ 2018-02-06 20:08 ` Ladislav Michl [not found] ` <CGME20180206200943epcas3p1b7ea1c191a47934ac0fef07e57c79448@epcas3p1.samsung.com> 2018-03-12 14:41 ` [PATCH 1/2] video: udlfb: Fix unaligned access Bartlomiej Zolnierkiewicz 0 siblings, 2 replies; 4+ messages in thread From: Ladislav Michl @ 2018-02-06 20:08 UTC (permalink / raw) To: linux-fbdev Driver generates lots of alignment trap exceptions on ARM. Fix that by replacing typecasting of odd addresses with byte shifting and remove uneccessary typecasting. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> --- Here's what happens on at91sam9g20 few minutes after boot: $ cat /proc/cpu/alignment User: 0 System: 10747836 (dlfb_render_hline+0x22c/0x2f0 [udlfb]) Skipped: 0 Half: 10747971 Word: 159 DWord: 0 Multi: 0 Each hline transfer causes dozens alignment exceptions and few are in dlfb_parse_vendor_descriptor function. drivers/video/fbdev/udlfb.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index 452a4207ac1b..45081297efa5 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -441,9 +441,9 @@ static void dlfb_compress_hline( *cmd++ = 0xAF; *cmd++ = 0x6B; - *cmd++ = (uint8_t) ((dev_addr >> 16) & 0xFF); - *cmd++ = (uint8_t) ((dev_addr >> 8) & 0xFF); - *cmd++ = (uint8_t) ((dev_addr) & 0xFF); + *cmd++ = dev_addr >> 16; + *cmd++ = dev_addr >> 8; + *cmd++ = dev_addr; cmd_pixels_count_byte = cmd++; /* we'll know this later */ cmd_pixel_start = pixel; @@ -460,8 +460,8 @@ static void dlfb_compress_hline( while (pixel < cmd_pixel_end) { const uint16_t * const repeating_pixel = pixel; - *(uint16_t *)cmd = cpu_to_be16p(pixel); - cmd += 2; + *cmd++ = *pixel >> 8; + *cmd++ = *pixel; pixel++; if (unlikely((pixel < cmd_pixel_end) && @@ -1531,15 +1531,16 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb, u8 length; u16 key; - key = le16_to_cpu(*((u16 *) desc)); - desc += sizeof(u16); - length = *desc; - desc++; + key = *desc++; + key |= (u16)*desc++ << 8; + length = *desc++; switch (key) { case 0x0200: { /* max_area */ - u32 max_area; - max_area = le32_to_cpu(*((u32 *)desc)); + u32 max_area = *desc++; + max_area |= (u32)*desc++ << 8; + max_area |= (u32)*desc++ << 16; + max_area |= (u32)*desc++ << 24; dev_warn(&intf->dev, "DL chip limited to %d pixel modes\n", max_area); -- 2.16.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <CGME20180206200943epcas3p1b7ea1c191a47934ac0fef07e57c79448@epcas3p1.samsung.com>]
* [PATCH 2/2] video: udlfb: Use already defined BPP constant @ 2018-02-06 20:09 ` Ladislav Michl 2018-03-12 14:44 ` Bartlomiej Zolnierkiewicz 0 siblings, 1 reply; 4+ messages in thread From: Ladislav Michl @ 2018-02-06 20:09 UTC (permalink / raw) To: linux-fbdev Replace const variable with already defined constant. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> --- drivers/video/fbdev/udlfb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index 45081297efa5..7b53fefb4b94 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -428,7 +428,6 @@ static void dlfb_compress_hline( const uint16_t *pixel = *pixel_start_ptr; uint32_t dev_addr = *device_address_ptr; uint8_t *cmd = *command_buffer_ptr; - const int bpp = 2; while ((pixel_end > pixel) && (cmd_buffer_end - MIN_RLX_CMD_BYTES > cmd)) { @@ -453,9 +452,9 @@ static void dlfb_compress_hline( cmd_pixel_end = pixel + min(MAX_CMD_PIXELS + 1, min((int)(pixel_end - pixel), - (int)(cmd_buffer_end - cmd) / bpp)); + (int)(cmd_buffer_end - cmd) / BPP)); - prefetch_range((void *) pixel, (cmd_pixel_end - pixel) * bpp); + prefetch_range((void *) pixel, (cmd_pixel_end - pixel) * BPP); while (pixel < cmd_pixel_end) { const uint16_t * const repeating_pixel = pixel; @@ -490,7 +489,7 @@ static void dlfb_compress_hline( } *cmd_pixels_count_byte = (pixel - cmd_pixel_start) & 0xFF; - dev_addr += (pixel - cmd_pixel_start) * bpp; + dev_addr += (pixel - cmd_pixel_start) * BPP; } if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) { -- 2.16.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] video: udlfb: Use already defined BPP constant 2018-02-06 20:09 ` [PATCH 2/2] video: udlfb: Use already defined BPP constant Ladislav Michl @ 2018-03-12 14:44 ` Bartlomiej Zolnierkiewicz 0 siblings, 0 replies; 4+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2018-03-12 14:44 UTC (permalink / raw) To: Ladislav Michl; +Cc: linux-fbdev, Bernie Thompson, dri-devel On Tuesday, February 06, 2018 09:09:39 PM Ladislav Michl wrote: > Replace const variable with already defined constant. > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Patch queued for 4.17, thanks. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] video: udlfb: Fix unaligned access 2018-02-06 20:08 ` [PATCH 1/2] video: udlfb: Fix unaligned access Ladislav Michl [not found] ` <CGME20180206200943epcas3p1b7ea1c191a47934ac0fef07e57c79448@epcas3p1.samsung.com> @ 2018-03-12 14:41 ` Bartlomiej Zolnierkiewicz 1 sibling, 0 replies; 4+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2018-03-12 14:41 UTC (permalink / raw) To: Ladislav Michl; +Cc: linux-fbdev, Bernie Thompson, dri-devel On Tuesday, February 06, 2018 09:08:38 PM Ladislav Michl wrote: > Driver generates lots of alignment trap exceptions on ARM. > Fix that by replacing typecasting of odd addresses with > byte shifting and remove uneccessary typecasting. > > Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Patch queued for 4.17, thanks. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-12 14:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20180206200846epcas1p489416383baf34280bb1e7981496db76e@epcas1p4.samsung.com>
2018-02-06 20:08 ` [PATCH 1/2] video: udlfb: Fix unaligned access Ladislav Michl
[not found] ` <CGME20180206200943epcas3p1b7ea1c191a47934ac0fef07e57c79448@epcas3p1.samsung.com>
2018-02-06 20:09 ` [PATCH 2/2] video: udlfb: Use already defined BPP constant Ladislav Michl
2018-03-12 14:44 ` Bartlomiej Zolnierkiewicz
2018-03-12 14:41 ` [PATCH 1/2] video: udlfb: Fix unaligned access Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).