vbox_main.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
* 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 "vbox_drv.h"
#include <VBox/VBoxVideoGuest.h>
#include <VBox/VBoxVideo.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_crtc_helper.h>
{
}
unsigned int *handle)
{
return -EINVAL;
}
/** Send information about dirty rectangles to VBVA. If necessary we enable
* VBVA first, as this is normally disabled after a mode set in case a user
* takes over the console that is not aware of VBVA (i.e. the VESA BIOS). */
struct drm_clip_rect *pRects,
unsigned cRects)
{
unsigned i;
unsigned long flags;
for (i = 0; i < cRects; ++i)
{
{
if (!pVBVA)
{
+ iCrtc * VBVA_MIN_BUFFER_SIZE);
AssertReleaseMsgFailed(("VBoxVBVAEnable failed - heap allocation error, very old host or driver error.\n"));
}
continue;
{
sizeof(cmdHdr));
}
}
}
}
struct drm_clip_rect *pRects,
unsigned cRects)
{
return 0;
}
static const struct drm_framebuffer_funcs vbox_fb_funcs =
{
};
struct vbox_framebuffer *vbox_fb,
struct DRM_MODE_FB_CMD *mode_cmd,
struct drm_gem_object *obj)
{
int ret;
if (ret)
{
return ret;
}
return 0;
}
static struct drm_framebuffer *
struct drm_mode_fb_cmd2 *mode_cmd)
{
struct drm_gem_object *obj;
struct vbox_framebuffer *vbox_fb;
int ret;
if (!vbox_fb)
{
}
if (ret)
{
}
}
static const struct drm_mode_config_funcs vbox_mode_funcs =
{
};
{
unsigned i;
{
}
}
{
unsigned i;
bool fRC = true;
LogFunc(("vboxvideo: %d: vbox=%p, vbox->cCrtcs=%u, vbox->paVBVACtx=%p\n",
{
return -ENOMEM;
}
/* Take a command buffer for each screen from the end of usable VRAM. */
LogFunc(("vboxvideo: %d: vbox->paVBVACtx=%p, vbox->vram_size=%u\n",
return 0;
}
/** Allocation function for the HGSMI heap and data. */
{
}
/** Free function for the HGSMI heap and data. */
{
}
/** Pointers to the HGSMI heap and data manipulation functions. */
static HGSMIENV g_hgsmiEnv =
{
NULL,
};
/** Set up our heaps and data exchange buffers in VRAM before handing the rest
* to the memory manager. */
{
void *pvGuestHeap;
if (poffBase)
&g_hgsmiEnv)))
return -ENOMEM;
/* Reduce available VRAM size to reflect the guest heap. */
/* Linux drm represents monitors as a 32-bit array. */
return vbox_vbva_init(pVBox);
}
{
struct vbox_private *vbox;
int ret = 0;
if (!VBoxHGSMIIsSupported())
return -ENODEV;
if (!vbox)
return -ENOMEM;
/* I hope this won't interfere with the memory manager. */
{
goto out_free;
}
if (ret)
goto out_free;
if (ret)
goto out_free;
if (ret)
goto out_free;
if (ret)
goto out_free;
LogFunc(("vboxvideo: %d: vbox=%p, vbox->vram=%p, vbox->full_vram_size=%u\n",
return 0;
return ret;
}
{
int i;
return 0;
}
static bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper
*pHelper)
{
bool rc;
return rc;
}
#endif
{
}
struct drm_gem_object **obj)
{
int ret;
if (size == 0)
return -EINVAL;
if (ret)
{
if (ret != -ERESTARTSYS)
DRM_ERROR("failed to allocate GEM object\n");
return ret;
}
return 0;
}
struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
int ret;
struct drm_gem_object *gobj;
LogFunc(("vboxvideo: %d: args->width=%u, args->height=%u, args->bpp=%u\n",
&gobj);
if (ret)
return ret;
if (ret)
return ret;
return 0;
}
struct drm_device *dev,
{
(unsigned)handle));
}
{
struct ttm_buffer_object *tbo;
return;
ttm_bo_unref(&tbo);
}
{
if (!vbox_bo)
return;
}
{
#else
#endif
}
int
struct drm_device *dev,
{
struct drm_gem_object *obj;
int ret;
{
goto out_unlock;
}
ret = 0;
return ret;
}