From 681966ce6548c6f47b087eb7e369674b7ddbaade Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 22 Feb 2007 11:45:43 -0800 Subject: [PATCH 1/8] Disable unused functions after configuring the remaining resources. This eliminates an unsightly flash of the hardware cursor during X server startup. --- src/i830_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i830_driver.c b/src/i830_driver.c index e46c0572..bb803362 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -3049,8 +3049,6 @@ I830EnterVT(int scrnIndex, int flags) ResetState(pScrn, FALSE); SetHWOperatingState(pScrn); - xf86DisableUnusedFunctions(pScrn); - for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; @@ -3070,6 +3068,8 @@ I830EnterVT(int scrnIndex, int flags) return FALSE; } + xf86DisableUnusedFunctions(pScrn); + i830DumpRegs (pScrn); i830DescribeOutputConfiguration(pScrn); From dd24d2a082b41abc466391c37a9b3d066586dc55 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 22 Feb 2007 11:46:44 -0800 Subject: [PATCH 2/8] Remove copied X server headers from driver. These two headers were copied during mode setting development; as that code is now inside the server, these files are no longer needed here. --- src/xf86Optrec.h | 112 ----------- src/xf86Parser.h | 483 ----------------------------------------------- 2 files changed, 595 deletions(-) delete mode 100644 src/xf86Optrec.h delete mode 100644 src/xf86Parser.h diff --git a/src/xf86Optrec.h b/src/xf86Optrec.h deleted file mode 100644 index 183b8572..00000000 --- a/src/xf86Optrec.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * - * Copyright (c) 1997 Metro Link Incorporated - * - * 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 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 X CONSORTIUM 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. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ -/* - * Copyright (c) 1997-2001 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file contains the Option Record that is passed between the Parser, - * and Module setup procs. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _xf86Optrec_h_ -#define _xf86Optrec_h_ -#include - -/* - * all records that need to be linked lists should contain a GenericList as - * their first field. - */ -typedef struct generic_list_rec -{ - void *next; -} -GenericListRec, *GenericListPtr, *glp; - -/* - * All options are stored using this data type. - */ -typedef struct -{ - GenericListRec list; - char *opt_name; - char *opt_val; - int opt_used; - char *opt_comment; -} -XF86OptionRec, *XF86OptionPtr; - - -XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val); -XF86OptionPtr xf86optionListDup(XF86OptionPtr opt); -void xf86optionListFree(XF86OptionPtr opt); -char *xf86optionName(XF86OptionPtr opt); -char *xf86optionValue(XF86OptionPtr opt); -XF86OptionPtr xf86newOption(char *name, char *value); -XF86OptionPtr xf86nextOption(XF86OptionPtr list); -XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name); -char *xf86findOptionValue(XF86OptionPtr list, const char *name); -int xf86findOptionBoolean (XF86OptionPtr, const char *, int); -XF86OptionPtr xf86optionListCreate(const char **options, int count, int used); -XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail); -char *xf86configStrdup (const char *s); -int xf86nameCompare (const char *s1, const char *s2); -char *xf86uLongToString(unsigned long i); -void xf86debugListOptions(XF86OptionPtr); -XF86OptionPtr xf86parseOption(XF86OptionPtr head); -void xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs); - - -#endif /* _xf86Optrec_h_ */ diff --git a/src/xf86Parser.h b/src/xf86Parser.h deleted file mode 100644 index a6829273..00000000 --- a/src/xf86Parser.h +++ /dev/null @@ -1,483 +0,0 @@ -/* - * - * Copyright (c) 1997 Metro Link Incorporated - * - * 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 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 X CONSORTIUM 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. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file contains the external interfaces for the XFree86 configuration - * file parser. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _xf86Parser_h_ -#define _xf86Parser_h_ - -#include "xf86Optrec.h" - -#define HAVE_PARSER_DECLS - -typedef struct -{ - char *file_logfile; - char *file_rgbpath; - char *file_modulepath; - char *file_inputdevs; - char *file_fontpath; - char *file_comment; -} -XF86ConfFilesRec, *XF86ConfFilesPtr; - -/* Values for load_type */ -#define XF86_LOAD_MODULE 0 -#define XF86_LOAD_DRIVER 1 - -typedef struct -{ - GenericListRec list; - int load_type; - char *load_name; - XF86OptionPtr load_opt; - char *load_comment; - int ignore; -} -XF86LoadRec, *XF86LoadPtr; - -typedef struct -{ - XF86LoadPtr mod_load_lst; - char *mod_comment; -} -XF86ConfModuleRec, *XF86ConfModulePtr; - -#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard" - -#define CONF_IMPLICIT_POINTER "Implicit Core Pointer" - -#define XF86CONF_PHSYNC 0x0001 -#define XF86CONF_NHSYNC 0x0002 -#define XF86CONF_PVSYNC 0x0004 -#define XF86CONF_NVSYNC 0x0008 -#define XF86CONF_INTERLACE 0x0010 -#define XF86CONF_DBLSCAN 0x0020 -#define XF86CONF_CSYNC 0x0040 -#define XF86CONF_PCSYNC 0x0080 -#define XF86CONF_NCSYNC 0x0100 -#define XF86CONF_HSKEW 0x0200 /* hskew provided */ -#define XF86CONF_BCAST 0x0400 -#define XF86CONF_CUSTOM 0x0800 /* timing numbers customized by editor */ -#define XF86CONF_VSCAN 0x1000 - -typedef struct -{ - GenericListRec list; - char *ml_identifier; - int ml_clock; - int ml_hdisplay; - int ml_hsyncstart; - int ml_hsyncend; - int ml_htotal; - int ml_vdisplay; - int ml_vsyncstart; - int ml_vsyncend; - int ml_vtotal; - int ml_vscan; - int ml_flags; - int ml_hskew; - char *ml_comment; -} -XF86ConfModeLineRec, *XF86ConfModeLinePtr; - -typedef struct -{ - GenericListRec list; - char *vp_identifier; - XF86OptionPtr vp_option_lst; - char *vp_comment; -} -XF86ConfVideoPortRec, *XF86ConfVideoPortPtr; - -typedef struct -{ - GenericListRec list; - char *va_identifier; - char *va_vendor; - char *va_board; - char *va_busid; - char *va_driver; - XF86OptionPtr va_option_lst; - XF86ConfVideoPortPtr va_port_lst; - char *va_fwdref; - char *va_comment; -} -XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr; - -#define CONF_MAX_HSYNC 8 -#define CONF_MAX_VREFRESH 8 - -typedef struct -{ - float hi, lo; -} -parser_range; - -typedef struct -{ - int red, green, blue; -} -parser_rgb; - -typedef struct -{ - GenericListRec list; - char *modes_identifier; - XF86ConfModeLinePtr mon_modeline_lst; - char *modes_comment; -} -XF86ConfModesRec, *XF86ConfModesPtr; - -typedef struct -{ - GenericListRec list; - char *ml_modes_str; - XF86ConfModesPtr ml_modes; -} -XF86ConfModesLinkRec, *XF86ConfModesLinkPtr; - -typedef struct -{ - GenericListRec list; - char *mon_identifier; - char *mon_vendor; - char *mon_modelname; - int mon_width; /* in mm */ - int mon_height; /* in mm */ - XF86ConfModeLinePtr mon_modeline_lst; - int mon_n_hsync; - parser_range mon_hsync[CONF_MAX_HSYNC]; - int mon_n_vrefresh; - parser_range mon_vrefresh[CONF_MAX_VREFRESH]; - float mon_gamma_red; - float mon_gamma_green; - float mon_gamma_blue; - XF86OptionPtr mon_option_lst; - XF86ConfModesLinkPtr mon_modes_sect_lst; - char *mon_comment; -} -XF86ConfMonitorRec, *XF86ConfMonitorPtr; - -#define CONF_MAXDACSPEEDS 4 -#define CONF_MAXCLOCKS 128 - -typedef struct -{ - GenericListRec list; - char *dev_identifier; - char *dev_vendor; - char *dev_board; - char *dev_chipset; - char *dev_busid; - char *dev_card; - char *dev_driver; - char *dev_ramdac; - int dev_dacSpeeds[CONF_MAXDACSPEEDS]; - int dev_videoram; - int dev_textclockfreq; - unsigned long dev_bios_base; - unsigned long dev_mem_base; - unsigned long dev_io_base; - char *dev_clockchip; - int dev_clocks; - int dev_clock[CONF_MAXCLOCKS]; - int dev_chipid; - int dev_chiprev; - int dev_irq; - int dev_screen; - XF86OptionPtr dev_option_lst; - char *dev_comment; -} -XF86ConfDeviceRec, *XF86ConfDevicePtr; - -typedef struct -{ - GenericListRec list; - char *mode_name; -} -XF86ModeRec, *XF86ModePtr; - -typedef struct -{ - GenericListRec list; - int disp_frameX0; - int disp_frameY0; - int disp_virtualX; - int disp_virtualY; - int disp_depth; - int disp_bpp; - char *disp_visual; - parser_rgb disp_weight; - parser_rgb disp_black; - parser_rgb disp_white; - XF86ModePtr disp_mode_lst; - XF86OptionPtr disp_option_lst; - char *disp_comment; -} -XF86ConfDisplayRec, *XF86ConfDisplayPtr; - -typedef struct -{ - XF86OptionPtr flg_option_lst; - char *flg_comment; -} -XF86ConfFlagsRec, *XF86ConfFlagsPtr; - -typedef struct -{ - GenericListRec list; - char *al_adaptor_str; - XF86ConfVideoAdaptorPtr al_adaptor; -} -XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr; - -typedef struct -{ - GenericListRec list; - char *scrn_identifier; - char *scrn_obso_driver; - int scrn_defaultdepth; - int scrn_defaultbpp; - int scrn_defaultfbbpp; - char *scrn_monitor_str; - XF86ConfMonitorPtr scrn_monitor; - char *scrn_device_str; - XF86ConfDevicePtr scrn_device; - XF86ConfAdaptorLinkPtr scrn_adaptor_lst; - XF86ConfDisplayPtr scrn_display_lst; - XF86OptionPtr scrn_option_lst; - char *scrn_comment; -} -XF86ConfScreenRec, *XF86ConfScreenPtr; - -typedef struct -{ - GenericListRec list; - char *inp_identifier; - char *inp_driver; - XF86OptionPtr inp_option_lst; - char *inp_comment; -} -XF86ConfInputRec, *XF86ConfInputPtr; - -typedef struct -{ - GenericListRec list; - XF86ConfInputPtr iref_inputdev; - char *iref_inputdev_str; - XF86OptionPtr iref_option_lst; -} -XF86ConfInputrefRec, *XF86ConfInputrefPtr; - -/* Values for adj_where */ -#define CONF_ADJ_OBSOLETE -1 -#define CONF_ADJ_ABSOLUTE 0 -#define CONF_ADJ_RIGHTOF 1 -#define CONF_ADJ_LEFTOF 2 -#define CONF_ADJ_ABOVE 3 -#define CONF_ADJ_BELOW 4 -#define CONF_ADJ_RELATIVE 5 - -typedef struct -{ - GenericListRec list; - int adj_scrnum; - XF86ConfScreenPtr adj_screen; - char *adj_screen_str; - XF86ConfScreenPtr adj_top; - char *adj_top_str; - XF86ConfScreenPtr adj_bottom; - char *adj_bottom_str; - XF86ConfScreenPtr adj_left; - char *adj_left_str; - XF86ConfScreenPtr adj_right; - char *adj_right_str; - int adj_where; - int adj_x; - int adj_y; - char *adj_refscreen; -} -XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr; - -typedef struct -{ - GenericListRec list; - char *inactive_device_str; - XF86ConfDevicePtr inactive_device; -} -XF86ConfInactiveRec, *XF86ConfInactivePtr; - -typedef struct -{ - GenericListRec list; - char *lay_identifier; - XF86ConfAdjacencyPtr lay_adjacency_lst; - XF86ConfInactivePtr lay_inactive_lst; - XF86ConfInputrefPtr lay_input_lst; - XF86OptionPtr lay_option_lst; - char *lay_comment; -} -XF86ConfLayoutRec, *XF86ConfLayoutPtr; - -typedef struct -{ - GenericListRec list; - char *vs_name; - char *vs_identifier; - XF86OptionPtr vs_option_lst; - char *vs_comment; -} -XF86ConfVendSubRec, *XF86ConfVendSubPtr; - -typedef struct -{ - GenericListRec list; - char *vnd_identifier; - XF86OptionPtr vnd_option_lst; - XF86ConfVendSubPtr vnd_sub_lst; - char *vnd_comment; -} -XF86ConfVendorRec, *XF86ConfVendorPtr; - -typedef struct -{ - GenericListRec list; - int buf_count; - int buf_size; - char *buf_flags; - char *buf_comment; -} -XF86ConfBuffersRec, *XF86ConfBuffersPtr; - -typedef struct -{ - char *dri_group_name; - int dri_group; - int dri_mode; - XF86ConfBuffersPtr dri_buffers_lst; - char *dri_comment; -} -XF86ConfDRIRec, *XF86ConfDRIPtr; - -typedef struct -{ - XF86OptionPtr ext_option_lst; - char *extensions_comment; -} -XF86ConfExtensionsRec, *XF86ConfExtensionsPtr; - -typedef struct -{ - XF86ConfFilesPtr conf_files; - XF86ConfModulePtr conf_modules; - XF86ConfFlagsPtr conf_flags; - XF86ConfVideoAdaptorPtr conf_videoadaptor_lst; - XF86ConfModesPtr conf_modes_lst; - XF86ConfMonitorPtr conf_monitor_lst; - XF86ConfDevicePtr conf_device_lst; - XF86ConfScreenPtr conf_screen_lst; - XF86ConfInputPtr conf_input_lst; - XF86ConfLayoutPtr conf_layout_lst; - XF86ConfVendorPtr conf_vendor_lst; - XF86ConfDRIPtr conf_dri; - XF86ConfExtensionsPtr conf_extensions; - char *conf_comment; -} -XF86ConfigRec, *XF86ConfigPtr; - -typedef struct -{ - int token; /* id of the token */ - char *name; /* pointer to the LOWERCASED name */ -} -xf86ConfigSymTabRec, *xf86ConfigSymTabPtr; - -/* - * prototypes for public functions - */ -extern const char *xf86openConfigFile (const char *, const char *, - const char *); -extern void xf86setBuiltinConfig(const char *config[]); -extern XF86ConfigPtr xf86readConfigFile (void); -extern void xf86closeConfigFile (void); -extern void xf86freeConfig (XF86ConfigPtr p); -extern int xf86writeConfigFile (const char *, XF86ConfigPtr); -XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p); -XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list); -XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p); -XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p); -XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); -XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); -XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); -XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); -XF86ConfVendorPtr xf86findVendor(const char *name, XF86ConfVendorPtr list); -XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, - XF86ConfVideoAdaptorPtr p); - -GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new); -int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2); - -int xf86pathIsAbsolute(const char *path); -int xf86pathIsSafe(const char *path); -char *xf86addComment(char *cur, char *add); - -#endif /* _xf86Parser_h_ */ From 435d35558d8135a2c1724dfd813fb4a9a4e14178 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 3 Mar 2007 22:46:31 -0800 Subject: [PATCH 3/8] Update for Aaron's xserver changes. Add xf86CrtcConfigFuncs to xf86CrtcConfigInit Add canGrow option to xf86InitialConfiguration --- src/i830_driver.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/i830_driver.c b/src/i830_driver.c index 5ba96a53..3c10ffce 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -778,6 +778,18 @@ I830IsPrimary(ScrnInfoPtr pScrn) return TRUE; } +static Bool +i830_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) +{ + scrn->virtualX = width; + scrn->virtualY = height; + return TRUE; +} + +static const xf86CrtcConfigFuncsRec i830_xf86crtc_config_funcs = { + i830_xf86crtc_resize +}; + #define HOTKEY_BIOS_SWITCH 0 #define HOTKEY_DRIVER_NOTIFY 1 @@ -1091,7 +1103,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) (unsigned long)pI830->MMIOAddr); /* Allocate an xf86CrtcConfig */ - xf86CrtcConfigInit (pScrn); + xf86CrtcConfigInit (pScrn, &i830_xf86crtc_config_funcs); xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); /* See i830_exa.c comments for why we limit the framebuffer size like this. @@ -1282,7 +1294,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) output->status = (*output->funcs->detect) (output); } - if (!xf86InitialConfiguration (pScrn)) + if (!xf86InitialConfiguration (pScrn, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); RestoreHWState(pScrn); From 6aeb855b9d4e03d458773240a9c0c9c1edd3e403 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 4 Mar 2007 17:11:40 -0800 Subject: [PATCH 4/8] Shadow pixmaps use fixed offset of 0. Shadow pixmap contents are copied from the main frame buffer and contain only the bits displayed by the crtc, not the whole frame buffer. The crtc origin is always interpreted by the shadow copying code, the frame buffer itself doesn't move. --- src/i830_display.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/i830_display.c b/src/i830_display.c index e9666de0..67744d59 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -359,10 +359,11 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; int pipe = intel_crtc->pipe; - unsigned long Start; + unsigned long Start, Offset; int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE); int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF); + Offset = ((y * pScrn->displayWidth + x) * pI830->cpp); if (pI830->front_buffer == NULL) { /* During startup we may be called as part of monitor detection while * there is no memory allocation done, so just supply a dummy base @@ -370,7 +371,9 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) */ Start = 0; } else if (crtc->rotatedData != NULL) { + /* offset is done by shadow painting code, not here */ Start = (char *)crtc->rotatedData - (char *)pI830->FbBase; + Offset = 0; } else if (I830IsPrimary(pScrn)) { Start = pI830->front_buffer->offset; } else { @@ -379,12 +382,12 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) } if (IS_I965G(pI830)) { - OUTREG(dspbase, ((y * pScrn->displayWidth + x) * pI830->cpp)); + OUTREG(dspbase, Offset); (void) INREG(dspbase); OUTREG(dspsurf, Start); (void) INREG(dspsurf); } else { - OUTREG(dspbase, Start + ((y * pScrn->displayWidth + x) * pI830->cpp)); + OUTREG(dspbase, Start + Offset); (void) INREG(dspbase); } } From b7b6063e62927dd135e118c433f48b4d0b5fe246 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 4 Mar 2007 15:53:50 -0800 Subject: [PATCH 5/8] Add a little BIOS dumper program. This isn't actually tested yet as libpciaccess doesn't do rom access on non-linux yet. --- src/bios_reader/.gitignore | 1 + src/bios_reader/Makefile.am | 11 +++- src/bios_reader/bios_dumper.c | 98 +++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 src/bios_reader/bios_dumper.c diff --git a/src/bios_reader/.gitignore b/src/bios_reader/.gitignore index 3e325072..49312f2d 100644 --- a/src/bios_reader/.gitignore +++ b/src/bios_reader/.gitignore @@ -1 +1,2 @@ +bios_dumper bios_reader diff --git a/src/bios_reader/Makefile.am b/src/bios_reader/Makefile.am index a5c81a6c..bba969b3 100644 --- a/src/bios_reader/Makefile.am +++ b/src/bios_reader/Makefile.am @@ -1,4 +1,13 @@ AM_CFLAGS = @XORG_CFLAGS@ @XMODES_CFLAGS@ -noinst_PROGRAMS = bios_reader +noinst_PROGRAMS = bios_reader $(BIOS_DUMPER) +if HAVE_PCIACCESS +BIOS_DUMPER = bios_dumper + +bios_dumper_SOURCES = bios_dumper.c + +bios_dumper_CFLAGS = $(PCIACCESS_CFLAGS) +bios_dumper_LDADD = $(PCIACCESS_LIBS) + +endif diff --git a/src/bios_reader/bios_dumper.c b/src/bios_reader/bios_dumper.c new file mode 100644 index 00000000..071419bc --- /dev/null +++ b/src/bios_reader/bios_dumper.c @@ -0,0 +1,98 @@ +/* + * Copyright © 2007 Intel Corporation + * + * 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: + * Eric Anholt + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static void usage(void) +{ + fprintf(stderr, "usage: bios_dumper \n"); + exit(1); +} + +int main(int argc, char **argv) +{ + struct pci_device *dev; + void *bios; + int err, fd; + + if (argc != 2) + usage(); + + err = pci_system_init(); + if (err != 0) { + fprintf(stderr, "Couldn't initialize PCI system: %s\n", strerror(err)); + exit(1); + } + + /* Grab the graphics card */ + dev = pci_device_find_by_slot(0, 0, 2, 0); + if (dev == NULL) + errx(1, "Couldn't find graphics card"); + + if (dev->vendor_id != 0x8086) + errx(1, "Graphics card is non-intel"); + + err = pci_device_probe(dev); + if (err != 0) { + fprintf(stderr, "Couldn't probe graphics card: %s\n", strerror(err)); + exit(1); + } + + bios = malloc(dev->rom_size); + if (bios == NULL) + errx(1, "Couldn't allocate memory for BIOS data\n"); + + err = pci_device_read_rom(dev, bios); + if (err != 0) { + fprintf(stderr, "Couldn't read graphics card ROM: %s\n", + strerror(err)); + exit(1); + } + + fd = open(argv[1], O_RDWR | O_CREAT | O_TRUNC); + if (fd < 0) { + fprintf(stderr, "Couldn't open output: %s\n", strerror(errno)); + exit(1); + } + + if (write(fd, bios, dev->rom_size) < dev->rom_size) { + fprintf(stderr, "Couldn't write BIOS data: %s\n", strerror(errno)); + exit(1); + } + + close(fd); + pci_system_cleanup(); + + return 0; +} From fc7d43c2b6b98be597152fbd88024273edd931d0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 4 Mar 2007 17:14:30 -0800 Subject: [PATCH 6/8] Use -f for ln of server source. Otherwise, changing paths didn't take effect. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 775e87f0..772b40bd 100644 --- a/configure.ac +++ b/configure.ac @@ -145,13 +145,13 @@ if test -d "$XSERVER_SOURCE"; then if test -f src/modes/xf86Modes.h; then : else - ln -s $XSERVER_SOURCE/hw/xfree86/modes src/modes + ln -sf $XSERVER_SOURCE/hw/xfree86/modes src/modes fi if test -f src/parser/xf86Parser.h; then : else - ln -s $XSERVER_SOURCE/hw/xfree86/parser src/parser + ln -sf $XSERVER_SOURCE/hw/xfree86/parser src/parser fi fi AC_SUBST([XMODES_CFLAGS]) From b27fa2c257ccc49c6f29a20a3e672ebaaf58e7aa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 4 Mar 2007 17:15:45 -0800 Subject: [PATCH 7/8] Fix a crash with XAA and DRI disabled after the allocation rework. --- src/i830_xaa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/i830_xaa.c b/src/i830_xaa.c index f0951387..9ecf7067 100644 --- a/src/i830_xaa.c +++ b/src/i830_xaa.c @@ -279,12 +279,14 @@ CheckTiling(ScrnInfoPtr pScrn) if (IS_I965G(pI830)) { if (pI830->bufferOffset == pScrn->fbOffset && pI830->front_tiled == FENCE_XMAJOR) tiled = 1; - if (pI830->bufferOffset == pI830->back_buffer->offset && + if (pI830->back_buffer != NULL && + pI830->bufferOffset == pI830->back_buffer->offset && pI830->back_tiled == FENCE_XMAJOR) { tiled = 1; } /* not really supported as it's always YMajor tiled */ - if (pI830->bufferOffset == pI830->depth_buffer->offset && + if (pI830->depth_buffer != NULL && + pI830->bufferOffset == pI830->depth_buffer->offset && pI830->depth_tiled == FENCE_XMAJOR) { tiled = 1; } From bc20b54c34088356a277beaebcc90bb4a7063e19 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 4 Mar 2007 19:35:44 -0800 Subject: [PATCH 8/8] Support new CRTC/Output prepare/commit hooks. New hooks replace explicit invocation of DPMS functions to manage mode setting sequencing. --- src/i830_crt.c | 2 ++ src/i830_display.c | 26 ++++++++++++++++++++++++++ src/i830_display.h | 3 +++ src/i830_dvo.c | 3 +++ src/i830_lvds.c | 2 ++ src/i830_sdvo.c | 2 ++ src/i830_tv.c | 2 ++ 7 files changed, 40 insertions(+) diff --git a/src/i830_crt.c b/src/i830_crt.c index 77061653..fbb4adc5 100644 --- a/src/i830_crt.c +++ b/src/i830_crt.c @@ -341,7 +341,9 @@ static const xf86OutputFuncsRec i830_crt_output_funcs = { .restore = i830_crt_restore, .mode_valid = i830_crt_mode_valid, .mode_fixup = i830_crt_mode_fixup, + .prepare = i830_output_prepare, .mode_set = i830_crt_mode_set, + .commit = i830_output_commit, .detect = i830_crt_detect, .get_modes = i830_ddc_get_modes, .destroy = i830_crt_destroy diff --git a/src/i830_display.c b/src/i830_display.c index 67744d59..d0b21a92 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -613,6 +613,30 @@ i830_crtc_unlock (xf86CrtcPtr crtc) #endif } +static void +i830_crtc_prepare (xf86CrtcPtr crtc) +{ + crtc->funcs->dpms (crtc, DPMSModeOff); +} + +static void +i830_crtc_commit (xf86CrtcPtr crtc) +{ + crtc->funcs->dpms (crtc, DPMSModeOn); +} + +void +i830_output_prepare (xf86OutputPtr output) +{ + output->funcs->dpms (output, DPMSModeOff); +} + +void +i830_output_commit (xf86OutputPtr output) +{ + output->funcs->dpms (output, DPMSModeOn); +} + static Bool i830_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode) @@ -1377,7 +1401,9 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = { .lock = i830_crtc_lock, .unlock = i830_crtc_unlock, .mode_fixup = i830_crtc_mode_fixup, + .prepare = i830_crtc_prepare, .mode_set = i830_crtc_mode_set, + .commit = i830_crtc_commit, .gamma_set = i830_crtc_gamma_set, .shadow_create = i830_crtc_shadow_create, .shadow_allocate = i830_crtc_shadow_allocate, diff --git a/src/i830_display.h b/src/i830_display.h index dbd1ea8e..31ab6155 100644 --- a/src/i830_display.h +++ b/src/i830_display.h @@ -40,3 +40,6 @@ void i830ReleaseLoadDetectPipe(xf86OutputPtr output); void i830_crtc_init(ScrnInfoPtr pScrn, int pipe); void i830_crtc_load_lut(xf86CrtcPtr crtc); DisplayModePtr i830_crtc_mode_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc); +void i830_output_prepare (xf86OutputPtr output); +void i830_output_commit (xf86OutputPtr output); + diff --git a/src/i830_dvo.c b/src/i830_dvo.c index d938f466..629e9c7d 100644 --- a/src/i830_dvo.c +++ b/src/i830_dvo.c @@ -31,6 +31,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86.h" #include "i830.h" +#include "i830_display.h" #include "i810_reg.h" #include "sil164/sil164.h" @@ -226,7 +227,9 @@ static const xf86OutputFuncsRec i830_dvo_output_funcs = { .restore = i830_dvo_restore, .mode_valid = i830_dvo_mode_valid, .mode_fixup = i830_dvo_mode_fixup, + .prepare = i830_output_prepare, .mode_set = i830_dvo_mode_set, + .commit = i830_output_commit, .detect = i830_dvo_detect, .get_modes = i830_ddc_get_modes, .destroy = i830_dvo_destroy diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 642dd8a3..f554b388 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -392,7 +392,9 @@ static const xf86OutputFuncsRec i830_lvds_output_funcs = { .restore = i830_lvds_restore, .mode_valid = i830_lvds_mode_valid, .mode_fixup = i830_lvds_mode_fixup, + .prepare = i830_output_prepare, .mode_set = i830_lvds_mode_set, + .commit = i830_output_commit, .detect = i830_lvds_detect, .get_modes = i830_lvds_get_modes, #ifdef RANDR_12_INTERFACE diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index 46a35f1c..b7cf8436 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -1060,7 +1060,9 @@ static const xf86OutputFuncsRec i830_sdvo_output_funcs = { .restore = i830_sdvo_restore, .mode_valid = i830_sdvo_mode_valid, .mode_fixup = i830_sdvo_mode_fixup, + .prepare = i830_output_prepare, .mode_set = i830_sdvo_mode_set, + .commit = i830_output_commit, .detect = i830_sdvo_detect, .get_modes = i830_sdvo_get_modes, .destroy = i830_sdvo_destroy diff --git a/src/i830_tv.c b/src/i830_tv.c index 95612e41..d7f4f563 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -1406,7 +1406,9 @@ static const xf86OutputFuncsRec i830_tv_output_funcs = { .restore = i830_tv_restore, .mode_valid = i830_tv_mode_valid, .mode_fixup = i830_tv_mode_fixup, + .prepare = i830_output_prepare, .mode_set = i830_tv_mode_set, + .commit = i830_output_commit, .detect = i830_tv_detect, .get_modes = i830_tv_get_modes, .destroy = i830_tv_destroy