/** @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.
* Parts based on xf86-video-vbox
* Copyright (c) 2005 ASPEED Technology 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/VBoxVideo.h>
#include <drm/drm_crtc_helper.h>
/** Set a graphics mode. Poke any required values into registers, do an HGSMI
* mode set and tell the host we support advanced graphics functions.
*/
const struct drm_display_mode *mode)
{
unsigned iCrtc;
#else
#endif
/* if (vbox_crtc->crtc_id == 0 && crtc->enabled)
VBoxVideoSetModeRegisters(width, height, pitch * 8 / cBPP,
CRTC_FB(crtc)->bits_per_pixel, 0,
crtc->x, crtc->y); */
}
{
void *p;
/* Tell the host about the view. This design originally targeted the
* Windows XP driver architecture and assumed that each screen would have
* a dedicated frame buffer with the command buffer following it, the whole
* being a "view". The host works out which screen a command buffer belongs
* to by checking whether it is in the first view, then whether it is in the
* second and so on. The first match wins. We cheat around this by making
* the first view be the managed memory plus the first command buffer, the
* second the same plus the second buffer and so on. */
if (p)
{
}
else
return -ENOMEM;
return 0;
}
{
}
{
unsigned long flags;
mode));
switch (mode)
{
case DRM_MODE_DPMS_ON:
break;
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
break;
}
}
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
struct drm_framebuffer *fb,
int x, int y, int atomic)
{
int ret;
if (ret)
return ret;
if (ret)
{
return ret;
}
{
/* if pushing console in kmap it */
if (ret)
DRM_ERROR("failed to kmap fbcon\n");
}
/* vbox_set_start_address_crt1(crtc, (u32)gpu_addr); */
LogFunc(("vboxvideo: %d: vbox_fb=%p, obj=%p, bo=%p, gpu_addr=%u\n",
return 0;
}
struct drm_framebuffer *old_fb)
{
}
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode,
int x, int y,
struct drm_framebuffer *old_fb)
{
unsigned long flags;
int rc = 0;
if (!rc)
return rc;
}
{
}
{
}
{
}
{
.dpms = vbox_crtc_dpms,
/* .mode_set_base = vbox_crtc_mode_set_base, */
};
{
}
{
}
{
#ifdef DRM_IOCTL_MODE_CURSOR2
#endif
.reset = vbox_crtc_reset,
/* .gamma_set = vbox_crtc_gamma_set, */
};
{
if (!pCrtc)
return -ENOMEM;
return 0;
}
{
}
{
/* pick the encoder ids */
if (enc_id)
{
if (!obj)
return NULL;
return encoder;
}
return NULL;
}
{
};
{
}
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
}
{
}
{
}
{
};
{
if (!vbox_encoder)
return NULL;
return &vbox_encoder->base;
}
{
unsigned cModes = 0;
{
false);
if (pMode)
{
++cModes;
}
}
return cModes;
}
struct drm_display_mode *mode)
{
return MODE_OK;
}
{
}
static enum drm_connector_status
{
return connector_status_connected;
}
{
};
{
};
struct device_attribute *pAttr,
{
char ch;
return -EINVAL;
return -EINVAL;
return cch;
}
struct drm_encoder *pEncoder)
{
int rc;
pEncoder));
if (!pVBoxConnector)
return -ENOMEM;
/*
* Set up the sysfs file we use for getting video mode hints from user
* space.
*/
"vbox_screen_%u", cScreen);
if (rc < 0)
{
return rc;
}
pConnector->interlace_allowed = 0;
pConnector->doublescan_allowed = 0;
/* The connector supports hot-plug detection: we promise to call
* "drm_helper_hpd_irq_event" when hot-plugging occurs. */
return 0;
}
#if 0
/* allocate cursor cache and pin at start of VRAM */
{
int size;
int ret;
struct drm_gem_object *obj;
if (ret)
return ret;
goto fail;
if (ret)
goto fail;
/* kmap the object */
if (ret)
goto fail;
return 0;
fail:
return ret;
}
{
}
#endif
{
unsigned i;
/* vbox_cursor_init(dev); */
{
vbox_crtc_init(pDev, i);
if (pEncoder)
}
return 0;
}
{
/* vbox_cursor_fini(dev); */
}
{
unsigned long flags;
}
/** Copy the ARGB image and generate the mask, which is needed in case the host
* does not support ARGB cursors. The mask is a 1BPP bitmap with the bit set
* if the corresponding alpha value in the ARGB image is greater than 0xF0. */
{
unsigned i, j;
for (i = 0; i < height; ++i)
for (j = 0; j < width; ++j)
}
{
bool src_isiomem;
if (!handle) {
/* Hide cursor. */
return 0;
}
return -EINVAL;
if (obj)
{
if (!ret)
{
/* The mask must be calculated based on the alpha channel, one bit
* per ARGB word, and must be 32-bit padded. */
if (dst)
{
if (!ret)
{
if (!src_isiomem)
{
}
else
DRM_ERROR("src cursor bo should be in main memory\n");
}
}
}
}
else
{
}
return ret;
}
int x, int y)
{
return 0;
}