unsigned int num_rects)
{
struct vbox_private *vbox = fb->dev->dev_private;
+ struct drm_display_mode *mode;
struct drm_crtc *crtc;
+ int crtc_x, crtc_y;
unsigned int i;
mutex_lock(&vbox->hw_mutex);
list_for_each_entry(crtc, &fb->dev->mode_config.crtc_list, head) {
- if (CRTC_FB(crtc) != fb)
+ if (crtc->primary->state->fb != fb)
continue;
+ mode = &crtc->state->mode;
+ crtc_x = crtc->primary->state->src_x >> 16;
+ crtc_y = crtc->primary->state->src_y >> 16;
+
vbox_enable_accel(vbox);
for (i = 0; i < num_rects; ++i) {
struct vbva_cmd_hdr cmd_hdr;
unsigned int crtc_id = to_vbox_crtc(crtc)->crtc_id;
- if ((rects[i].x1 > crtc->x + crtc->hwmode.hdisplay) ||
- (rects[i].y1 > crtc->y + crtc->hwmode.vdisplay) ||
- (rects[i].x2 < crtc->x) ||
- (rects[i].y2 < crtc->y))
+ if ((rects[i].x1 > crtc_x + mode->hdisplay) ||
+ (rects[i].y1 > crtc_y + mode->vdisplay) ||
+ (rects[i].x2 < crtc_x) ||
+ (rects[i].y2 < crtc_y))
continue;
cmd_hdr.x = (s16)rects[i].x1;
*/
static void vbox_do_modeset(struct drm_crtc *crtc)
{
+ struct drm_framebuffer *fb = crtc->primary->state->fb;
struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
struct vbox_private *vbox;
int width, height, bpp, pitch;
vbox = crtc->dev->dev_private;
width = vbox_crtc->width ? vbox_crtc->width : 640;
height = vbox_crtc->height ? vbox_crtc->height : 480;
- bpp = crtc->enabled ? CRTC_FB(crtc)->format->cpp[0] * 8 : 32;
- pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;
+ bpp = fb ? fb->format->cpp[0] * 8 : 32;
+ pitch = fb ? fb->pitches[0] : width * bpp / 8;
x_offset = vbox->single_framebuffer ? vbox_crtc->x : vbox_crtc->x_hint;
y_offset = vbox->single_framebuffer ? vbox_crtc->y : vbox_crtc->y_hint;
* VirtualBox, certain parts of the code still assume that the first
* screen is programmed this way, so try to fake it.
*/
- if (vbox_crtc->crtc_id == 0 && crtc->enabled &&
+ if (vbox_crtc->crtc_id == 0 && fb &&
vbox_crtc->fb_offset / pitch < 0xffff - crtc->y &&
vbox_crtc->fb_offset % (bpp / 8) == 0) {
vbox_write_ioport(VBE_DISPI_INDEX_XRES, width);
vbox_write_ioport(VBE_DISPI_INDEX_YRES, height);
vbox_write_ioport(VBE_DISPI_INDEX_VIRT_WIDTH, pitch * 8 / bpp);
- vbox_write_ioport(VBE_DISPI_INDEX_BPP,
- CRTC_FB(crtc)->format->cpp[0] * 8);
+ vbox_write_ioport(VBE_DISPI_INDEX_BPP, bpp);
vbox_write_ioport(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED);
vbox_write_ioport(
VBE_DISPI_INDEX_X_OFFSET,
}
flags = VBVA_SCREEN_F_ACTIVE;
- flags |= (crtc->enabled && !vbox_crtc->blanked) ?
- 0 : VBVA_SCREEN_F_BLANK;
+ flags |= (fb && !vbox_crtc->blanked) ? 0 : VBVA_SCREEN_F_BLANK;
flags |= vbox_crtc->disconnected ? VBVA_SCREEN_F_DISABLED : 0;
hgsmi_process_display_info(vbox->guest_pool, vbox_crtc->crtc_id,
x_offset, y_offset,
* Same fall-back if this is the fbdev frame-buffer.
*/
list_for_each_entry(crtci, &vbox->ddev.mode_config.crtc_list, head) {
- fb = CRTC_FB(crtci);
+ fb = crtci->primary->state->fb;
if (!fb)
continue;