vbox_fb.c revision 4cedb1a5cf9082f72e6b8373e0dc8a15e312ea46
/** @file $Id$
*
* VirtualBox Additions Linux kernel video driver
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
* --------------------------------------------------------------------
*
* This code is based on
* ast_fb.c
* with the following copyright and permission notice:
*
* Copyright 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*/
/*
* Authors: Dave Airlie <airlied@redhat.com>
*/
/* Include from most specific to most general to be able to override things. */
#include "vbox_drv.h"
#include <VBox/VBoxVideo.h>
#include <drm/drm_crtc.h>
#include <drm/drm_fb_helper.h>
#include "vbox_drv.h"
/** This is called whenever there is a virtual console switch. We do two things
* here. First we re-set all video modes in case the last console owner
* programmed the card directly. Second we disable VBVA in case the new console
* owner is about to programme the card directly and doesn't know about VBVA.
* We re-enable VBVA if necessary when we get dirty rectangle information, as
* the owner should not be sending that if they plan to programme the card
* themselves. */
{
struct drm_device *pDev;
struct vbox_private *pVBox;
unsigned i;
return drm_fb_helper_set_par(pInfo);
}
/**
* Tell the host about dirty rectangles to update.
*/
{
int i;
struct drm_gem_object *obj;
int src_offset, dst_offset;
int ret;
bool unmap = false;
bool store_for_later = false;
unsigned long flags;
struct drm_clip_rect rect;
/*
* try and reserve the BO, if we fail with busy
* then the BO is being moved and we should
* store up the damage until later.
*/
if (ret)
{
return;
store_for_later = true;
}
if (store_for_later)
{
return;
}
{
if (ret)
{
DRM_ERROR("failed to kmap fb updates\n");
return;
}
unmap = true;
}
for (i = y; i <= y2; i++)
{
/* assume equal stride for now */
}
/* Not sure why the original code subtracted 1 here, but I will keep it that
* way to avoid unnecessary differences. */
if (unmap)
}
const struct fb_fillrect *rect)
{
}
const struct fb_copyarea *area)
{
}
{
}
static struct fb_ops vboxfb_ops =
{
.owner = THIS_MODULE,
.fb_set_par = VBoxSetPar,
};
struct DRM_MODE_FB_CMD *mode_cmd,
struct drm_gem_object **gobj_p)
{
struct drm_gem_object *gobj;
#else
#endif
int ret = 0;
if (ret)
return ret;
return ret;
}
struct drm_fb_helper_surface_size *sizes)
{
struct DRM_MODE_FB_CMD mode_cmd;
struct drm_framebuffer *fb;
unsigned int fb_pitch;
void *sysram;
#else
#endif
if (ret)
{
return ret;
}
if (!sysram)
return -ENOMEM;
if (!info)
{
goto out;
}
if (ret)
goto out;
/* The last flag forces a mode set on VT switches even if the kernel does
* not think it is needed. */
if (ret)
{
goto out;
}
/* This seems to be done for safety checking that the framebuffer is not
* registered twice by different drivers. */
{
goto out;
}
DRM_DEBUG_KMS("allocated %dx%d\n",
return 0;
out:
return ret;
}
{
}
{
}
struct drm_fb_helper_surface_size *sizes)
{
int new_fb = 0;
int ret;
{
if (ret)
return ret;
new_fb = 1;
}
return new_fb;
}
static struct drm_fb_helper_funcs vbox_fb_helper_funcs =
{
};
struct vbox_fbdev *afbdev)
{
{
}
{
}
}
{
struct vbox_fbdev *afbdev;
int ret;
if (!afbdev)
return -ENOMEM;
if (ret)
{
return ret;
}
return 0;
}
{
return;
}
{
return;
}