diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 00000000..cbbe7f76 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,12 @@ +((nil + (indent-tabs-mode . t) + (tab-width . 8) + (c-basic-offset . 4) + (c-file-style . "stroustrup") + (fill-column . 78) + (eval . (progn + (c-set-offset 'innamespace '0) + (c-set-offset 'inline-open '0))) + ) + (makefile-mode (indent-tabs-mode . t)) + ) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..91f0ff80 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root=true + +[*] +indent_style=tab +tab_width=8 +indent_size=4 +charset=utf-8 + +[src/{drmmode_display.c,radeon_dri3.c,radeon_glamor.c,radeon_glamor.h,radeon_glamor_wrappers.c}] +indent_size=8 + +[src/ati.c] +indent_style=space diff --git a/.github/ISSUE_TEMPLATE/01-bug-report.yml b/.github/ISSUE_TEMPLATE/01-bug-report.yml deleted file mode 100644 index 9f41f595..00000000 --- a/.github/ISSUE_TEMPLATE/01-bug-report.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: 🐞 Bug report -description: Create a report to help us improve - -labels: [bug, needs-triage] - -body: - - type: markdown - attributes: - value: | - Please fill out the sections below to help everyone identify and fix the bug. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions). - - type: dropdown - id: affected-version - attributes: - label: Select the version - options: - - 22.0.0.1 - - Git master branch - - other or don't know - default: 1 - validations: - required: true - - type: textarea - id: description - attributes: - label: Describe your issue - placeholder: When I did X then Y happened. - validations: - required: true - - type: textarea - id: steps - attributes: - label: Steps to reproduce - placeholder: | - 1. Start ... - 2. Do this - 3. Do that - validations: - required: true - - type: textarea - id: expected - attributes: - label: What did you expect? - placeholder: I expected this to happen. - - type: textarea - id: environment - attributes: - label: Additional Information - description: | - Additional information you want to provide such as logs, system info, environment, screenshots, etc. - placeholder: | - Add any other context about the bug here. - - type: checkboxes - id: checks - attributes: - label: Extra fields - options: - - label: I have checked the existing [issues](https://github.com/X11Libre/xf86-video-ati/issues) - required: true - - label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md) - required: true - - label: I'd like to work on this issue - - type: markdown - attributes: - value: | - Thanks for reporting this issue! We will get back to you as soon as possible. diff --git a/.github/ISSUE_TEMPLATE/02-feature-request.yml b/.github/ISSUE_TEMPLATE/02-feature-request.yml deleted file mode 100644 index 94e69e72..00000000 --- a/.github/ISSUE_TEMPLATE/02-feature-request.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: ✨ Feature request -description: Suggest a feature for this software -labels: [enhancement, needs-triage] - -body: - - type: markdown - attributes: - value: | - Please fill out the sections below to properly describe the new software feature you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions). - - type: textarea - id: description - attributes: - label: "Describe the feature" - placeholder: A thing in X that allows to do Y. - validations: - required: true - - type: textarea - id: rationale - attributes: - label: "It should be done because" - placeholder: Doing Y is needed for Z. - validations: - required: true - - type: textarea - id: alternative - attributes: - label: "What are the alternatives?" - placeholder: We could do A or B instead. - - type: textarea - id: context - attributes: - label: Additional context - description: Additional information you want to provide such as references to related issues or protocols, the implications on existing use cases, etc. - placeholder: | - Add any other context about the feature request here. - - type: checkboxes - id: checks - attributes: - label: Extra fields - options: - - label: I have checked the existing [issues](https://github.com/X11Libre/xf86-video-ati/issues) - required: true - - label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md) - required: true - - label: I'd like to work on this issue - - type: markdown - attributes: - value: | - Thanks for your suggestion! Let's see together if it can be done. diff --git a/.github/ISSUE_TEMPLATE/03-code-cleanup.yml b/.github/ISSUE_TEMPLATE/03-code-cleanup.yml deleted file mode 100644 index 9ffdb873..00000000 --- a/.github/ISSUE_TEMPLATE/03-code-cleanup.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: 🔧 Code cleanup -description: Level up the source code -labels: [code-cleanup, needs-triage] - -body: - - type: markdown - attributes: - value: | - Please fill out the sections below to properly describe the code cleanup you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions). - - type: textarea - id: description - attributes: - label: "Describe the cleanup" - placeholder: C in X needs to be changed into D. - validations: - required: true - - type: textarea - id: rationale - attributes: - label: "It should be done because" - placeholder: Having D is needed for E. - validations: - required: true - - type: textarea - id: alternative - attributes: - label: "What are the alternatives?" - placeholder: We could do A or B instead. - - type: textarea - id: context - attributes: - label: Additional context - description: Additional information you want to provide such as implications on existing code, how to ensure API/ABI stability, which tests are needed or to be run, related issues, etc. - placeholder: | - Add any other context about the cleanup here. - - type: checkboxes - id: checks - attributes: - label: Extra fields - options: - - label: I have checked the existing [issues](https://github.com/X11Libre/xf86-video-ati/issues) - required: true - - label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md) - required: true - - label: I'd like to work on this issue - - type: markdown - attributes: - value: | - Thanks for looking at the source code! Let's see together how it can be improved. diff --git a/.github/ISSUE_TEMPLATE/04-doc-update.yml b/.github/ISSUE_TEMPLATE/04-doc-update.yml deleted file mode 100644 index 8d19facd..00000000 --- a/.github/ISSUE_TEMPLATE/04-doc-update.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: 🔖 Documentation update -description: Make your mark for better documentation - -labels: [documentation, needs-triage] - -body: - - type: markdown - attributes: - value: | - Please fill out the sections below to help others understand our software. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions). - - type: textarea - id: description - attributes: - label: Describe the update - placeholder: These things need to be better documented. - validations: - required: true - - type: textarea - id: environment - attributes: - label: Additional Information - description: Additional information you want to provide such as tickets related to changes in the software, affected files, screenshots, etc. - placeholder: | - Add any other context about the update here. - - type: checkboxes - id: checks - attributes: - label: Extra fields - options: - - label: I have checked the existing [issues](https://github.com/X11Libre/xf86-video-ati/issues) - required: true - - label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md) - required: true - - label: I'd like to work on this issue - - type: markdown - attributes: - value: | - Thanks for requesting this update! We will get back to you as soon as possible. diff --git a/.github/ISSUE_TEMPLATE/05-org-task.yml b/.github/ISSUE_TEMPLATE/05-org-task.yml deleted file mode 100644 index 22fa94f0..00000000 --- a/.github/ISSUE_TEMPLATE/05-org-task.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: ✅ Organizational task -description: Create a task for project organization - -labels: [needs-triage, organization] - -body: - - type: markdown - attributes: - value: | - Please fill out the sections below to get organizational things done. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions). - - type: textarea - id: description - attributes: - label: Describe the task - placeholder: These things need to be done. - validations: - required: true - - type: textarea - id: rationale - attributes: - label: "It should be done because" - placeholder: Doing Y is needed for Z. - - type: textarea - id: environment - attributes: - label: Additional Information - description: Additional information you want to provide such as the context for bigger tasks, the implicatons on existing workflows, related issues, etc. - placeholder: | - Add any other context about the task here. - - type: checkboxes - id: checks - attributes: - label: Extra fields - options: - - label: I have checked the existing [issues](https://github.com/X11Libre/xf86-video-ati/issues) - required: true - - label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md) - required: true - - label: I'd like to work on this issue - - type: markdown - attributes: - value: | - Thanks for adding this task! We will get back to you as soon as possible. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 5d1b3a85..00000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,8 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: XLibre Community Support - url: https://github.com/orgs/X11Libre/discussions - about: Please ask and answer questions here. - - name: Mailing List - url: https://www.freelists.org/list/xlibre - about: You can join the discussions on our mailing list. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 25307e76..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,58 +0,0 @@ -permissions: - contents: write - -on: - push: - pull_request: - -jobs: - ubuntu: - strategy: - matrix: - xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ] - runs-on: ubuntu-latest - steps: - - uses: X11Libre/action-build-driver/target/ubuntu@v0.4.0 - with: - xserver-version: ${{ matrix.xserver-version }} - - freebsd: - strategy: - matrix: - xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ] - runs-on: ubuntu-latest - steps: - - uses: X11Libre/action-build-driver/target/freebsd@v0.4.0 - with: - xserver-version: ${{ matrix.xserver-version }} - - dragonfly: - strategy: - matrix: - # xlibre-xserver-25.0.x not compiling on dragonfly yet - xserver-version: [ master, xlibre-xserver-25.1.0 ] - runs-on: ubuntu-latest - steps: - - uses: X11Libre/action-build-driver/target/dragonfly@v0.4.0 - with: - xserver-version: ${{ matrix.xserver-version }} - - netbsd: - strategy: - matrix: - xserver-version: [ master, xlibre-xserver-25.1.0 ] - runs-on: ubuntu-latest - steps: - - uses: X11Libre/action-build-driver/target/netbsd@v0.4.0 - with: - xserver-version: ${{ matrix.xserver-version }} - - release-notes: - name: Release pushed tag - runs-on: ubuntu-latest - if: ${{ startsWith(github.ref, 'refs/tags/xlibre-') }} - needs: [ ubuntu, freebsd, dragonfly, netbsd ] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: X11Libre/action-build-driver/release@v0.4.0 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..4cd462b6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,136 @@ +# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml: + +# FDO_DISTRIBUTION_TAG is the tag of the docker image used for the build +# jobs. If the image doesn't exist yet, the docker-image stage generates it +# or copies it from upstream (this is all handled by the templates). +# +# In order to generate a new image, one should generally change the tag. +# While removing the image from the registry would also work, that's not +# recommended except for ephemeral images during development. +# +variables: + FDO_DISTRIBUTION_VERSION: bookworm-slim + FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/debian-install.sh' + FDO_DISTRIBUTION_PACKAGES: 'ca-certificates' + FDO_DISTRIBUTION_TAG: "2024-02-23.2" + FDO_UPSTREAM_REPO: xorg/driver/xf86-video-ati + +# +# This CI uses the freedesktop.org ci-templates. +# Please see the ci-templates documentation for details: +# https://freedesktop.pages.freedesktop.org/ci-templates/ + +.templates_sha: &template_sha 9568e38927f9e9c48d4f586f84a071c3a4bdcd39 # see https://docs.gitlab.com/ee/ci/yaml/#includefile + +include: + - project: 'freedesktop/ci-templates' + ref: *template_sha + file: '/templates/debian.yml' + - project: 'freedesktop/ci-templates' + ref: *template_sha + file: '/templates/ci-fairy.yml' + - template: Security/SAST.gitlab-ci.yml + + +stages: + - docker-image + - build + - test + +# +# Verify that commit messages are as expected +# +check-commits: + extends: + - .fdo.ci-fairy + stage: test + script: + - ci-fairy check-commits --junit-xml=results.xml + except: + - master@$FDO_UPSTREAM_REPO + variables: + GIT_DEPTH: 100 + artifacts: + reports: + junit: results.xml + allow_failure: true + +# +# Verify that the merge request has the allow-collaboration checkbox ticked +# +check-merge-request: + extends: + - .fdo.ci-fairy + stage: test + script: + - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml + artifacts: + when: on_failure + reports: + junit: results.xml + allow_failure: true + + +# +# Build a container with the given tag and the packages pre-installed. +# This only happens if/when the tag changes, otherwise the existing image is +# re-used. +# +container-build: + extends: + - .fdo.container-build@debian + stage: docker-image + variables: + GIT_STRATEGY: none + + +# The default build instructions +.default_build: + extends: + - .fdo.distribution-image@debian + stage: build + script: + - ./autogen.sh + - make -j${FDO_CI_CONCURRENT:-4} check V=1 + variables: + CFLAGS: "-pipe -g -O2 -Werror" + ACLOCAL_PATH: /usr/local/xserver-$XSERVER_VERSION/share/aclocal + PKG_CONFIG_PATH: /usr/local/xserver-$XSERVER_VERSION/lib/pkgconfig + +build-distcheck: + extends: + - .default_build + script: + - ./autogen.sh + - make -j${FDO_CI_CONCURRENT:-4} check V=1 + - make install V=1 + - make -j${FDO_CI_CONCURRENT:-4} distcheck + variables: + XSERVER_VERSION: "21.1" + +# excludes version already checked in build-distcheck +build-gcc: + extends: + - .default_build + parallel: + matrix: + - XSERVER_VERSION: ["1.16", "1.17", "1.18", "1.19", "1.20"] + +build-clang: + extends: + - .default_build + parallel: + matrix: + - XSERVER_VERSION: ["1.18", "1.19", "1.20", "21.1"] + variables: + CC: clang + +build-noglamor: + extends: + - .default_build + script: + - ./autogen.sh --disable-glamor + - make -j${FDO_CI_CONCURRENT:-4} check V=1 + parallel: + matrix: + - XSERVER_VERSION: ["1.13", "1.14", "1.15"] diff --git a/.gitlab-ci/debian-install.sh b/.gitlab-ci/debian-install.sh new file mode 100644 index 00000000..f010cd0b --- /dev/null +++ b/.gitlab-ci/debian-install.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +set -e +set -o xtrace + +echo 'deb-src https://deb.debian.org/debian bookworm main' >/etc/apt/sources.list.d/deb-src.list +apt-get update + + +# Ephemeral packages (installed for this script and removed again at the end) +EPHEMERAL=" + ca-certificates + git + " + +# libXfont/xserver build dependencies +apt-get install -y --no-remove \ + autoconf \ + automake \ + build-essential \ + libtool \ + pkg-config \ + $EPHEMERAL + +echo 'APT::Get::Build-Dep-Automatic "true";' >>/etc/apt/apt.conf +apt-get build-dep -y xorg-server + +# xserver 1.18 and older branches require libXfont 1.5 instead of 2.0 +git clone https://gitlab.freedesktop.org/xorg/lib/libXfont.git +cd libXfont +git checkout libXfont-1.5-branch +./autogen.sh +make install-pkgconfigDATA +cd .. +rm -rf libXfont + + +git clone https://gitlab.freedesktop.org/xorg/xserver.git +cd xserver + +for VERSION in 1.13 1.14 1.15; do + git checkout server-${VERSION}-branch + # Workaround glvnd having reset the version in gl.pc from what Mesa used + # similar to xserver commit e6ef2b12404dfec7f23592a3524d2a63d9d25802 + sed -i -e 's/gl >= [79].[12].0/gl >= 1.2/' configure.ac + ./autogen.sh --prefix=/usr/local/xserver-$VERSION --enable-dri2 --disable-dmx + make -C include install-nodist_sdkHEADERS + make install-headers install-aclocalDATA install-pkgconfigDATA clean + git restore configure.ac +done + +for VERSION in 1.16 1.17 1.18 1.19 1.20 21.1; do + git checkout server-${VERSION}-branch + # Workaround glvnd having reset the version in gl.pc from what Mesa used + # similar to xserver commit e6ef2b12404dfec7f23592a3524d2a63d9d25802 + sed -i -e 's/gl >= [79].[12].0/gl >= 1.2/' configure.ac + ./autogen.sh --prefix=/usr/local/xserver-$VERSION --enable-dri2 --enable-dri3 --enable-glamor --disable-dmx + make -C include install-nodist_sdkHEADERS + make install-headers install-aclocalDATA install-pkgconfigDATA clean + git restore configure.ac +done + +cd .. +rm -rf xserver + + +# xf86-video-ati build dependencies +apt-get install -y --no-remove \ + clang \ + libdrm-dev \ + libgbm-dev \ + libgl1-mesa-dev \ + libpciaccess-dev \ + libpixman-1-dev \ + libudev-dev \ + libxcvt-dev \ + mesa-common-dev \ + xutils-dev \ + x11proto-dev + + +# Remove unneeded packages +apt-get purge -y $EPHEMERAL +apt-get autoremove -y --purge diff --git a/Makefile.am b/Makefile.am index 5f815325..d14ed8f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,10 +18,6 @@ # 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. -# During distcheck, system locations (as provided by pkg-config) may -# not be writable; provide instead relative locations. -DISTCHECK_CONFIGURE_FLAGS = --with-xorg-module-dir='$${libdir}/xorg/modules' - SUBDIRS = src man conf MAINTAINERCLEANFILES = ChangeLog INSTALL diff --git a/README.md b/README.md index 4b95a1df..6897feab 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,14 @@ xf86-video-ati - Xorg driver for ATI/AMD Radeon GPUs using the radeon kernel dri Questions regarding this software should be directed at the [amd-gfx mailing list](https://lists.freedesktop.org/mailman/listinfo/amd-gfx). -[main development code repository](https://github.com/X11Libre/xf86-video-ati) +The +[main development code repository](https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati) +can be found at FreeDesktop Gitlab. Please submit bug reports there and use merge requests for patch submission. + +See the X.org wiki for +[further patch submission instructions](https://www.x.org/wiki/Development/Documentation/SubmittingPatches) +and +[more information on the git code manager](https://wiki.x.org/wiki/GitPage). + diff --git a/conf/Makefile.am b/conf/Makefile.am index 966b1686..fba75dac 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -19,4 +19,6 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +if HAS_XORG_CONF_DIR dist_config_DATA = 10-radeon.conf +endif diff --git a/configure.ac b/configure.ac index 163b7860..57af58b2 100644 --- a/configure.ac +++ b/configure.ac @@ -22,13 +22,12 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xlibre-xf86-video-ati], - [25.0.1], - [https://github.com/X11Libre/xf86-video-ati/issues], - [xlibre-xf86-video-ati]) +AC_INIT([xf86-video-ati], + [22.0.0], + [https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/issues], + [xf86-video-ati]) AC_CONFIG_SRCDIR([Makefile.am]) -AC_USE_SYSTEM_EXTENSIONS AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) @@ -36,6 +35,7 @@ AC_CONFIG_AUX_DIR(.) # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-xz]) +AC_SYS_LARGEFILE # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], @@ -45,7 +45,7 @@ XORG_DEFAULT_OPTIONS # Initialize libtool AC_DISABLE_STATIC -LT_INIT +AC_PROG_LIBTOOL # Checks for programs. AM_PROG_CC_C_O @@ -57,12 +57,11 @@ fi AH_TOP([#include "xorg-server.h"]) # Define a configure option for an alternate module directory -PKG_PROG_PKG_CONFIG([0.25]) AC_ARG_WITH(xorg-module-dir, AS_HELP_STRING([--with-xorg-module-dir=DIR], - [Default xorg module directory]), + [Default xorg module directory [[default=$libdir/xorg/modules]]]), [moduledir="$withval"], - [moduledir=`$PKG_CONFIG --variable=moduledir xorg-server`]) + [moduledir="$libdir/xorg/modules"]) # Store the list of server defined optional extensions in REQUIRED_MODULES XORG_DRIVER_CHECK_EXT(RANDR, randrproto) @@ -75,8 +74,17 @@ PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.89]) PKG_CHECK_MODULES(LIBDRM_RADEON, [libdrm_radeon]) # Obtain compiler/linker options for the driver dependencies -PKG_CHECK_MODULES(XORG, [xorg-server >= 25.0.0 xproto fontsproto xf86driproto $REQUIRED_MODULES]) -PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1]) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.13 xproto fontsproto xf86driproto $REQUIRED_MODULES]) +PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1], + HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]), + HAVE_XEXTPROTO_71="no") +AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ]) + +# Section "OutputClass" is only supported as of xserver 1.16 +PKG_CHECK_EXISTS([xorg-server >= 1.16], + [sysconfigdir=`$PKG_CONFIG --variable=sysconfigdir xorg-server`], + [sysconfigdir=""]) +AM_CONDITIONAL(HAS_XORG_CONF_DIR, [test "x$sysconfigdir" != "x"]) # Define a configure option for an alternate X Server configuration directory AC_ARG_WITH(xorg-conf-dir, @@ -125,6 +133,12 @@ if test "x$GLAMOR" != "xno"; then [#include "xorg-server.h" #include "glamor.h"]) + AC_CHECK_DECL(glamor_egl_destroy_textured_pixmap, + [AC_DEFINE(HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP, 1, + [Have glamor_egl_destroy_textured_pixmap API])], [], + [#include "xorg-server.h" + #include "glamor.h"]) + AC_CHECK_DECL(glamor_finish, [AC_DEFINE(HAVE_GLAMOR_FINISH, 1, [Have glamor_finish API])], @@ -146,12 +160,44 @@ else fi AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno) +AC_CHECK_DECL(RegionDuplicate, + [AC_DEFINE(HAVE_REGIONDUPLICATE, 1, + [Have RegionDuplicate API])], [], + [#include + #include ]) + +AC_CHECK_DECL(fbGlyphs, + [AC_DEFINE(HAVE_FBGLYPHS, 1, [Have fbGlyphs API])], [], + [#include + #include + #include + #include + #include + #include + #include ]) + AC_CHECK_DECL(xf86CursorResetCursor, [AC_DEFINE(HAVE_XF86_CURSOR_RESET_CURSOR, 1, [Have xf86CursorResetCursor API])], [], [#include #include ]) +AC_CHECK_HEADERS([misyncshm.h], [], [], + [#include + #include + #include + #include ]) + +AC_CHECK_HEADERS([present.h], [], [], + [#include + #include + #include "xorg-server.h" + #include ]) + +AC_CHECK_HEADERS([dri3.h], [], [], + [#include + #include ]) + CPPFLAGS="$SAVE_CPPFLAGS" PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) @@ -159,9 +205,9 @@ XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" # Checks for headers/macros for byte swapping # Known variants: -# bswap_16, bswap_32 (glibc) +# bswap_16, bswap_32, bswap_64 (glibc) # __swap16, __swap32, __swap64 (OpenBSD) -# bswap16, bswap32 (other BSD's) +# bswap16, bswap32, bswap64 (other BSD's) # and a fallback to local macros if none of the above are found # if is found, assume it's the correct version @@ -212,12 +258,34 @@ b = bswap16(a); [Define to 16-bit byteswap macro]) AC_DEFINE_UNQUOTED([radeon_bswap_32], ${BSWAP}32, [Define to 32-bit byteswap macro]) + AC_DEFINE_UNQUOTED([radeon_bswap_64], ${BSWAP}64, + [Define to 64-bit byteswap macro]) fi fi AC_SUBST([moduledir]) -AC_CONFIG_FILES([Makefile src/Makefile man/Makefile conf/Makefile]) +DRIVER_NAME=ati +AC_SUBST([DRIVER_NAME]) + +AC_MSG_NOTICE( +[The atimisc sub-driver has been split out to xf86-video-mach64:] +[ https://gitlab.freedesktop.org/xorg/driver/xf86-video-mach64] +[Please install that driver as well for mach64-based cards.] +) + +AC_MSG_NOTICE( +[The r128 sub-driver has been split out to xf86-video-r128:] +[ https://gitlab.freedesktop.org/xorg/driver/xf86-video-r128] +[Please install that driver as well for rage128-based cards.] +) + +AC_CONFIG_FILES([ + Makefile + src/Makefile + man/Makefile + conf/Makefile +]) AC_OUTPUT dnl diff --git a/man/Makefile.am b/man/Makefile.am index 3a00d7a9..b73073e1 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -23,11 +23,11 @@ drivermandir = $(DRIVER_MAN_DIR) -driverman_PRE = ati.man radeon.man +driverman_PRE = @DRIVER_NAME@.man radeon.man driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@) -EXTRA_DIST = ati.man radeon.man +EXTRA_DIST = @DRIVER_NAME@.man radeon.man CLEANFILES = $(driverman_DATA) diff --git a/man/ati.man b/man/ati.man index 8ac5f4ea..52d79e65 100644 --- a/man/ati.man +++ b/man/ati.man @@ -2,7 +2,7 @@ .ds q \N'34' .TH ATI __drivermansuffix__ 2010-12-02 __vendorversion__ .SH NAME -ati \- ATI video wrapper driver for XLibre +ati \- ATI video wrapper driver for Xorg .SH SYNOPSIS .nf .B "Section \*qDevice\*q" @@ -13,7 +13,7 @@ ati \- ATI video wrapper driver for XLibre .fi .SH DESCRIPTION .B ati -is an XLibre wrapper driver for ATI video cards. +is an Xorg wrapper driver for ATI video cards. It autodetects whether your hardware has a Radeon, Rage 128, or Mach64 or earlier class of chipset, and loads the .BR radeon (__drivermansuffix__), @@ -33,7 +33,7 @@ Please refer to for general configuration details, and the specific card driver for driver configuration details. .SH "SEE ALSO" -.BR XLibre (__appmansuffix__), +.BR Xorg (__appmansuffix__), .BR xorg.conf (__filemansuffix__), .BR Xserver (__appmansuffix__), .BR X (__miscmansuffix__), diff --git a/man/radeon.man b/man/radeon.man index 941925c4..e370c1d5 100644 --- a/man/radeon.man +++ b/man/radeon.man @@ -1,7 +1,7 @@ .ds q \N'34' .TH RADEON __drivermansuffix__ 2024-09-29 __vendorversion__ .SH NAME -radeon \- ATI/AMD RADEON video driver for XLibre +radeon \- ATI/AMD RADEON video driver for Xorg .SH SYNOPSIS .nf .B "Section \*qDevice\*q" @@ -12,7 +12,7 @@ radeon \- ATI/AMD RADEON video driver for XLibre .fi .SH DESCRIPTION .B radeon -is an XLibre driver for ATI/AMD RADEON-based video cards with the +is an Xorg driver for ATI/AMD RADEON-based video cards with the following features: .PP .PD 0 @@ -400,7 +400,7 @@ contrast, and brightness, and must be disabled to use those attributes. The default is .B 'off'(0). .SH SEE ALSO -.BR XLibre (__appmansuffix__), +.BR Xorg (__appmansuffix__), .BR xorg.conf (__filemansuffix__), .BR Xserver (__appmansuffix__), .BR X (__miscmansuffix__) @@ -412,7 +412,7 @@ https://www.x.org/wiki/radeon .IP " 2." 4 Overview about radeon development code: .RS 4 -https://github.com/X11Libre/xf86-video-ati +https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati .RE .IP " 3." 4 Mailing list: @@ -427,7 +427,12 @@ IRC channel: .IP " 5." 4 Query the bugtracker for radeon bugs: .RS 4 -https://github.com/X11Libre/xf86-video-ati/issues +https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/issues +.RE +.IP " 6." 4 +Submit bugs & patches: +.RS 4 +https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/ .RE .SH AUTHORS .nf diff --git a/src/Makefile.am b/src/Makefile.am index 723c299c..df4a95e4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -84,6 +84,7 @@ EXTRA_DIST = \ cayman_reg.h \ cayman_reg_auto.h \ cayman_shader.h \ + compat-api.h \ ati.h \ ativersion.h \ bicubic_table.h \ diff --git a/src/ati.c b/src/ati.c index 6e384fd2..837b0094 100644 --- a/src/ati.c +++ b/src/ati.c @@ -52,7 +52,10 @@ * The driver is intended to support all ATI adapters since their VGA Wonder * V3, including OEM counterparts. */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include @@ -137,7 +140,7 @@ ati_device_get_indexed(int index) #endif void -ati_gdev_subdriver(void *options) +ati_gdev_subdriver(pointer options) { int nATIGDev, nMach64GDev, nR128GDev, nRadeonGDev, nAmdgpuGDev; GDevPtr *ATIGDevs; @@ -200,14 +203,11 @@ ati_gdev_subdriver(void *options) } if (chip_family == ATI_CHIP_FAMILY_Radeon) { - char *busid = NULL; + char *busid; - if (asprintf(&busid, "pci:%04x:%02x:%02x.%d", + XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d", device->domain, device->bus, device->dev, - device->func) == -1) { - ErrorF("ati: malloc() failed\n"); - continue; - } + device->func); if (busid) { int fd = drmOpen(NULL, busid); diff --git a/src/ati.h b/src/ati.h index f3e0daa0..b7120d9f 100644 --- a/src/ati.h +++ b/src/ati.h @@ -31,6 +31,6 @@ #include "xf86_OSproc.h" -extern void ati_gdev_subdriver(void *options); +extern void ati_gdev_subdriver(pointer options); #endif /* ___ATI_H___ */ diff --git a/src/atimodule.c b/src/atimodule.c index 1671d867..f0eb147a 100644 --- a/src/atimodule.c +++ b/src/atimodule.c @@ -19,7 +19,10 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "ati.h" #include "ativersion.h" @@ -45,11 +48,11 @@ static XF86ModuleVersionInfo ATIVersionRec = * * This function is called every time the module is loaded. */ -static void* +static pointer ATISetup ( - void *Module, - void *Options, + pointer Module, + pointer Options, int *ErrorMajor, int *ErrorMinor ) @@ -62,7 +65,7 @@ ATISetup ati_gdev_subdriver(Options); } - return (void*)1; + return (pointer)1; } /* The following record must be called atiModuleData */ diff --git a/src/cayman_accel.c b/src/cayman_accel.c index 1ad39446..a754610a 100644 --- a/src/cayman_accel.c +++ b/src/cayman_accel.c @@ -23,7 +23,9 @@ * Authors: Alex Deucher * */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/cayman_shader.c b/src/cayman_shader.c index 184d52cb..59f41776 100644 --- a/src/cayman_shader.c +++ b/src/cayman_shader.c @@ -23,7 +23,10 @@ * Author: Alex Deucher * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/compat-api.h b/src/compat-api.h new file mode 100644 index 00000000..def6d3e4 --- /dev/null +++ b/src/compat-api.h @@ -0,0 +1,43 @@ +/* + * Copyright 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Dave Airlie + */ + +#ifndef COMPAT_API_H +#define COMPAT_API_H + +#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0) +#define BLOCKHANDLER_ARGS_DECL ScreenPtr pScreen, pointer pTimeout +#define BLOCKHANDLER_ARGS pScreen, pTimeout +#else +#define BLOCKHANDLER_ARGS_DECL ScreenPtr pScreen, pointer pTimeout, pointer pReadmask +#define BLOCKHANDLER_ARGS pScreen, pTimeout, pReadmask +#endif + +#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2) +#define current_primary current_master +#define primary_pixmap master_pixmap +#define secondary_dst slave_dst +#endif + +#endif diff --git a/src/drmmode_display.c b/src/drmmode_display.c index bb1137a9..83b16d5a 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -24,7 +24,10 @@ * Dave Airlie * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include @@ -41,13 +44,27 @@ #include "radeon_bo_helper.h" #include "radeon_glamor.h" #include "radeon_reg.h" + +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,19,99,1,0) +#include +#endif + #include "drmmode_display.h" /* DPMS */ +#ifdef HAVE_XEXTPROTO_71 #include +#else +#define DPMS_SERVER +#include +#endif #define DEFAULT_NOMINAL_FRAME_RATE 60 +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 22 +#define HAVE_NOTIFY_FD 1 +#endif + static Bool drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height); @@ -124,13 +141,15 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn, return pixmap; fail: - dixDestroyPixmap(pixmap, 0); + pScreen->DestroyPixmap(pixmap); return NULL; } static void drmmode_destroy_bo_pixmap(PixmapPtr pixmap) { - dixDestroyPixmap(pixmap, 0); + ScreenPtr pScreen = pixmap->drawable.pScreen; + + (*pScreen->DestroyPixmap)(pixmap); } static void @@ -417,11 +436,13 @@ destroy_pixmap_for_fbcon(ScrnInfoPtr pScrn) * avoid issues due to a GEM handle lifetime conflict between us and * Mesa */ - if (info->use_glamor) + if (info->use_glamor && + (info->ChipFamily >= CHIP_FAMILY_CAYMAN || + xorgGetVersion() >= XORG_VERSION_NUMERIC(1,19,99,1,0))) return; if (info->fbcon_pixmap) - dixDestroyPixmap(info->fbcon_pixmap, 0); + pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap); info->fbcon_pixmap = NULL; } @@ -598,6 +619,20 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc) if (crtc->transformPresent) return FALSE; +#if XF86_CRTC_VERSION < 7 + /* Xorg doesn't correctly handle cursor position transform in the + * rotation case + */ + if (crtc->driverIsPerformingTransform && + (crtc->rotation & 0xf) != RR_Rotate_0) + return FALSE; +#endif + + /* HW cursor not supported with RandR 1.4 multihead up to 1.18.99.901 */ + if (xorgGetVersion() <= XORG_VERSION_NUMERIC(1,18,99,901,0) && + !xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list)) + return FALSE; + return TRUE; } @@ -629,12 +664,22 @@ drmmode_crtc_update_tear_free(xf86CrtcPtr crtc) } } +#if XF86_CRTC_VERSION < 7 +#define XF86DriverTransformOutput TRUE +#define XF86DriverTransformNone FALSE +#endif + static Bool drmmode_handle_transform(xf86CrtcPtr crtc) { Bool ret; +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,903,0) crtc->driverIsPerformingTransform = XF86DriverTransformOutput; +#else + crtc->driverIsPerformingTransform = !crtc->transformPresent && + (crtc->rotation & 0xf) == RR_Rotate_0; +#endif ret = xf86CrtcRotate(crtc); @@ -966,12 +1011,55 @@ drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y) drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn); +#if XF86_CRTC_VERSION < 7 + if (crtc->driverIsPerformingTransform) { + x += crtc->x; + y += crtc->y; + xf86CrtcTransformCursorPos(crtc, &x, &y); + } +#endif + drmmode_crtc->cursor_x = x; drmmode_crtc->cursor_y = y; drmModeMoveCursor(pRADEONEnt->fd, drmmode_crtc->mode_crtc->crtc_id, x, y); } +#if XF86_CRTC_VERSION < 7 + +static int +drmmode_cursor_src_offset(Rotation rotation, int width, int height, + int x_dst, int y_dst) +{ + int t; + + switch (rotation & 0xf) { + case RR_Rotate_90: + t = x_dst; + x_dst = height - y_dst - 1; + y_dst = t; + break; + case RR_Rotate_180: + x_dst = width - x_dst - 1; + y_dst = height - y_dst - 1; + break; + case RR_Rotate_270: + t = x_dst; + x_dst = y_dst; + y_dst = width - t - 1; + break; + } + + if (rotation & RR_Reflect_X) + x_dst = width - x_dst - 1; + if (rotation & RR_Reflect_Y) + y_dst = height - y_dst - 1; + + return y_dst * height + x_dst; +} + +#endif + static Bool drmmode_cursor_pixel(xf86CrtcPtr crtc, uint32_t *argb, Bool *premultiplied, Bool *apply_gamma) @@ -981,6 +1069,14 @@ drmmode_cursor_pixel(xf86CrtcPtr crtc, uint32_t *argb, Bool *premultiplied, int i; if (premultiplied) { +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 18, 4, 0, 0) + if (alpha == 0 && (*argb & 0xffffff) != 0) { + /* Doesn't look like premultiplied alpha */ + *premultiplied = FALSE; + return FALSE; + } +#endif + if (!(*apply_gamma)) return TRUE; @@ -1044,6 +1140,29 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) if (crtc->scrn->depth != 24 && crtc->scrn->depth != 32) apply_gamma = FALSE; +#if XF86_CRTC_VERSION < 7 + if (crtc->driverIsPerformingTransform) { + uint32_t cursor_w = info->cursor_w, cursor_h = info->cursor_h; + int dstx, dsty; + int srcoffset; + +retry_transform: + for (dsty = 0; dsty < cursor_h; dsty++) { + for (dstx = 0; dstx < cursor_w; dstx++) { + srcoffset = drmmode_cursor_src_offset(crtc->rotation, + cursor_w, + cursor_h, + dstx, dsty); + argb = image[srcoffset]; + if (!drmmode_cursor_pixel(crtc, &argb, &premultiplied, + &apply_gamma)) + goto retry_transform; + + ptr[dsty * info->cursor_w + dstx] = cpu_to_le32(argb); + } + } + } else +#endif { uint32_t cursor_size = info->cursor_w * info->cursor_h; int i; @@ -1065,6 +1184,8 @@ retry: } } +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,903,0) + static Bool drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 * image) { if (!drmmode_can_use_hw_cursor(crtc)) @@ -1074,6 +1195,8 @@ static Bool drmmode_load_cursor_argb_check(xf86CrtcPtr crtc, CARD32 * image) return TRUE; } +#endif + static void drmmode_hide_cursor (xf86CrtcPtr crtc) { @@ -1265,9 +1388,14 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix) PixmapStartDirtyTracking(&ppix->drawable, drmmode_crtc->scanout[scanout_id].pixmap, 0, 0, 0, 0, RR_Rotate_0); -#else +#elif defined(HAS_DIRTYTRACKING_ROTATION) PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id].pixmap, 0, 0, 0, 0, RR_Rotate_0); +#elif defined(HAS_DIRTYTRACKING2) + PixmapStartDirtyTracking2(ppix, drmmode_crtc->scanout[scanout_id].pixmap, + 0, 0, 0, 0); +#else + PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[scanout_id].pixmap, 0, 0); #endif return TRUE; } @@ -1280,7 +1408,10 @@ static xf86CrtcFuncsRec drmmode_crtc_funcs = { .show_cursor = drmmode_show_cursor, .hide_cursor = drmmode_hide_cursor, .load_cursor_argb = drmmode_load_cursor_argb, +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,903,0) .load_cursor_argb_check = drmmode_load_cursor_argb_check, +#endif + .gamma_set = drmmode_crtc_gamma_set, .shadow_create = drmmode_crtc_shadow_create, .shadow_allocate = drmmode_crtc_shadow_allocate, @@ -1327,7 +1458,7 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res if (!crtc) return 0; - drmmode_crtc = XNFcallocarray(sizeof(drmmode_crtc_private_rec), 1); + drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1); drmmode_crtc->mode_crtc = drmModeGetCrtc(pRADEONEnt->fd, mode_res->crtcs[num]); drmmode_crtc->drmmode = drmmode; drmmode_crtc->dpms_mode = DPMSModeOff; @@ -1450,6 +1581,7 @@ drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes) static void drmmode_output_attach_tile(xf86OutputPtr output) { +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0) drmmode_output_private_ptr drmmode_output = output->driver_private; drmModeConnectorPtr koutput = drmmode_output->mode_output; RADEONEntPtr pRADEONEnt = RADEONEntPriv(output->scrn); @@ -1488,6 +1620,7 @@ drmmode_output_attach_tile(xf86OutputPtr output) set = &tile_info; } xf86OutputSetTile(output, set); +#endif } static int @@ -1566,7 +1699,7 @@ drmmode_output_get_modes(xf86OutputPtr output) /* modes should already be available */ for (i = 0; i < koutput->count_modes; i++) { - Mode = XNFalloc(sizeof(DisplayModeRec)); + Mode = xnfalloc(sizeof(DisplayModeRec)); drmmode_ConvertFromKMode(output->scrn, &koutput->modes[i], Mode); Modes = xf86ModesAdd(Modes, Mode); @@ -1582,7 +1715,9 @@ drmmode_output_destroy(xf86OutputPtr output) int i; drmModeFreePropertyBlob(drmmode_output->edid_blob); +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0) drmModeFreePropertyBlob(drmmode_output->tile_blob); +#endif for (i = 0; i < drmmode_output->num_props; i++) { drmModeFreeProperty(drmmode_output->props[i].mode_prop); @@ -1998,7 +2133,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r drmModeEncoderPtr *kencoders = NULL; drmmode_output_private_ptr drmmode_output; drmModePropertyBlobPtr path_blob = NULL; +#if XF86_CRTC_VERSION >= 8 Bool nonDesktop = FALSE; +#endif char name[32]; int i; const char *s; @@ -2009,10 +2146,12 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r path_blob = koutput_get_prop_blob(pRADEONEnt->fd, koutput, "PATH"); +#if XF86_CRTC_VERSION >= 8 i = koutput_get_prop_idx(pRADEONEnt->fd, koutput, DRM_MODE_PROP_RANGE, "non-desktop"); if (i >= 0) nonDesktop = koutput->prop_values[i] != 0; +#endif kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders); if (!kencoders) { @@ -2043,7 +2182,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r drmmode_output = output->driver_private; drmmode_output->output_id = mode_res->connectors[num]; drmmode_output->mode_output = koutput; +#if XF86_CRTC_VERSION >= 8 output->non_desktop = nonDesktop; +#endif for (i = 0; i < koutput->count_encoders; i++) drmModeFreeEncoder(kencoders[i]); free(kencoders); @@ -2083,7 +2224,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r output->interlaceAllowed = TRUE; output->doubleScanAllowed = TRUE; output->driver_private = drmmode_output; +#if XF86_CRTC_VERSION >= 8 output->non_desktop = nonDesktop; +#endif output->possible_crtcs = 0xffffffff; for (i = 0; i < koutput->count_encoders; i++) { @@ -2583,12 +2726,26 @@ drmmode_flip_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec, void *even } } + +#if HAVE_NOTIFY_FD static void drm_notify_fd(int fd, int ready, void *data) +#else +static void +drm_wakeup_handler(pointer data, int err, pointer p) +#endif { drmmode_ptr drmmode = data; RADEONEntPtr pRADEONEnt = RADEONEntPriv(drmmode->scrn); - radeon_drm_handle_event(pRADEONEnt->fd, &drmmode->event_context); + +#if !HAVE_NOTIFY_FD + fd_set *read_mask = p; + + if (err >= 0 && FD_ISSET(pRADEONEnt->fd, read_mask)) +#endif + { + radeon_drm_handle_event(pRADEONEnt->fd, &drmmode->event_context); + } } static Bool drmmode_probe_page_flip_target(RADEONEntPtr pRADEONEnt) @@ -2724,11 +2881,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp) drmmode_clones_init(pScrn, drmmode, mode_res); bus_id_string = DRICreatePCIBusID(info->PciInfo); - if (asprintf(&provider_name, "%s @ %s", pScrn->chipset, bus_id_string) == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "malloc() failed\n"); - return FALSE; - } - + XNFasprintf(&provider_name, "%s @ %s", pScrn->chipset, bus_id_string); free(bus_id_string); xf86ProviderSetup(pScrn, NULL, provider_name); free(provider_name); @@ -2751,8 +2904,15 @@ void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode) info->drmmode_inited = TRUE; if (pRADEONEnt->fd_wakeup_registered != serverGeneration) { +#if HAVE_NOTIFY_FD SetNotifyFd(pRADEONEnt->fd, drm_notify_fd, X_NOTIFY_READ, &info->drmmode); +#else + AddGeneralSocket(pRADEONEnt->fd); + RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, + drm_wakeup_handler, + &info->drmmode); +#endif pRADEONEnt->fd_wakeup_registered = serverGeneration; pRADEONEnt->fd_wakeup_ref = 1; } else @@ -2774,10 +2934,17 @@ void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode) if (pRADEONEnt->fd_wakeup_registered == serverGeneration && !--pRADEONEnt->fd_wakeup_ref) { +#if HAVE_NOTIFY_FD RemoveNotifyFd(pRADEONEnt->fd); +#else + RemoveGeneralSocket(pRADEONEnt->fd); + RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, + drm_wakeup_handler, pScrn); +#endif } } + Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr) { drmmode->bufmgr = bufmgr; @@ -3162,7 +3329,12 @@ restart_destroy: drmmode_validate_leases(scrn); if (changed) { +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0) RRSetChanged(xf86ScrnToScreen(scrn)); +#else + rrScrPrivPtr rrScrPriv = rrGetScrPriv(scrn->pScreen); + rrScrPriv->changed = TRUE; +#endif RRTellChanged(xf86ScrnToScreen(scrn)); } diff --git a/src/drmmode_display.h b/src/drmmode_display.h index f5dc033d..8cd8a0a6 100644 --- a/src/drmmode_display.h +++ b/src/drmmode_display.h @@ -27,8 +27,6 @@ #ifndef DRMMODE_DISPLAY_H #define DRMMODE_DISPLAY_H -#include - #include "xf86drmMode.h" #ifdef HAVE_LIBUDEV #include "libudev.h" @@ -144,7 +142,9 @@ typedef struct { drmModeConnectorPtr mode_output; drmModeEncoderPtr *mode_encoders; drmModePropertyBlobPtr edid_blob; +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0) drmModePropertyBlobPtr tile_blob; +#endif int dpms_enum_id; int num_props; drmmode_prop_ptr props; diff --git a/src/evergreen_accel.c b/src/evergreen_accel.c index 87558c2f..43146bbf 100644 --- a/src/evergreen_accel.c +++ b/src/evergreen_accel.c @@ -23,7 +23,9 @@ * Authors: Alex Deucher * */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c index 48bb3b45..ec7fe77e 100644 --- a/src/evergreen_exa.c +++ b/src/evergreen_exa.c @@ -23,7 +23,10 @@ * Author: Alex Deucher * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" @@ -665,20 +668,20 @@ struct formatinfo { }; static struct formatinfo EVERGREENTexFormats[] = { - {PIXMAN_a2r10g10b10, FMT_2_10_10_10}, - {PIXMAN_x2r10g10b10, FMT_2_10_10_10}, - {PIXMAN_a2b10g10r10, FMT_2_10_10_10}, - {PIXMAN_x2b10g10r10, FMT_2_10_10_10}, - {PIXMAN_a8r8g8b8, FMT_8_8_8_8}, - {PIXMAN_x8r8g8b8, FMT_8_8_8_8}, - {PIXMAN_a8b8g8r8, FMT_8_8_8_8}, - {PIXMAN_x8b8g8r8, FMT_8_8_8_8}, - {PIXMAN_b8g8r8a8, FMT_8_8_8_8}, - {PIXMAN_b8g8r8x8, FMT_8_8_8_8}, - {PIXMAN_r5g6b5, FMT_5_6_5}, - {PIXMAN_a1r5g5b5, FMT_1_5_5_5}, - {PIXMAN_x1r5g5b5, FMT_1_5_5_5}, - {PIXMAN_a8, FMT_8}, + {PICT_a2r10g10b10, FMT_2_10_10_10}, + {PICT_x2r10g10b10, FMT_2_10_10_10}, + {PICT_a2b10g10r10, FMT_2_10_10_10}, + {PICT_x2b10g10r10, FMT_2_10_10_10}, + {PICT_a8r8g8b8, FMT_8_8_8_8}, + {PICT_x8r8g8b8, FMT_8_8_8_8}, + {PICT_a8b8g8r8, FMT_8_8_8_8}, + {PICT_x8b8g8r8, FMT_8_8_8_8}, + {PICT_b8g8r8a8, FMT_8_8_8_8}, + {PICT_b8g8r8x8, FMT_8_8_8_8}, + {PICT_r5g6b5, FMT_5_6_5}, + {PICT_a1r5g5b5, FMT_1_5_5_5}, + {PICT_x1r5g5b5, FMT_1_5_5_5}, + {PICT_a8, FMT_8}, }; static uint32_t EVERGREENGetBlendCntl(int op, PicturePtr pMask, uint32_t dst_format) @@ -691,7 +694,7 @@ static uint32_t EVERGREENGetBlendCntl(int op, PicturePtr pMask, uint32_t dst_for /* If there's no dst alpha channel, adjust the blend op so that we'll treat * it as always 1. */ - if (PIXMAN_FORMAT_A(dst_format) == 0 && EVERGREENBlendOp[op].dst_alpha) { + if (PICT_FORMAT_A(dst_format) == 0 && EVERGREENBlendOp[op].dst_alpha) { if (sblend == (BLEND_DST_ALPHA << COLOR_SRCBLEND_shift)) sblend = (BLEND_ONE << COLOR_SRCBLEND_shift); else if (sblend == (BLEND_ONE_MINUS_DST_ALPHA << COLOR_SRCBLEND_shift)) @@ -724,28 +727,28 @@ static uint32_t EVERGREENGetBlendCntl(int op, PicturePtr pMask, uint32_t dst_for static Bool EVERGREENGetDestFormat(PicturePtr pDstPicture, uint32_t *dst_format) { switch (pDstPicture->format) { - case PIXMAN_a2r10g10b10: - case PIXMAN_x2r10g10b10: - case PIXMAN_a2b10g10r10: - case PIXMAN_x2b10g10r10: + case PICT_a2r10g10b10: + case PICT_x2r10g10b10: + case PICT_a2b10g10r10: + case PICT_x2b10g10r10: *dst_format = COLOR_2_10_10_10; break; - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: - case PIXMAN_b8g8r8a8: - case PIXMAN_b8g8r8x8: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: *dst_format = COLOR_8_8_8_8; break; - case PIXMAN_r5g6b5: + case PICT_r5g6b5: *dst_format = COLOR_5_6_5; break; - case PIXMAN_a1r5g5b5: - case PIXMAN_x1r5g5b5: + case PICT_a1r5g5b5: + case PICT_x1r5g5b5: *dst_format = COLOR_1_5_5_5; break; - case PIXMAN_a8: + case PICT_a8: *dst_format = COLOR_8; break; default: @@ -784,8 +787,8 @@ static Bool EVERGREENCheckCompositeTexture(PicturePtr pPict, * clipping. */ /* FIXME evergreen */ - if (pPict->transform != 0 && repeatType == RepeatNone && PIXMAN_FORMAT_A(pPict->format) == 0) { - if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PIXMAN_FORMAT_A(pDstPict->format) == 0))) + if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) { + if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); } @@ -898,50 +901,50 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix, /* component swizzles */ switch (pPict->format) { - case PIXMAN_a2r10g10b10: - case PIXMAN_a1r5g5b5: - case PIXMAN_a8r8g8b8: + case PICT_a2r10g10b10: + case PICT_a1r5g5b5: + case PICT_a8r8g8b8: pix_r = SQ_SEL_Z; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_X; /* B */ pix_a = SQ_SEL_W; /* A */ break; - case PIXMAN_a2b10g10r10: - case PIXMAN_a8b8g8r8: + case PICT_a2b10g10r10: + case PICT_a8b8g8r8: pix_r = SQ_SEL_X; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_Z; /* B */ pix_a = SQ_SEL_W; /* A */ break; - case PIXMAN_x2b10g10r10: - case PIXMAN_x8b8g8r8: + case PICT_x2b10g10r10: + case PICT_x8b8g8r8: pix_r = SQ_SEL_X; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_Z; /* B */ pix_a = SQ_SEL_1; /* A */ break; - case PIXMAN_b8g8r8a8: + case PICT_b8g8r8a8: pix_r = SQ_SEL_Y; /* R */ pix_g = SQ_SEL_Z; /* G */ pix_b = SQ_SEL_W; /* B */ pix_a = SQ_SEL_X; /* A */ break; - case PIXMAN_b8g8r8x8: + case PICT_b8g8r8x8: pix_r = SQ_SEL_Y; /* R */ pix_g = SQ_SEL_Z; /* G */ pix_b = SQ_SEL_W; /* B */ pix_a = SQ_SEL_1; /* A */ break; - case PIXMAN_x2r10g10b10: - case PIXMAN_x1r5g5b5: - case PIXMAN_x8r8g8b8: - case PIXMAN_r5g6b5: + case PICT_x2r10g10b10: + case PICT_x1r5g5b5: + case PICT_x8r8g8b8: + case PICT_r5g6b5: pix_r = SQ_SEL_Z; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_X; /* B */ pix_a = SQ_SEL_1; /* A */ break; - case PIXMAN_a8: + case PICT_a8: pix_r = SQ_SEL_0; /* R */ pix_g = SQ_SEL_0; /* G */ pix_b = SQ_SEL_0; /* B */ @@ -953,18 +956,18 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix, if (unit == 0) { if (!accel_state->msk_pic) { - if (PIXMAN_FORMAT_RGB(pPict->format) == 0) { + if (PICT_FORMAT_RGB(pPict->format) == 0) { pix_r = SQ_SEL_0; pix_g = SQ_SEL_0; pix_b = SQ_SEL_0; } - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } else { if (accel_state->component_alpha) { if (accel_state->src_alpha) { - if (PIXMAN_FORMAT_A(pPict->format) == 0) { + if (PICT_FORMAT_A(pPict->format) == 0) { pix_r = SQ_SEL_1; pix_g = SQ_SEL_1; pix_b = SQ_SEL_1; @@ -975,26 +978,26 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix, pix_b = pix_a; } } else { - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } } else { - if (PIXMAN_FORMAT_RGB(pPict->format) == 0) { + if (PICT_FORMAT_RGB(pPict->format) == 0) { pix_r = SQ_SEL_0; pix_g = SQ_SEL_0; pix_b = SQ_SEL_0; } - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } } } else { if (accel_state->component_alpha) { - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } else { - if (PIXMAN_FORMAT_A(pPict->format) == 0) { + if (PICT_FORMAT_A(pPict->format) == 0) { pix_r = SQ_SEL_1; pix_g = SQ_SEL_1; pix_b = SQ_SEL_1; @@ -1162,46 +1165,46 @@ static void EVERGREENSetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, u /* component swizzles */ switch (format) { - case PIXMAN_a1r5g5b5: - case PIXMAN_a8r8g8b8: + case PICT_a1r5g5b5: + case PICT_a8r8g8b8: pix_r = zf; /* R */ pix_g = yf; /* G */ pix_b = xf; /* B */ pix_a = wf; /* A */ break; - case PIXMAN_a8b8g8r8: + case PICT_a8b8g8r8: pix_r = xf; /* R */ pix_g = yf; /* G */ pix_b = zf; /* B */ pix_a = wf; /* A */ break; - case PIXMAN_x8b8g8r8: + case PICT_x8b8g8r8: pix_r = xf; /* R */ pix_g = yf; /* G */ pix_b = zf; /* B */ pix_a = 1.0; /* A */ break; - case PIXMAN_b8g8r8a8: + case PICT_b8g8r8a8: pix_r = yf; /* R */ pix_g = zf; /* G */ pix_b = wf; /* B */ pix_a = xf; /* A */ break; - case PIXMAN_b8g8r8x8: + case PICT_b8g8r8x8: pix_r = yf; /* R */ pix_g = zf; /* G */ pix_b = wf; /* B */ pix_a = 1.0; /* A */ break; - case PIXMAN_x1r5g5b5: - case PIXMAN_x8r8g8b8: - case PIXMAN_r5g6b5: + case PICT_x1r5g5b5: + case PICT_x8r8g8b8: + case PICT_r5g6b5: pix_r = zf; /* R */ pix_g = yf; /* G */ pix_b = xf; /* B */ pix_a = 1.0; /* A */ break; - case PIXMAN_a8: + case PICT_a8: pix_r = 0.0; /* R */ pix_g = 0.0; /* G */ pix_b = 0.0; /* B */ @@ -1213,13 +1216,13 @@ static void EVERGREENSetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, u if (unit == 0) { if (!accel_state->msk_pic) { - if (PIXMAN_FORMAT_RGB(format) == 0) { + if (PICT_FORMAT_RGB(format) == 0) { pix_r = 0.0; pix_g = 0.0; pix_b = 0.0; } - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } else { if (accel_state->component_alpha) { @@ -1229,7 +1232,7 @@ static void EVERGREENSetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, u pix_b / pix_a, pix_a / pix_a }; evergreen_set_blend_color(pScrn, cblend); - if (PIXMAN_FORMAT_A(format) == 0) { + if (PICT_FORMAT_A(format) == 0) { pix_r = 1.0; pix_g = 1.0; pix_b = 1.0; @@ -1240,26 +1243,26 @@ static void EVERGREENSetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, u pix_b = pix_a; } } else { - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } } else { - if (PIXMAN_FORMAT_RGB(format) == 0) { + if (PICT_FORMAT_RGB(format) == 0) { pix_r = 0; pix_g = 0; pix_b = 0; } - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } } } else { if (accel_state->component_alpha) { - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } else { - if (PIXMAN_FORMAT_A(format) == 0) { + if (PICT_FORMAT_A(format) == 0) { pix_r = 1.0; pix_g = 1.0; pix_b = 1.0; @@ -1436,29 +1439,29 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture, cb_conf.surface = accel_state->dst_obj.surface; switch (pDstPicture->format) { - case PIXMAN_a2r10g10b10: - case PIXMAN_x2r10g10b10: - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a1r5g5b5: - case PIXMAN_x1r5g5b5: + case PICT_a2r10g10b10: + case PICT_x2r10g10b10: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a1r5g5b5: + case PICT_x1r5g5b5: default: cb_conf.comp_swap = 1; /* ARGB */ break; - case PIXMAN_a2b10g10r10: - case PIXMAN_x2b10g10r10: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: + case PICT_a2b10g10r10: + case PICT_x2b10g10r10: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: cb_conf.comp_swap = 0; /* ABGR */ break; - case PIXMAN_b8g8r8a8: - case PIXMAN_b8g8r8x8: + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: cb_conf.comp_swap = 3; /* BGRA */ break; - case PIXMAN_r5g6b5: + case PICT_r5g6b5: cb_conf.comp_swap = 2; /* RGB */ break; - case PIXMAN_a8: + case PICT_a8: cb_conf.comp_swap = 3; /* A */ break; } diff --git a/src/evergreen_shader.c b/src/evergreen_shader.c index ebf9bb2e..4852578e 100644 --- a/src/evergreen_shader.c +++ b/src/evergreen_shader.c @@ -23,7 +23,10 @@ * Author: Alex Deucher * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/evergreen_textured_videofuncs.c b/src/evergreen_textured_videofuncs.c index 784d8811..53675600 100644 --- a/src/evergreen_textured_videofuncs.c +++ b/src/evergreen_textured_videofuncs.c @@ -23,7 +23,10 @@ * Author: Alex Deucher * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/r600_exa.c b/src/r600_exa.c index 28be7559..45c193f0 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -23,7 +23,10 @@ * Author: Alex Deucher * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" @@ -724,20 +727,20 @@ struct formatinfo { }; static struct formatinfo R600TexFormats[] = { - {PIXMAN_a2r10g10b10, FMT_2_10_10_10}, - {PIXMAN_x2r10g10b10, FMT_2_10_10_10}, - {PIXMAN_a2b10g10r10, FMT_2_10_10_10}, - {PIXMAN_x2b10g10r10, FMT_2_10_10_10}, - {PIXMAN_a8r8g8b8, FMT_8_8_8_8}, - {PIXMAN_x8r8g8b8, FMT_8_8_8_8}, - {PIXMAN_a8b8g8r8, FMT_8_8_8_8}, - {PIXMAN_x8b8g8r8, FMT_8_8_8_8}, - {PIXMAN_b8g8r8a8, FMT_8_8_8_8}, - {PIXMAN_b8g8r8x8, FMT_8_8_8_8}, - {PIXMAN_r5g6b5, FMT_5_6_5}, - {PIXMAN_a1r5g5b5, FMT_1_5_5_5}, - {PIXMAN_x1r5g5b5, FMT_1_5_5_5}, - {PIXMAN_a8, FMT_8}, + {PICT_a2r10g10b10, FMT_2_10_10_10}, + {PICT_x2r10g10b10, FMT_2_10_10_10}, + {PICT_a2b10g10r10, FMT_2_10_10_10}, + {PICT_x2b10g10r10, FMT_2_10_10_10}, + {PICT_a8r8g8b8, FMT_8_8_8_8}, + {PICT_x8r8g8b8, FMT_8_8_8_8}, + {PICT_a8b8g8r8, FMT_8_8_8_8}, + {PICT_x8b8g8r8, FMT_8_8_8_8}, + {PICT_b8g8r8a8, FMT_8_8_8_8}, + {PICT_b8g8r8x8, FMT_8_8_8_8}, + {PICT_r5g6b5, FMT_5_6_5}, + {PICT_a1r5g5b5, FMT_1_5_5_5}, + {PICT_x1r5g5b5, FMT_1_5_5_5}, + {PICT_a8, FMT_8}, }; static uint32_t R600GetBlendCntl(int op, PicturePtr pMask, uint32_t dst_format) @@ -750,7 +753,7 @@ static uint32_t R600GetBlendCntl(int op, PicturePtr pMask, uint32_t dst_format) /* If there's no dst alpha channel, adjust the blend op so that we'll treat * it as always 1. */ - if (PIXMAN_FORMAT_A(dst_format) == 0 && R600BlendOp[op].dst_alpha) { + if (PICT_FORMAT_A(dst_format) == 0 && R600BlendOp[op].dst_alpha) { if (sblend == (BLEND_DST_ALPHA << COLOR_SRCBLEND_shift)) sblend = (BLEND_ONE << COLOR_SRCBLEND_shift); else if (sblend == (BLEND_ONE_MINUS_DST_ALPHA << COLOR_SRCBLEND_shift)) @@ -783,28 +786,28 @@ static uint32_t R600GetBlendCntl(int op, PicturePtr pMask, uint32_t dst_format) static Bool R600GetDestFormat(PicturePtr pDstPicture, uint32_t *dst_format) { switch (pDstPicture->format) { - case PIXMAN_a2r10g10b10: - case PIXMAN_x2r10g10b10: - case PIXMAN_a2b10g10r10: - case PIXMAN_x2b10g10r10: + case PICT_a2r10g10b10: + case PICT_x2r10g10b10: + case PICT_a2b10g10r10: + case PICT_x2b10g10r10: *dst_format = COLOR_2_10_10_10; break; - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: - case PIXMAN_b8g8r8a8: - case PIXMAN_b8g8r8x8: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: *dst_format = COLOR_8_8_8_8; break; - case PIXMAN_r5g6b5: + case PICT_r5g6b5: *dst_format = COLOR_5_6_5; break; - case PIXMAN_a1r5g5b5: - case PIXMAN_x1r5g5b5: + case PICT_a1r5g5b5: + case PICT_x1r5g5b5: *dst_format = COLOR_1_5_5_5; break; - case PIXMAN_a8: + case PICT_a8: *dst_format = COLOR_8; break; default: @@ -843,8 +846,8 @@ static Bool R600CheckCompositeTexture(PicturePtr pPict, * clipping. */ /* FIXME R6xx */ - if (pPict->transform != 0 && repeatType == RepeatNone && PIXMAN_FORMAT_A(pPict->format) == 0) { - if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PIXMAN_FORMAT_A(pDstPict->format) == 0))) + if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) { + if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); } @@ -913,50 +916,50 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, /* component swizzles */ switch (pPict->format) { - case PIXMAN_a2r10g10b10: - case PIXMAN_a1r5g5b5: - case PIXMAN_a8r8g8b8: + case PICT_a2r10g10b10: + case PICT_a1r5g5b5: + case PICT_a8r8g8b8: pix_r = SQ_SEL_Z; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_X; /* B */ pix_a = SQ_SEL_W; /* A */ break; - case PIXMAN_a2b10g10r10: - case PIXMAN_a8b8g8r8: + case PICT_a2b10g10r10: + case PICT_a8b8g8r8: pix_r = SQ_SEL_X; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_Z; /* B */ pix_a = SQ_SEL_W; /* A */ break; - case PIXMAN_x2b10g10r10: - case PIXMAN_x8b8g8r8: + case PICT_x2b10g10r10: + case PICT_x8b8g8r8: pix_r = SQ_SEL_X; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_Z; /* B */ pix_a = SQ_SEL_1; /* A */ break; - case PIXMAN_b8g8r8a8: + case PICT_b8g8r8a8: pix_r = SQ_SEL_Y; /* R */ pix_g = SQ_SEL_Z; /* G */ pix_b = SQ_SEL_W; /* B */ pix_a = SQ_SEL_X; /* A */ break; - case PIXMAN_b8g8r8x8: + case PICT_b8g8r8x8: pix_r = SQ_SEL_Y; /* R */ pix_g = SQ_SEL_Z; /* G */ pix_b = SQ_SEL_W; /* B */ pix_a = SQ_SEL_1; /* A */ break; - case PIXMAN_x2r10g10b10: - case PIXMAN_x1r5g5b5: - case PIXMAN_x8r8g8b8: - case PIXMAN_r5g6b5: + case PICT_x2r10g10b10: + case PICT_x1r5g5b5: + case PICT_x8r8g8b8: + case PICT_r5g6b5: pix_r = SQ_SEL_Z; /* R */ pix_g = SQ_SEL_Y; /* G */ pix_b = SQ_SEL_X; /* B */ pix_a = SQ_SEL_1; /* A */ break; - case PIXMAN_a8: + case PICT_a8: pix_r = SQ_SEL_0; /* R */ pix_g = SQ_SEL_0; /* G */ pix_b = SQ_SEL_0; /* B */ @@ -968,18 +971,18 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, if (unit == 0) { if (!accel_state->msk_pic) { - if (PIXMAN_FORMAT_RGB(pPict->format) == 0) { + if (PICT_FORMAT_RGB(pPict->format) == 0) { pix_r = SQ_SEL_0; pix_g = SQ_SEL_0; pix_b = SQ_SEL_0; } - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } else { if (accel_state->component_alpha) { if (accel_state->src_alpha) { - if (PIXMAN_FORMAT_A(pPict->format) == 0) { + if (PICT_FORMAT_A(pPict->format) == 0) { pix_r = SQ_SEL_1; pix_g = SQ_SEL_1; pix_b = SQ_SEL_1; @@ -990,26 +993,26 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, pix_b = pix_a; } } else { - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } } else { - if (PIXMAN_FORMAT_RGB(pPict->format) == 0) { + if (PICT_FORMAT_RGB(pPict->format) == 0) { pix_r = SQ_SEL_0; pix_g = SQ_SEL_0; pix_b = SQ_SEL_0; } - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } } } else { if (accel_state->component_alpha) { - if (PIXMAN_FORMAT_A(pPict->format) == 0) + if (PICT_FORMAT_A(pPict->format) == 0) pix_a = SQ_SEL_1; } else { - if (PIXMAN_FORMAT_A(pPict->format) == 0) { + if (PICT_FORMAT_A(pPict->format) == 0) { pix_r = SQ_SEL_1; pix_g = SQ_SEL_1; pix_b = SQ_SEL_1; @@ -1206,46 +1209,46 @@ static void R600SetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, uint32 /* component swizzles */ switch (format) { - case PIXMAN_a1r5g5b5: - case PIXMAN_a8r8g8b8: + case PICT_a1r5g5b5: + case PICT_a8r8g8b8: pix_r = zf; /* R */ pix_g = yf; /* G */ pix_b = xf; /* B */ pix_a = wf; /* A */ break; - case PIXMAN_a8b8g8r8: + case PICT_a8b8g8r8: pix_r = xf; /* R */ pix_g = yf; /* G */ pix_b = zf; /* B */ pix_a = wf; /* A */ break; - case PIXMAN_x8b8g8r8: + case PICT_x8b8g8r8: pix_r = xf; /* R */ pix_g = yf; /* G */ pix_b = zf; /* B */ pix_a = 1.0; /* A */ break; - case PIXMAN_b8g8r8a8: + case PICT_b8g8r8a8: pix_r = yf; /* R */ pix_g = zf; /* G */ pix_b = wf; /* B */ pix_a = xf; /* A */ break; - case PIXMAN_b8g8r8x8: + case PICT_b8g8r8x8: pix_r = yf; /* R */ pix_g = zf; /* G */ pix_b = wf; /* B */ pix_a = 1.0; /* A */ break; - case PIXMAN_x1r5g5b5: - case PIXMAN_x8r8g8b8: - case PIXMAN_r5g6b5: + case PICT_x1r5g5b5: + case PICT_x8r8g8b8: + case PICT_r5g6b5: pix_r = zf; /* R */ pix_g = yf; /* G */ pix_b = xf; /* B */ pix_a = 1.0; /* A */ break; - case PIXMAN_a8: + case PICT_a8: pix_r = 0.0; /* R */ pix_g = 0.0; /* G */ pix_b = 0.0; /* B */ @@ -1257,13 +1260,13 @@ static void R600SetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, uint32 if (unit == 0) { if (!accel_state->msk_pic) { - if (PIXMAN_FORMAT_RGB(format) == 0) { + if (PICT_FORMAT_RGB(format) == 0) { pix_r = 0.0; pix_g = 0.0; pix_b = 0.0; } - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } else { if (accel_state->component_alpha) { @@ -1273,7 +1276,7 @@ static void R600SetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, uint32 pix_b / pix_a, pix_a / pix_a }; r600_set_blend_color(pScrn, cblend); - if (PIXMAN_FORMAT_A(format) == 0) { + if (PICT_FORMAT_A(format) == 0) { pix_r = 1.0; pix_g = 1.0; pix_b = 1.0; @@ -1284,26 +1287,26 @@ static void R600SetSolidConsts(ScrnInfoPtr pScrn, float *buf, int format, uint32 pix_b = pix_a; } } else { - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } } else { - if (PIXMAN_FORMAT_RGB(format) == 0) { + if (PICT_FORMAT_RGB(format) == 0) { pix_r = 0; pix_g = 0; pix_b = 0; } - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } } } else { if (accel_state->component_alpha) { - if (PIXMAN_FORMAT_A(format) == 0) + if (PICT_FORMAT_A(format) == 0) pix_a = 1.0; } else { - if (PIXMAN_FORMAT_A(format) == 0) { + if (PICT_FORMAT_A(format) == 0) { pix_r = 1.0; pix_g = 1.0; pix_b = 1.0; @@ -1475,29 +1478,29 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture, cb_conf.surface = accel_state->dst_obj.surface; switch (pDstPicture->format) { - case PIXMAN_a2r10g10b10: - case PIXMAN_x2r10g10b10: - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a1r5g5b5: - case PIXMAN_x1r5g5b5: + case PICT_a2r10g10b10: + case PICT_x2r10g10b10: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a1r5g5b5: + case PICT_x1r5g5b5: default: cb_conf.comp_swap = 1; /* ARGB */ break; - case PIXMAN_a2b10g10r10: - case PIXMAN_x2b10g10r10: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: + case PICT_a2b10g10r10: + case PICT_x2b10g10r10: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: cb_conf.comp_swap = 0; /* ABGR */ break; - case PIXMAN_b8g8r8a8: - case PIXMAN_b8g8r8x8: + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: cb_conf.comp_swap = 3; /* BGRA */ break; - case PIXMAN_r5g6b5: + case PICT_r5g6b5: cb_conf.comp_swap = 2; /* RGB */ break; - case PIXMAN_a8: + case PICT_a8: cb_conf.comp_swap = 3; /* A */ break; } diff --git a/src/r600_shader.c b/src/r600_shader.c index 653ccc20..30ce8265 100644 --- a/src/r600_shader.c +++ b/src/r600_shader.c @@ -23,7 +23,10 @@ * Author: Alex Deucher * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/r600_textured_videofuncs.c b/src/r600_textured_videofuncs.c index f4d61e39..c8a9b197 100644 --- a/src/r600_textured_videofuncs.c +++ b/src/r600_textured_videofuncs.c @@ -23,7 +23,10 @@ * Author: Alex Deucher * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/r6xx_accel.c b/src/r6xx_accel.c index 07548106..1f5c0523 100644 --- a/src/r6xx_accel.c +++ b/src/r6xx_accel.c @@ -23,7 +23,9 @@ * Authors: Alex Deucher * Matthias Hopf */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "xf86.h" diff --git a/src/radeon.h b/src/radeon.h index 7f09cf30..ad0f98c5 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -90,11 +90,32 @@ #include "picturestr.h" #endif +#include "compat-api.h" + #include "simple_list.h" #include "atipcirename.h" struct _SyncFence; +#ifndef HAVE_REGIONDUPLICATE + +static inline RegionPtr +RegionDuplicate(RegionPtr pOld) +{ + RegionPtr pNew; + + pNew = RegionCreate(&pOld->extents, 0); + if (!pNew) + return NULL; + if (!RegionCopy(pNew, pOld)) { + RegionDestroy(pNew); + return NULL; + } + return pNew; +} + +#endif + #ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) #endif @@ -106,6 +127,7 @@ struct _SyncFence; #include #define radeon_bswap_16 bswap_16 #define radeon_bswap_32 bswap_32 +#define radeon_bswap_64 bswap_64 #elif defined(USE_SYS_ENDIAN_H) #include #else @@ -116,12 +138,22 @@ struct _SyncFence; (((uint32_t)radeon_bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ (uint32_t)radeon_bswap_16((uint16_t)((value) >> 16))) +#define radeon_bswap_64(value) \ + (((uint64_t)radeon_bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)radeon_bswap_32((uint32_t)((value) >> 32))) #endif #if X_BYTE_ORDER == X_BIG_ENDIAN +#define le32_to_cpu(x) radeon_bswap_32(x) +#define le16_to_cpu(x) radeon_bswap_16(x) #define cpu_to_le32(x) radeon_bswap_32(x) +#define cpu_to_le16(x) radeon_bswap_16(x) #else +#define le32_to_cpu(x) (x) +#define le16_to_cpu(x) (x) #define cpu_to_le32(x) (x) +#define cpu_to_le16(x) (x) #endif /* Provide substitutes for gcc's __FUNCTION__ on other compilers */ @@ -485,7 +517,7 @@ typedef struct { Bool (*CloseScreen)(ScreenPtr pScreen); - void (*BlockHandler)(ScreenPtr pScreen, void *pTimeout); + void (*BlockHandler)(BLOCKHANDLER_ARGS_DECL); void (*CreateFence) (ScreenPtr pScreen, struct _SyncFence *pFence, Bool initially_triggered); @@ -649,7 +681,11 @@ Bool radeon_dri3_screen_init(ScreenPtr screen); /* radeon_kms.c */ Bool radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id, PixmapPtr src_pix, BoxRec extents); -void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion); +void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0) + , RegionPtr pBSRegion +#endif + ); /* radeon_present.c */ Bool radeon_present_screen_init(ScreenPtr screen); diff --git a/src/radeon_accel.c b/src/radeon_accel.c index 85a59007..f09bb1da 100644 --- a/src/radeon_accel.c +++ b/src/radeon_accel.c @@ -25,7 +25,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif /* * Authors: diff --git a/src/radeon_bo_helper.c b/src/radeon_bo_helper.c index de682898..8b3e5797 100644 --- a/src/radeon_bo_helper.c +++ b/src/radeon_bo_helper.c @@ -19,7 +19,10 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -#include "config.h" + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "radeon.h" #include "radeon_glamor.h" diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index f9e6c1cf..d7492440 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -25,7 +25,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "radeon.h" #include "radeon_dri2.h" @@ -271,7 +273,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen, error: free(buffers); - dixDestroyPixmap(pixmap, 0); + (*pScreen->DestroyPixmap)(pixmap); return NULL; } @@ -297,7 +299,7 @@ radeon_dri2_destroy_buffer2(ScreenPtr pScreen, if (private->refcnt == 0) { if (private->pixmap) - dixDestroyPixmap(private->pixmap, 0); + (*pScreen->DestroyPixmap)(private->pixmap); free(buffers->driverPrivate); free(buffers); @@ -430,7 +432,7 @@ radeon_dri2_unref_buffer(BufferPtr buffer) } static void -radeon_dri2_client_state_changed(CallbackListPtr *ClientStateCallback, void *data, void *calldata) +radeon_dri2_client_state_changed(CallbackListPtr *ClientStateCallback, pointer data, pointer calldata) { NewClientInfoRec *clientinfo = calldata; ClientPtr pClient = clientinfo->client; @@ -647,10 +649,10 @@ update_front(DrawablePtr draw, DRI2BufferPtr front) if (!info->use_glamor) exaMoveInPixmap(pixmap); if (!radeon_get_flink_name(pRADEONEnt, pixmap, &front->name)) { - dixDestroyPixmap(pixmap, 0); + (*draw->pScreen->DestroyPixmap)(pixmap); return FALSE; } - dixDestroyPixmap(priv->pixmap, 0); + (*draw->pScreen->DestroyPixmap)(priv->pixmap); front->pitch = pixmap->devKind; front->cpp = pixmap->drawable.bitsPerPixel / 8; priv->pixmap = pixmap; @@ -938,7 +940,7 @@ static int radeon_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc) } static -CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, void *data) +CARD32 radeon_dri2_deferred_event(OsTimerPtr timer, CARD32 now, pointer data) { DRI2FrameEventPtr event_info = (DRI2FrameEventPtr)data; xf86CrtcPtr crtc = event_info->crtc; diff --git a/src/radeon_dri3.c b/src/radeon_dri3.c index a9a2a520..f8f91c4b 100644 --- a/src/radeon_dri3.c +++ b/src/radeon_dri3.c @@ -20,9 +20,16 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ + + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "radeon.h" + +#ifdef HAVE_DRI3_H + #include "radeon_bo_gem.h" #include "radeon_glamor.h" #include "dri3.h" @@ -110,6 +117,38 @@ radeon_dri3_open(ScreenPtr screen, RRProviderPtr provider, int *out) return ret; } +#if DRI3_SCREEN_INFO_VERSION >= 1 && XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1,18,99,1,0) + +static int +radeon_dri3_open_client(ClientPtr client, ScreenPtr screen, + RRProviderPtr provider, int *out) +{ + const char *cmdname = GetClientCmdName(client); + Bool is_ssh = FALSE; + + /* If the executable name is "ssh", assume that this client connection + * is forwarded from another host via SSH + */ + if (cmdname) { + char *cmd = strdup(cmdname); + + /* Cut off any colon and whatever comes after it, see + * https://lists.freedesktop.org/archives/xorg-devel/2015-December/048164.html + */ + cmd = strtok(cmd, ":"); + + is_ssh = strcmp(basename(cmd), "ssh") == 0; + free(cmd); + } + + if (!is_ssh) + return radeon_dri3_open(screen, provider, out); + + return BadAccess; +} + +#endif /* DRI3_SCREEN_INFO_VERSION >= 1 && XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1,18,99,1,0) */ + static PixmapPtr radeon_dri3_pixmap_from_fd(ScreenPtr screen, int fd, CARD16 width, @@ -214,8 +253,13 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen, } static dri3_screen_info_rec radeon_dri3_screen_info = { +#if DRI3_SCREEN_INFO_VERSION >= 1 && XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1,18,99,1,0) + .version = 1, + .open_client = radeon_dri3_open_client, +#else .version = 0, .open = radeon_dri3_open, +#endif .pixmap_from_fd = radeon_dri3_pixmap_from_fd, .fd_from_pixmap = radeon_dri3_fd_from_pixmap }; @@ -236,3 +280,17 @@ radeon_dri3_screen_init(ScreenPtr screen) return TRUE; } + +#else /* !HAVE_DRI3_H */ + +Bool +radeon_dri3_screen_init(ScreenPtr screen) +{ + xf86DrvMsg(xf86ScreenToScrn(screen)->scrnIndex, X_INFO, + "Can't initialize DRI3 because dri3.h not available at " + "build time\n"); + + return FALSE; +} + +#endif diff --git a/src/radeon_drm_queue.c b/src/radeon_drm_queue.c index c336ad33..fc043605 100644 --- a/src/radeon_drm_queue.c +++ b/src/radeon_drm_queue.c @@ -25,7 +25,10 @@ * Dave Airlie * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include diff --git a/src/radeon_exa.c b/src/radeon_exa.c index 2c576ba1..2344da7f 100644 --- a/src/radeon_exa.c +++ b/src/radeon_exa.c @@ -28,7 +28,10 @@ * Benjamin Herrenschmidt * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "radeon.h" #include "radeon_reg.h" diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 0c8f0fbb..44bcc49c 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -74,36 +74,36 @@ struct formatinfo { * TXFORMAT_Y8 expands to (Y,Y,Y,1). TXFORMAT_I8 expands to (I,I,I,I) */ static struct formatinfo R100TexFormats[] = { - {PIXMAN_a8r8g8b8, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PIXMAN_x8r8g8b8, RADEON_TXFORMAT_ARGB8888}, - {PIXMAN_r5g6b5, RADEON_TXFORMAT_RGB565}, - {PIXMAN_a1r5g5b5, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PIXMAN_x1r5g5b5, RADEON_TXFORMAT_ARGB1555}, - {PIXMAN_a8, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP}, + {PICT_a8r8g8b8, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x8r8g8b8, RADEON_TXFORMAT_ARGB8888}, + {PICT_r5g6b5, RADEON_TXFORMAT_RGB565}, + {PICT_a1r5g5b5, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x1r5g5b5, RADEON_TXFORMAT_ARGB1555}, + {PICT_a8, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP}, }; static struct formatinfo R200TexFormats[] = { - {PIXMAN_a8r8g8b8, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PIXMAN_x8r8g8b8, R200_TXFORMAT_ARGB8888}, - {PIXMAN_a8b8g8r8, R200_TXFORMAT_ABGR8888 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PIXMAN_x8b8g8r8, R200_TXFORMAT_ABGR8888}, - {PIXMAN_r5g6b5, R200_TXFORMAT_RGB565}, - {PIXMAN_a1r5g5b5, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PIXMAN_x1r5g5b5, R200_TXFORMAT_ARGB1555}, - {PIXMAN_a8, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_a8r8g8b8, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x8r8g8b8, R200_TXFORMAT_ARGB8888}, + {PICT_a8b8g8r8, R200_TXFORMAT_ABGR8888 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x8b8g8r8, R200_TXFORMAT_ABGR8888}, + {PICT_r5g6b5, R200_TXFORMAT_RGB565}, + {PICT_a1r5g5b5, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP}, + {PICT_x1r5g5b5, R200_TXFORMAT_ARGB1555}, + {PICT_a8, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP}, }; static struct formatinfo R300TexFormats[] = { - {PIXMAN_a8r8g8b8, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)}, - {PIXMAN_x8r8g8b8, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)}, - {PIXMAN_a8b8g8r8, R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8)}, - {PIXMAN_x8b8g8r8, R300_EASY_TX_FORMAT(Z, Y, X, ONE, W8Z8Y8X8)}, - {PIXMAN_b8g8r8a8, R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8)}, - {PIXMAN_b8g8r8x8, R300_EASY_TX_FORMAT(W, Z, Y, ONE, W8Z8Y8X8)}, - {PIXMAN_r5g6b5, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)}, - {PIXMAN_a1r5g5b5, R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5)}, - {PIXMAN_x1r5g5b5, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W1Z5Y5X5)}, - {PIXMAN_a8, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X8)}, + {PICT_a8r8g8b8, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)}, + {PICT_x8r8g8b8, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)}, + {PICT_a8b8g8r8, R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8)}, + {PICT_x8b8g8r8, R300_EASY_TX_FORMAT(Z, Y, X, ONE, W8Z8Y8X8)}, + {PICT_b8g8r8a8, R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8)}, + {PICT_b8g8r8x8, R300_EASY_TX_FORMAT(W, Z, Y, ONE, W8Z8Y8X8)}, + {PICT_r5g6b5, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)}, + {PICT_a1r5g5b5, R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5)}, + {PICT_x1r5g5b5, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W1Z5Y5X5)}, + {PICT_a8, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X8)}, }; /* Common Radeon setup code */ @@ -111,18 +111,18 @@ static struct formatinfo R300TexFormats[] = { static Bool RADEONGetDestFormat(PicturePtr pDstPicture, uint32_t *dst_format) { switch (pDstPicture->format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: *dst_format = RADEON_COLOR_FORMAT_ARGB8888; break; - case PIXMAN_r5g6b5: + case PICT_r5g6b5: *dst_format = RADEON_COLOR_FORMAT_RGB565; break; - case PIXMAN_a1r5g5b5: - case PIXMAN_x1r5g5b5: + case PICT_a1r5g5b5: + case PICT_x1r5g5b5: *dst_format = RADEON_COLOR_FORMAT_ARGB1555; break; - case PIXMAN_a8: + case PICT_a8: *dst_format = RADEON_COLOR_FORMAT_RGB8; break; default: @@ -136,22 +136,22 @@ static Bool RADEONGetDestFormat(PicturePtr pDstPicture, uint32_t *dst_format) static Bool R300GetDestFormat(PicturePtr pDstPicture, uint32_t *dst_format) { switch (pDstPicture->format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: - case PIXMAN_b8g8r8a8: - case PIXMAN_b8g8r8x8: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: *dst_format = R300_COLORFORMAT_ARGB8888; break; - case PIXMAN_r5g6b5: + case PICT_r5g6b5: *dst_format = R300_COLORFORMAT_RGB565; break; - case PIXMAN_a1r5g5b5: - case PIXMAN_x1r5g5b5: + case PICT_a1r5g5b5: + case PICT_x1r5g5b5: *dst_format = R300_COLORFORMAT_ARGB1555; break; - case PIXMAN_a8: + case PICT_a8: *dst_format = R300_COLORFORMAT_I8; break; default: @@ -171,7 +171,7 @@ static uint32_t RADEONGetBlendCntl(int op, PicturePtr pMask, uint32_t dst_format /* If there's no dst alpha channel, adjust the blend op so that we'll treat * it as always 1. */ - if (PIXMAN_FORMAT_A(dst_format) == 0 && RadeonBlendOp[op].dst_alpha) { + if (PICT_FORMAT_A(dst_format) == 0 && RadeonBlendOp[op].dst_alpha) { if (sblend == RADEON_SRC_BLEND_GL_DST_ALPHA) sblend = RADEON_SRC_BLEND_GL_ONE; else if (sblend == RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA) @@ -334,8 +334,8 @@ static Bool R100CheckCompositeTexture(PicturePtr pPict, * matter. I have not, however, verified that the X server always does such * clipping. */ - if (pPict->transform != 0 && repeatType == RepeatNone && PIXMAN_FORMAT_A(pPict->format) == 0) { - if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PIXMAN_FORMAT_A(pDstPict->format) == 0))) + if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) { + if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); } @@ -589,7 +589,7 @@ static Bool R100PrepareComposite(int op, if (!RADEONGetDestFormat(pDstPicture, &dst_format)) return FALSE; - if (pDstPicture->format == PIXMAN_a8 && RadeonBlendOp[op].dst_alpha) + if (pDstPicture->format == PICT_a8 && RadeonBlendOp[op].dst_alpha) RADEON_FALLBACK(("Can't dst alpha blend A8\n")); pixel_shift = pDst->drawable.bitsPerPixel >> 4; @@ -615,7 +615,7 @@ static Bool R100PrepareComposite(int op, pMask = RADEONSolidPixmap(pScreen, cpu_to_le32(pMaskPicture->pSourcePict->solidFill.color)); if (!pMask) { if (!pSrcPicture->pDrawable) - dixDestroyPixmap(pSrc, 0); + pScreen->DestroyPixmap(pSrc); RADEON_FALLBACK(("Failed to create solid scratch pixmap\n")); } } @@ -655,11 +655,11 @@ static Bool R100PrepareComposite(int op, cblend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | RADEON_COLOR_ARG_C_ZERO; ablend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | RADEON_ALPHA_ARG_C_ZERO; - if (pDstPicture->format == PIXMAN_a8 || + if (pDstPicture->format == PICT_a8 || (pMask && pMaskPicture->componentAlpha && RadeonBlendOp[op].src_alpha)) { cblend |= RADEON_COLOR_ARG_A_T0_ALPHA; - } else if (pSrcPicture->format == PIXMAN_a8) + } else if (pSrcPicture->format == PICT_a8) cblend |= RADEON_COLOR_ARG_A_ZERO; else cblend |= RADEON_COLOR_ARG_A_T0_COLOR; @@ -667,7 +667,7 @@ static Bool R100PrepareComposite(int op, if (pMask) { if (pMaskPicture->componentAlpha && - pDstPicture->format != PIXMAN_a8) + pDstPicture->format != PICT_a8) cblend |= RADEON_COLOR_ARG_B_T1_COLOR; else cblend |= RADEON_COLOR_ARG_B_T1_ALPHA; @@ -731,8 +731,8 @@ static Bool R200CheckCompositeTexture(PicturePtr pPict, * matter. I have not, however, verified that the X server always does such * clipping. */ - if (pPict->transform != 0 && repeatType == RepeatNone && PIXMAN_FORMAT_A(pPict->format) == 0) { - if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PIXMAN_FORMAT_A(pDstPict->format) == 0))) + if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) { + if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); } @@ -951,7 +951,7 @@ static Bool R200PrepareComposite(int op, PicturePtr pSrcPicture, if (!RADEONGetDestFormat(pDstPicture, &dst_format)) return FALSE; - if (pDstPicture->format == PIXMAN_a8 && RadeonBlendOp[op].dst_alpha) + if (pDstPicture->format == PICT_a8 && RadeonBlendOp[op].dst_alpha) RADEON_FALLBACK(("Can't dst alpha blend A8\n")); pixel_shift = pDst->drawable.bitsPerPixel >> 4; @@ -977,7 +977,7 @@ static Bool R200PrepareComposite(int op, PicturePtr pSrcPicture, pMask = RADEONSolidPixmap(pScreen, cpu_to_le32(pMaskPicture->pSourcePict->solidFill.color)); if (!pMask) { if (!pSrcPicture->pDrawable) - dixDestroyPixmap(pSrc, 0); + pScreen->DestroyPixmap(pSrc); RADEON_FALLBACK(("Failed to create solid scratch pixmap\n")); } } @@ -1030,11 +1030,11 @@ static Bool R200PrepareComposite(int op, PicturePtr pSrcPicture, cblend = R200_TXC_OP_MADD | R200_TXC_ARG_C_ZERO; ablend = R200_TXA_OP_MADD | R200_TXA_ARG_C_ZERO; - if (pDstPicture->format == PIXMAN_a8 || + if (pDstPicture->format == PICT_a8 || (pMask && pMaskPicture->componentAlpha && RadeonBlendOp[op].src_alpha)) { cblend |= R200_TXC_ARG_A_R0_ALPHA; - } else if (pSrcPicture->format == PIXMAN_a8) + } else if (pSrcPicture->format == PICT_a8) cblend |= R200_TXC_ARG_A_ZERO; else cblend |= R200_TXC_ARG_A_R0_COLOR; @@ -1042,7 +1042,7 @@ static Bool R200PrepareComposite(int op, PicturePtr pSrcPicture, if (pMask) { if (pMaskPicture->componentAlpha && - pDstPicture->format != PIXMAN_a8) + pDstPicture->format != PICT_a8) cblend |= R200_TXC_ARG_B_R1_COLOR; else cblend |= R200_TXC_ARG_B_R1_ALPHA; @@ -1113,8 +1113,8 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict, * matter. I have not, however, verified that the X server always does such * clipping. */ - if (pPict->transform != 0 && repeatType == RepeatNone && PIXMAN_FORMAT_A(pPict->format) == 0) { - if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PIXMAN_FORMAT_A(pDstPict->format) == 0))) + if (pPict->transform != 0 && repeatType == RepeatNone && PICT_FORMAT_A(pPict->format) == 0) { + if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); } @@ -1469,7 +1469,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, pMask = RADEONSolidPixmap(pScreen, cpu_to_le32(pMaskPicture->pSourcePict->solidFill.color)); if (!pMask) { if (!pSrcPicture->pDrawable) - dixDestroyPixmap(pSrc, 0); + pScreen->DestroyPixmap(pSrc); RADEON_FALLBACK(("Failed to create solid scratch pixmap\n")); } } @@ -1594,8 +1594,8 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, /* shader output swizzling */ switch (pDstPicture->format) { - case PIXMAN_a8r8g8b8: - case PIXMAN_x8r8g8b8: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: default: output_fmt = (R300_OUT_FMT_C4_8 | R300_OUT_FMT_C0_SEL_BLUE | @@ -1603,23 +1603,23 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, R300_OUT_FMT_C2_SEL_RED | R300_OUT_FMT_C3_SEL_ALPHA); break; - case PIXMAN_a8b8g8r8: - case PIXMAN_x8b8g8r8: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: output_fmt = (R300_OUT_FMT_C4_8 | R300_OUT_FMT_C0_SEL_RED | R300_OUT_FMT_C1_SEL_GREEN | R300_OUT_FMT_C2_SEL_BLUE | R300_OUT_FMT_C3_SEL_ALPHA); break; - case PIXMAN_b8g8r8a8: - case PIXMAN_b8g8r8x8: + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: output_fmt = (R300_OUT_FMT_C4_8 | R300_OUT_FMT_C0_SEL_ALPHA | R300_OUT_FMT_C1_SEL_RED | R300_OUT_FMT_C2_SEL_GREEN | R300_OUT_FMT_C3_SEL_BLUE); break; - case PIXMAN_a8: + case PICT_a8: output_fmt = (R300_OUT_FMT_C4_8 | R300_OUT_FMT_C0_SEL_ALPHA); break; @@ -1627,12 +1627,12 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, /* setup pixel shader */ if (IS_R300_3D) { - if (PIXMAN_FORMAT_RGB(pSrcPicture->format) == 0) + if (PICT_FORMAT_RGB(pSrcPicture->format) == 0) src_color = R300_ALU_RGB_0_0; else src_color = R300_ALU_RGB_SRC0_RGB; - if (PIXMAN_FORMAT_A(pSrcPicture->format) == 0) + if (PICT_FORMAT_A(pSrcPicture->format) == 0) src_alpha = R300_ALU_ALPHA_1_0; else src_alpha = R300_ALU_ALPHA_SRC0_A; @@ -1640,7 +1640,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, if (pMask) { if (pMaskPicture->componentAlpha) { if (RadeonBlendOp[op].src_alpha) { - if (PIXMAN_FORMAT_A(pSrcPicture->format) == 0) + if (PICT_FORMAT_A(pSrcPicture->format) == 0) src_color = R300_ALU_RGB_1_0; else src_color = R300_ALU_RGB_SRC0_AAA; @@ -1648,12 +1648,12 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, src_color = R300_ALU_RGB_SRC0_RGB; mask_color = R300_ALU_RGB_SRC1_RGB; } else { - if (PIXMAN_FORMAT_A(pMaskPicture->format) == 0) + if (PICT_FORMAT_A(pMaskPicture->format) == 0) mask_color = R300_ALU_RGB_1_0; else mask_color = R300_ALU_RGB_SRC1_AAA; } - if (PIXMAN_FORMAT_A(pMaskPicture->format) == 0) + if (PICT_FORMAT_A(pMaskPicture->format) == 0) mask_alpha = R300_ALU_ALPHA_1_0; else mask_alpha = R300_ALU_ALPHA_SRC1_A; @@ -1805,7 +1805,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, R300_ALU_ALPHA_CLAMP)); ADVANCE_RING(); } else { - if (PIXMAN_FORMAT_RGB(pSrcPicture->format) == 0) + if (PICT_FORMAT_RGB(pSrcPicture->format) == 0) src_color = (R500_ALU_RGB_R_SWIZ_A_0 | R500_ALU_RGB_G_SWIZ_A_0 | R500_ALU_RGB_B_SWIZ_A_0); @@ -1814,7 +1814,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B); - if (PIXMAN_FORMAT_A(pSrcPicture->format) == 0) + if (PICT_FORMAT_A(pSrcPicture->format) == 0) src_alpha = R500_ALPHA_SWIZ_A_1; else src_alpha = R500_ALPHA_SWIZ_A_A; @@ -1822,7 +1822,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, if (pMask) { if (pMaskPicture->componentAlpha) { if (RadeonBlendOp[op].src_alpha) { - if (PIXMAN_FORMAT_A(pSrcPicture->format) == 0) + if (PICT_FORMAT_A(pSrcPicture->format) == 0) src_color = (R500_ALU_RGB_R_SWIZ_A_1 | R500_ALU_RGB_G_SWIZ_A_1 | R500_ALU_RGB_B_SWIZ_A_1); @@ -1839,7 +1839,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, R500_ALU_RGB_G_SWIZ_B_G | R500_ALU_RGB_B_SWIZ_B_B); } else { - if (PIXMAN_FORMAT_A(pMaskPicture->format) == 0) + if (PICT_FORMAT_A(pMaskPicture->format) == 0) mask_color = (R500_ALU_RGB_R_SWIZ_B_1 | R500_ALU_RGB_G_SWIZ_B_1 | R500_ALU_RGB_B_SWIZ_B_1); @@ -1848,7 +1848,7 @@ static Bool R300PrepareComposite(int op, PicturePtr pSrcPicture, R500_ALU_RGB_G_SWIZ_B_A | R500_ALU_RGB_B_SWIZ_B_A); } - if (PIXMAN_FORMAT_A(pMaskPicture->format) == 0) + if (PICT_FORMAT_A(pMaskPicture->format) == 0) mask_alpha = R500_ALPHA_SWIZ_B_1; else mask_alpha = R500_ALPHA_SWIZ_B_A; @@ -2148,10 +2148,10 @@ static void RadeonDoneComposite(PixmapPtr pDst) RadeonFinishComposite(pDst); if (!accel_state->src_pic->pDrawable) - dixDestroyPixmap(accel_state->src_pix, 0); + pScreen->DestroyPixmap(accel_state->src_pix); if (accel_state->msk_pic && !accel_state->msk_pic->pDrawable) - dixDestroyPixmap(accel_state->msk_pix, 0); + pScreen->DestroyPixmap(accel_state->msk_pix); } #define VTX_OUT_MASK(_dstX, _dstY, _srcX, _srcY, _maskX, _maskY) \ diff --git a/src/radeon_exa_shared.c b/src/radeon_exa_shared.c index 07664520..94238a5a 100644 --- a/src/radeon_exa_shared.c +++ b/src/radeon_exa_shared.c @@ -30,7 +30,9 @@ * Alex Deucher * Matthias Hopf */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "radeon.h" #include "radeon_probe.h" @@ -130,7 +132,7 @@ PixmapPtr RADEONSolidPixmap(ScreenPtr pScreen, uint32_t solid) bo = radeon_get_pixmap_bo(pPix)->bo.radeon; if (radeon_bo_map(bo, 1)) { - dixDestroyPixmap(pPix, 0); + pScreen->DestroyPixmap(pPix); return NULL; } diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c index e51e5547..ccf99941 100644 --- a/src/radeon_glamor.c +++ b/src/radeon_glamor.c @@ -23,7 +23,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include @@ -69,7 +72,7 @@ radeon_glamor_pre_init(ScrnInfoPtr scrn) { RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); RADEONInfoPtr info = RADEONPTR(scrn); - void *glamor_module; + pointer glamor_module; CARD32 version; const char *s; @@ -78,8 +81,13 @@ radeon_glamor_pre_init(ScrnInfoPtr scrn) s = xf86GetOptValString(info->Options, OPTION_ACCELMETHOD); if (!s) { - if (info->ChipFamily < CHIP_FAMILY_R600) - return FALSE; + if (xorgGetVersion() >= XORG_VERSION_NUMERIC(1,18,3,0,0)) { + if (info->ChipFamily < CHIP_FAMILY_R600) + return FALSE; + } else { + if (info->ChipFamily < CHIP_FAMILY_TAHITI) + return FALSE; + } } if (s && strcasecmp(s, "glamor") != 0) { @@ -101,13 +109,34 @@ radeon_glamor_pre_init(ScrnInfoPtr scrn) "glamor may not work (well) with GPUs < RV515.\n"); } +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,20,99,0,0) + if (scrn->depth < 24) { +#else if (scrn->depth < 15) { +#endif xf86DrvMsg(scrn->scrnIndex, s ? X_ERROR : X_WARNING, "Depth %d not supported with glamor, disabling\n", scrn->depth); return FALSE; } + if (scrn->depth == 30 && + xorgGetVersion() < XORG_VERSION_NUMERIC(1,19,99,1,0)) { + xf86DrvMsg(scrn->scrnIndex, X_WARNING, + "Depth 30 is not supported by GLAMOR with Xorg < " + "1.19.99.1\n"); + return FALSE; + } + +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,15,0,0,0) + if (!xf86LoaderCheckSymbol("glamor_egl_init")) { + xf86DrvMsg(scrn->scrnIndex, s ? X_ERROR : X_WARNING, + "glamor requires Load \"glamoregl\" in " + "Section \"Module\", disabling.\n"); + return FALSE; + } +#endif + info->gbm = gbm_create_device(pRADEONEnt->fd); if (!info->gbm) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, @@ -153,8 +182,11 @@ radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_buffer *bo) if (bo->flags & RADEON_BO_FLAGS_GBM) { return glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap, - bo->bo.gbm, - FALSE); + bo->bo.gbm +#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(1,19,99,903,0) + , FALSE +#endif + ); } else { return glamor_egl_create_textured_pixmap(pixmap, bo->bo.radeon->handle, @@ -164,20 +196,30 @@ radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_buffer *bo) static Bool radeon_glamor_destroy_pixmap(PixmapPtr pixmap) { +#ifndef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP ScreenPtr screen = pixmap->drawable.pScreen; RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen)); - Bool ret = TRUE; + Bool ret; +#endif - if (pixmap->refcnt == 1) + if (pixmap->refcnt == 1) { +#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP + glamor_egl_destroy_textured_pixmap(pixmap); +#endif radeon_set_pixmap_bo(pixmap, NULL); - - if (info->glamor.SavedDestroyPixmap) { - screen->DestroyPixmap = info->glamor.SavedDestroyPixmap; - ret = screen->DestroyPixmap(pixmap); } + +#ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP + fbDestroyPixmap(pixmap); + return TRUE; +#else + screen->DestroyPixmap = info->glamor.SavedDestroyPixmap; + ret = screen->DestroyPixmap(pixmap); + info->glamor.SavedDestroyPixmap = screen->DestroyPixmap; screen->DestroyPixmap = radeon_glamor_destroy_pixmap; return ret; +#endif } static PixmapPtr @@ -317,7 +359,7 @@ radeon_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap) 0, 0, pixmap->devKind, NULL); old->devPrivate.ptr = NULL; - dixDestroyPixmap(pixmap, 0); + screen->DestroyPixmap(pixmap); return old; } @@ -393,14 +435,18 @@ radeon_glamor_init(ScreenPtr screen) ScrnInfoPtr scrn = xf86ScreenToScrn(screen); RADEONInfoPtr info = RADEONPTR(scrn); #ifdef RENDER +#ifdef HAVE_FBGLYPHS UnrealizeGlyphProcPtr SavedUnrealizeGlyph = NULL; +#endif PictureScreenPtr ps = NULL; if (info->shadow_primary) { ps = GetPictureScreenIfSet(screen); if (ps) { +#ifdef HAVE_FBGLYPHS SavedUnrealizeGlyph = ps->UnrealizeGlyph; +#endif info->glamor.SavedGlyphs = ps->Glyphs; info->glamor.SavedTriangles = ps->Triangles; info->glamor.SavedTrapezoids = ps->Trapezoids; @@ -416,13 +462,19 @@ radeon_glamor_init(ScreenPtr screen) return FALSE; } + if (!glamor_egl_init_textured_pixmap(screen)) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, + "Failed to initialize textured pixmap of screen for glamor.\n"); + return FALSE; + } + if (!dixRegisterPrivateKey(&glamor_pixmap_index, PRIVATE_PIXMAP, 0)) return FALSE; if (info->shadow_primary) radeon_glamor_screen_init(screen); -#if defined(RENDER) +#if defined(RENDER) && defined(HAVE_FBGLYPHS) /* For ShadowPrimary, we need fbUnrealizeGlyph instead of * glamor_unrealize_glyph */ diff --git a/src/radeon_glamor_wrappers.c b/src/radeon_glamor_wrappers.c index 8371f337..bc47cc89 100644 --- a/src/radeon_glamor_wrappers.c +++ b/src/radeon_glamor_wrappers.c @@ -26,13 +26,14 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ + + +#ifdef HAVE_CONFIG_H #include +#endif #ifdef USE_GLAMOR -#include -#include - #include "radeon.h" #include "radeon_bo_helper.h" #include "radeon_glamor.h" @@ -425,7 +426,7 @@ radeon_glamor_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC, static void radeon_glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, void *pglyphBase) + CharInfoPtr *ppci, pointer pglyphBase) { ScrnInfoPtr scrn = xf86ScreenToScrn(pDrawable->pScreen); PixmapPtr pixmap = get_drawable_pixmap(pDrawable); @@ -444,7 +445,7 @@ radeon_glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, static void radeon_glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, void *pglyphBase) + CharInfoPtr *ppci, pointer pglyphBase) { ScrnInfoPtr scrn = xf86ScreenToScrn(pDrawable->pScreen); PixmapPtr pixmap = get_drawable_pixmap(pDrawable); diff --git a/src/radeon_kms.c b/src/radeon_kms.c index d855d192..833d4812 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -24,7 +24,9 @@ * Dave Airlie * */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include @@ -41,20 +43,23 @@ #include "radeon_version.h" #include "shadow.h" #include + #include "atipciids.h" + +#if HAVE_PRESENT_H #include +#endif /* DPMS */ +#ifdef HAVE_XEXTPROTO_71 #include - -#ifdef __DragonFly__ -#include +#else +#define DPMS_SERVER +#include #endif #include -#include - #include "radeon_chipinfo_gen.h" #include "radeon_bo_gem.h" @@ -102,7 +107,7 @@ void radeon_cs_flush_indirect(ScrnInfoPtr pScrn) #ifdef USE_GLAMOR if (info->use_glamor) { - /* Pending operations have already been flushed in glamor_close_screen() */ + glamor_block_handler(pScrn->pScreen); return; } #endif @@ -182,7 +187,7 @@ static Bool RADEONGetRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate) return TRUE; - pScrn->driverPrivate = XNFcallocarray(sizeof(RADEONInfoRec), 1); + pScrn->driverPrivate = xnfcalloc(sizeof(RADEONInfoRec), 1); return TRUE; } @@ -204,7 +209,7 @@ static void RADEONFreeRec(ScrnInfoPtr pScrn) info = RADEONPTR(pScrn); if (info) { if (info->fbcon_pixmap) - dixDestroyPixmap(info->fbcon_pixmap, 0); + pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap); if (info->accel_state) { free(info->accel_state); @@ -272,7 +277,7 @@ callback_needs_flush(RADEONInfoPtr info, struct radeon_client_priv *client_priv) static void radeon_event_callback(CallbackListPtr *list, - void *user_data, void *call_data) + pointer user_data, pointer call_data) { EventInfoRec *eventinfo = call_data; ScrnInfoPtr pScrn = user_data; @@ -307,7 +312,7 @@ radeon_event_callback(CallbackListPtr *list, static void radeon_flush_callback(CallbackListPtr *list, - void *user_data, void *call_data) + pointer user_data, pointer call_data) { ScrnInfoPtr pScrn = user_data; ScreenPtr pScreen = pScrn->pScreen; @@ -421,7 +426,7 @@ radeon_scanout_extents_intersect(xf86CrtcPtr xf86_crtc, BoxPtr extents) } static RegionPtr -transform_region(RegionPtr region, struct pixman_f_transform *transform, +transform_region(RegionPtr region, struct pict_f_transform *transform, int w, int h) { BoxPtr boxes = RegionRects(region); @@ -550,12 +555,14 @@ dirty_region(PixmapDirtyUpdatePtr dirty) RegionPtr damageregion = DamageRegion(dirty->damage); RegionPtr dstregion; +#ifdef HAS_DIRTYTRACKING_ROTATION if (dirty->rotation != RR_Rotate_0) { dstregion = transform_region(damageregion, &dirty->f_inverse, dirty->secondary_dst->drawable.width, dirty->secondary_dst->drawable.height); } else +#endif { RegionRec pixregion; @@ -581,7 +588,11 @@ redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region) if (dirty->secondary_dst->primary_pixmap) DamageRegionAppend(&dirty->secondary_dst->drawable, region); +#ifdef HAS_DIRTYTRACKING_ROTATION PixmapSyncDirtyHelper(dirty); +#else + PixmapSyncDirtyHelper(dirty, region); +#endif radeon_cs_flush_indirect(src_scrn); if (dirty->secondary_dst->primary_pixmap) @@ -1201,7 +1212,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info, drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending, fb); } -static void RADEONBlockHandler_KMS(ScreenPtr pScreen, void *pTimeout) +static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1209,7 +1220,7 @@ static void RADEONBlockHandler_KMS(ScreenPtr pScreen, void *pTimeout) int c; pScreen->BlockHandler = info->BlockHandler; - pScreen->BlockHandler(pScreen, pTimeout); + (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS); pScreen->BlockHandler = RADEONBlockHandler_KMS; if (!xf86ScreenToScrn(radeon_primary_screen(pScreen))->vtSema) @@ -1513,29 +1524,8 @@ static int radeon_get_drm_master_fd(ScrnInfoPtr pScrn) } #endif - if (asprintf(&busid, "pci:%04x:%02x:%02x.%d", - dev->domain, dev->bus, dev->dev, dev->func) == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "malloc() failed\n"); - return -1; - } - -#ifdef __DragonFly__ - /* On DragonFlyBSD Appropriate kernel drivers need to be loaded before - * accessing DRM facilities */ - int loaded=0; /* if we were able to load the module. */ - loaded = xf86LoadKernelModule("radeon"); - /* EEXIST is set if the module has already been loaded in the kernel */ - if (!loaded && errno != EEXIST) { - loaded = xf86LoadKernelModule("radeonkms"); - if (!loaded && errno != EEXIST) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Failed to load kernel module for %s: %s\n", - busid, strerror(errno)); - free(busid); - return -1; - } - } -#endif + XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d", + dev->domain, dev->bus, dev->dev, dev->func); fd = drmOpen(NULL, busid); if (fd == -1) @@ -1744,7 +1734,11 @@ static Bool RADEONCreateWindow_oneshot(WindowPtr pWin) } /* When the root window is mapped, set the initial modes */ -void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion) +void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0) + , RegionPtr pBSRegion +#endif + ) { ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); @@ -1754,7 +1748,11 @@ void RADEONWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion) ErrorF("%s called for non-root window %p\n", __func__, pWin); pScreen->WindowExposures = info->WindowExposures; +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0) + pScreen->WindowExposures(pWin, pRegion, pBSRegion); +#else pScreen->WindowExposures(pWin, pRegion); +#endif radeon_finish(pScrn, info->front_buffer); drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE); @@ -2399,7 +2397,10 @@ Bool RADEONScreenInit_KMS(ScreenPtr pScreen, int argc, char **argv) #endif if (!pScreen->isGPU) { - value = info->use_glamor; + if (xorgGetVersion() >= XORG_VERSION_NUMERIC(1,18,3,0,0)) + value = info->use_glamor; + else + value = FALSE; from = X_DEFAULT; if (!info->r600_shadow_fb) { @@ -2582,7 +2583,7 @@ Bool RADEONEnterVT_KMS(ScrnInfoPtr pScrn) } static -CARD32 cleanup_black_fb(OsTimerPtr timer, CARD32 now, void *data) +CARD32 cleanup_black_fb(OsTimerPtr timer, CARD32 now, pointer data) { ScreenPtr screen = data; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); diff --git a/src/radeon_misc.c b/src/radeon_misc.c index ea696cd7..1115118a 100644 --- a/src/radeon_misc.c +++ b/src/radeon_misc.c @@ -19,7 +19,10 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "radeon_probe.h" #include "radeon_version.h" @@ -47,11 +50,11 @@ static XF86ModuleVersionInfo RADEONVersionRec = * * This function is called every time the module is loaded. */ -static void * +static pointer RADEONSetup ( - void *Module, - void *Options, + pointer Module, + pointer Options, int *ErrorMajor, int *ErrorMinor ) @@ -63,7 +66,7 @@ RADEONSetup xf86AddDriver(&RADEON, Module, HaveDriverFuncs); } - return (void*)TRUE; + return (pointer)TRUE; } /* The following record must be called radeonModuleData */ diff --git a/src/radeon_present.c b/src/radeon_present.c index 80ec8a8b..d010aa19 100644 --- a/src/radeon_present.c +++ b/src/radeon_present.c @@ -20,10 +20,15 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "radeon.h" +#ifdef HAVE_PRESENT_H + #include #include #include @@ -270,6 +275,11 @@ radeon_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, if (info->drmmode.dri2_flipping) return FALSE; +#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1, 20, 99, 1, 0) + if (pixmap->devKind != screen_pixmap->devKind) + return FALSE; +#endif + #ifdef USE_GLAMOR if (priv && priv->fb_failed) return FALSE; @@ -481,3 +491,17 @@ radeon_present_screen_init(ScreenPtr screen) return TRUE; } + +#else /* !HAVE_PRESENT_H */ + +Bool +radeon_present_screen_init(ScreenPtr screen) +{ + xf86DrvMsg(xf86ScreenToScrn(screen)->scrnIndex, X_INFO, + "Present extension disabled because present.h not available at " + "build time\n"); + + return FALSE; +} + +#endif diff --git a/src/radeon_probe.c b/src/radeon_probe.c index 2c4463f0..04f9e559 100644 --- a/src/radeon_probe.c +++ b/src/radeon_probe.c @@ -25,7 +25,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include @@ -46,9 +49,13 @@ #include "xf86drmMode.h" +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,19,99,1,0) #include +#else +#include "dri.h" +#endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #endif @@ -94,7 +101,7 @@ static Bool radeon_kernel_mode_enabled(ScrnInfoPtr pScrn, struct pci_device *pci busIdString = DRICreatePCIBusID(pci_dev); ret = drmCheckModesettingSupported(busIdString); -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) if (ret) { if (xf86LoadKernelModule("radeonkms")) ret = drmCheckModesettingSupported(busIdString); @@ -161,7 +168,7 @@ radeon_get_scrninfo(int entity_num, void *pci_dev) xf86SetEntityInstanceForScreen(pScrn, pEnt->index, xf86GetNumEntityInstances(pEnt->index) - 1); if (!pPriv->ptr) - pPriv->ptr = XNFcallocarray(sizeof(RADEONEntRec), 1); + pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1); } free(pEnt); @@ -190,8 +197,10 @@ RADEONDriverFunc(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data) flag = (CARD32 *)data; (*flag) = 0; return TRUE; +#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(1,15,99,0,0) case SUPPORTS_SERVER_FDS: return TRUE; +#endif default: return FALSE; } @@ -255,7 +264,7 @@ radeon_platform_probe(DriverPtr pDriver, xf86SetEntityInstanceForScreen(pScrn, pEnt->index, xf86GetNumEntityInstances(pEnt->index) - 1); if (!pPriv->ptr) { - pPriv->ptr = XNFcallocarray(sizeof(RADEONEntRec), 1); + pPriv->ptr = xnfcalloc(sizeof(RADEONEntRec), 1); pRADEONEnt = pPriv->ptr; } else { pRADEONEnt = pPriv->ptr; diff --git a/src/radeon_probe.h b/src/radeon_probe.h index 75f1e76b..7cb29b91 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -48,6 +48,7 @@ #include "xf86platformBus.h" #endif +#include "compat-api.h" #include "exa.h" extern DriverRec RADEON; diff --git a/src/radeon_sync.c b/src/radeon_sync.c index 180fc95e..86e0283f 100644 --- a/src/radeon_sync.c +++ b/src/radeon_sync.c @@ -23,6 +23,8 @@ #include "radeon.h" +#ifdef HAVE_MISYNCSHM_H + #include "misync.h" #include "misyncshm.h" #include "misyncstr.h" @@ -129,3 +131,22 @@ radeon_sync_close(ScreenPtr screen) info->CreateFence = NULL; } + +#else /* !HAVE_MISYNCSHM_H */ + +Bool +radeon_sync_init(ScreenPtr screen) +{ + xf86DrvMsg(xf86ScreenToScrn(screen)->scrnIndex, X_INFO, + "SYNC extension fences disabled because misyncshm.h not " + "available at build time\n"); + + return FALSE; +} + +void +radeon_sync_close(ScreenPtr screen) +{ +} + +#endif diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c index 46c9e0a7..96094d5a 100644 --- a/src/radeon_textured_video.c +++ b/src/radeon_textured_video.c @@ -24,7 +24,10 @@ * Based on radeon_exa_render.c and kdrive ati_video.c by Eric Anholt, et al. * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include @@ -163,7 +166,7 @@ RADEONFreeVideoMemory(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) } static void -RADEONStopVideo(ScrnInfoPtr pScrn, void *data, Bool cleanup) +RADEONStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) { RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; @@ -220,7 +223,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn, short height, Bool sync, RegionPtr clipBoxes, - void *data, + pointer data, DrawablePtr pDraw) { ScreenPtr pScreen = pScrn->pScreen; @@ -603,7 +606,7 @@ int RADEONGetTexPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value, - void *data) + pointer data) { RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; @@ -645,7 +648,7 @@ int RADEONSetTexPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, - void *data) + pointer data) { RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; @@ -737,7 +740,7 @@ RADEONQueryBestSize( short vid_w, short vid_h, short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, - void *data + pointer data ){ RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; @@ -911,7 +914,7 @@ RADEONSetupImageTexturedVideo(ScreenPtr pScreen) /* gotta uninit this someplace, XXX: shouldn't be necessary for textured */ REGION_NULL(pScreen, &pPriv->clip); - adapt->pPortPrivates[i].ptr = (void*) (pPriv); + adapt->pPortPrivates[i].ptr = (pointer) (pPriv); } if (IS_R500_3D || IS_R300_3D) diff --git a/src/radeon_vbo.c b/src/radeon_vbo.c index 5b7c98af..6b0d278a 100644 --- a/src/radeon_vbo.c +++ b/src/radeon_vbo.c @@ -24,7 +24,9 @@ * Dave Airlie * */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include "radeon.h" diff --git a/src/radeon_vbo.h b/src/radeon_vbo.h index c1e61f16..312e03b3 100644 --- a/src/radeon_vbo.h +++ b/src/radeon_vbo.h @@ -31,7 +31,7 @@ radeon_vbo_space(ScrnInfoPtr pScrn, radeon_vbo_check(pScrn, vbo, vert_size); vbo->vb_op_vert_size = vert_size; - vb = (void*)((char *)vbo->vb_bo->ptr + vbo->vb_offset); + vb = (pointer)((char *)vbo->vb_bo->ptr + vbo->vb_offset); return vb; } diff --git a/src/radeon_video.c b/src/radeon_video.c index a92ac45e..5cc9e8d0 100644 --- a/src/radeon_video.c +++ b/src/radeon_video.c @@ -1,4 +1,7 @@ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include @@ -15,7 +18,12 @@ #include "dixstruct.h" /* DPMS */ +#ifdef HAVE_XEXTPROTO_71 #include +#else +#define DPMS_SERVER +#include +#endif #include #include "fourcc.h" @@ -245,7 +253,7 @@ RADEONCopyMungedData( w /= 2; for( j = 0; j < h; j++ ) { - dst = (void*)dst1; + dst = (pointer)dst1; s1 = src1; s2 = src2; s3 = src3; i = w; while( i > 4 ) { diff --git a/src/radeon_video.h b/src/radeon_video.h index 227ebf13..e6068e86 100644 --- a/src/radeon_video.h +++ b/src/radeon_video.h @@ -2,6 +2,8 @@ #define __RADEON_VIDEO_H__ #include "xf86i2c.h" +#include "i2c_def.h" + #include "xf86Crtc.h" #include "bicubic_table.h" diff --git a/src/radeon_xvmc.c b/src/radeon_xvmc.c index 70b28ba7..e96f0635 100644 --- a/src/radeon_xvmc.c +++ b/src/radeon_xvmc.c @@ -24,10 +24,14 @@ * Based on vl_hwmc.c from xf86-video-nouveau * */ + +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include "radeon_video.h" +#include "compat-api.h" #include #include