Commit 472fde88 authored by Gerd Hoffmann's avatar Gerd Hoffmann

drm/bochs: split bochs_hw_setmode

Create a separate bochs_hw_setformat function to configure
the framebuffer format (actually just the byteorder).
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarOleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20190111053752.4004-3-kraxel@redhat.com
parent 35289661
...@@ -121,8 +121,9 @@ int bochs_hw_init(struct drm_device *dev); ...@@ -121,8 +121,9 @@ int bochs_hw_init(struct drm_device *dev);
void bochs_hw_fini(struct drm_device *dev); void bochs_hw_fini(struct drm_device *dev);
void bochs_hw_setmode(struct bochs_device *bochs, void bochs_hw_setmode(struct bochs_device *bochs,
struct drm_display_mode *mode, struct drm_display_mode *mode);
const struct drm_format_info *format); void bochs_hw_setformat(struct bochs_device *bochs,
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, u64 addr);
int bochs_hw_load_edid(struct bochs_device *bochs); int bochs_hw_load_edid(struct bochs_device *bochs);
......
...@@ -204,8 +204,7 @@ void bochs_hw_fini(struct drm_device *dev) ...@@ -204,8 +204,7 @@ void bochs_hw_fini(struct drm_device *dev)
} }
void bochs_hw_setmode(struct bochs_device *bochs, void bochs_hw_setmode(struct bochs_device *bochs,
struct drm_display_mode *mode, struct drm_display_mode *mode)
const struct drm_format_info *format)
{ {
bochs->xres = mode->hdisplay; bochs->xres = mode->hdisplay;
bochs->yres = mode->vdisplay; bochs->yres = mode->vdisplay;
...@@ -213,12 +212,8 @@ void bochs_hw_setmode(struct bochs_device *bochs, ...@@ -213,12 +212,8 @@ void bochs_hw_setmode(struct bochs_device *bochs,
bochs->stride = mode->hdisplay * (bochs->bpp / 8); bochs->stride = mode->hdisplay * (bochs->bpp / 8);
bochs->yres_virtual = bochs->fb_size / bochs->stride; bochs->yres_virtual = bochs->fb_size / bochs->stride;
DRM_DEBUG_DRIVER("%dx%d @ %d bpp, format %c%c%c%c, vy %d\n", DRM_DEBUG_DRIVER("%dx%d @ %d bpp, vy %d\n",
bochs->xres, bochs->yres, bochs->bpp, bochs->xres, bochs->yres, bochs->bpp,
(format->format >> 0) & 0xff,
(format->format >> 8) & 0xff,
(format->format >> 16) & 0xff,
(format->format >> 24) & 0xff,
bochs->yres_virtual); bochs->yres_virtual);
bochs_vga_writeb(bochs, 0x3c0, 0x20); /* unblank */ bochs_vga_writeb(bochs, 0x3c0, 0x20); /* unblank */
...@@ -236,6 +231,16 @@ void bochs_hw_setmode(struct bochs_device *bochs, ...@@ -236,6 +231,16 @@ void bochs_hw_setmode(struct bochs_device *bochs,
bochs_dispi_write(bochs, VBE_DISPI_INDEX_ENABLE, bochs_dispi_write(bochs, VBE_DISPI_INDEX_ENABLE,
VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED); VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED);
}
void bochs_hw_setformat(struct bochs_device *bochs,
const struct drm_format_info *format)
{
DRM_DEBUG_DRIVER("format %c%c%c%c\n",
(format->format >> 0) & 0xff,
(format->format >> 8) & 0xff,
(format->format >> 16) & 0xff,
(format->format >> 24) & 0xff);
switch (format->format) { switch (format->format) {
case DRM_FORMAT_XRGB8888: case DRM_FORMAT_XRGB8888:
......
...@@ -80,7 +80,8 @@ static int bochs_crtc_mode_set(struct drm_crtc *crtc, ...@@ -80,7 +80,8 @@ static int bochs_crtc_mode_set(struct drm_crtc *crtc,
if (WARN_ON(crtc->primary->fb == NULL)) if (WARN_ON(crtc->primary->fb == NULL))
return -EINVAL; return -EINVAL;
bochs_hw_setmode(bochs, mode, crtc->primary->fb->format); bochs_hw_setmode(bochs, mode);
bochs_hw_setformat(bochs, crtc->primary->fb->format);
bochs_crtc_mode_set_base(crtc, x, y, old_fb); bochs_crtc_mode_set_base(crtc, x, y, old_fb);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment