mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-23 01:29:58 +00:00
Allow for missing or disabled compat_output
When the compat output is missing (I don't think this is actually possible), or is disabled (and hence has no crtc), we would like to avoid dereferencing NULL pointers. This patch creates inline functions to extract the current compat output, crtc or associated RandR crtc structure, carefully checking for NULL pointers everywhere. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
fbbadca7e8
commit
de86a3a344
4 changed files with 46 additions and 17 deletions
|
|
@ -1001,8 +1001,7 @@ xf86ChangeGammaRamp(
|
|||
CMapLinkPtr pLink;
|
||||
|
||||
if (xf86_crtc_supports_gamma(pScrn)) {
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
||||
RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
|
||||
|
||||
if (crtc) {
|
||||
if (crtc->gammaSize != size)
|
||||
|
|
@ -1076,8 +1075,7 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
|
|||
CMapScreenPtr pScreenPriv;
|
||||
|
||||
if (xf86_crtc_supports_gamma(pScrn)) {
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
||||
RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
|
||||
|
||||
if (crtc)
|
||||
return crtc->gammaSize;
|
||||
|
|
@ -1106,8 +1104,7 @@ xf86GetGammaRamp(
|
|||
int shift, sigbits;
|
||||
|
||||
if (xf86_crtc_supports_gamma(pScrn)) {
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
|
||||
RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
|
||||
|
||||
if (crtc) {
|
||||
if (crtc->gammaSize < size)
|
||||
|
|
|
|||
Loading…
Reference in a new issue