Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd2b5959 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

drm/bochs: fix framebuffer setup.



The driver doesn't consider framebuffer pitch and offset, leading to a
wrong display in case offset != 0 or pitch != width * bpp.  Fix it.

Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190627081206.23135-1-kraxel@redhat.com
parent daed277e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -86,7 +86,7 @@ void bochs_hw_setmode(struct bochs_device *bochs,
void bochs_hw_setformat(struct bochs_device *bochs,
void bochs_hw_setformat(struct bochs_device *bochs,
			const struct drm_format_info *format);
			const struct drm_format_info *format);
void bochs_hw_setbase(struct bochs_device *bochs,
void bochs_hw_setbase(struct bochs_device *bochs,
		      int x, int y, u64 addr);
		      int x, int y, int stride, u64 addr);
int bochs_hw_load_edid(struct bochs_device *bochs);
int bochs_hw_load_edid(struct bochs_device *bochs);


/* bochs_mm.c */
/* bochs_mm.c */
+10 −4
Original line number Original line Diff line number Diff line
@@ -255,16 +255,22 @@ void bochs_hw_setformat(struct bochs_device *bochs,
}
}


void bochs_hw_setbase(struct bochs_device *bochs,
void bochs_hw_setbase(struct bochs_device *bochs,
		      int x, int y, u64 addr)
		      int x, int y, int stride, u64 addr)
{
{
	unsigned long offset = (unsigned long)addr +
	unsigned long offset;
	unsigned int vx, vy, vwidth;

	bochs->stride = stride;
	offset = (unsigned long)addr +
		y * bochs->stride +
		y * bochs->stride +
		x * (bochs->bpp / 8);
		x * (bochs->bpp / 8);
	int vy = offset / bochs->stride;
	vy = offset / bochs->stride;
	int vx = (offset % bochs->stride) * 8 / bochs->bpp;
	vx = (offset % bochs->stride) * 8 / bochs->bpp;
	vwidth = stride * 8 / bochs->bpp;


	DRM_DEBUG_DRIVER("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n",
	DRM_DEBUG_DRIVER("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n",
			 x, y, addr, offset, vx, vy);
			 x, y, addr, offset, vx, vy);
	bochs_dispi_write(bochs, VBE_DISPI_INDEX_VIRT_WIDTH, vwidth);
	bochs_dispi_write(bochs, VBE_DISPI_INDEX_X_OFFSET, vx);
	bochs_dispi_write(bochs, VBE_DISPI_INDEX_X_OFFSET, vx);
	bochs_dispi_write(bochs, VBE_DISPI_INDEX_Y_OFFSET, vy);
	bochs_dispi_write(bochs, VBE_DISPI_INDEX_Y_OFFSET, vy);
}
}
+2 −1
Original line number Original line Diff line number Diff line
@@ -36,7 +36,8 @@ static void bochs_plane_update(struct bochs_device *bochs,
	bochs_hw_setbase(bochs,
	bochs_hw_setbase(bochs,
			 state->crtc_x,
			 state->crtc_x,
			 state->crtc_y,
			 state->crtc_y,
			 gbo->bo.offset);
			 state->fb->pitches[0],
			 state->fb->offsets[0] + gbo->bo.offset);
	bochs_hw_setformat(bochs, state->fb->format);
	bochs_hw_setformat(bochs, state->fb->format);
}
}