diff --git a/radeon-modeset.patch b/radeon-modeset.patch index ad40c1a..3739c3e 100644 --- a/radeon-modeset.patch +++ b/radeon-modeset.patch @@ -1,3 +1,33 @@ +commit e62421656dcf49633380fa698d5c94394069403f +Author: Dave Airlie +Date: Sat Nov 8 14:48:29 2008 +1000 + + radeon: add DPMS support for connectors + +commit 7bdeb2bfbe91bfd5e5f3b1e11b3f4a717526f0b0 +Author: Dave Airlie +Date: Fri Nov 7 16:20:09 2008 +1000 + + radeon: fix rotation of right-of heads + +commit b4dd210c7186ea5660b902357862c59a856d3993 +Author: Dave Airlie +Date: Mon Nov 3 14:51:43 2008 +1000 + + radeon: respect fb tex percent + trust kernel values + +commit 1261865fa2a4f8174d31fefbf6e134d8c719ee5b +Author: Dave Airlie +Date: Fri Oct 31 15:05:14 2008 +1000 + + radeon: remove workaround hack since kernel is hopefully fixed + +commit 03cfb265dada3233262f40715a9a542ae889f5bc +Author: Dave Airlie +Date: Fri Oct 31 15:04:31 2008 +1000 + + radeon: workaround use after free + commit e3b394a58329df2efe1b57f369cefe6803b5f853 Author: Dave Airlie Date: Thu Oct 30 13:53:02 2008 +1000 @@ -631,10 +661,10 @@ index d65a3e4..ff54329 100644 + radeon_dri_bufmgr.h diff --git a/src/drmmode_display.c b/src/drmmode_display.c new file mode 100644 -index 0000000..7ac30f8 +index 0000000..d3ba7db --- /dev/null +++ b/src/drmmode_display.c -@@ -0,0 +1,771 @@ +@@ -0,0 +1,864 @@ +/* + * Copyright © 2007 Red Hat, Inc. + * @@ -672,6 +702,9 @@ index 0000000..7ac30f8 +#include "radeon_drm.h" +#include "sarea.h" + ++/* DPMS */ ++#define DPMS_SERVER ++#include + +static Bool drmmode_resize_fb(ScrnInfoPtr scrn, drmmode_ptr drmmode, int width, int height); + @@ -754,9 +787,17 @@ index 0000000..7ac30f8 +}; + +static void -+drmmode_crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode) ++drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode) +{ ++ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); ++ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; ++ drmmode_ptr drmmode = drmmode_crtc->drmmode; + ++ /* bonghits in the randr 1.2 - uses dpms to disable crtc - bad buzz */ ++ if (mode == DPMSModeOff) { ++ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, ++ 0, 0, 0, NULL, 0, NULL); ++ } +} + +static PixmapPtr @@ -846,10 +887,12 @@ index 0000000..7ac30f8 + saved_y = crtc->y; + saved_rotation = crtc->rotation; + -+ crtc->mode = *mode; -+ crtc->x = x; -+ crtc->y = y; -+ crtc->rotation = rotation; ++ if (mode) { ++ crtc->mode = *mode; ++ crtc->x = x; ++ crtc->y = y; ++ crtc->rotation = rotation; ++ } + + output_ids = xcalloc(sizeof(uint32_t), xf86_config->num_output); + if (!output_ids) { @@ -857,35 +900,42 @@ index 0000000..7ac30f8 + goto done; + } + -+ for (i = 0; i < xf86_config->num_output; i++) { -+ xf86OutputPtr output = xf86_config->output[i]; -+ drmmode_output_private_ptr drmmode_output; ++ if (mode) { ++ for (i = 0; i < xf86_config->num_output; i++) { ++ xf86OutputPtr output = xf86_config->output[i]; ++ drmmode_output_private_ptr drmmode_output; + -+ if (output->crtc != crtc) -+ continue; ++ if (output->crtc != crtc) ++ continue; + -+ drmmode_output = output->driver_private; -+ output_ids[output_count] = drmmode_output->mode_output->connector_id; -+ output_count++; -+ } ++ drmmode_output = output->driver_private; ++ output_ids[output_count] = drmmode_output->mode_output->connector_id; ++ output_count++; ++ } + -+ if (!xf86CrtcRotate(crtc, mode, rotation)) { -+ goto done; -+ } ++ if (!xf86CrtcRotate(crtc, mode, rotation)) { ++ goto done; ++ } + -+ drmmode_ConvertToKMode(crtc->scrn, &kmode, mode); ++ drmmode_ConvertToKMode(crtc->scrn, &kmode, mode); ++ ++ fb_id = drmmode->fb_id; ++ if (drmmode_crtc->rotate_fb_id) { ++ fb_id = drmmode_crtc->rotate_fb_id; ++ x = y = 0; ++ } ++ else if (fb_id != drmmode_crtc->mode_crtc->buffer_id) ++ copy_fb_contents (drmmode, crtc->scrn, fb_id, x, y, ++ drmmode_crtc->mode_crtc->buffer_id); + ++ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, ++ fb_id, x, y, output_ids, output_count, &kmode); + -+ fb_id = drmmode->fb_id; -+ if (drmmode_crtc->rotate_fb_id) -+ fb_id = drmmode_crtc->rotate_fb_id; -+ copy_fb_contents (drmmode, crtc->scrn, fb_id, x, y, -+ drmmode_crtc->mode_crtc->buffer_id); -+ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, -+ fb_id, x, y, output_ids, output_count, &kmode); ++ if (crtc->scrn->pScreen) ++ xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen); ++ } ++ + -+ if (crtc->scrn->pScreen) -+ xf86CrtcSetScreenSubpixelOrder(crtc->scrn->pScreen); + + +done: @@ -1147,6 +1197,12 @@ index 0000000..7ac30f8 +static void +drmmode_output_dpms(xf86OutputPtr output, int mode) +{ ++ drmmode_output_private_ptr drmmode_output = output->driver_private; ++ drmModeConnectorPtr koutput = drmmode_output->mode_output; ++ drmmode_ptr drmmode = drmmode_output->drmmode; ++ ++ drmModeConnectorSetProperty(drmmode->fd, koutput->connector_id, ++ drmmode_output->dpms_enum_id, mode); + return; +} + @@ -1198,7 +1254,9 @@ index 0000000..7ac30f8 + drmModeConnectorPtr koutput; + drmModeEncoderPtr kencoder; + drmmode_output_private_ptr drmmode_output; ++ drmModePropertyPtr props; + char name[32]; ++ int i; + + koutput = drmModeGetConnector(drmmode->fd, drmmode->mode_res->connectors[num]); + if (!koutput) @@ -1257,6 +1315,18 @@ index 0000000..7ac30f8 + output->possible_crtcs = kencoder->possible_crtcs; + output->possible_clones = kencoder->possible_clones; + ++ for (i = 0; i < koutput->count_props; i++) { ++ props = drmModeGetProperty(drmmode->fd, koutput->props[i]); ++ if (props && (props->flags && DRM_MODE_PROP_ENUM)) { ++ if (!strcmp(props->name, "DPMS")) { ++ drmmode_output->dpms_enum_id = koutput->props[i]; ++ drmModeFreeProperty(props); ++ break; ++ } ++ drmModeFreeProperty(props); ++ } ++ } ++ + return; +} + @@ -1405,13 +1475,66 @@ index 0000000..7ac30f8 + } +} + ++Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode) ++{ ++ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); ++ int c, o; ++ ++ for (c = 0; c < config->num_crtc; c++) { ++ xf86CrtcPtr crtc = config->crtc[c]; ++ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; ++ xf86OutputPtr output = NULL; ++ int o; ++ ++ /* Skip disabled CRTCs */ ++ if (!crtc->enabled) { ++ drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, ++ 0, 0, 0, NULL, 0, NULL); ++ continue; ++ } ++ ++ if (config->output[config->compat_output]->crtc == crtc) ++ output = config->output[config->compat_output]; ++ else ++ { ++ for (o = 0; o < config->num_output; o++) ++ if (config->output[o]->crtc == crtc) ++ { ++ output = config->output[o]; ++ break; ++ } ++ } ++ /* paranoia */ ++ if (!output) ++ continue; ++ ++ /* Mark that we'll need to re-set the mode for sure */ ++ memset(&crtc->mode, 0, sizeof(crtc->mode)); ++ if (!crtc->desiredMode.CrtcHDisplay) ++ { ++ DisplayModePtr mode = xf86OutputFindClosestMode (output, pScrn->currentMode); ++ ++ if (!mode) ++ return FALSE; ++ crtc->desiredMode = *mode; ++ crtc->desiredRotation = RR_Rotate_0; ++ crtc->desiredX = 0; ++ crtc->desiredY = 0; ++ } ++ ++ if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation, ++ crtc->desiredX, crtc->desiredY)) ++ return FALSE; ++ } ++ return TRUE; ++} +#endif diff --git a/src/drmmode_display.h b/src/drmmode_display.h new file mode 100644 -index 0000000..691d62e +index 0000000..dbb6412 --- /dev/null +++ b/src/drmmode_display.h -@@ -0,0 +1,74 @@ +@@ -0,0 +1,76 @@ +/* + * Copyright © 2007 Red Hat, Inc. + * @@ -1475,6 +1598,7 @@ index 0000000..691d62e + drmModeConnectorPtr mode_output; + drmModeEncoderPtr mode_encoder; + drmModePropertyBlobPtr edid_blob; ++ int dpms_enum_id; +} drmmode_output_private_rec, *drmmode_output_private_ptr; + + @@ -1484,6 +1608,7 @@ index 0000000..691d62e +extern Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData, dri_bo **bo); +extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, void *ptr, uint32_t handle); +void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y, int flags); ++extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode); +#endif +#endif diff --git a/src/radeon.h b/src/radeon.h @@ -2485,10 +2610,10 @@ index 0000000..0d79b58 +#endif diff --git a/src/radeon_bufmgr_gem.c b/src/radeon_bufmgr_gem.c new file mode 100644 -index 0000000..7a41852 +index 0000000..684491f --- /dev/null +++ b/src/radeon_bufmgr_gem.c -@@ -0,0 +1,538 @@ +@@ -0,0 +1,537 @@ +/************************************************************************** + * + * Copyright © 2007-2008 Red Hat Inc. @@ -2691,7 +2816,6 @@ index 0000000..7a41852 + if (gem_bo->map_count++ != 0) + return 0; + -+ /*gem_bo->touched = 1; workaround */ + args.handle = gem_bo->gem_handle; + args.offset = 0; + args.size = gem_bo->bo.size; @@ -4337,7 +4461,7 @@ index 0000000..041671f + +#endif diff --git a/src/radeon_driver.c b/src/radeon_driver.c -index c759bd6..0efe9de 100644 +index c759bd6..5ee5d95 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -224,7 +224,10 @@ radeonShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode, @@ -4907,14 +5031,14 @@ index c759bd6..0efe9de 100644 + xf86CrtcSetSizeRange (pScrn, 320, 200, crtc_max_X, crtc_max_Y); + + RADEONPreInitDDC(pScrn); -+ -+ if (!RADEONPreInitControllers(pScrn)) -+ goto fail; - RADEONPreInitDDC(pScrn); ++ if (!RADEONPreInitControllers(pScrn)) ++ goto fail; - if (!RADEONPreInitControllers(pScrn)) - goto fail; + + ErrorF("before xf86InitialConfiguration\n"); + + if (!xf86InitialConfiguration (pScrn, FALSE)) @@ -4925,13 +5049,18 @@ index c759bd6..0efe9de 100644 + + ErrorF("after xf86InitialConfiguration\n"); +- ErrorF("before xf86InitialConfiguration\n"); + } else { +#ifdef XF86DRM_MODE + char *bus_id; + if (!radeon_alloc_dri(pScrn)) + return FALSE; -- ErrorF("before xf86InitialConfiguration\n"); +- if (!xf86InitialConfiguration (pScrn, FALSE)) +- { +- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); +- goto fail; +- } + bus_id = DRICreatePCIBusID(info->PciInfo); + if (drmmode_pre_init(pScrn, &info->drmmode, bus_id, "radeon", pScrn->bitsPerPixel / 8) == FALSE) { + xfree(bus_id); @@ -4939,11 +5068,7 @@ index c759bd6..0efe9de 100644 + goto fail; + } -- if (!xf86InitialConfiguration (pScrn, FALSE)) -- { -- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); -- goto fail; -- } +- ErrorF("after xf86InitialConfiguration\n"); + info->drmmode.create_new_fb = radeon_create_new_fb; + info->dri->drmFD = info->drmmode.fd; + xfree(bus_id); @@ -4963,8 +5088,7 @@ index c759bd6..0efe9de 100644 + { + struct drm_radeon_getparam gp; + int value; - -- ErrorF("after xf86InitialConfiguration\n"); ++ + memset(&gp, 0, sizeof(gp)); + gp.param = RADEON_PARAM_FB_LOCATION; + gp.value = &value; @@ -5285,15 +5409,25 @@ index c759bd6..0efe9de 100644 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n"); -@@ -3649,6 +3816,7 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, +@@ -3649,10 +3816,16 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, return FALSE; } } + pScrn->pScreen = pScreen; /* set the modes with desired rotation, etc. */ - if (!xf86SetDesiredModes (pScrn)) -@@ -5133,7 +5301,7 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +- if (!xf86SetDesiredModes (pScrn)) ++ if (info->drm_mode_setting) { ++ if (!drmmode_set_desired_modes(pScrn, &info->drmmode)) + return FALSE; ++ } else { ++ if (!xf86SetDesiredModes (pScrn)) ++ return FALSE; ++ } + + /* Provide SaveScreen & wrap BlockHandler and CloseScreen */ + /* Wrap CloseScreen */ +@@ -5133,7 +5306,7 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) #ifdef XF86DRI Bool CPStarted = info->cp->CPStarted; @@ -5302,7 +5436,7 @@ index c759bd6..0efe9de 100644 DRILock(pScrn->pScreen, 0); RADEONCP_STOP(pScrn, info); } -@@ -5156,8 +5324,10 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +@@ -5156,8 +5329,10 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) #endif } @@ -5315,7 +5449,7 @@ index c759bd6..0efe9de 100644 ret = xf86SetSingleMode (pScrn, mode, RR_Rotate_0); -@@ -5169,15 +5339,18 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +@@ -5169,15 +5344,18 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) /* xf86SetRootClip would do, but can't access that here */ } @@ -5341,7 +5475,7 @@ index c759bd6..0efe9de 100644 } #endif -@@ -5375,6 +5548,11 @@ void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) +@@ -5375,6 +5553,11 @@ void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) xf86OutputPtr output = config->output[config->compat_output]; xf86CrtcPtr crtc = output->crtc; @@ -5353,7 +5487,7 @@ index c759bd6..0efe9de 100644 #ifdef XF86DRI if (info->cp->CPStarted && pScrn->pScreen) DRILock(pScrn->pScreen, 0); #endif -@@ -5410,67 +5588,79 @@ Bool RADEONEnterVT(int scrnIndex, int flags) +@@ -5410,67 +5593,84 @@ Bool RADEONEnterVT(int scrnIndex, int flags) xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "RADEONEnterVT\n"); @@ -5437,12 +5571,18 @@ index c759bd6..0efe9de 100644 pScrn->vtSema = TRUE; +- if (!xf86SetDesiredModes(pScrn)) + if (!info->drm_mode_setting) + for (i = 0; i < config->num_crtc; i++) + radeon_crtc_modeset_ioctl(config->crtc[i], TRUE); + - if (!xf86SetDesiredModes(pScrn)) ++ if (info->drm_mode_setting) { ++ if (!drmmode_set_desired_modes(pScrn, &info->drmmode)) ++ return FALSE; ++ } else { ++ if (!xf86SetDesiredModes(pScrn)) return FALSE; ++ } - if (info->ChipFamily < CHIP_FAMILY_R600) - RADEONRestoreSurfaces(pScrn, info->ModeReg); @@ -5478,7 +5618,7 @@ index c759bd6..0efe9de 100644 } #endif /* this will get XVideo going again, but only if XVideo was initialised -@@ -5482,7 +5672,7 @@ Bool RADEONEnterVT(int scrnIndex, int flags) +@@ -5482,7 +5682,7 @@ Bool RADEONEnterVT(int scrnIndex, int flags) RADEONEngineRestore(pScrn); #ifdef XF86DRI @@ -5487,7 +5627,7 @@ index c759bd6..0efe9de 100644 RADEONCP_START(pScrn, info); DRIUnlock(pScrn->pScreen); } -@@ -5505,17 +5695,18 @@ void RADEONLeaveVT(int scrnIndex, int flags) +@@ -5505,17 +5705,18 @@ void RADEONLeaveVT(int scrnIndex, int flags) "RADEONLeaveVT\n"); #ifdef XF86DRI if (RADEONPTR(pScrn)->directRenderingInited) { @@ -5517,7 +5657,7 @@ index c759bd6..0efe9de 100644 /* Make sure 3D clients will re-upload textures to video RAM */ if (info->dri->textureSize) { -@@ -5551,10 +5742,15 @@ void RADEONLeaveVT(int scrnIndex, int flags) +@@ -5551,10 +5752,15 @@ void RADEONLeaveVT(int scrnIndex, int flags) xf86_hide_cursors (pScrn); @@ -5536,7 +5676,7 @@ index c759bd6..0efe9de 100644 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "Ok, leaving now...\n"); -@@ -5599,7 +5795,8 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) +@@ -5599,7 +5805,8 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) #endif /* USE_XAA */ if (pScrn->vtSema) { @@ -5546,7 +5686,7 @@ index c759bd6..0efe9de 100644 } xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, -@@ -5634,6 +5831,12 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) +@@ -5634,6 +5841,12 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) info->DGAModes = NULL; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, "Unmapping memory\n"); @@ -7399,10 +7539,10 @@ index 2a9ee94..0423571 100644 ExaOffscreenArea *area = mem_struct; diff --git a/src/radeon_memory.c b/src/radeon_memory.c new file mode 100644 -index 0000000..94ff656 +index 0000000..244c2de --- /dev/null +++ b/src/radeon_memory.c -@@ -0,0 +1,407 @@ +@@ -0,0 +1,412 @@ + +#include +#include @@ -7603,13 +7743,15 @@ index 0000000..94ff656 +Bool radeon_free_all_memory(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); -+ struct radeon_memory *mem; ++ struct radeon_memory *mem, *tmp; + int i; + + for (i = 0; i < 2; i++) { -+ for (mem = info->mm.bo_list[i]; mem != NULL; -+ mem = mem->next) { ++ ++ for (mem = info->mm.bo_list[i]; mem != NULL; ) { ++ tmp = mem->next; + radeon_free_memory(pScrn, mem); ++ mem = tmp; + } + } + return TRUE; @@ -7664,7 +7806,7 @@ index 0000000..94ff656 + int cpp = info->CurrentLayout.pixel_bytes; + int screen_size; + int stride = pScrn->displayWidth * cpp; -+ int total_size_bytes = (16*1024*1024)+32*1024, remain_size_bytes; ++ int total_size_bytes = 0, remain_size_bytes; + int fb_size_bytes; + + @@ -7728,7 +7870,10 @@ index 0000000..94ff656 + /* 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->dri->textureSize = remain_size_bytes / 2; ++ if (info->dri->textureSize > 0) ++ info->dri->textureSize = (remain_size_bytes / 100) * info->dri->textureSize; ++ else ++ info->dri->textureSize = remain_size_bytes / 2; + + ErrorF("texture size is %dK, exa is %dK\n", info->dri->textureSize / 1024, (remain_size_bytes - info->dri->textureSize)/1024); + diff --git a/xorg-x11-drv-ati.spec b/xorg-x11-drv-ati.spec index f81980c..3c06884 100644 --- a/xorg-x11-drv-ati.spec +++ b/xorg-x11-drv-ati.spec @@ -5,7 +5,7 @@ Summary: Xorg X11 ati video driver Name: xorg-x11-drv-ati Version: 6.9.0 -Release: 41%{?dist} +Release: 42%{?dist} URL: http://www.x.org License: MIT Group: User Interface/X Hardware Support @@ -82,6 +82,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man4/radeon.4* %changelog +* Sat Nov 08 2008 Dave Airlie 6.9.0-42 +- radeon-modeset.patch: fix rotation + dpms + * Sat Nov 01 2008 Dave Airlie 6.9.0-41 - radeon-modeset.patch - hopefully speed up mozilla again