Makefile.am | 2 autogen.sh | 5 configure.ac | 11 + src/Makefile.am | 1 src/compat-api.h | 94 ++++++++++++ src/driver.c | 383 +++++++++++++++++++++++++++++++++++++------------- src/drmmode_display.c | 233 +++++++++++++++++++++++++++++- src/drmmode_display.h | 31 +++- 8 files changed, 654 insertions(+), 106 deletions(-)
New commits: commit 58d3dc53a89c5aa2acfc93e4ae5719dd92b785b9 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Wed Jun 12 14:11:53 2013 +0200 bump to 0.8.0 Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> diff --git a/configure.ac b/configure.ac index f0c267f..6f7a7be 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-modesetting], - [0.7.0], + [0.8.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-video-modesetting]) AC_CONFIG_SRCDIR([Makefile.am]) commit a299400b8404f935e5e2bc6a5b9c17821844bd0d Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Wed Jun 12 14:05:19 2013 +0200 modesetting: probe only succeeds if connectors are detected This will prevent modesetting being used for outputless intel or nvidia cards. Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> diff --git a/src/driver.c b/src/driver.c index c3d78be..cc526f6 100644 --- a/src/driver.c +++ b/src/driver.c @@ -201,12 +201,25 @@ static int open_hw(char *dev) return fd; } +static int check_outputs(int fd) +{ + drmModeResPtr res = drmModeGetResources(fd); + int ret; + + if (!res) + return FALSE; + ret = res->count_connectors > 0; + drmModeFreeResources(res); + return ret; +} + static Bool probe_hw(char *dev) { int fd = open_hw(dev); if (fd != -1) { + int ret = check_outputs(fd); close(fd); - return TRUE; + return ret; } return FALSE; } @@ -226,7 +239,7 @@ ms_DRICreatePCIBusID(const struct pci_device *dev) static Bool probe_hw_pci(char *dev, struct pci_device *pdev) { - int fd = open_hw(dev); + int ret = FALSE, fd = open_hw(dev); char *id, *devid; drmSetVersion sv; @@ -247,13 +260,12 @@ static Bool probe_hw_pci(char *dev, struct pci_device *pdev) devid = ms_DRICreatePCIBusID(pdev); close(fd); - if (!id || !devid) - return FALSE; - - if (!strcmp(id, devid)) - return TRUE; + if (id && devid && !strcmp(id, devid)) + ret = check_outputs(fd); - return FALSE; + free(id); + free(devid); + return ret; } static const OptionInfoRec * AvailableOptions(int chipid, int busid) commit a62d5e60896166be88fcf3778921b8d10baec2c1 Author: Dave Airlie <airl...@redhat.com> Date: Tue Jun 11 10:29:25 2013 +1000 modesetting: fix adjust frame crash When SDL called this it was totally broken, actually hook up to the underlying drmmode function. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64808 Thanks to Peter Wu <lekenst...@gmail.com> for harassing me. Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/src/driver.c b/src/driver.c index 742aadd..c3d78be 100644 --- a/src/driver.c +++ b/src/driver.c @@ -956,16 +956,9 @@ static void AdjustFrame(ADJUST_FRAME_ARGS_DECL) { SCRN_INFO_PTR(arg); - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); - xf86OutputPtr output = config->output[config->compat_output]; - xf86CrtcPtr crtc = output->crtc; - - if (crtc && crtc->enabled) { - crtc->funcs->mode_set(crtc, pScrn->currentMode, pScrn->currentMode, x, - y); - crtc->x = output->initial_x + x; - crtc->y = output->initial_y + y; - } + modesettingPtr ms = modesettingPTR(pScrn); + + drmmode_adjust_frame(pScrn, &ms->drmmode, x, y); } static void diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 2dc7576..ce90cea 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1267,7 +1267,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp) return TRUE; } -void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y, int flags) +void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86OutputPtr output = config->output[config->compat_output]; diff --git a/src/drmmode_display.h b/src/drmmode_display.h index 1d5522b..adf4b99 100644 --- a/src/drmmode_display.h +++ b/src/drmmode_display.h @@ -118,7 +118,7 @@ Bool drmmode_SetSlaveBO(PixmapPtr ppix, #endif 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, int flags); +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); commit cba29fd8c2f605ed66718aa3a6b5833deb5d4cf9 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Wed Apr 3 12:08:44 2013 +0200 support 32 bpp pixmaps when 24 bpp fb is used. Fixes background corruption in ubuntu. Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> diff --git a/src/driver.c b/src/driver.c index 06d6d53..742aadd 100644 --- a/src/driver.c +++ b/src/driver.c @@ -650,7 +650,7 @@ PreInit(ScrnInfoPtr pScrn, int flags) #endif drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp); if (defaultdepth == 24 && defaultbpp == 24) - bppflags = Support24bppFb; + bppflags = SupportConvert32to24 | Support24bppFb; else bppflags = PreferConvert24to32 | SupportConvert24to32 | Support32bppFb; commit 332fbe8e13502c11bf32353123cba5e1e1bf3796 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Wed Mar 27 10:33:46 2013 +0100 bump version to 0.7.0 diff --git a/configure.ac b/configure.ac index 562249e..f0c267f 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-modesetting], - [0.6.0], + [0.7.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-video-modesetting]) AC_CONFIG_SRCDIR([Makefile.am]) commit 3c631228a9f57e73ee693d5283894db1a460e0a4 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Tue Mar 26 15:19:52 2013 +0100 modesetting: return null for get_modes if output could not be retrieved Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> diff --git a/src/drmmode_display.c b/src/drmmode_display.c index e8ebef1..2dc7576 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -709,6 +709,9 @@ drmmode_output_get_modes(xf86OutputPtr output) drmModePropertyPtr props; xf86MonPtr mon = NULL; + if (!koutput) + return NULL; + /* look for an EDID property */ for (i = 0; i < koutput->count_props; i++) { props = drmModeGetProperty(drmmode->fd, koutput->props[i]); commit e5b5297ac449fb4ac62cc6471f933ae2265778a2 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Tue Mar 26 15:19:33 2013 +0100 modesetting: clean up leaks Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> diff --git a/src/driver.c b/src/driver.c index 87ba272..06d6d53 100644 --- a/src/driver.c +++ b/src/driver.c @@ -206,7 +206,7 @@ static Bool probe_hw(char *dev) int fd = open_hw(dev); if (fd != -1) { close(fd); - return TRUE; + return TRUE; } return FALSE; } @@ -530,15 +530,27 @@ static void msBlockHandler(BLOCKHANDLER_ARGS_DECL) static void FreeRec(ScrnInfoPtr pScrn) { + modesettingPtr ms; + if (!pScrn) - return; + return; - if (!pScrn->driverPrivate) - return; + ms = modesettingPTR(pScrn); + if (!ms) + return; + pScrn->driverPrivate = NULL; - free(pScrn->driverPrivate); + if (ms->fd > 0) { + int ret; + + if (ms->pEnt->location.type == BUS_PCI) + ret = drmClose(ms->fd); + else + ret = close(ms->fd); + } + free(ms->Options); + free(ms); - pScrn->driverPrivate = NULL; } static Bool @@ -596,8 +608,8 @@ PreInit(ScrnInfoPtr pScrn, int flags) #if XSERVER_PLATFORM_BUS if (pEnt->location.type == BUS_PLATFORM) { - char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH); - ms->fd = open_hw(path); + char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH); + ms->fd = open_hw(path); } else #endif commit 1e571934629280053caeb155e418acbdca609e36 Author: Aaron Plattner <aplatt...@nvidia.com> Date: Wed Feb 20 17:27:16 2013 -0800 modesetting: match PCI class 3, any subclass If a device is not primary, the PCI device match fails because the xf86-video-modesetting driver looks specifically for a PCI class match of 0x30000 with a mask of 0xffffff. This fails to match, for example, a non-primary Intel VGA device, because it is reported as having a class of 0x38000. Fix that by ignoring the low 16 bits of the class in the pci_id_match table. Signed-off-by: Aaron Plattner <aplatt...@nvidia.com> Reviewed on IRC by Adam Jackson <a...@redhat.com> diff --git a/src/driver.c b/src/driver.c index 05b6176..87ba272 100644 --- a/src/driver.c +++ b/src/driver.c @@ -86,7 +86,7 @@ static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, static const struct pci_id_match ms_device_match[] = { { PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, - 0x00030000, 0x00ffffff, 0 + 0x00030000, 0x00ff0000, 0 }, { 0, 0, 0 }, commit 8dd5b22ea4469515b4218fad0deaf76cc98e3b9c Author: Colin Walters <walt...@verbum.org> Date: Wed Jan 4 22:37:06 2012 +0000 autogen.sh: Implement GNOME Build API http://people.gnome.org/~walters/docs/build-api.txt Signed-off-by: Adam Jackson <a...@redhat.com> diff --git a/autogen.sh b/autogen.sh index f83ed27..7415c05 100755 --- a/autogen.sh +++ b/autogen.sh @@ -10,4 +10,6 @@ test -d m4 || mkdir m4 autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? -$srcdir/configure --enable-maintainer-mode "$@" +if test -z "$NOCONFIGURE"; then + $srcdir/configure "$@" +fi commit 06618a9b3d9585508b0debd18d5b981636f98c54 Author: Chris Wilson <ch...@chris-wilson.co.uk> Date: Mon Dec 3 13:25:19 2012 +0000 Add missing GTF modes A fixed-mode output device like a panel will often only inform of its preferred mode through its EDID. However, the driver will adjust user specified modes for display through use of a panel-fitter allowing greater flexibility in upscaling. This is often used by games to set a low resolution for performance and use the panel fitter to fill the screen. v2: Use the presence of the 'scaling mode' connector property as an indication that a panel fitter is attached to that pipe. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55564 diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 63cecc3..e8ebef1 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -626,6 +626,78 @@ drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes) return MODE_OK; } +static Bool +has_panel_fitter(xf86OutputPtr output) +{ + drmmode_output_private_ptr drmmode_output = output->driver_private; + drmModeConnectorPtr koutput = drmmode_output->mode_output; + drmmode_ptr drmmode = drmmode_output->drmmode; + int i; + + /* Presume that if the output supports scaling, then we have a + * panel fitter capable of adjust any mode to suit. + */ + for (i = 0; i < koutput->count_props; i++) { + drmModePropertyPtr props; + Bool found = FALSE; + + props = drmModeGetProperty(drmmode->fd, koutput->props[i]); + if (props) { + found = strcmp(props->name, "scaling mode") == 0; + drmModeFreeProperty(props); + } + + if (found) + return TRUE; + } + + return FALSE; +} + +static DisplayModePtr +drmmode_output_add_gtf_modes(xf86OutputPtr output, + DisplayModePtr Modes) +{ + xf86MonPtr mon = output->MonInfo; + DisplayModePtr i, m, preferred = NULL; + int max_x = 0, max_y = 0; + float max_vrefresh = 0.0; + + if (mon && GTF_SUPPORTED(mon->features.msc)) + return Modes; + + if (!has_panel_fitter(output)) + return Modes; + + for (m = Modes; m; m = m->next) { + if (m->type & M_T_PREFERRED) + preferred = m; + max_x = max(max_x, m->HDisplay); + max_y = max(max_y, m->VDisplay); + max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(m)); + } + + max_vrefresh = max(max_vrefresh, 60.0); + max_vrefresh *= (1 + SYNC_TOLERANCE); + + m = xf86GetDefaultModes(); + xf86ValidateModesSize(output->scrn, m, max_x, max_y, 0); + + for (i = m; i; i = i->next) { + if (xf86ModeVRefresh(i) > max_vrefresh) + i->status = MODE_VSYNC; + if (preferred && + i->HDisplay >= preferred->HDisplay && + i->VDisplay >= preferred->VDisplay && + xf86ModeVRefresh(i) >= xf86ModeVRefresh(preferred)) + i->status = MODE_VSYNC; + } + + xf86PruneInvalidModes(output->scrn, &m, FALSE); + + return xf86ModesAdd(Modes, m); +} + static DisplayModePtr drmmode_output_get_modes(xf86OutputPtr output) { @@ -666,7 +738,8 @@ drmmode_output_get_modes(xf86OutputPtr output) Modes = xf86ModesAdd(Modes, Mode); } - return Modes; + + return drmmode_output_add_gtf_modes(output, Modes); } static void commit acb90bc34ad99a7c4de8c69a26ff09a65cd0281d Author: Dave Airlie <airl...@redhat.com> Date: Thu Feb 7 12:24:20 2013 +1000 modesetting: provide dummy hooks for shadow Since in some wierd cases the server can call these without checking they exist. Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 42cd5ac..63cecc3 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -547,6 +547,17 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix) } #endif +static void *drmmode_shadow_allocate(xf86CrtcPtr crtc, int width, int height) +{ + return NULL; +} + +static PixmapPtr drmmode_shadow_create(xf86CrtcPtr crtc, void *data, int width, + int height) +{ + return NULL; +} + static const xf86CrtcFuncsRec drmmode_crtc_funcs = { .dpms = drmmode_crtc_dpms, .set_mode_major = drmmode_set_mode_major, @@ -561,6 +572,8 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = { #ifdef MODESETTING_OUTPUT_SLAVE_SUPPORT .set_scanout_pixmap = drmmode_set_scanout_pixmap, #endif + .shadow_allocate = drmmode_shadow_allocate, + .shadow_create = drmmode_shadow_create, }; static void commit 404b5e2b53578d8b78471da5aaaaa80a85c6acc4 Author: Dave Airlie <airl...@redhat.com> Date: Wed Jan 9 13:04:00 2013 +1000 modesetting: bump to 0.6.0 diff --git a/configure.ac b/configure.ac index 58b1666..562249e 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-modesetting], - [0.5.0], + [0.6.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-video-modesetting]) AC_CONFIG_SRCDIR([Makefile.am]) commit 282e6876fc32d41648684b858e13130c97a58b8e Author: Dave Airlie <airl...@redhat.com> Date: Wed Jan 9 12:48:30 2013 +1000 modesetting: fix crashes caused by udev race conditions So the kernel removes the device, and the driver processes the first udev event, and gets no output back from the kernel, so it check and don't fall over. This fixes a couple of crashes seen when hotplugging USB devices. Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 8d760c2..42cd5ac 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -589,6 +589,8 @@ drmmode_output_detect(xf86OutputPtr output) drmModeFreeConnector(drmmode_output->mode_output); drmmode_output->mode_output = drmModeGetConnector(drmmode->fd, drmmode_output->output_id); + if (!drmmode_output->mode_output) + return XF86OutputStatusDisconnected; switch (drmmode_output->mode_output->connection) { case DRM_MODE_CONNECTED: @@ -683,6 +685,9 @@ drmmode_output_dpms(xf86OutputPtr output, int mode) drmModeConnectorPtr koutput = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; + if (!koutput) + return; + drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id, drmmode_output->dpms_enum_id, mode); return; commit 0ad9fb5109a3cd3bded6455aa2fca0a1fe18e980 Author: Thierry Reding <thierry.red...@avionic-design.de> Date: Thu Nov 8 14:28:10 2012 +0100 Remove call to miInitializeBackingStore() Recent versions of the X server no longer provide this function, which has been obsolete for over 2 years now. Signed-off-by: Thierry Reding <thierry.red...@avionic-design.de> Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/src/driver.c b/src/driver.c index 200a6d8..05b6176 100644 --- a/src/driver.c +++ b/src/driver.c @@ -901,7 +901,6 @@ ScreenInit(SCREEN_INIT_ARGS_DECL) xf86SetBlackWhitePixels(pScreen); - miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); commit 5b3f6e347ae1763f066848a07554e8d33e17662e Author: Thierry Reding <thierry.red...@avionic-design.de> Date: Thu Nov 8 14:28:09 2012 +0100 build: Put m4 macros in m4 subdirectory This silences a warning from libtoolize when running the autogen.sh script. Signed-off-by: Thierry Reding <thierry.red...@avionic-design.de> Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/Makefile.am b/Makefile.am index 8e4dfdb..a7ab3e0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,6 +18,8 @@ # 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. +ACLOCAL_AMFLAGS = -I m4 + SUBDIRS = src man MAINTAINERCLEANFILES = ChangeLog INSTALL diff --git a/autogen.sh b/autogen.sh index 904cd67..f83ed27 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,6 +5,7 @@ test -z "$srcdir" && srcdir=. ORIGDIR=`pwd` cd $srcdir +test -d m4 || mkdir m4 autoreconf -v --install || exit 1 cd $ORIGDIR || exit $? diff --git a/configure.ac b/configure.ac index b6815c4..58b1666 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_INIT([xf86-video-modesetting], [xf86-video-modesetting]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR(.) AC_SYS_LARGEFILE commit 07e4b5c5e766d06a91178a0ff7589c842ee509fb Author: Dave Airlie <airl...@redhat.com> Date: Mon Sep 17 11:48:14 2012 +1000 modesetting: remove alloca usage again this slipped back in. Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/src/driver.c b/src/driver.c index 38a1c09..200a6d8 100644 --- a/src/driver.c +++ b/src/driver.c @@ -428,10 +428,13 @@ static int dispatch_dirty_region(ScrnInfoPtr scrn, unsigned num_cliprects = REGION_NUM_RECTS(dirty); if (num_cliprects) { - drmModeClip *clip = alloca(num_cliprects * sizeof(drmModeClip)); + drmModeClip *clip = malloc(num_cliprects * sizeof(drmModeClip)); BoxPtr rect = REGION_RECTS(dirty); int i, ret; + if (!clip) + return -ENOMEM; + /* XXX no need for copy? */ for (i = 0; i < num_cliprects; i++, rect++) { clip[i].x1 = rect->x1; @@ -442,6 +445,7 @@ static int dispatch_dirty_region(ScrnInfoPtr scrn, /* TODO query connector property to see if this is needed */ ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects); + free(clip); DamageEmpty(damage); if (ret) { if (ret == -EINVAL) commit fcf9ddf3c6ddb531020b532123118ab0216e6e65 Author: Alon Levy <al...@redhat.com> Date: Tue Aug 28 11:46:47 2012 +1000 modesetting: add virtual connector support [airlied: also make sure we don't crash in future.] Signed-off-by: Alon Levy <al...@redhat.com> Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 5e38265..8d760c2 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -882,7 +882,8 @@ const char *output_names[] = { "None", "HDMI", "HDMI", "TV", - "eDP" + "eDP", + "Virtual" }; static void @@ -913,7 +914,10 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num, int *num_dv } /* need to do smart conversion here for compat with non-kms ATI driver */ - snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1); + if (koutput->connector_type >= MS_ARRAY_SIZE(output_names)) + snprintf(name, 32, "Unknown-%d", koutput->connector_type_id - 1); + else + snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1); output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name); if (!output) { diff --git a/src/drmmode_display.h b/src/drmmode_display.h index 24f7960..1d5522b 100644 --- a/src/drmmode_display.h +++ b/src/drmmode_display.h @@ -139,5 +139,7 @@ void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode, int *depth #define DRM_CAP_DUMB_PREFER_SHADOW 4 #endif +#define MS_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) + #endif commit e00ef802391af73310c0ee0ee78254228bc29075 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Thu Sep 13 08:45:14 2012 +0200 bump version to 0.5.0 diff --git a/configure.ac b/configure.ac index e1b3727..b6815c4 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-modesetting], - [0.4.0], + [0.5.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xf86-video-modesetting]) AC_CONFIG_SRCDIR([Makefile.am]) commit 2b9531d969e7c106391b509a64c16257a5109fed Author: Adam Jackson <a...@redhat.com> Date: Thu Jul 19 22:15:10 2012 +0000 Implement ->driverFunc Copied from fbdev, makes it so we can run without iopl. Signed-off-by: Adam Jackson <a...@redhat.com> diff --git a/src/driver.c b/src/driver.c index 371c171..38a1c09 100644 --- a/src/driver.c +++ b/src/driver.c @@ -79,6 +79,8 @@ static Bool Probe(DriverPtr drv, int flags); static Bool ms_pci_probe(DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data); +static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, + void *data); #ifdef XSERVER_LIBPCIACCESS static const struct pci_id_match ms_device_match[] = { @@ -105,7 +107,7 @@ _X_EXPORT DriverRec modesetting = { AvailableOptions, NULL, 0, - NULL, + ms_driver_func, ms_device_match, ms_pci_probe, #ifdef XSERVER_PLATFORM_BUS @@ -259,6 +261,21 @@ AvailableOptions(int chipid, int busid) return Options; } +static Bool +ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data) +{ + xorgHWFlags *flag; + + switch (op) { + case GET_REQUIRED_HW_INTERFACES: + flag = (CARD32 *)data; + (*flag) = 0; + return TRUE; + default: + return FALSE; + } +} + #if XSERVER_LIBPCIACCESS static Bool ms_pci_probe(DriverPtr driver, commit 2802071fa9d421a2998d4971671b5c4275d3d435 Author: Dave Airlie <airl...@redhat.com> Date: Thu Jul 19 14:12:59 2012 +1000 modesetting: add output slave support. This allows the driver to operate as an output slave. It adds scan out pixmap, and the capability checks to make sure they available. Signed-off-by: Dave Airlie <airl...@redhat.com> diff --git a/configure.ac b/configure.ac index 45a1b9f..e1b3727 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,14 @@ if test x"$udev" = xyes; then AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection]) fi +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS=$DRM_CFLAGS +LIBS=$DRM_LIBS +AC_CHECK_FUNCS([drmPrimeFDToHandle]) +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS + DRIVER_NAME=modesetting AC_SUBST([DRIVER_NAME]) AC_SUBST([moduledir]) diff --git a/src/driver.c b/src/driver.c index 86be277..371c171 100644 --- a/src/driver.c +++ b/src/driver.c @@ -401,21 +401,20 @@ GetRec(ScrnInfoPtr pScrn) return TRUE; } -static void dispatch_dirty(ScreenPtr pScreen) +static int dispatch_dirty_region(ScrnInfoPtr scrn, + PixmapPtr pixmap, + DamagePtr damage, + int fb_id) { - ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(scrn); - RegionPtr dirty = DamageRegion(ms->damage); + RegionPtr dirty = DamageRegion(damage); unsigned num_cliprects = REGION_NUM_RECTS(dirty); if (num_cliprects) { - drmModeClip *clip = malloc(num_cliprects * sizeof(drmModeClip)); + drmModeClip *clip = alloca(num_cliprects * sizeof(drmModeClip)); BoxPtr rect = REGION_RECTS(dirty); int i, ret; - - if (!clip) - return; - + /* XXX no need for copy? */ for (i = 0; i < num_cliprects; i++, rect++) { clip[i].x1 = rect->x1; @@ -425,25 +424,71 @@ static void dispatch_dirty(ScreenPtr pScreen) } /* TODO query connector property to see if this is needed */ - ret = drmModeDirtyFB(ms->fd, ms->drmmode.fb_id, clip, num_cliprects); - free(clip); + ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects); + DamageEmpty(damage); if (ret) { - if (ret == -EINVAL || ret == -ENOSYS) { - ms->dirty_enabled = FALSE; - DamageUnregister(&pScreen->GetScreenPixmap(pScreen)->drawable, ms->damage); - DamageDestroy(ms->damage); - ms->damage = NULL; - xf86DrvMsg(scrn->scrnIndex, X_INFO, "Disabling kernel dirty updates, not required.\n"); - return; - } else - ErrorF("%s: failed to send dirty (%i, %s)\n", - __func__, ret, strerror(-ret)); + if (ret == -EINVAL) + return ret; } - - DamageEmpty(ms->damage); + } + return 0; +} + +static void dispatch_dirty(ScreenPtr pScreen) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); + modesettingPtr ms = modesettingPTR(scrn); + PixmapPtr pixmap = pScreen->GetScreenPixmap(pScreen); + int fb_id = ms->drmmode.fb_id; + int ret; + + ret = dispatch_dirty_region(scrn, pixmap, ms->damage, fb_id); + if (ret == -EINVAL || ret == -ENOSYS) { + ms->dirty_enabled = FALSE; + DamageUnregister(&pScreen->GetScreenPixmap(pScreen)->drawable, ms->damage); + DamageDestroy(ms->damage); + ms->damage = NULL; + xf86DrvMsg(scrn->scrnIndex, X_INFO, "Disabling kernel dirty updates, not required.\n"); + return; + } +} + +#ifdef MODESETTING_OUTPUT_SLAVE_SUPPORT +static void dispatch_dirty_crtc(ScrnInfoPtr scrn, xf86CrtcPtr crtc) +{ + modesettingPtr ms = modesettingPTR(scrn); + PixmapPtr pixmap = crtc->randr_crtc->scanout_pixmap; + msPixmapPrivPtr ppriv = msGetPixmapPriv(&ms->drmmode, pixmap); + drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + DamagePtr damage = drmmode_crtc->slave_damage; + int fb_id = ppriv->fb_id; + int ret; + + ret = dispatch_dirty_region(scrn, pixmap, damage, fb_id); + if (ret) { + } } +static void dispatch_slave_dirty(ScreenPtr pScreen) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + int c; + + for (c = 0; c < xf86_config->num_crtc; c++) { + xf86CrtcPtr crtc = xf86_config->crtc[c]; + + if (!crtc->randr_crtc) + continue; + if (!crtc->randr_crtc->scanout_pixmap) + continue; + + dispatch_dirty_crtc(scrn, crtc); + } +} +#endif + static void msBlockHandler(BLOCKHANDLER_ARGS_DECL) { SCREEN_PTR(arg); @@ -452,8 +497,13 @@ static void msBlockHandler(BLOCKHANDLER_ARGS_DECL) pScreen->BlockHandler = ms->BlockHandler; pScreen->BlockHandler(BLOCKHANDLER_ARGS); pScreen->BlockHandler = msBlockHandler; +#ifdef MODESETTING_OUTPUT_SLAVE_SUPPORT + if (pScreen->isGPU) + dispatch_slave_dirty(pScreen); + else +#endif if (ms->dirty_enabled) - dispatch_dirty(pScreen); + dispatch_dirty(pScreen); } static void @@ -555,6 +605,16 @@ PreInit(ScrnInfoPtr pScrn, int flags) ms->drmmode.fd = ms->fd; +#ifdef MODESETTING_OUTPUT_SLAVE_SUPPORT + pScrn->capabilities = 0; +#ifdef DRM_CAP_PRIME + ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value); + if (ret == 0) { + if (value & DRM_PRIME_CAP_IMPORT) + pScrn->capabilities |= RR_Capability_SinkOutput; + } +#endif +#endif drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp); if (defaultdepth == 24 && defaultbpp == 24) bppflags = Support24bppFb; @@ -719,6 +779,25 @@ msShadowInit(ScreenPtr pScreen) return TRUE; } +#ifdef MODESETTING_OUTPUT_SLAVE_SUPPORT +static Bool +msSetSharedPixmapBacking(PixmapPtr ppix, void *fd_handle) +{ + ScreenPtr screen = ppix->drawable.pScreen; -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1vhgup-0003vg...@vasks.debian.org