diff mbox

drm/udl: Fix for the X server screen update v2

Message ID 88ba6722-c757-7685-5e89-6abe177aef44@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

poma Sept. 19, 2016, 6:27 p.m. UTC
Fix for DisplayLink GPU USB2.0 device X server screen update

Within X server on top of DisplayLink GPU USB2.0 device,
screen content is not refreshed i.e. updated,
which is the most basic functionality of the screen.

This partially (udl_handle_damage()) reverts commit:

- e375882406d0cc24030746638592004755ed4ae0
  "drm/udl: Use drm_fb_helper deferred_io support"

Thanks Noralf for the comments.

Reported and
Tested-by: poma <poma@gmail.com>
---
 drivers/gpu/drm/udl/udl_fb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Daniel Vetter Sept. 19, 2016, 9:12 p.m. UTC | #1
On Mon, Sep 19, 2016 at 8:27 PM, poma <pomidorabelisima@gmail.com> wrote:
> @@ -122,14 +126,14 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
>                 return 0;
>         cmd = urb->transfer_buffer;
>
> -       for (i = y; i < height ; i++) {
> +       for (i = y; i <= y2 ; i++) {

I think a simpler fix (which retains Noralf's nice cleanup would be to
change the loop condition to i < y + height. At least that seems to be
the underlying bug. Can you pls test that and then submit either that
one-liner (if it works) or your original patch (it's missing the
signed-off-by right now, so can't be merged as-is)? Either one has my
r-b (preemptive since I'm travelling).

Thanks, Daniel
poma Sept. 22, 2016, 12:23 p.m. UTC | #2
On 19.09.2016 23:12, Daniel Vetter wrote:
> On Mon, Sep 19, 2016 at 8:27 PM, poma <pomidorabelisima@gmail.com> wrote:
>> @@ -122,14 +126,14 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
>>                 return 0;
>>         cmd = urb->transfer_buffer;
>>
>> -       for (i = y; i < height ; i++) {
>> +       for (i = y; i <= y2 ; i++) {
> 
> I think a simpler fix (which retains Noralf's nice cleanup would be to
> change the loop condition to i < y + height. At least that seems to be
> the underlying bug. Can you pls test that and then submit either that
> one-liner (if it works) or your original patch (it's missing the
> signed-off-by right now, so can't be merged as-is)? Either one has my
> r-b (preemptive since I'm travelling).
> 
> Thanks, Daniel
> 

Feel free to (re)send patch v3, whenever you can.
After all, the idea is yours.

Respect
diff mbox

Patch

diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index d5df555..05ab114 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -90,6 +90,7 @@  int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
 	struct urb *urb;
 	int aligned_x;
 	int bpp = (fb->base.bits_per_pixel / 8);
+	int x2, y2;
 
 	if (!fb->active_16)
 		return 0;
@@ -115,6 +116,9 @@  int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
 	    (y + height > fb->base.height))
 		return -EINVAL;
 
+	x2 = x + width - 1;
+	y2 = y + height - 1;
+
 	start_cycles = get_cycles();
 
 	urb = udl_get_urb(dev);
@@ -122,14 +126,14 @@  int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
 		return 0;
 	cmd = urb->transfer_buffer;
 
-	for (i = y; i < height ; i++) {
+	for (i = y; i <= y2 ; i++) {
 		const int line_offset = fb->base.pitches[0] * i;
 		const int byte_offset = line_offset + (x * bpp);
 		const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp);
 		if (udl_render_hline(dev, bpp, &urb,
 				     (char *) fb->obj->vmapping,
 				     &cmd, byte_offset, dev_byte_offset,
-				     width * bpp,
+				     (x2 - x + 1) * bpp,
 				     &bytes_identical, &bytes_sent))
 			goto error;
 	}