mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-02 03:15:52 +00:00
Merge branch 'master' into mpx
Conflicts: dix/devices.c dix/events.c
This commit is contained in:
commit
f28eea0647
58 changed files with 4354 additions and 1786 deletions
|
|
@ -23,14 +23,20 @@ if KDRIVELINUX
|
|||
LINUX_SUBDIRS = linux
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
$(LINUX_SUBDIRS) \
|
||||
SERVER_SUBDIRS = \
|
||||
$(XSDL_SUBDIRS) \
|
||||
$(FBDEV_SUBDIRS) \
|
||||
$(VESA_SUBDIRS) \
|
||||
$(XEPHYR_SUBDIRS) \
|
||||
$(XFAKE_SUBDIRS)
|
||||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
$(LINUX_SUBDIRS) \
|
||||
$(SERVER_SUBDIRS)
|
||||
|
||||
DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
|
||||
smi via fbdev sdl ephyr src linux fake sis300
|
||||
|
||||
relink:
|
||||
@for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done
|
||||
|
|
|
|||
|
|
@ -62,3 +62,6 @@ Xati_LDADD = \
|
|||
$(ATI_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -24,3 +24,6 @@ Xchips_LDADD = \
|
|||
$(CHIPS_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -29,3 +29,6 @@ Xephyr_LDADD = \
|
|||
../../../exa/libexa.la \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XEPHYR_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -24,3 +24,6 @@ Xepson_LDADD = \
|
|||
$(EPSON_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -20,3 +20,6 @@ Xfake_LDADD = \
|
|||
libfake.a \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -18,4 +18,7 @@ Xfbdev_LDADD = \
|
|||
libfbdev.a \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -27,3 +27,6 @@ Xi810_LDADD = \
|
|||
$(I810_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -31,3 +31,6 @@ Xmach64_LDADD = \
|
|||
$(MACH64_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -26,3 +26,6 @@ Xmga_LDADD = \
|
|||
$(MGA_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -38,3 +38,6 @@ Xneomagic_LDADD = \
|
|||
$(NEOMAGIC_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -27,3 +27,6 @@ Xnvidia_LDADD = \
|
|||
$(NVIDIA_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -25,3 +25,6 @@ Xpm2_LDADD = \
|
|||
$(PM2_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -24,3 +24,6 @@ Xr128_LDADD = \
|
|||
$(R128_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -11,3 +11,6 @@ Xsdl_LDADD = @KDRIVE_PURE_LIBS@ \
|
|||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@ \
|
||||
@XSDL_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -38,3 +38,6 @@ Xsis_LDADD = \
|
|||
$(SIS_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
$(TSLIB_FLAG)
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -29,3 +29,6 @@ Xsmi_LDADD = \
|
|||
$(SMI_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -23,3 +23,6 @@ Xvesa_LDADD = \
|
|||
libvesa.a \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -25,3 +25,6 @@ Xvia_LDADD = \
|
|||
$(VIA_LIBS) \
|
||||
@KDRIVE_LIBS@ \
|
||||
@XSERVER_LIBS@
|
||||
|
||||
relink:
|
||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
||||
|
|
|
|||
|
|
@ -807,4 +807,48 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deactivate a device. Call this function from the driver if you receive a
|
||||
* read error or something else that spoils your day.
|
||||
* Device will be moved to the off_devices list, but it will still be there
|
||||
* until you really clean up after it.
|
||||
* Notifies the client about an inactive device.
|
||||
*
|
||||
* @param panic True if device is unrecoverable and needs to be removed.
|
||||
*/
|
||||
_X_EXPORT void
|
||||
xf86DisableDevice(DeviceIntPtr dev, Bool panic)
|
||||
{
|
||||
devicePresenceNotify ev;
|
||||
DeviceIntRec dummyDev;
|
||||
|
||||
if(!panic)
|
||||
{
|
||||
DisableDevice(dev);
|
||||
} else
|
||||
{
|
||||
ev.type = DevicePresenceNotify;
|
||||
ev.time = currentTime.milliseconds;
|
||||
ev.devchange = DeviceUnrecoverable;
|
||||
ev.deviceid = dev->id;
|
||||
dummyDev.id = 0;
|
||||
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
|
||||
(xEvent *) &ev, 1);
|
||||
|
||||
DeleteInputDeviceRequest(dev);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reactivate a device. Call this function from the driver if you just found
|
||||
* out that the read error wasn't quite that bad after all.
|
||||
* Device will be re-activated, and an event sent to the client.
|
||||
*/
|
||||
_X_EXPORT void
|
||||
xf86EnableDevice(DeviceIntPtr dev)
|
||||
{
|
||||
EnableDevice(dev);
|
||||
}
|
||||
|
||||
/* end of xf86Xinput.c */
|
||||
|
|
|
|||
|
|
@ -188,6 +188,8 @@ void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
|
|||
void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
|
||||
void xf86AddEnabledDevice(InputInfoPtr pInfo);
|
||||
void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
|
||||
void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
|
||||
void xf86EnableDevice(DeviceIntPtr dev);
|
||||
|
||||
/* xf86Helper.c */
|
||||
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
|
||||
|
|
@ -205,6 +207,7 @@ int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
|
|||
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
|
||||
pointer extraOpts);
|
||||
|
||||
|
||||
/* Legacy hatred */
|
||||
#define SendCoreEvents 59
|
||||
#define DontSendCoreEvents 60
|
||||
|
|
|
|||
|
|
@ -1,361 +0,0 @@
|
|||
/*
|
||||
* Copyright 2006 Luc Verhaegen.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86DDC.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include "property.h"
|
||||
#include "propertyst.h"
|
||||
#include "xf86DDC.h"
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* - for those with access to the VESA DMT standard; review please.
|
||||
*/
|
||||
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
|
||||
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
|
||||
|
||||
DisplayModeRec DDCEstablishedModes[17] = {
|
||||
{ MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
|
||||
{ MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
|
||||
{ MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
|
||||
{ MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
|
||||
{ MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
|
||||
{ MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
|
||||
{ MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
|
||||
{ MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
|
||||
{ MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
|
||||
{ MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
|
||||
{ MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
|
||||
{ MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
|
||||
{ MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
|
||||
{ MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
|
||||
{ MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
|
||||
{ MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
|
||||
{ MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
|
||||
};
|
||||
|
||||
static DisplayModePtr
|
||||
DDCModesFromEstablished(int scrnIndex, struct established_timings *timing)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode = NULL;
|
||||
CARD32 bits = (timing->t1) | (timing->t2 << 8) |
|
||||
((timing->t_manu & 0x80) << 9);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 17; i++) {
|
||||
if (bits & (0x01 << i)) {
|
||||
Mode = xf86DuplicateMode(&DDCEstablishedModes[i]);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
}
|
||||
}
|
||||
|
||||
return Modes;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static DisplayModePtr
|
||||
DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < STD_TIMINGS; i++) {
|
||||
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
|
||||
Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
|
||||
timing[i].refresh, FALSE, FALSE);
|
||||
Mode->type = M_T_DRIVER;
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
}
|
||||
}
|
||||
|
||||
return Modes;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static DisplayModePtr
|
||||
DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
|
||||
int preferred)
|
||||
{
|
||||
DisplayModePtr Mode;
|
||||
|
||||
/*
|
||||
* Refuse to create modes that are insufficiently large. 64 is a random
|
||||
* number, maybe the spec says something about what the minimum is. In
|
||||
* particular I see this frequently with _old_ EDID, 1.0 or so, so maybe
|
||||
* our parser is just being too aggresive there.
|
||||
*/
|
||||
if (timing->h_active < 64 || timing->v_active < 64) {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"%s: Ignoring tiny %dx%d mode\n", __func__,
|
||||
timing->h_active, timing->v_active);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* We don't do stereo */
|
||||
if (timing->stereo) {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"%s: Ignoring: We don't handle stereo.\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* We only do seperate sync currently */
|
||||
if (timing->sync != 0x03) {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"%s: %dx%d Warning: We only handle seperate"
|
||||
" sync.\n", __func__, timing->h_active, timing->v_active);
|
||||
}
|
||||
|
||||
Mode = xnfalloc(sizeof(DisplayModeRec));
|
||||
memset(Mode, 0, sizeof(DisplayModeRec));
|
||||
|
||||
Mode->type = M_T_DRIVER;
|
||||
if (preferred)
|
||||
Mode->type |= M_T_PREFERRED;
|
||||
|
||||
Mode->Clock = timing->clock / 1000.0;
|
||||
|
||||
Mode->HDisplay = timing->h_active;
|
||||
Mode->HSyncStart = timing->h_active + timing->h_sync_off;
|
||||
Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
|
||||
Mode->HTotal = timing->h_active + timing->h_blanking;
|
||||
|
||||
Mode->VDisplay = timing->v_active;
|
||||
Mode->VSyncStart = timing->v_active + timing->v_sync_off;
|
||||
Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
|
||||
Mode->VTotal = timing->v_active + timing->v_blanking;
|
||||
|
||||
xf86SetModeDefaultName(Mode);
|
||||
|
||||
/* We ignore h/v_size and h/v_border for now. */
|
||||
|
||||
if (timing->interlaced)
|
||||
Mode->Flags |= V_INTERLACE;
|
||||
|
||||
if (timing->misc & 0x02)
|
||||
Mode->Flags |= V_PHSYNC;
|
||||
else
|
||||
Mode->Flags |= V_NHSYNC;
|
||||
|
||||
if (timing->misc & 0x01)
|
||||
Mode->Flags |= V_PVSYNC;
|
||||
else
|
||||
Mode->Flags |= V_NVSYNC;
|
||||
|
||||
return Mode;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
static void
|
||||
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
|
||||
{
|
||||
DisplayModePtr Mode = Modes;
|
||||
|
||||
if (!Monitor || !Modes)
|
||||
return;
|
||||
|
||||
/* set up the ranges for scanning through the modes */
|
||||
Monitor->nHsync = 1;
|
||||
Monitor->hsync[0].lo = 1024.0;
|
||||
Monitor->hsync[0].hi = 0.0;
|
||||
|
||||
Monitor->nVrefresh = 1;
|
||||
Monitor->vrefresh[0].lo = 1024.0;
|
||||
Monitor->vrefresh[0].hi = 0.0;
|
||||
|
||||
while (Mode) {
|
||||
if (!Mode->HSync)
|
||||
Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
|
||||
|
||||
if (!Mode->VRefresh)
|
||||
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
|
||||
((float) (Mode->HTotal * Mode->VTotal));
|
||||
|
||||
if (Mode->HSync < Monitor->hsync[0].lo)
|
||||
Monitor->hsync[0].lo = Mode->HSync;
|
||||
|
||||
if (Mode->HSync > Monitor->hsync[0].hi)
|
||||
Monitor->hsync[0].hi = Mode->HSync;
|
||||
|
||||
if (Mode->VRefresh < Monitor->vrefresh[0].lo)
|
||||
Monitor->vrefresh[0].lo = Mode->VRefresh;
|
||||
|
||||
if (Mode->VRefresh > Monitor->vrefresh[0].hi)
|
||||
Monitor->vrefresh[0].hi = Mode->VRefresh;
|
||||
|
||||
Mode = Mode->next;
|
||||
}
|
||||
}
|
||||
|
||||
DisplayModePtr
|
||||
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
|
||||
{
|
||||
int preferred, i;
|
||||
DisplayModePtr Modes = NULL, Mode;
|
||||
|
||||
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
|
||||
|
||||
/* Add established timings */
|
||||
Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
|
||||
/* Add standard timings */
|
||||
Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
|
||||
for (i = 0; i < DET_TIMINGS; i++) {
|
||||
struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
|
||||
|
||||
switch (det_mon->type) {
|
||||
case DT:
|
||||
Mode = DDCModeFromDetailedTiming(scrnIndex,
|
||||
&det_mon->section.d_timings,
|
||||
preferred);
|
||||
preferred = 0;
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
break;
|
||||
case DS_STD_TIMINGS:
|
||||
Mode = DDCModesFromStandardTiming(scrnIndex,
|
||||
det_mon->section.std_t);
|
||||
Modes = xf86ModesAdd(Modes, Mode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Modes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill out MonPtr with xf86MonPtr information.
|
||||
*/
|
||||
void
|
||||
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
|
||||
{
|
||||
DisplayModePtr Modes = NULL, Mode;
|
||||
int i, clock;
|
||||
Bool have_hsync = FALSE, have_vrefresh = FALSE;
|
||||
|
||||
if (!Monitor || !DDC)
|
||||
return;
|
||||
|
||||
Monitor->DDC = DDC;
|
||||
|
||||
Monitor->widthmm = 10 * DDC->features.hsize;
|
||||
Monitor->heightmm = 10 * DDC->features.vsize;
|
||||
|
||||
/* If this is a digital display, then we can use reduced blanking */
|
||||
if (DDC->features.input_type)
|
||||
Monitor->reducedblanking = TRUE;
|
||||
/* Allow the user to also enable this through config */
|
||||
|
||||
Modes = xf86DDCGetModes(scrnIndex, DDC);
|
||||
|
||||
/* Skip EDID ranges if they were specified in the config file */
|
||||
have_hsync = (Monitor->nHsync != 0);
|
||||
have_vrefresh = (Monitor->nVrefresh != 0);
|
||||
|
||||
/* Go through the detailed monitor sections */
|
||||
for (i = 0; i < DET_TIMINGS; i++) {
|
||||
switch (DDC->det_mon[i].type) {
|
||||
case DS_RANGES:
|
||||
if (!have_hsync) {
|
||||
if (!Monitor->nHsync)
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using EDID range info for horizontal sync\n");
|
||||
Monitor->hsync[Monitor->nHsync].lo =
|
||||
DDC->det_mon[i].section.ranges.min_h;
|
||||
Monitor->hsync[Monitor->nHsync].hi =
|
||||
DDC->det_mon[i].section.ranges.max_h;
|
||||
Monitor->nHsync++;
|
||||
} else {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using hsync ranges from config file\n");
|
||||
}
|
||||
|
||||
if (!have_vrefresh) {
|
||||
if (!Monitor->nVrefresh)
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using EDID range info for vertical refresh\n");
|
||||
Monitor->vrefresh[Monitor->nVrefresh].lo =
|
||||
DDC->det_mon[i].section.ranges.min_v;
|
||||
Monitor->vrefresh[Monitor->nVrefresh].hi =
|
||||
DDC->det_mon[i].section.ranges.max_v;
|
||||
Monitor->nVrefresh++;
|
||||
} else {
|
||||
xf86DrvMsg(scrnIndex, X_INFO,
|
||||
"Using vrefresh ranges from config file\n");
|
||||
}
|
||||
|
||||
clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
|
||||
if (clock > Monitor->maxPixClock)
|
||||
Monitor->maxPixClock = clock;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Modes) {
|
||||
/* Print Modes */
|
||||
xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
|
||||
|
||||
Mode = Modes;
|
||||
while (Mode) {
|
||||
xf86PrintModeline(scrnIndex, Mode);
|
||||
Mode = Mode->next;
|
||||
}
|
||||
|
||||
/* Do we still need ranges to be filled in? */
|
||||
if (!Monitor->nHsync || !Monitor->nVrefresh)
|
||||
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
|
||||
|
||||
/* look for last Mode */
|
||||
Mode = Modes;
|
||||
|
||||
while (Mode->next)
|
||||
Mode = Mode->next;
|
||||
|
||||
/* add to MonPtr */
|
||||
if (Monitor->Modes) {
|
||||
Monitor->Last->next = Modes;
|
||||
Modes->prev = Monitor->Last;
|
||||
Monitor->Last = Mode;
|
||||
} else {
|
||||
Monitor->Modes = Modes;
|
||||
Monitor->Last = Mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
|
|
@ -78,6 +79,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
extern Bool noPanoramiXExtension;
|
||||
#endif
|
||||
|
||||
static int DRIEntPrivIndex = -1;
|
||||
static int DRIScreenPrivIndex = -1;
|
||||
static int DRIWindowPrivIndex = -1;
|
||||
static unsigned long DRIGeneration = 0;
|
||||
|
|
@ -113,18 +115,203 @@ DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
DRIOpenDRMCleanup(DRIEntPrivPtr pDRIEntPriv)
|
||||
{
|
||||
if (pDRIEntPriv->pLSAREA != NULL) {
|
||||
drmUnmap(pDRIEntPriv->pLSAREA, pDRIEntPriv->sAreaSize);
|
||||
pDRIEntPriv->pLSAREA = NULL;
|
||||
}
|
||||
if (pDRIEntPriv->hLSAREA != 0) {
|
||||
drmRmMap(pDRIEntPriv->drmFD, pDRIEntPriv->hLSAREA);
|
||||
}
|
||||
if (pDRIEntPriv->drmFD >= 0) {
|
||||
drmClose(pDRIEntPriv->drmFD);
|
||||
pDRIEntPriv->drmFD = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
DRIMasterFD(ScrnInfoPtr pScrn)
|
||||
{
|
||||
return DRI_ENT_PRIV(pScrn)->drmFD;
|
||||
}
|
||||
|
||||
void *
|
||||
DRIMasterSareaPointer(ScrnInfoPtr pScrn)
|
||||
{
|
||||
return DRI_ENT_PRIV(pScrn)->pLSAREA;
|
||||
}
|
||||
|
||||
drm_handle_t
|
||||
DRIMasterSareaHandle(ScrnInfoPtr pScrn)
|
||||
{
|
||||
return DRI_ENT_PRIV(pScrn)->hLSAREA;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
DRIOpenDRMMaster(ScrnInfoPtr pScrn,
|
||||
unsigned long sAreaSize,
|
||||
const char *busID,
|
||||
const char *drmDriverName)
|
||||
{
|
||||
drmSetVersion saveSv, sv;
|
||||
Bool drmWasAvailable;
|
||||
DRIEntPrivPtr pDRIEntPriv;
|
||||
DRIEntPrivRec tmp;
|
||||
drmVersionPtr drmlibv;
|
||||
int drmlibmajor, drmlibminor;
|
||||
const char *openBusID;
|
||||
int count;
|
||||
int err;
|
||||
|
||||
if (DRIEntPrivIndex == -1)
|
||||
DRIEntPrivIndex = xf86AllocateEntityPrivateIndex();
|
||||
|
||||
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
|
||||
|
||||
if (pDRIEntPriv && pDRIEntPriv->drmFD != -1)
|
||||
return TRUE;
|
||||
|
||||
drmWasAvailable = drmAvailable();
|
||||
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
|
||||
/* Check the DRM lib version.
|
||||
* drmGetLibVersion was not supported in version 1.0, so check for
|
||||
* symbol first to avoid possible crash or hang.
|
||||
*/
|
||||
|
||||
drmlibmajor = 1;
|
||||
drmlibminor = 0;
|
||||
if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
|
||||
drmlibv = drmGetLibVersion(-1);
|
||||
if (drmlibv != NULL) {
|
||||
drmlibmajor = drmlibv->version_major;
|
||||
drmlibminor = drmlibv->version_minor;
|
||||
drmFreeVersion(drmlibv);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the libdrm can handle falling back to loading based on name
|
||||
* if a busid string is passed.
|
||||
*/
|
||||
openBusID = (drmlibmajor == 1 && drmlibminor >= 2) ? busID : NULL;
|
||||
|
||||
tmp.drmFD = -1;
|
||||
sv.drm_di_major = 1;
|
||||
sv.drm_di_minor = 1;
|
||||
sv.drm_dd_major = -1;
|
||||
|
||||
saveSv = sv;
|
||||
count = 10;
|
||||
while (count--) {
|
||||
tmp.drmFD = drmOpen(drmDriverName, openBusID);
|
||||
|
||||
if (tmp.drmFD < 0) {
|
||||
DRIDrvMsg(-1, X_ERROR, "[drm] drmOpen failed.\n");
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
err = drmSetInterfaceVersion(tmp.drmFD, &sv);
|
||||
|
||||
if (err != -EPERM)
|
||||
break;
|
||||
|
||||
sv = saveSv;
|
||||
drmClose(tmp.drmFD);
|
||||
tmp.drmFD = -1;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
if (tmp.drmFD <= 0) {
|
||||
DRIDrvMsg(-1, X_ERROR, "[drm] DRM was busy with another master.\n");
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (!drmWasAvailable) {
|
||||
DRIDrvMsg(-1, X_INFO,
|
||||
"[drm] loaded kernel module for \"%s\" driver.\n",
|
||||
drmDriverName);
|
||||
}
|
||||
|
||||
if (err != 0) {
|
||||
sv.drm_di_major = 1;
|
||||
sv.drm_di_minor = 0;
|
||||
}
|
||||
|
||||
DRIDrvMsg(-1, X_INFO, "[drm] DRM interface version %d.%d\n",
|
||||
sv.drm_di_major, sv.drm_di_minor);
|
||||
|
||||
if (sv.drm_di_major == 1 && sv.drm_di_minor >= 1)
|
||||
err = 0;
|
||||
else
|
||||
err = drmSetBusid(tmp.drmFD, busID);
|
||||
|
||||
if (err) {
|
||||
DRIDrvMsg(-1, X_ERROR, "[drm] Could not set DRM device bus ID.\n");
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a lock-containing sarea.
|
||||
*/
|
||||
|
||||
if (drmAddMap( tmp.drmFD, 0, sAreaSize, DRM_SHM,
|
||||
DRM_CONTAINS_LOCK, &tmp.hLSAREA) < 0) {
|
||||
DRIDrvMsg(-1, X_INFO, "[drm] Could not create SAREA for DRM lock.\n");
|
||||
tmp.hLSAREA = 0;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (drmMap( tmp.drmFD, tmp.hLSAREA, sAreaSize,
|
||||
(drmAddressPtr)(&tmp.pLSAREA)) < 0) {
|
||||
DRIDrvMsg(-1, X_INFO, "[drm] Mapping SAREA for DRM lock failed.\n");
|
||||
tmp.pLSAREA = NULL;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
memset(tmp.pLSAREA, 0, sAreaSize);
|
||||
|
||||
/*
|
||||
* Reserved contexts are handled by the first opened screen.
|
||||
*/
|
||||
|
||||
tmp.resOwner = NULL;
|
||||
|
||||
if (!pDRIEntPriv)
|
||||
pDRIEntPriv = xnfcalloc(sizeof(*pDRIEntPriv), 1);
|
||||
|
||||
if (!pDRIEntPriv) {
|
||||
DRIDrvMsg(-1, X_INFO, "[drm] Failed to allocate memory for "
|
||||
"DRM device.\n");
|
||||
goto out_err;
|
||||
}
|
||||
*pDRIEntPriv = tmp;
|
||||
xf86GetEntityPrivate((pScrn)->entityList[0],DRIEntPrivIndex)->ptr =
|
||||
pDRIEntPriv;
|
||||
|
||||
DRIDrvMsg(-1, X_INFO, "[drm] DRM open master succeeded.\n");
|
||||
return TRUE;
|
||||
|
||||
out_err:
|
||||
|
||||
DRIOpenDRMCleanup(&tmp);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv;
|
||||
drm_context_t * reserved;
|
||||
int reserved_count;
|
||||
int i, fd, drmWasAvailable;
|
||||
int i;
|
||||
Bool xineramaInCore = FALSE;
|
||||
int err = 0;
|
||||
char *openbusid;
|
||||
drmVersionPtr drmlibv;
|
||||
int drmlibmajor, drmlibminor, drmdimajor, drmdiminor;
|
||||
DRIEntPrivPtr pDRIEntPriv;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
|
||||
if (DRIGeneration != serverGeneration) {
|
||||
if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
|
|
@ -154,47 +341,12 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
|||
}
|
||||
}
|
||||
|
||||
drmWasAvailable = drmAvailable();
|
||||
if (!DRIOpenDRMMaster(pScrn, pDRIInfo->SAREASize,
|
||||
pDRIInfo->busIdString,
|
||||
pDRIInfo->drmDriverName))
|
||||
return FALSE;
|
||||
|
||||
/* Check the DRM lib version.
|
||||
* drmGetLibVersion was not supported in version 1.0, so check for
|
||||
* symbol first to avoid possible crash or hang.
|
||||
*/
|
||||
drmlibmajor = 1;
|
||||
drmlibminor = 0;
|
||||
if (xf86LoaderCheckSymbol("drmGetLibVersion")) {
|
||||
drmlibv = drmGetLibVersion(-1);
|
||||
if (drmlibv != NULL) {
|
||||
drmlibmajor = drmlibv->version_major;
|
||||
drmlibminor = drmlibv->version_minor;
|
||||
drmFreeVersion(drmlibv);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the libdrm can handle falling back to loading based on name
|
||||
* if a busid string is passed.
|
||||
*/
|
||||
if (drmlibmajor == 1 && drmlibminor >= 2)
|
||||
openbusid = pDRIInfo->busIdString;
|
||||
else
|
||||
openbusid = NULL;
|
||||
|
||||
/* Note that drmOpen will try to load the kernel module, if needed. */
|
||||
fd = drmOpen(pDRIInfo->drmDriverName, openbusid);
|
||||
if (fd < 0) {
|
||||
/* failed to open DRM */
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] drmOpen failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!drmWasAvailable) {
|
||||
/* drmOpen loaded the kernel module, print a message to say so */
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] loaded kernel module for \"%s\" driver\n",
|
||||
pDRIInfo->drmDriverName);
|
||||
}
|
||||
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
|
||||
|
||||
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
|
||||
if (!pDRIPriv) {
|
||||
|
|
@ -203,7 +355,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
|||
}
|
||||
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
|
||||
pDRIPriv->drmFD = fd;
|
||||
pDRIPriv->drmFD = pDRIEntPriv->drmFD;
|
||||
pDRIPriv->directRenderingSupport = TRUE;
|
||||
pDRIPriv->pDriverInfo = pDRIInfo;
|
||||
pDRIPriv->nrWindows = 0;
|
||||
|
|
@ -215,89 +367,54 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
|||
|
||||
pDRIPriv->grabbedDRILock = FALSE;
|
||||
pDRIPriv->drmSIGIOHandlerInstalled = FALSE;
|
||||
|
||||
if (drmlibmajor == 1 && drmlibminor >= 2) {
|
||||
drmSetVersion sv;
|
||||
|
||||
/* Get the interface version, asking for 1.1. */
|
||||
sv.drm_di_major = 1;
|
||||
sv.drm_di_minor = 1;
|
||||
sv.drm_dd_major = -1;
|
||||
err = drmSetInterfaceVersion(pDRIPriv->drmFD, &sv);
|
||||
if (err == 0) {
|
||||
drmdimajor = sv.drm_di_major;
|
||||
drmdiminor = sv.drm_di_minor;
|
||||
} else {
|
||||
/* failure, so set it to 1.0.0. */
|
||||
drmdimajor = 1;
|
||||
drmdiminor = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* We can't check the DI DRM interface version, so set it to 1.0.0. */
|
||||
drmdimajor = 1;
|
||||
drmdiminor = 0;
|
||||
}
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] DRM interface version %d.%d\n", drmdimajor, drmdiminor);
|
||||
|
||||
/* If the interface minor number is 1.1, then we've opened a DRM device
|
||||
* that already had the busid set through drmOpen.
|
||||
*/
|
||||
if (drmdimajor == 1 && drmdiminor >= 1)
|
||||
err = 0;
|
||||
else
|
||||
err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString);
|
||||
|
||||
if (err < 0) {
|
||||
pDRIPriv->directRenderingSupport = FALSE;
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
drmClose(pDRIPriv->drmFD);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] drmSetBusid failed (%d, %s), %s\n",
|
||||
pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString, strerror(-err));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pDRMFD = pDRIPriv->drmFD;
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] created \"%s\" driver at busid \"%s\"\n",
|
||||
pDRIPriv->pDriverInfo->drmDriverName,
|
||||
pDRIPriv->pDriverInfo->busIdString);
|
||||
|
||||
if (drmAddMap( pDRIPriv->drmFD,
|
||||
0,
|
||||
pDRIPriv->pDriverInfo->SAREASize,
|
||||
DRM_SHM,
|
||||
DRM_CONTAINS_LOCK,
|
||||
&pDRIPriv->hSAREA) < 0)
|
||||
{
|
||||
pDRIPriv->directRenderingSupport = FALSE;
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
drmClose(pDRIPriv->drmFD);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] drmAddMap failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] added %d byte SAREA at %p\n",
|
||||
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
|
||||
if (pDRIEntPriv->sAreaGrabbed || pDRIInfo->allocSarea) {
|
||||
|
||||
if (drmMap( pDRIPriv->drmFD,
|
||||
pDRIPriv->hSAREA,
|
||||
pDRIPriv->pDriverInfo->SAREASize,
|
||||
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
|
||||
{
|
||||
pDRIPriv->directRenderingSupport = FALSE;
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
drmClose(pDRIPriv->drmFD);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] drmMap failed\n");
|
||||
return FALSE;
|
||||
if (drmAddMap( pDRIPriv->drmFD,
|
||||
0,
|
||||
pDRIPriv->pDriverInfo->SAREASize,
|
||||
DRM_SHM,
|
||||
0,
|
||||
&pDRIPriv->hSAREA) < 0)
|
||||
{
|
||||
pDRIPriv->directRenderingSupport = FALSE;
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
drmClose(pDRIPriv->drmFD);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] drmAddMap failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] added %d byte SAREA at %p\n",
|
||||
pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA);
|
||||
|
||||
/* Backwards compat. */
|
||||
if (drmMap( pDRIPriv->drmFD,
|
||||
pDRIPriv->hSAREA,
|
||||
pDRIPriv->pDriverInfo->SAREASize,
|
||||
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
|
||||
{
|
||||
pDRIPriv->directRenderingSupport = FALSE;
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
drmClose(pDRIPriv->drmFD);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] drmMap failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
|
||||
pDRIPriv->hSAREA, pDRIPriv->pSAREA);
|
||||
memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
|
||||
} else {
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Using the DRM lock "
|
||||
"SAREA also for drawables.\n");
|
||||
pDRIPriv->hSAREA = pDRIEntPriv->hLSAREA;
|
||||
pDRIPriv->pSAREA = (XF86DRISAREAPtr) pDRIEntPriv->pLSAREA;
|
||||
pDRIEntPriv->sAreaGrabbed = TRUE;
|
||||
}
|
||||
memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA %p to %p\n",
|
||||
pDRIPriv->hSAREA, pDRIPriv->pSAREA);
|
||||
|
||||
pDRIPriv->hLSAREA = pDRIEntPriv->hLSAREA;
|
||||
pDRIPriv->pLSAREA = pDRIEntPriv->pLSAREA;
|
||||
|
||||
if (drmAddMap( pDRIPriv->drmFD,
|
||||
(drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress,
|
||||
|
|
@ -317,22 +434,26 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
|||
DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] framebuffer handle = %p\n",
|
||||
pDRIPriv->hFrameBuffer);
|
||||
|
||||
/* Add tags for reserved contexts */
|
||||
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
||||
&reserved_count))) {
|
||||
int i;
|
||||
void *tag;
|
||||
if (pDRIEntPriv->resOwner == NULL) {
|
||||
pDRIEntPriv->resOwner = pScreen;
|
||||
|
||||
for (i = 0; i < reserved_count; i++) {
|
||||
tag = DRICreateContextPrivFromHandle(pScreen,
|
||||
reserved[i],
|
||||
DRI_CONTEXT_RESERVED);
|
||||
drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
|
||||
/* Add tags for reserved contexts */
|
||||
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
||||
&reserved_count))) {
|
||||
int i;
|
||||
void *tag;
|
||||
|
||||
for (i = 0; i < reserved_count; i++) {
|
||||
tag = DRICreateContextPrivFromHandle(pScreen,
|
||||
reserved[i],
|
||||
DRI_CONTEXT_RESERVED);
|
||||
drmAddContextTag(pDRIPriv->drmFD, reserved[i], tag);
|
||||
}
|
||||
drmFreeReservedContextList(reserved);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] added %d reserved context%s for kernel\n",
|
||||
reserved_count, reserved_count > 1 ? "s" : "");
|
||||
}
|
||||
drmFreeReservedContextList(reserved);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] added %d reserved context%s for kernel\n",
|
||||
reserved_count, reserved_count > 1 ? "s" : "");
|
||||
}
|
||||
|
||||
/* validate max drawable table entry set by driver */
|
||||
|
|
@ -350,6 +471,14 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
|||
pDRIPriv->pSAREA->drawableTable[i].flags = 0;
|
||||
}
|
||||
|
||||
pDRIPriv->pLockRefCount = &pDRIEntPriv->lockRefCount;
|
||||
pDRIPriv->pLockingContext = &pDRIEntPriv->lockingContext;
|
||||
|
||||
if (!pDRIEntPriv->keepFDOpen)
|
||||
pDRIEntPriv->keepFDOpen = pDRIInfo->keepFDOpen;
|
||||
|
||||
pDRIEntPriv->refCount++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -491,6 +620,9 @@ DRICloseScreen(ScreenPtr pScreen)
|
|||
DRIInfoPtr pDRIInfo;
|
||||
drm_context_t * reserved;
|
||||
int reserved_count;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
DRIEntPrivPtr pDRIEntPriv = DRI_ENT_PRIV(pScrn);
|
||||
Bool closeMaster;
|
||||
|
||||
if (pDRIPriv && pDRIPriv->directRenderingSupport) {
|
||||
|
||||
|
|
@ -543,38 +675,55 @@ DRICloseScreen(ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
/* Remove tags for reserved contexts */
|
||||
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
||||
&reserved_count))) {
|
||||
int i;
|
||||
if (pDRIEntPriv->resOwner == pScreen) {
|
||||
pDRIEntPriv->resOwner = NULL;
|
||||
|
||||
for (i = 0; i < reserved_count; i++) {
|
||||
DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
|
||||
reserved[i]));
|
||||
if ((reserved = drmGetReservedContextList(pDRIPriv->drmFD,
|
||||
&reserved_count))) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < reserved_count; i++) {
|
||||
DRIDestroyContextPriv(drmGetContextTag(pDRIPriv->drmFD,
|
||||
reserved[i]));
|
||||
}
|
||||
drmFreeReservedContextList(reserved);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] removed %d reserved context%s for kernel\n",
|
||||
reserved_count, reserved_count > 1 ? "s" : "");
|
||||
}
|
||||
drmFreeReservedContextList(reserved);
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] removed %d reserved context%s for kernel\n",
|
||||
reserved_count, reserved_count > 1 ? "s" : "");
|
||||
}
|
||||
|
||||
/* Make sure signals get unblocked etc. */
|
||||
drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
|
||||
pDRIPriv->lockRefCount = 0;
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] unmapping %d bytes of SAREA %p at %p\n",
|
||||
pDRIInfo->SAREASize,
|
||||
pDRIPriv->hSAREA,
|
||||
pDRIPriv->pSAREA);
|
||||
if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
|
||||
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||
"[drm] unable to unmap %d bytes"
|
||||
" of SAREA %p at %p\n",
|
||||
pDRIPriv->pLockRefCount = NULL;
|
||||
closeMaster = (--pDRIEntPriv->refCount == 0) &&
|
||||
!pDRIEntPriv->keepFDOpen;
|
||||
if (closeMaster || pDRIPriv->hSAREA != pDRIEntPriv->hLSAREA) {
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] unmapping %d bytes of SAREA %p at %p\n",
|
||||
pDRIInfo->SAREASize,
|
||||
pDRIPriv->hSAREA,
|
||||
pDRIPriv->pSAREA);
|
||||
if (drmUnmap(pDRIPriv->pSAREA, pDRIInfo->SAREASize)) {
|
||||
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||
"[drm] unable to unmap %d bytes"
|
||||
" of SAREA %p at %p\n",
|
||||
pDRIInfo->SAREASize,
|
||||
pDRIPriv->hSAREA,
|
||||
pDRIPriv->pSAREA);
|
||||
}
|
||||
} else {
|
||||
pDRIEntPriv->sAreaGrabbed = FALSE;
|
||||
}
|
||||
|
||||
drmClose(pDRIPriv->drmFD);
|
||||
if (closeMaster || (pDRIEntPriv->drmFD != pDRIPriv->drmFD)) {
|
||||
drmClose(pDRIPriv->drmFD);
|
||||
if (pDRIEntPriv->drmFD == pDRIPriv->drmFD) {
|
||||
DRIDrvMsg(pScreen->myNum, X_INFO,
|
||||
"[drm] Closed DRM master.\n");
|
||||
pDRIEntPriv->drmFD = -1;
|
||||
}
|
||||
}
|
||||
|
||||
xfree(pDRIPriv);
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
|
|
@ -2002,28 +2151,46 @@ void
|
|||
DRILock(ScreenPtr pScreen, int flags)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
if(!pDRIPriv) return;
|
||||
|
||||
if (!pDRIPriv->lockRefCount)
|
||||
DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags);
|
||||
pDRIPriv->lockRefCount++;
|
||||
if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
|
||||
|
||||
if (!*pDRIPriv->pLockRefCount) {
|
||||
DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext, flags);
|
||||
*pDRIPriv->pLockingContext = pDRIPriv->myContext;
|
||||
} else if (*pDRIPriv->pLockingContext != pDRIPriv->myContext) {
|
||||
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||
"[DRI] Locking deadlock.\n"
|
||||
"\tAlready locked with context %d,\n"
|
||||
"\ttrying to lock with context %d.\n",
|
||||
pDRIPriv->pLockingContext,
|
||||
pDRIPriv->myContext);
|
||||
}
|
||||
(*pDRIPriv->pLockRefCount)++;
|
||||
}
|
||||
|
||||
void
|
||||
DRIUnlock(ScreenPtr pScreen)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
if(!pDRIPriv) return;
|
||||
|
||||
if (pDRIPriv->lockRefCount > 0) {
|
||||
pDRIPriv->lockRefCount--;
|
||||
}
|
||||
else {
|
||||
ErrorF("DRIUnlock called when not locked\n");
|
||||
if(!pDRIPriv || !pDRIPriv->pLockRefCount) return;
|
||||
|
||||
if (*pDRIPriv->pLockRefCount > 0) {
|
||||
if (pDRIPriv->myContext != *pDRIPriv->pLockingContext) {
|
||||
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||
"[DRI] Unlocking inconsistency:\n"
|
||||
"\tContext %d trying to unlock lock held by context %d\n",
|
||||
pDRIPriv->pLockingContext,
|
||||
pDRIPriv->myContext);
|
||||
}
|
||||
(*pDRIPriv->pLockRefCount)--;
|
||||
} else {
|
||||
DRIDrvMsg(pScreen->myNum, X_ERROR,
|
||||
"DRIUnlock called when not locked.\n");
|
||||
return;
|
||||
}
|
||||
if (!pDRIPriv->lockRefCount)
|
||||
DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext);
|
||||
if (! *pDRIPriv->pLockRefCount)
|
||||
DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pLSAREA, pDRIPriv->myContext);
|
||||
}
|
||||
|
||||
void *
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ typedef struct {
|
|||
*/
|
||||
|
||||
#define DRIINFO_MAJOR_VERSION 5
|
||||
#define DRIINFO_MINOR_VERSION 1
|
||||
#define DRIINFO_MINOR_VERSION 2
|
||||
#define DRIINFO_PATCH_VERSION 0
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -176,9 +176,17 @@ typedef struct {
|
|||
|
||||
/* New with DRI version 5.1.0 */
|
||||
void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
|
||||
|
||||
/* New with DRI version 5.2.0 */
|
||||
Bool allocSarea;
|
||||
Bool keepFDOpen;
|
||||
} DRIInfoRec, *DRIInfoPtr;
|
||||
|
||||
|
||||
extern Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize,
|
||||
const char *busID,
|
||||
const char *drmDriverName);
|
||||
|
||||
extern Bool DRIScreenInit(ScreenPtr pScreen,
|
||||
DRIInfoPtr pDRIInfo,
|
||||
int *pDRMFD);
|
||||
|
|
@ -344,6 +352,14 @@ extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
|
|||
|
||||
extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
|
||||
extern int drmRemoveSIGIOHandler(int fd);
|
||||
extern int DRIMasterFD(ScrnInfoPtr pScrn);
|
||||
|
||||
extern void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
|
||||
|
||||
extern drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
|
||||
|
||||
|
||||
|
||||
#define _DRI_H_
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -73,6 +73,11 @@ struct _DRIContextPrivRec
|
|||
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
|
||||
(screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
|
||||
|
||||
#define DRI_ENT_PRIV(pScrn) \
|
||||
((DRIEntPrivIndex < 0) ? \
|
||||
NULL: \
|
||||
((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
|
||||
DRIEntPrivIndex)->ptr)))
|
||||
|
||||
typedef struct _DRIScreenPrivRec
|
||||
{
|
||||
|
|
@ -103,6 +108,25 @@ typedef struct _DRIScreenPrivRec
|
|||
Bool wrapped;
|
||||
Bool windowsTouched;
|
||||
int lockRefCount;
|
||||
drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
|
||||
XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
|
||||
int* pLockRefCount;
|
||||
int* pLockingContext;
|
||||
} DRIScreenPrivRec, *DRIScreenPrivPtr;
|
||||
|
||||
|
||||
typedef struct _DRIEntPrivRec {
|
||||
int drmFD;
|
||||
Bool drmOpened;
|
||||
Bool sAreaGrabbed;
|
||||
drm_handle_t hLSAREA;
|
||||
XF86DRILSAREAPtr pLSAREA;
|
||||
unsigned long sAreaSize;
|
||||
int lockRefCount;
|
||||
int lockingContext;
|
||||
ScreenPtr resOwner;
|
||||
Bool keepFDOpen;
|
||||
int refCount;
|
||||
} DRIEntPrivRec, *DRIEntPrivPtr;
|
||||
|
||||
#endif /* DRI_STRUCT_H */
|
||||
|
|
|
|||
|
|
@ -89,4 +89,9 @@ typedef struct _XF86DRISAREA {
|
|||
drm_context_t dummy_context;
|
||||
} XF86DRISAREARec, *XF86DRISAREAPtr;
|
||||
|
||||
typedef struct _XF86DRILSAREA {
|
||||
drmLock lock;
|
||||
drmLock otherLocks[31];
|
||||
} XF86DRILSAREARec, *XF86DRILSAREAPtr;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -869,7 +869,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
|
|||
for (cim = compiled_in_modules; *cim; cim++)
|
||||
if (!strcmp (module, *cim))
|
||||
{
|
||||
xf86MsgVerb(X_INFO, 3, "Module already built-in\n");
|
||||
xf86MsgVerb(X_INFO, 0, "Module already built-in\n");
|
||||
return (ModuleDescPtr) 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -414,22 +414,51 @@ xf86OutputSetMonitor (xf86OutputPtr output)
|
|||
xfree (option_name);
|
||||
output->conf_monitor = xf86findMonitor (monitor,
|
||||
xf86configptr->conf_monitor_lst);
|
||||
/*
|
||||
* Find the monitor section of the screen and use that
|
||||
*/
|
||||
if (!output->conf_monitor && output->use_screen_monitor)
|
||||
output->conf_monitor = xf86findMonitor (output->scrn->monitor->id,
|
||||
xf86configptr->conf_monitor_lst);
|
||||
if (output->conf_monitor)
|
||||
{
|
||||
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||
"Output %s using monitor section %s\n",
|
||||
output->name, output->conf_monitor->mon_identifier);
|
||||
xf86ProcessOptions (output->scrn->scrnIndex,
|
||||
output->conf_monitor->mon_option_lst,
|
||||
output->options);
|
||||
}
|
||||
else
|
||||
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||
"Output %s has no monitor section\n",
|
||||
output->name);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86OutputEnabled (xf86OutputPtr output)
|
||||
xf86OutputEnabled (xf86OutputPtr output)
|
||||
{
|
||||
/* Check to see if this output was disabled in the config file */
|
||||
if (xf86ReturnOptValBool (output->options, OPTION_ENABLE, TRUE) == FALSE ||
|
||||
xf86ReturnOptValBool (output->options, OPTION_DISABLE, FALSE) == TRUE)
|
||||
Bool enable, disable;
|
||||
|
||||
/* check to see if this output was enabled in the config file */
|
||||
if (xf86GetOptValBool (output->options, OPTION_ENABLE, &enable) && enable)
|
||||
{
|
||||
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||
"Output %s enabled by config file\n", output->name);
|
||||
return TRUE;
|
||||
}
|
||||
/* or if this output was disabled in the config file */
|
||||
if (xf86GetOptValBool (output->options, OPTION_DISABLE, &disable) && disable)
|
||||
{
|
||||
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||
"Output %s disabled by config file\n", output->name);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
/* otherwise, enable if it is not disconnected */
|
||||
enable = output->status != XF86OutputStatusDisconnected;
|
||||
xf86DrvMsg (output->scrn->scrnIndex, X_INFO,
|
||||
"Output %s %sconnected\n", output->name, enable ? "" : "dis");
|
||||
return enable;
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
|
@ -463,7 +492,7 @@ xf86OutputInitialRotation (xf86OutputPtr output)
|
|||
|
||||
xf86OutputPtr
|
||||
xf86OutputCreate (ScrnInfoPtr scrn,
|
||||
const xf86OutputFuncsRec *funcs,
|
||||
const xf86OutputFuncsRec *funcs,
|
||||
const char *name)
|
||||
{
|
||||
xf86OutputPtr output, *outputs;
|
||||
|
|
@ -486,6 +515,10 @@ xf86OutputCreate (ScrnInfoPtr scrn,
|
|||
strcpy (output->name, name);
|
||||
}
|
||||
output->subpixel_order = SubPixelUnknown;
|
||||
/*
|
||||
* Use the old per-screen monitor section for the first output
|
||||
*/
|
||||
output->use_screen_monitor = (xf86_config->num_output == 0);
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
output->randr_output = NULL;
|
||||
#endif
|
||||
|
|
@ -536,6 +569,16 @@ xf86OutputRename (xf86OutputPtr output, const char *name)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
|
||||
{
|
||||
if (use_screen_monitor != output->use_screen_monitor)
|
||||
{
|
||||
output->use_screen_monitor = use_screen_monitor;
|
||||
xf86OutputSetMonitor (output);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xf86OutputDestroy (xf86OutputPtr output)
|
||||
{
|
||||
|
|
@ -1203,7 +1246,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
|
|||
*/
|
||||
output->status = (*output->funcs->detect)(output);
|
||||
|
||||
if (output->status == XF86OutputStatusDisconnected)
|
||||
if (!xf86OutputEnabled (output))
|
||||
{
|
||||
xf86OutputSetEDID (output, NULL);
|
||||
continue;
|
||||
|
|
@ -1514,8 +1557,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
|||
xf86OutputPtr output = config->output[o];
|
||||
|
||||
modes[o] = NULL;
|
||||
enabled[o] = (xf86OutputEnabled (output) &&
|
||||
output->status != XF86OutputStatusDisconnected);
|
||||
enabled[o] = xf86OutputEnabled (output);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1560,8 +1602,20 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
|||
{
|
||||
xf86OutputPtr output = config->output[o];
|
||||
|
||||
if (enabled[o] && !modes[o])
|
||||
modes[o] = xf86ClosestMode (output, target_mode, target_rotation, width, height);
|
||||
if (enabled[o])
|
||||
{
|
||||
if (!modes[o])
|
||||
modes[o] = xf86ClosestMode (output, target_mode,
|
||||
target_rotation, width, height);
|
||||
if (!modes[o])
|
||||
xf86DrvMsg (scrn->scrnIndex, X_ERROR,
|
||||
"Output %s enabled but has no modes\n",
|
||||
output->name);
|
||||
else
|
||||
xf86DrvMsg (scrn->scrnIndex, X_INFO,
|
||||
"Output %s using initial mode %s\n",
|
||||
output->name, modes[o]->name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1849,7 +1903,9 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
|
|||
}
|
||||
}
|
||||
xf86DisableUnusedFunctions(pScrn);
|
||||
#if RANDR_12_INTERFACE
|
||||
xf86RandR12TellChanged (pScrn->pScreen);
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -479,6 +479,9 @@ struct _xf86Output {
|
|||
/** driver private information */
|
||||
void *driver_private;
|
||||
|
||||
/** Whether to use the old per-screen Monitor config section */
|
||||
Bool use_screen_monitor;
|
||||
|
||||
#ifdef RANDR_12_INTERFACE
|
||||
/**
|
||||
* RandR 1.2 output structure.
|
||||
|
|
@ -618,9 +621,12 @@ xf86CrtcInUse (xf86CrtcPtr crtc);
|
|||
* Output functions
|
||||
*/
|
||||
xf86OutputPtr
|
||||
xf86OutputCreate (ScrnInfoPtr scrn,
|
||||
const xf86OutputFuncsRec *funcs,
|
||||
const char *name);
|
||||
xf86OutputCreate (ScrnInfoPtr scrn,
|
||||
const xf86OutputFuncsRec *funcs,
|
||||
const char *name);
|
||||
|
||||
void
|
||||
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
|
||||
|
||||
Bool
|
||||
xf86OutputRename (xf86OutputPtr output, const char *name);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,16 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
|
|||
DDC->vendor.prod_id == 1516)
|
||||
return TRUE;
|
||||
|
||||
/* Acer AL1706 */
|
||||
if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 44358)
|
||||
return TRUE;
|
||||
|
||||
/* Samsung SyncMaster 226BW */
|
||||
if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 638)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -338,6 +338,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
|
|||
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
WindowPtr pRoot = WindowTable[pScreen->myNum];
|
||||
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
|
||||
Bool ret = FALSE;
|
||||
|
||||
if (randrp->virtualX == -1 || randrp->virtualY == -1)
|
||||
|
|
@ -354,8 +355,8 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
|
|||
|
||||
ret = TRUE;
|
||||
|
||||
pScreen->width = width;
|
||||
pScreen->height = height;
|
||||
pScreen->width = pScrnPix->drawable.width = width;
|
||||
pScreen->height = pScrnPix->drawable.height = height;
|
||||
pScreen->mmWidth = mmWidth;
|
||||
pScreen->mmHeight = mmHeight;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@
|
|||
#define _XF86_RANDR_H_
|
||||
#include <randrstr.h>
|
||||
#include <X11/extensions/render.h>
|
||||
#if XF86_MODES_RENAME
|
||||
#include "xf86Rename.h"
|
||||
#endif
|
||||
|
||||
Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
|
||||
Bool xf86RandR12Init(ScreenPtr pScreen);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@
|
|||
|
||||
#include "local_xf86Rename.h"
|
||||
|
||||
#define xf86_cursors_fini XF86NAME(xf86_cursors_fini)
|
||||
#define xf86_cursors_init XF86NAME(xf86_cursors_init)
|
||||
#define xf86_hide_cursors XF86NAME(xf86_hide_cursors)
|
||||
#define xf86_reload_cursors XF86NAME(xf86_reload_cursors)
|
||||
#define xf86_show_cursors XF86NAME(xf86_show_cursors)
|
||||
#define xf86ConnectorGetName XF86NAME(xf86ConnectorGetName)
|
||||
#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
|
||||
#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
|
||||
#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
|
||||
|
|
@ -35,6 +41,7 @@
|
|||
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
|
||||
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
|
||||
#define xf86CVTMode XF86NAME(xf86CVTMode)
|
||||
#define xf86DDCMonitorSet XF86NAME(xf86DDCMonitorSet)
|
||||
#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
|
||||
#define xf86DPMSSet XF86NAME(xf86DPMSSet)
|
||||
#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
|
||||
|
|
@ -52,9 +59,11 @@
|
|||
#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
|
||||
#define xf86OutputRename XF86NAME(xf86OutputRename)
|
||||
#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
|
||||
#define xf86OutputUseScreenMonitor XF86NAME(xf86OutputUseScreenMonitor)
|
||||
#define xf86PrintModeline XF86NAME(xf86PrintModeline)
|
||||
#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
|
||||
#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
|
||||
#define xf86RotateCloseScreen XF86NAME(xf86RotateCloseScreen)
|
||||
#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
|
||||
#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
|
||||
#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)
|
||||
|
|
|
|||
|
|
@ -278,13 +278,23 @@ xf86RotateRedisplay(ScreenPtr pScreen)
|
|||
region = DamageRegion(damage);
|
||||
if (REGION_NOTEMPTY(pScreen, region))
|
||||
{
|
||||
int c;
|
||||
|
||||
int c;
|
||||
SourceValidateProcPtr SourceValidate;
|
||||
|
||||
/*
|
||||
* SourceValidate is used by the software cursor code
|
||||
* to pull the cursor off of the screen when reading
|
||||
* bits from the frame buffer. Bypassing this function
|
||||
* leaves the software cursor in place
|
||||
*/
|
||||
SourceValidate = pScreen->SourceValidate;
|
||||
pScreen->SourceValidate = NULL;
|
||||
|
||||
for (c = 0; c < xf86_config->num_crtc; c++)
|
||||
{
|
||||
xf86CrtcPtr crtc = xf86_config->crtc[c];
|
||||
|
||||
if (crtc->rotation != RR_Rotate_0)
|
||||
if (crtc->rotation != RR_Rotate_0 && crtc->enabled)
|
||||
{
|
||||
BoxRec box;
|
||||
RegionRec crtc_damage;
|
||||
|
|
@ -304,6 +314,7 @@ xf86RotateRedisplay(ScreenPtr pScreen)
|
|||
REGION_UNINIT (pScreen, &crtc_damage);
|
||||
}
|
||||
}
|
||||
pScreen->SourceValidate = SourceValidate;
|
||||
DamageEmpty(damage);
|
||||
}
|
||||
}
|
||||
|
|
@ -338,7 +349,8 @@ xf86RotateDestroy (xf86CrtcPtr crtc)
|
|||
}
|
||||
|
||||
for (c = 0; c < xf86_config->num_crtc; c++)
|
||||
if (crtc->rotatedPixmap || crtc->rotatedData)
|
||||
if (xf86_config->crtc[c]->rotatedPixmap ||
|
||||
xf86_config->crtc[c]->rotatedData)
|
||||
return;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -232,14 +232,14 @@ _X_EXPORT int pciNumBuses = 0; /* Actual number of PCI buses */
|
|||
int pciMaxBusNum = MAX_PCI_BUSES;
|
||||
static Bool inProbe = FALSE;
|
||||
|
||||
static pciConfigPtr pci_devp[MAX_PCI_DEVICES + 1] = {NULL, };
|
||||
static pciConfigPtr *pci_devp = NULL;
|
||||
|
||||
static int readPciBios( PCITAG Tag, CARD8* tmp, ADDRESS hostbase,
|
||||
unsigned char * buf, int len, PciBiosType BiosType );
|
||||
|
||||
static int (*pciOSHandleBIOS)(PCITAG Tag, int basereg, unsigned char *buf, int len);
|
||||
|
||||
int xf86MaxPciDevs = MAX_PCI_DEVICES;
|
||||
int xf86MaxPciDevs = 0;
|
||||
|
||||
/*
|
||||
* Platform specific PCI function pointers.
|
||||
|
|
@ -272,6 +272,14 @@ pciInit()
|
|||
if (pciNumBuses <= 0)
|
||||
ARCH_PCI_OS_INIT();
|
||||
#endif
|
||||
if (xf86MaxPciDevs == 0) {
|
||||
xf86Msg(X_WARNING,
|
||||
"OS did not count PCI devices, guessing wildly\n");
|
||||
xf86MaxPciDevs = MAX_PCI_DEVICES;
|
||||
}
|
||||
if (pci_devp)
|
||||
xfree(pci_devp);
|
||||
pci_devp = xnfcalloc(xf86MaxPciDevs + 1, sizeof(pciConfigPtr));
|
||||
}
|
||||
|
||||
void pciSetOSBIOSPtr(int (*bios_fn)(PCITAG Tag, int basereg, unsigned char * buf, int len))
|
||||
|
|
@ -920,7 +928,7 @@ xf86scanpci(int flags)
|
|||
* result in an endless recursion if platform/OS specific PCI
|
||||
* bus probing code calls this function from with in it.
|
||||
*/
|
||||
if (done || pci_devp[0])
|
||||
if (done || pci_devp)
|
||||
return pci_devp;
|
||||
|
||||
done = TRUE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue