@@ -85,8 +85,9 @@ void bochs_hw_setmode(struct bochs_device *bochs,
struct drm_display_mode *mode);
void bochs_hw_setformat(struct bochs_device *bochs,
const struct drm_format_info *format);
-void bochs_hw_setbase(struct bochs_device *bochs,
- int x, int y, u64 addr);
+void bochs_hw_setfb(struct bochs_device *bochs,
+ struct drm_framebuffer *fb,
+ int x, int y);
int bochs_hw_load_edid(struct bochs_device *bochs);
/* bochs_mm.c */
@@ -254,17 +254,17 @@ void bochs_hw_setformat(struct bochs_device *bochs,
};
}
-void bochs_hw_setbase(struct bochs_device *bochs,
- int x, int y, u64 addr)
+void bochs_hw_setfb(struct bochs_device *bochs,
+ struct drm_framebuffer *fb,
+ int x, int y)
{
- unsigned long offset = (unsigned long)addr +
+ struct drm_gem_vram_object *bo = drm_gem_vram_of_gem(fb->obj[0]);
+ unsigned long offset = bo->bo.offset +
y * bochs->stride +
x * (bochs->bpp / 8);
int vy = offset / bochs->stride;
int vx = (offset % bochs->stride) * 8 / bochs->bpp;
- DRM_DEBUG_DRIVER("x %d, y %d, addr %llx -> offset %lx, vx %d, vy %d\n",
- x, y, addr, offset, vx, vy);
bochs_dispi_write(bochs, VBE_DISPI_INDEX_X_OFFSET, vx);
bochs_dispi_write(bochs, VBE_DISPI_INDEX_Y_OFFSET, vy);
}
@@ -27,16 +27,12 @@ static const uint32_t bochs_formats[] = {
static void bochs_plane_update(struct bochs_device *bochs,
struct drm_plane_state *state)
{
- struct drm_gem_vram_object *gbo;
-
if (!state->fb || !bochs->stride)
return;
- gbo = drm_gem_vram_of_gem(state->fb->obj[0]);
- bochs_hw_setbase(bochs,
- state->crtc_x,
- state->crtc_y,
- gbo->bo.offset);
+ bochs_hw_setfb(bochs, state->fb,
+ state->crtc_x,
+ state->crtc_y);
bochs_hw_setformat(bochs, state->fb->format);
}
Also rename to bochs_hw_setfb, we have to set more than just the base address. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- drivers/gpu/drm/bochs/bochs.h | 5 +++-- drivers/gpu/drm/bochs/bochs_hw.c | 10 +++++----- drivers/gpu/drm/bochs/bochs_kms.c | 10 +++------- 3 files changed, 11 insertions(+), 14 deletions(-)