VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/drm/vboxvideo_vga.c@ 39837

Last change on this file since 39837 was 39335, checked in by vboxsync, 13 years ago

Additions/linux/drm: latest drop of the KMS driver.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1/** @file $Id: vboxvideo_vga.c 39335 2011-11-16 15:37:26Z vboxsync $
2 *
3 * VirtualBox Additions Linux kernel video driver, VGA functions
4 */
5
6/*
7 * Copyright (C) 2011 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 * --------------------------------------------------------------------
17 *
18 * This code is based on
19 * glint_vga.c
20 * with the following copyright and permission notice:
21 *
22 * Copyright 2010 Matt Turner.
23 *
24 * Permission is hereby granted, free of charge, to any person obtaining a
25 * copy of this software and associated documentation files (the "Software"),
26 * to deal in the Software without restriction, including without limitation
27 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
28 * and/or sell copies of the Software, and to permit persons to whom the
29 * Software is furnished to do so, subject to the following conditions:
30 *
31 * The above copyright notice and this permission notice shall be included in
32 * all copies or substantial portions of the Software.
33 *
34 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
37 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
38 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
39 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40 * OTHER DEALINGS IN THE SOFTWARE.
41 *
42 * Authors: Matt Turner
43 */
44
45#include <linux/version.h>
46#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
47
48#include "vboxvideo_drv.h"
49#include "drm/drm_crtc_helper.h"
50
51static int vboxvideo_vga_get_modes(struct drm_connector *connector)
52{
53 /* return 0 modes, so that we don't have to implement DDC/I2C yet. */
54 return 0;
55}
56
57static int vboxvideo_vga_mode_valid(struct drm_connector *connector,
58 struct drm_display_mode *mode)
59{
60 /* XXX check mode bandwidth */
61 /* XXX verify against max DAC output frequency */
62 return MODE_OK;
63}
64
65struct drm_encoder *vboxvideo_connector_best_encoder(struct drm_connector
66 *connector)
67{
68 int enc_id = connector->encoder_ids[0];
69 struct drm_mode_object *obj;
70 struct drm_encoder *encoder;
71
72 /* pick the encoder ids */
73 if (enc_id) {
74 obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER);
75 if (!obj)
76 return NULL;
77 encoder = obj_to_encoder(obj);
78 return encoder;
79 }
80 return NULL;
81}
82
83static enum drm_connector_status vboxvideo_vga_detect(struct drm_connector
84 *connector)
85{
86 return connector_status_connected;
87}
88
89static void vboxvideo_connector_destroy(struct drm_connector *connector)
90{
91 drm_connector_cleanup(connector);
92 kfree(connector);
93}
94
95struct drm_connector_helper_funcs vboxvideo_vga_connector_helper_funcs =
96{
97 .get_modes = vboxvideo_vga_get_modes,
98 .mode_valid = vboxvideo_vga_mode_valid,
99 .best_encoder = vboxvideo_connector_best_encoder,
100};
101
102struct drm_connector_funcs vboxvideo_vga_connector_funcs =
103{
104 .dpms = drm_helper_connector_dpms,
105 .detect = vboxvideo_vga_detect,
106 .fill_modes = drm_helper_probe_single_connector_modes,
107 .destroy = vboxvideo_connector_destroy,
108};
109
110struct drm_connector *vboxvideo_vga_init(struct drm_device *dev)
111{
112 struct drm_connector *connector;
113 struct vboxvideo_connector *vboxvideo_connector;
114
115 vboxvideo_connector = kzalloc(sizeof(struct vboxvideo_connector),
116 GFP_KERNEL);
117 if (!vboxvideo_connector)
118 return NULL;
119
120 connector = &vboxvideo_connector->base;
121
122 drm_connector_init(dev, connector,
123 &vboxvideo_vga_connector_funcs, DRM_MODE_CONNECTOR_VGA);
124
125 drm_connector_helper_add(connector, &vboxvideo_vga_connector_helper_funcs);
126
127 return connector;
128}
129
130#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette