Merge remote-tracking branch 'anholt/modesetting-import'

This commit is contained in:
Keith Packard 2014-09-17 15:49:24 -07:00
commit eaee6572be
10 changed files with 3101 additions and 1 deletions

24
COPYING
View File

@ -8,6 +8,7 @@ possible, and insert their name to this list. Please sort by surname
for people, and by the full name for other entities (e.g. Juliusz
Chroboczek sorts before Intel Corporation sorts before Daniel Stone).
Copyright © 2011 Dave Airlie
Copyright © 2000-2001 Juliusz Chroboczek
Copyright © 1998 Egbert Eich
Copyright © 2006-2007 Intel Corporation
@ -145,6 +146,29 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, 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.
Copyright © 1999-2000 SuSE, Inc.
Copyright © 2007 Red Hat, Inc.

View File

@ -840,6 +840,7 @@ fi
PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
if test "x$CONFIG_UDEV" = xauto; then
CONFIG_UDEV="$HAVE_LIBUDEV"
AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
fi
AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
if test "x$CONFIG_UDEV" = xyes; then
@ -2016,6 +2017,12 @@ if test "x$XORG" = xyes; then
XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
fi
if test "x$DRM" = xyes; then
dnl 2.4.46 is required for cursor hotspot support.
PKG_CHECK_EXISTS(libdrm >= 2.4.46)
XORG_DRIVER_MODESETTING=yes
fi
AC_SUBST([XORG_LIBS])
AC_SUBST([XORG_SYS_LIBS])
AC_SUBST([XORG_INCS])
@ -2086,6 +2093,7 @@ AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
AM_CONDITIONAL([XORG_BUS_PLATFORM], [test "x$CONFIG_UDEV_KMS" = xyes])
AM_CONDITIONAL([XORG_DRIVER_MODESETTING], [test "x$XORG_DRIVER_MODESETTING" = xyes])
dnl glamor
AM_CONDITIONAL([GLAMOR], [test "x$GLAMOR" = xyes])
@ -2531,6 +2539,8 @@ hw/xfree86/dixmods/Makefile
hw/xfree86/doc/Makefile
hw/xfree86/dri/Makefile
hw/xfree86/dri2/Makefile
hw/xfree86/drivers/Makefile
hw/xfree86/drivers/modesetting/Makefile
hw/xfree86/exa/Makefile
hw/xfree86/exa/man/Makefile
hw/xfree86/fbdevhw/Makefile

View File

@ -38,7 +38,7 @@ SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \
$(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \
fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man \
$(GLAMOR_EGL_SUBDIR)
$(GLAMOR_EGL_SUBDIR) drivers
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
parser ramdac shadowfb vbe vgahw \

View File

@ -0,0 +1,5 @@
SUBDIRS =
if XORG_DRIVER_MODESETTING
SUBDIRS += modesetting
endif

View File

@ -0,0 +1,61 @@
# Copyright 2005 Adam Jackson.
#
# 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
# on the rights to use, copy, modify, merge, publish, distribute, sub
# license, and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# 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
# ADAM JACKSON BE LIABLE FOR ANY CLAIM, 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.
# this is obnoxious:
# -module lets us name the module exactly how we want
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) $(CWARNFLAGS)
AM_CPPFLAGS = \
$(XORG_INCS) \
-I$(srcdir)/../../ddc \
-I$(srcdir)/../../i2c \
-I$(srcdir)/../../modes \
-I$(srcdir)/../../parser \
-I$(srcdir)/../../ramdac \
$(NULL)
modesetting_drv_la_LTLIBRARIES = modesetting_drv.la
modesetting_drv_la_LDFLAGS = -module -avoid-version
modesetting_drv_la_LIBADD = $(UDEV_LIBS) $(DRM_LIBS)
modesetting_drv_ladir = @moduledir@/drivers
modesetting_drv_la_SOURCES = \
driver.c \
driver.h \
drmmode_display.c \
drmmode_display.h
drivermandir = $(DRIVER_MAN_DIR)
driverman_PRE = modesetting.man
driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
EXTRA_DIST = modesetting.man
CLEANFILES = $(driverman_DATA)
# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
.man.$(DRIVER_MAN_SUFFIX):
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
/*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* 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,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, 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.
*
*
* Author: Alan Hourihane <alanh@tungstengraphics.com>
*
*/
#include <errno.h>
#include <drm.h>
#include <xf86drm.h>
#include <damage.h>
#include "drmmode_display.h"
#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
typedef struct
{
int lastInstance;
int refCount;
ScrnInfoPtr pScrn_1;
ScrnInfoPtr pScrn_2;
} EntRec, *EntPtr;
typedef struct _modesettingRec
{
int fd;
EntPtr entityPrivate;
int Chipset;
EntityInfoPtr pEnt;
#if XSERVER_LIBPCIACCESS
struct pci_device *PciInfo;
#else
pciVideoPtr PciInfo;
PCITAG PciTag;
#endif
Bool noAccel;
CloseScreenProcPtr CloseScreen;
/* Broken-out options. */
OptionInfoPtr Options;
unsigned int SaveGeneration;
CreateScreenResourcesProcPtr createScreenResources;
ScreenBlockHandlerProcPtr BlockHandler;
void *driver;
drmmode_rec drmmode;
DamagePtr damage;
Bool dirty_enabled;
uint32_t cursor_width, cursor_height;
} modesettingRec, *modesettingPtr;
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,136 @@
/*
* Copyright © 2007 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, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 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.
*
* Authors:
* Dave Airlie <airlied@redhat.com>
*
*/
#ifndef DRMMODE_DISPLAY_H
#define DRMMODE_DISPLAY_H
#include "xf86drmMode.h"
#ifdef HAVE_UDEV
#include "libudev.h"
#endif
struct dumb_bo {
uint32_t handle;
uint32_t size;
void *ptr;
int map_count;
uint32_t pitch;
};
typedef struct {
int fd;
unsigned fb_id;
drmModeResPtr mode_res;
drmModeFBPtr mode_fb;
int cpp;
ScrnInfoPtr scrn;
#ifdef HAVE_UDEV
struct udev_monitor *uevent_monitor;
InputHandlerProc uevent_handler;
#endif
drmEventContext event_context;
struct dumb_bo *front_bo;
Bool sw_cursor;
Bool shadow_enable;
void *shadow_fb;
DevPrivateKeyRec pixmapPrivateKeyRec;
} drmmode_rec, *drmmode_ptr;
typedef struct {
drmmode_ptr drmmode;
drmModeCrtcPtr mode_crtc;
int hw_id;
struct dumb_bo *cursor_bo;
unsigned rotate_fb_id;
uint16_t lut_r[256], lut_g[256], lut_b[256];
DamagePtr slave_damage;
} drmmode_crtc_private_rec, *drmmode_crtc_private_ptr;
typedef struct {
drmModePropertyPtr mode_prop;
uint64_t value;
int num_atoms; /* if range prop, num_atoms == 1; if enum prop, num_atoms == num_enums + 1 */
Atom *atoms;
} drmmode_prop_rec, *drmmode_prop_ptr;
typedef struct {
drmmode_ptr drmmode;
int output_id;
drmModeConnectorPtr mode_output;
drmModeEncoderPtr *mode_encoders;
drmModePropertyBlobPtr edid_blob;
int dpms_enum_id;
int num_props;
drmmode_prop_ptr props;
int enc_mask;
int enc_clone_mask;
} drmmode_output_private_rec, *drmmode_output_private_ptr;
typedef struct _msPixmapPriv {
uint32_t fb_id;
struct dumb_bo *backing_bo; /* if this pixmap is backed by a dumb bo */
} msPixmapPrivRec, *msPixmapPrivPtr;
extern DevPrivateKeyRec msPixmapPrivateKeyRec;
#define msPixmapPrivateKey (&msPixmapPrivateKeyRec)
#define msGetPixmapPriv(drmmode, p) ((msPixmapPrivPtr)dixGetPrivateAddr(&(p)->devPrivates, &(drmmode)->pixmapPrivateKeyRec))
void *drmmode_map_slave_bo(drmmode_ptr drmmode, msPixmapPrivPtr ppriv);
Bool drmmode_SetSlaveBO(PixmapPtr ppix,
drmmode_ptr drmmode,
int fd_handle, int pitch, int size);
extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y);
extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
Bool drmmode_create_initial_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
void *drmmode_map_front_bo(drmmode_ptr drmmode);
Bool drmmode_map_cursor_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
void drmmode_free_bos(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode, int *depth, int *bpp);
#ifndef DRM_CAP_DUMB_PREFERRED_DEPTH
#define DRM_CAP_DUMB_PREFERRED_DEPTH 3
#endif
#ifndef DRM_CAP_DUMB_PREFER_SHADOW
#define DRM_CAP_DUMB_PREFER_SHADOW 4
#endif
#define MS_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#endif

View File

@ -0,0 +1,54 @@
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH MODESETTING __drivermansuffix__ __vendorversion__
.SH NAME
modesetting \- video driver for framebuffer device
.SH SYNOPSIS
.nf
.B "Section \*qDevice\*q"
.BI " Identifier \*q" devname \*q
.B " Driver \*qmodesetting\*q"
.BI " BusID \*qpci:" bus : dev : func \*q
\ \ ...
.B EndSection
.fi
.SH DESCRIPTION
.B modesetting
is an __xservername__ driver for KMS devices. This is a non-accelerated
driver, the following framebuffer depths are supported: 8, 15, 16, 24.
All visual types are supported for depth 8, and TrueColor visual is
supported for the other depths. RandR 1.2 is supported.
.SH SUPPORTED HARDWARE
The
.B modesetting
driver supports all hardware where a KMS driver is available.
modesetting uses the Linux DRM KMS ioctls and dumb object create/map.
.SH CONFIGURATION DETAILS
Please refer to __xconfigfile__(__filemansuffix__) for general configuration
details. This section only covers configuration details specific to
this driver.
.PP
For this driver it is not required to specify modes in the screen
section of the config file. The
.B modesetting
driver can pick up the currently used video mode from the kernel
driver and will use it if there are no video modes configured.
.PP
For PCI boards you might have to add a BusID line to the Device
section. See above for a sample line.
.PP
The following driver
.B Options
are supported:
.TP
.BI "Option \*qkmsdev\*q \*q" string \*q
The framebuffer device to use. Default: /dev/dri/card0.
.TP
.BI "Option \*qShadowFB\*q \*q" boolean \*q
Enable or disable use of the shadow framebuffer layer. Default: on.
.TP
.SH "SEE ALSO"
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__),
X(__miscmansuffix__)
.SH AUTHORS
Authors include: Dave Airlie