summaryrefslogtreecommitdiff
path: root/xserver/hw/xfree86/drivers/modesetting
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2019-12-12 06:05:21 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2019-12-12 06:05:21 +0000
commitdff4a3473cbf3db68b2fa5b43e51f8c05ae6b029 (patch)
treeae898a699dbc977738010eaae623435d2ccee50a /xserver/hw/xfree86/drivers/modesetting
parent005295117c63143b3bf6d69d4503b360e660cf49 (diff)
Update to X server 1.20.6. Tested by naddy@
Diffstat (limited to 'xserver/hw/xfree86/drivers/modesetting')
-rw-r--r--xserver/hw/xfree86/drivers/modesetting/Makefile.am8
-rw-r--r--xserver/hw/xfree86/drivers/modesetting/Makefile.in133
-rw-r--r--xserver/hw/xfree86/drivers/modesetting/driver.h1
-rw-r--r--xserver/hw/xfree86/drivers/modesetting/present.c3
-rw-r--r--xserver/hw/xfree86/drivers/modesetting/vblank.c148
5 files changed, 257 insertions, 36 deletions
diff --git a/xserver/hw/xfree86/drivers/modesetting/Makefile.am b/xserver/hw/xfree86/drivers/modesetting/Makefile.am
index e0411ef51..961c57408 100644
--- a/xserver/hw/xfree86/drivers/modesetting/Makefile.am
+++ b/xserver/hw/xfree86/drivers/modesetting/Makefile.am
@@ -24,6 +24,8 @@
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+include $(top_srcdir)/manpages.am
+
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) $(CWARNFLAGS)
AM_CPPFLAGS = \
@@ -62,9 +64,3 @@ 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) < $< > $@
diff --git a/xserver/hw/xfree86/drivers/modesetting/Makefile.in b/xserver/hw/xfree86/drivers/modesetting/Makefile.in
index baca8fbc8..54f1779dc 100644
--- a/xserver/hw/xfree86/drivers/modesetting/Makefile.in
+++ b/xserver/hw/xfree86/drivers/modesetting/Makefile.in
@@ -77,9 +77,9 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-subdir = hw/xfree86/drivers/modesetting
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/depcomp
+ $(top_srcdir)/depcomp $(top_srcdir)/manpages.am
+subdir = hw/xfree86/drivers/modesetting
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -127,7 +127,8 @@ am__uninstall_files_from_dir = { \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(modesetting_drv_ladir)" \
- "$(DESTDIR)$(drivermandir)"
+ "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" \
+ "$(DESTDIR)$(filemandir)"
LTLIBRARIES = $(modesetting_drv_la_LTLIBRARIES)
am__DEPENDENCIES_1 =
modesetting_drv_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
@@ -183,7 +184,7 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-DATA = $(driverman_DATA)
+DATA = $(appman_DATA) $(driverman_DATA) $(fileman_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -327,7 +328,38 @@ MAINT = @MAINT@
MAIN_LIB = @MAIN_LIB@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
-MAN_SUBSTS = @MAN_SUBSTS@
+
+# xorg-macros.m4 has these bracketed by double underscores, but meson
+# wants ats.
+
+# Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS
+# 's|/,|/, |g' will add a space to help font path formatting
+MAN_SUBSTS = @MAN_SUBSTS@ -e 's|@vendorversion@|"$(PACKAGE_STRING)" \
+ "$(XORG_MAN_PAGE)"|' -e 's|@xorgversion@|"$(PACKAGE_STRING)" \
+ "$(XORG_MAN_PAGE)"|' -e 's|@xservername@|Xorg|g' -e \
+ 's|@xconfigfile@|xorg.conf|g' -e 's|@projectroot@|$(prefix)|g' \
+ -e 's|@apploaddir@|$(appdefaultdir)|g' -e \
+ 's|@appmansuffix@|$(APP_MAN_SUFFIX)|g' -e \
+ 's|@drivermansuffix@|$(DRIVER_MAN_SUFFIX)|g' -e \
+ 's|@adminmansuffix@|$(ADMIN_MAN_SUFFIX)|g' -e \
+ 's|@libmansuffix@|$(LIB_MAN_SUFFIX)|g' -e \
+ 's|@miscmansuffix@|$(MISC_MAN_SUFFIX)|g' -e \
+ 's|@filemansuffix@|$(FILE_MAN_SUFFIX)|g' -e \
+ 's|[@]logdir[@]|$(logdir)|g' -e 's|[@]datadir[@]|$(datadir)|g' \
+ -e 's|[@]mandir[@]|$(mandir)|g' -e \
+ 's|[@]sysconfdir[@]|$(sysconfdir)|g' -e \
+ 's|[@]xconfigdir[@]|$(XCONFIGDIR)|g' -e \
+ 's|[@]xkbdir[@]|$(XKB_BASE_DIRECTORY)|g' -e \
+ 's|[@]XKB_DFLT_RULES[@]|$(XKB_DFLT_RULES)|g' -e \
+ 's|[@]XKB_DFLT_MODEL[@]|$(XKB_DFLT_MODEL)|g' -e \
+ 's|[@]XKB_DFLT_LAYOUT[@]|$(XKB_DFLT_LAYOUT)|g' -e \
+ 's|[@]XKB_DFLT_VARIANT[@]|$(XKB_DFLT_VARIANT)|g' -e \
+ 's|[@]XKB_DFLT_OPTIONS[@]|$(XKB_DFLT_OPTIONS)|g' -e \
+ 's|[@]bundle_id_prefix[@]|$(BUNDLE_ID_PREFIX)|g' -e \
+ 's|[@]modulepath[@]|$(DEFAULT_MODULE_PATH)|g' -e \
+ 's|[@]suid_wrapper_dir[@]|$(SUID_WRAPPER_DIR)|g' -e \
+ 's|[@]default_font_path[@]|$(COMPILEDDEFAULTFONTPATH)|g' -e \
+ '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g'
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
@@ -545,6 +577,17 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+appmandir = $(APP_MAN_DIR)
+#appman_PRE = list of application man page files set by calling Makefile.am
+appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX))
+drivermandir = $(DRIVER_MAN_DIR)
+driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
+filemandir = $(FILE_MAN_DIR)
+#fileman_PRE = list of file man page files set by calling Makefile.am
+fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX))
+EXTRA_DIST = modesetting.man
+CLEANFILES = $(driverman_DATA)
+SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(LIBDRM_CFLAGS) $(UDEV_CFLAGS) $(CWARNFLAGS)
AM_CPPFLAGS = \
$(XORG_INCS) \
@@ -574,19 +617,12 @@ modesetting_drv_la_SOURCES = \
pageflip.c \
$(NULL)
-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
all: all-am
.SUFFIXES:
-.SUFFIXES: .$(DRIVER_MAN_SUFFIX) .man .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+.SUFFIXES: .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/manpages.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -607,6 +643,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
+$(top_srcdir)/manpages.am:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -693,6 +730,27 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+install-appmanDATA: $(appman_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(appmandir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(appmandir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appmandir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(appmandir)" || exit $$?; \
+ done
+
+uninstall-appmanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(appman_DATA)'; test -n "$(appmandir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(appmandir)'; $(am__uninstall_files_from_dir)
install-drivermanDATA: $(driverman_DATA)
@$(NORMAL_INSTALL)
@list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \
@@ -714,6 +772,27 @@ uninstall-drivermanDATA:
@list='$(driverman_DATA)'; test -n "$(drivermandir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(drivermandir)'; $(am__uninstall_files_from_dir)
+install-filemanDATA: $(fileman_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(filemandir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(filemandir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filemandir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(filemandir)" || exit $$?; \
+ done
+
+uninstall-filemanDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(fileman_DATA)'; test -n "$(filemandir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(filemandir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -815,7 +894,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(modesetting_drv_ladir)" "$(DESTDIR)$(drivermandir)"; do \
+ for dir in "$(DESTDIR)$(modesetting_drv_ladir)" "$(DESTDIR)$(appmandir)" "$(DESTDIR)$(drivermandir)" "$(DESTDIR)$(filemandir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -872,8 +951,8 @@ info: info-am
info-am:
-install-data-am: install-drivermanDATA \
- install-modesetting_drv_laLTLIBRARIES
+install-data-am: install-appmanDATA install-drivermanDATA \
+ install-filemanDATA install-modesetting_drv_laLTLIBRARIES
install-dvi: install-dvi-am
@@ -919,8 +998,8 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-drivermanDATA \
- uninstall-modesetting_drv_laLTLIBRARIES
+uninstall-am: uninstall-appmanDATA uninstall-drivermanDATA \
+ uninstall-filemanDATA uninstall-modesetting_drv_laLTLIBRARIES
.MAKE: install-am install-strip
@@ -928,21 +1007,27 @@ uninstall-am: uninstall-drivermanDATA \
clean-libtool clean-modesetting_drv_laLTLIBRARIES cscopelist \
ctags distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-drivermanDATA install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
+ html-am info info-am install install-am install-appmanDATA \
+ install-data install-data-am install-drivermanDATA install-dvi \
+ install-dvi-am install-exec install-exec-am \
+ install-filemanDATA install-html install-html-am install-info \
+ install-info-am install-man \
install-modesetting_drv_laLTLIBRARIES install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-drivermanDATA \
+ tags uninstall uninstall-am uninstall-appmanDATA \
+ uninstall-drivermanDATA uninstall-filemanDATA \
uninstall-modesetting_drv_laLTLIBRARIES
+.man.$(APP_MAN_SUFFIX):
+ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
.man.$(DRIVER_MAN_SUFFIX):
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+.man.$(FILE_MAN_SUFFIX):
+ $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/xserver/hw/xfree86/drivers/modesetting/driver.h b/xserver/hw/xfree86/drivers/modesetting/driver.h
index c8db4b8a4..493280c1d 100644
--- a/xserver/hw/xfree86/drivers/modesetting/driver.h
+++ b/xserver/hw/xfree86/drivers/modesetting/driver.h
@@ -147,6 +147,7 @@ void ms_drm_abort_seq(ScrnInfoPtr scrn, uint32_t seq);
Bool ms_crtc_on(xf86CrtcPtr crtc);
xf86CrtcPtr ms_dri2_crtc_covering_drawable(DrawablePtr pDraw);
+RRCrtcPtr ms_randr_crtc_covering_drawable(DrawablePtr pDraw);
int ms_get_crtc_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc);
diff --git a/xserver/hw/xfree86/drivers/modesetting/present.c b/xserver/hw/xfree86/drivers/modesetting/present.c
index dda7cc064..ab79fe778 100644
--- a/xserver/hw/xfree86/drivers/modesetting/present.c
+++ b/xserver/hw/xfree86/drivers/modesetting/present.c
@@ -59,8 +59,7 @@ struct ms_present_vblank_event {
static RRCrtcPtr
ms_present_get_crtc(WindowPtr window)
{
- xf86CrtcPtr xf86_crtc = ms_dri2_crtc_covering_drawable(&window->drawable);
- return xf86_crtc ? xf86_crtc->randr_crtc : NULL;
+ return ms_randr_crtc_covering_drawable(&window->drawable);
}
static int
diff --git a/xserver/hw/xfree86/drivers/modesetting/vblank.c b/xserver/hw/xfree86/drivers/modesetting/vblank.c
index 561229f30..31ff244ad 100644
--- a/xserver/hw/xfree86/drivers/modesetting/vblank.c
+++ b/xserver/hw/xfree86/drivers/modesetting/vblank.c
@@ -77,6 +77,28 @@ static void ms_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
}
+static void ms_randr_crtc_box(RRCrtcPtr crtc, BoxPtr crtc_box)
+{
+ if (crtc->mode) {
+ crtc_box->x1 = crtc->x;
+ crtc_box->y1 = crtc->y;
+ switch (crtc->rotation) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ default:
+ crtc_box->x2 = crtc->x + crtc->mode->mode.width;
+ crtc_box->y2 = crtc->y + crtc->mode->mode.height;
+ break;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ crtc_box->x2 = crtc->x + crtc->mode->mode.height;
+ crtc_box->y2 = crtc->y + crtc->mode->mode.width;
+ break;
+ }
+ } else
+ crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
+}
+
static int ms_box_area(BoxPtr box)
{
return (int)(box->x2 - box->x1) * (int)(box->y2 - box->y1);
@@ -91,12 +113,45 @@ ms_crtc_on(xf86CrtcPtr crtc)
}
/*
+ * Return the first output which is connected to an active CRTC on this screen.
+ *
+ * RRFirstOutput() will return an output from a slave screen if it is primary,
+ * which is not the behavior that ms_covering_crtc() wants.
+ */
+
+static RROutputPtr ms_first_output(ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ RROutputPtr output;
+ int i, j;
+
+ if (!pScrPriv)
+ return NULL;
+
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc &&
+ (pScrPriv->primaryOutput->pScreen == pScreen)) {
+ return pScrPriv->primaryOutput;
+ }
+
+ for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+ for (j = 0; j < pScrPriv->numOutputs; j++) {
+ output = pScrPriv->outputs[j];
+ if (output->crtc == crtc)
+ return output;
+ }
+ }
+ return NULL;
+}
+
+/*
* Return the crtc covering 'box'. If two crtcs cover a portion of
* 'box', then prefer the crtc with greater coverage.
*/
static xf86CrtcPtr
-ms_covering_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
+ms_covering_xf86_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -108,6 +163,10 @@ ms_covering_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
best_crtc = NULL;
best_coverage = 0;
+
+ if (!xf86_config)
+ return NULL;
+
for (c = 0; c < xf86_config->num_crtc; c++) {
crtc = xf86_config->crtc[c];
@@ -135,7 +194,7 @@ ms_covering_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
ScreenPtr slave;
if (dixPrivateKeyRegistered(rrPrivKey))
- primary_output = RRFirstOutput(scrn->pScreen);
+ primary_output = ms_first_output(scrn->pScreen);
if (!primary_output || !primary_output->crtc)
return NULL;
@@ -147,7 +206,74 @@ ms_covering_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
if (!slave->is_output_slave)
continue;
- if (ms_covering_crtc(slave, box, FALSE)) {
+ if (ms_covering_xf86_crtc(slave, box, FALSE)) {
+ /* The drawable is on a slave output, return primary crtc */
+ return crtc;
+ }
+ }
+ }
+
+ return best_crtc;
+}
+
+static RRCrtcPtr
+ms_covering_randr_crtc(ScreenPtr pScreen, BoxPtr box, Bool screen_is_ms)
+{
+ ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
+ rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
+ RRCrtcPtr crtc, best_crtc;
+ int coverage, best_coverage;
+ int c;
+ BoxRec crtc_box, cover_box;
+ Bool crtc_on;
+
+ best_crtc = NULL;
+ best_coverage = 0;
+
+ if (!pScrPriv)
+ return NULL;
+
+ for (c = 0; c < pScrPriv->numCrtcs; c++) {
+ crtc = pScrPriv->crtcs[c];
+
+ if (screen_is_ms) {
+ crtc_on = ms_crtc_on((xf86CrtcPtr) crtc->devPrivate);
+ } else {
+ crtc_on = !!crtc->mode;
+ }
+
+ /* If the CRTC is off, treat it as not covering */
+ if (!crtc_on)
+ continue;
+
+ ms_randr_crtc_box(crtc, &crtc_box);
+ ms_box_intersect(&cover_box, &crtc_box, box);
+ coverage = ms_box_area(&cover_box);
+ if (coverage > best_coverage) {
+ best_crtc = crtc;
+ best_coverage = coverage;
+ }
+ }
+
+ /* Fallback to primary crtc for drawable's on slave outputs */
+ if (best_crtc == NULL && !pScreen->isGPU) {
+ RROutputPtr primary_output = NULL;
+ ScreenPtr slave;
+
+ if (dixPrivateKeyRegistered(rrPrivKey))
+ primary_output = ms_first_output(scrn->pScreen);
+ if (!primary_output || !primary_output->crtc)
+ return NULL;
+
+ crtc = primary_output->crtc;
+ if (!ms_crtc_on((xf86CrtcPtr) crtc->devPrivate))
+ return NULL;
+
+ xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) {
+ if (!slave->is_output_slave)
+ continue;
+
+ if (ms_covering_randr_crtc(slave, box, FALSE)) {
/* The drawable is on a slave output, return primary crtc */
return crtc;
}
@@ -168,7 +294,21 @@ ms_dri2_crtc_covering_drawable(DrawablePtr pDraw)
box.x2 = box.x1 + pDraw->width;
box.y2 = box.y1 + pDraw->height;
- return ms_covering_crtc(pScreen, &box, TRUE);
+ return ms_covering_xf86_crtc(pScreen, &box, TRUE);
+}
+
+RRCrtcPtr
+ms_randr_crtc_covering_drawable(DrawablePtr pDraw)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ BoxRec box;
+
+ box.x1 = pDraw->x;
+ box.y1 = pDraw->y;
+ box.x2 = box.x1 + pDraw->width;
+ box.y2 = box.y1 + pDraw->height;
+
+ return ms_covering_randr_crtc(pScreen, &box, TRUE);
}
static Bool