rpms/xorg-x11-drv-ati/devel radeon-modeset.patch, NONE, 1.1 xorg-x11-drv-ati.spec, 1.92, 1.93
Dave Airlie (airlied)
fedora-extras-commits at redhat.com
Fri Aug 1 07:01:29 UTC 2008
Author: airlied
Update of /cvs/pkgs/rpms/xorg-x11-drv-ati/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25806
Modified Files:
xorg-x11-drv-ati.spec
Added Files:
radeon-modeset.patch
Log Message:
* Fri Aug 01 2008 Dave Airlie <airlied at redhat.com> 6.8.0-20
- DDX modesetting code
radeon-modeset.patch:
--- NEW FILE radeon-modeset.patch ---
diff --git a/configure.ac b/configure.ac
index b8c18a6..03f7c3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,6 +115,13 @@ if test "$DRI" = yes; then
if test "$have_damage_h" = yes; then
AC_DEFINE(DAMAGE,1,[Use Damage extension])
fi
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$XORG_CFLAGS $DRI_CFLAGS"
+ AC_CHECK_HEADER(xf86drmMode.h,[DRM_MODE=yes],[DRM_MODE=no],[#include "stdint.h"])
+ if test "x$DRM_MODE" = xyes; then
+ AC_DEFINE(XF86DRM_MODE,1,[DRM kernel modesetting])
+ fi
fi
save_CFLAGS="$CFLAGS"
diff --git a/src/Makefile.am b/src/Makefile.am
index 97c686b..9f58788 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,12 +90,13 @@ radeon_drv_ladir = @moduledir@/drivers
radeon_drv_la_SOURCES = \
radeon_accel.c radeon_cursor.c radeon_dga.c \
radeon_driver.c radeon_video.c radeon_bios.c radeon_mm_i2c.c \
- radeon_vip.c radeon_misc.c radeon_probe.c \
+ radeon_vip.c radeon_misc.c radeon_probe.c radeon_memory.c \
legacy_crtc.c legacy_output.c \
radeon_textured_video.c \
radeon_crtc.c radeon_output.c radeon_modes.c radeon_tv.c \
$(RADEON_ATOMBIOS_SOURCES) radeon_atombios.c radeon_atomwrapper.c \
- $(RADEON_DRI_SRCS) $(RADEON_EXA_SOURCES) atombios_output.c atombios_crtc.c
+ $(RADEON_DRI_SRCS) $(RADEON_EXA_SOURCES) atombios_output.c atombios_crtc.c \
+ drmmode_display.c
if XMODES
radeon_drv_la_SOURCES += \
@@ -160,4 +161,5 @@ EXTRA_DIST = \
radeon_pci_device_match_gen.h \
pcidb/ati_pciids.csv \
pcidb/parse_pci_ids.pl \
- radeon_atombios.h
+ radeon_atombios.h \
+ drmmode_display.h
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
new file mode 100644
index 0000000..b329090
--- /dev/null
+++ b/src/drmmode_display.c
@@ -0,0 +1,695 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Dave Airlie <airlied at redhat.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef XF86DRM_MODE
+#include "radeon.h"
+#include "sarea.h"
+
+static Bool drmmode_resize_fb(ScrnInfoPtr scrn, drmmode_ptr drmmode, int width, int height);
+
+static Bool
+drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[0]->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ Bool ret;
+
+ ErrorF("resize called %d %d\n", width, height);
+ ret = drmmode_resize_fb(scrn, drmmode, width, height);
+ scrn->virtualX = width;
+ scrn->virtualY = height;
+ return ret;
+}
+
+static void
+drmmode_ConvertFromKMode(ScrnInfoPtr scrn,
+ struct drm_mode_modeinfo *kmode,
+ DisplayModePtr mode)
+{
+ memset(mode, 0, sizeof(DisplayModeRec));
+ mode->status = MODE_OK;
+
+ mode->Clock = kmode->clock;
+
+ mode->HDisplay = kmode->hdisplay;
+ mode->HSyncStart = kmode->hsync_start;
+ mode->HSyncEnd = kmode->hsync_end;
+ mode->HTotal = kmode->htotal;
+ mode->HSkew = kmode->hskew;
+
+ mode->VDisplay = kmode->vdisplay;
+ mode->VSyncStart = kmode->vsync_start;
+ mode->VSyncEnd = kmode->vsync_end;
+ mode->VTotal = kmode->vtotal;
+ mode->VScan = kmode->vscan;
+
+ mode->Flags = kmode->flags; //& FLAG_BITS;
+ mode->name = strdup(kmode->name);
+
+ if (kmode->type & DRM_MODE_TYPE_DRIVER)
+ mode->type = M_T_DRIVER;
+ if (kmode->type & DRM_MODE_TYPE_PREFERRED)
+ mode->type |= M_T_PREFERRED;
+ xf86SetModeCrtc (mode, scrn->adjustFlags);
+}
+
+static void
+drmmode_ConvertToKMode(ScrnInfoPtr scrn,
+ struct drm_mode_modeinfo *kmode,
+ DisplayModePtr mode)
+{
+ memset(kmode, 0, sizeof(*kmode));
+
+ kmode->clock = mode->Clock;
+ kmode->hdisplay = mode->HDisplay;
+ kmode->hsync_start = mode->HSyncStart;
+ kmode->hsync_end = mode->HSyncEnd;
+ kmode->htotal = mode->HTotal;
+ kmode->hskew = mode->HSkew;
+
+ kmode->vdisplay = mode->VDisplay;
+ kmode->vsync_start = mode->VSyncStart;
+ kmode->vsync_end = mode->VSyncEnd;
+ kmode->vtotal = mode->VTotal;
+ kmode->vscan = mode->VScan;
+
+ kmode->flags = mode->Flags; //& FLAG_BITS;
+ if (mode->name)
+ strncpy(kmode->name, mode->name, DRM_DISPLAY_MODE_LEN);
+ kmode->name[DRM_DISPLAY_MODE_LEN-1] = 0;
+
+}
+
+static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
+ drmmode_xf86crtc_resize
+};
+
+static void
+drmmode_crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode)
+{
+
+}
+
+static Bool
+drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ drmmode_ptr drmmode = drmmode_crtc->drmmode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+ DisplayModeRec saved_mode;
+ uint32_t *output_ids;
+ int output_count = 0;
+ int ret = TRUE;
+ int i;
+ int fb_id;
+ struct drm_mode_modeinfo kmode;
+
+ saved_mode = crtc->mode;
+ saved_x = crtc->x;
+ saved_y = crtc->y;
+ saved_rotation = crtc->rotation;
+
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+
[...4151 lines suppressed...]
+ info->mm.back_buffer = radeon_allocate_memory(pScrn, RADEON_POOL_VRAM, screen_size, 0, 1, "Back Buffer");
+ if (!info->mm.back_buffer) {
+ return FALSE;
+ }
+ radeon_bind_memory(pScrn, info->mm.back_buffer);
+ total_size_bytes += screen_size;
+
+ info->depthPitch = RADEON_ALIGN(pScrn->displayWidth, 32);
+ {
+ int depthCpp = (info->depthBits - 8) / 4;
+ int depth_size = RADEON_ALIGN(pScrn->virtualY, 16) * info->depthPitch * depthCpp;
+ info->mm.depth_buffer = radeon_allocate_memory(pScrn, RADEON_POOL_VRAM, depth_size, 0, 1, "Depth Buffer");
+ if (!info->mm.depth_buffer) {
+ return FALSE;
+ }
+ radeon_bind_memory(pScrn, info->mm.depth_buffer);
+ total_size_bytes += depth_size;
+ }
+ }
+ /* work out from the mm size what the exa / tex sizes need to be */
+ remain_size_bytes = info->mm.vram_size - total_size_bytes;
+
+ info->textureSize = remain_size_bytes / 2;
+
+ ErrorF("texture size is %dK, exa is %dK\n", info->textureSize / 1024, (remain_size_bytes - info->textureSize)/1024);
+
+
+ /* allocate an object for all the EXA bits */
+ /* shove EXA + frontbuffer together until we have EXA pixmap hooks */
+ fb_size_bytes = screen_size + (remain_size_bytes - info->textureSize);
+ ErrorF("fb size is %dK %dK\n", fb_size_bytes / 1024, total_size_bytes / 1024);
+
+ fb_size_bytes = 64 * 1024 * 1024;
+ info->mm.front_buffer = radeon_allocate_memory(pScrn, RADEON_POOL_VRAM, fb_size_bytes, 0, 1, "Front Buffer + EXA");
+ if (!info->mm.front_buffer) {
+ return FALSE;
+ }
+
+ radeon_bind_memory(pScrn, info->mm.front_buffer);
+ if (radeon_map_memory(pScrn, info->mm.front_buffer)) {
+ ErrorF("Failed to map front buffer memory\n");
+ }
+ info->frontPitch = pScrn->displayWidth;
+#if 0
+ info->mm.exa_buffer = radeon_allocate_memory(pScrn, RADEON_POOL_VRAM, remain_size_bytes - info->textureSize, 0, 1, "EXA Memory Buffer");
+ if (!info->mm.exa_buffer) {
+ return FALSE;
+ }
+ radeon_bind_memory(pScrn, info->mm.exa_buffer);
+ if (radeon_map_memory(pScrn, info->mm.exa_buffer)) {
+ ErrorF("Failed to map front buffer memory\n");
+ }
+#endif
+ info->exa->memoryBase = (void *)(unsigned long)info->mm.front_buffer->bus_addr;
+ info->exa->offScreenBase = screen_size;
+ info->exa->memorySize = fb_size_bytes;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Will use %ld kb for X Server offscreen at offset 0x%08lx\n",
+ (info->exa->memorySize - info->exa->offScreenBase) /
+ 1024, info->exa->offScreenBase);
+
+ if (info->directRenderingEnabled) {
+ /* allocate an object for all the textures */
+ info->textureSize /= 2;
+ info->mm.texture_buffer = radeon_allocate_memory(pScrn, RADEON_POOL_VRAM, info->textureSize, 0, 1, "Texture Buffer");
+ if (!info->mm.texture_buffer) {
+ return FALSE;
+ }
+ radeon_bind_memory(pScrn, info->mm.texture_buffer);
+
+ }
+
+ if (info->drm_mode_setting) {
+ drmmode_set_fb(pScrn, &info->drmmode, pScrn->virtualX, RADEON_ALIGN(pScrn->virtualY, 16), stride, info->mm.front_buffer->kernel_bo_handle);
+ }
+ return TRUE;
+}
+
+Bool radeon_setup_gart_mem(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+
+ info->mm.gart_texture_buffer =
+ radeon_allocate_memory(pScrn, RADEON_POOL_GART,
+ info->gartTexMapSize,
+ 0, 1, "GART texture buffers");
+
+ if (!info->mm.gart_texture_buffer) {
+ return FALSE;
+ }
+
+ radeon_bind_memory(pScrn, info->mm.gart_texture_buffer);
+ return TRUE;
+}
+
+uint32_t radeon_create_new_fb(ScrnInfoPtr pScrn, int width, int height, int *pitch)
+{
+ return 0;
+}
+
+
+
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 944ab9f..d039b0b 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -178,6 +178,26 @@ typedef struct
uint32_t get_data_mask;
} RADEONI2CBusRec, *RADEONI2CBusPtr;
+struct radeon_memory {
+ int pool; // memory is VRAM vs GART
+ unsigned long offset;
+ unsigned long end;
+
+ unsigned long size;
+ unsigned long allocated_size;
+ uint64_t bus_addr;
+ int key;
+
+ Bool bound;
+ unsigned long agp_offset;
+ unsigned int pitch;
+ char *name;
+ struct radeon_memory *next, *prev;
+ uint32_t alignment;
+ uint32_t kernel_bo_handle;
+ uint32_t kernel_name;
+};
+
typedef struct _RADEONCrtcPrivateRec {
#ifdef USE_XAA
FBLinearPtr rotate_mem_xaa;
@@ -194,6 +214,8 @@ typedef struct _RADEONCrtcPrivateRec {
uint32_t crtc_offset;
int can_tile;
Bool enabled;
+ struct radeon_memory *cursor;
+
} RADEONCrtcPrivateRec, *RADEONCrtcPrivatePtr;
typedef struct {
diff --git a/src/radeon_sarea.h b/src/radeon_sarea.h
index 80333a4..c33632b 100644
--- a/src/radeon_sarea.h
+++ b/src/radeon_sarea.h
@@ -36,6 +36,7 @@
#ifndef _RADEON_SAREA_H_
#define _RADEON_SAREA_H_
+#if 0
/* WARNING: If you change any of these defines, make sure to change the
* defines in the kernel file (radeon_drm.h)
*/
@@ -229,3 +230,6 @@ typedef struct {
} RADEONSAREAPriv, *RADEONSAREAPrivPtr;
#endif
+
+typedef drm_radeon_sarea_t RADEONSAREAPriv, *RADEONSAREAPrivPtr;
+#endif
diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
index cfa349d..694f10d 100644
--- a/src/radeon_textured_video.c
+++ b/src/radeon_textured_video.c
@@ -179,7 +179,8 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
}
#ifdef XF86DRI
- if (info->directRenderingEnabled && info->DMAForXv)
+ if ((info->directRenderingEnabled || info->drm_mode_setting)
+ && info->DMAForXv )
/* The upload blit only supports multiples of 64 bytes */
dstPitch = (dstPitch + 63) & ~63;
else
@@ -283,7 +284,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
pPriv->h = height;
#ifdef XF86DRI
- if (info->directRenderingEnabled)
+ if (info->directRenderingEnabled || info->drm_mode_setting)
RADEONDisplayTexturedVideoCP(pScrn, pPriv);
else
#endif
diff --git a/src/radeon_video.c b/src/radeon_video.c
index ac60166..d9233a7 100644
--- a/src/radeon_video.c
+++ b/src/radeon_video.c
@@ -288,7 +288,7 @@ void RADEONInitVideo(ScreenPtr pScreen)
if (info->ChipFamily != CHIP_FAMILY_RV250) {
if ((info->ChipFamily < CHIP_FAMILY_RS400)
#ifdef XF86DRI
- || (info->directRenderingEnabled)
+ || (info->directRenderingEnabled || info->drm_mode_setting)
#endif
) {
texturedAdaptor = RADEONSetupImageTexturedVideo(pScreen);
Index: xorg-x11-drv-ati.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-ati/devel/xorg-x11-drv-ati.spec,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- xorg-x11-drv-ati.spec 30 Jul 2008 01:01:29 -0000 1.92
+++ xorg-x11-drv-ati.spec 1 Aug 2008 07:00:59 -0000 1.93
@@ -5,7 +5,7 @@
Summary: Xorg X11 ati video driver
Name: xorg-x11-drv-ati
Version: 6.8.0
-Release: 19%{?dist}
+Release: 20%{?dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X Hardware Support
@@ -19,6 +19,7 @@
# Radeon patches (0-99)
Patch1: radeon-git-upstream-fixes.patch
Patch2: radeon-git-upstream-fixes2.patch
+Patch3: radeon-modeset.patch
Patch4: radeon-6.7.196-faster-ddc.patch
# Rage 128 patches (100-199)
@@ -34,6 +35,7 @@
BuildRequires: xorg-x11-server-sdk >= 1.4.99.1
BuildRequires: mesa-libGL-devel >= 6.4-4
BuildRequires: libdrm-devel >= 2.0-1
+BuildRequires: kernel-headers >= 2.6.27-0.207
BuildRequires: automake autoconf libtool pkgconfig
BuildRequires: xorg-x11-util-macros >= 1.1.5
@@ -48,6 +50,7 @@
%patch1 -p1 -b .git
%patch2 -p1 -b .git2
+%patch3 -p1 -b .modeset
#patch4 -p1 -b .ddc
%patch100 -p1 -b .r128-bios
@@ -91,6 +94,9 @@
%{_mandir}/man4/radeon.4*
%changelog
+* Fri Aug 01 2008 Dave Airlie <airlied at redhat.com> 6.8.0-20
+- DDX modesetting code
+
* Wed Jul 30 2008 Dave Airlie <airlied at redhat.com> 6.8.0-19
- Update to latest upstream release + fixes
More information about the fedora-extras-commits
mailing list