sna: Do not conflate ignoring an output with an allocation failure
If the user explicitly ignores an output through xorg.conf, then
xf86OutputCreate returns NULL. This is not to be confused with an
allocation error that also returns NULL. The latter is terminal, the
former is desired.
Fixes regression from commit a9acc8dbb4
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu May 30 12:09:52 2013 +0100
sna: Cleanup up error reporting after failure to init KMS interface
Reported-by: David Rosca <nowrep@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65381
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
6dacaddb6a
commit
5d0ae71f1d
|
|
@ -44,6 +44,7 @@
|
|||
#include <X11/extensions/dpmsconst.h>
|
||||
#include <xf86drm.h>
|
||||
#include <xf86DDC.h> /* for xf86InterpretEDID */
|
||||
#include <xf86Opt.h> /* for xf86OptionPtr */
|
||||
|
||||
#include "sna.h"
|
||||
#include "sna_reg.h"
|
||||
|
|
@ -59,6 +60,8 @@
|
|||
#define __DBG(x)
|
||||
#endif
|
||||
|
||||
extern XF86ConfigPtr xf86configptr;
|
||||
|
||||
struct sna_crtc {
|
||||
struct drm_mode_modeinfo kmode;
|
||||
int dpms_mode;
|
||||
|
|
@ -2379,6 +2382,29 @@ sna_zaphod_match(const char *s, const char *output)
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
output_ignored(ScrnInfoPtr scrn, const char *name)
|
||||
{
|
||||
char monitor_name[64];
|
||||
const char *monitor;
|
||||
XF86ConfMonitorPtr conf;
|
||||
|
||||
snprintf(monitor_name, sizeof(monitor_name), "monitor-%s", name);
|
||||
monitor = xf86findOptionValue(scrn->options, monitor_name);
|
||||
if (!monitor)
|
||||
monitor = name;
|
||||
|
||||
conf = xf86findMonitor(monitor,
|
||||
xf86configptr->conf_monitor_lst);
|
||||
if (conf == NULL && XF86_CRTC_CONFIG_PTR(scrn)->num_output == 0)
|
||||
conf = xf86findMonitor(scrn->monitor->id,
|
||||
xf86configptr->conf_monitor_lst);
|
||||
if (conf == NULL)
|
||||
return false;
|
||||
|
||||
return xf86CheckBoolOption(conf->mon_option_lst, "Ignore", 0);
|
||||
}
|
||||
|
||||
static bool
|
||||
sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
|
||||
{
|
||||
|
|
@ -2389,6 +2415,7 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
|
|||
struct sna_output *sna_output;
|
||||
const char *output_name;
|
||||
char name[32];
|
||||
bool ret = false;
|
||||
int i;
|
||||
|
||||
koutput = drmModeGetConnector(sna->kgem.fd,
|
||||
|
|
@ -2412,8 +2439,8 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
|
|||
|
||||
str = xf86GetOptValString(sna->Options, OPTION_ZAPHOD);
|
||||
if (str && !sna_zaphod_match(str, name)) {
|
||||
drmModeFreeConnector(koutput);
|
||||
return true;
|
||||
ret = true;
|
||||
goto cleanup_connector;
|
||||
}
|
||||
|
||||
if ((enc.possible_crtcs & (1 << scrn->confScreen->device->screen)) == 0) {
|
||||
|
|
@ -2430,8 +2457,15 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
|
|||
}
|
||||
|
||||
output = xf86OutputCreate(scrn, &sna_output_funcs, name);
|
||||
if (!output)
|
||||
if (!output) {
|
||||
/* xf86OutputCreate does not differentiate between
|
||||
* a failure to allocate the output, and a user request
|
||||
* to ignore the output. So reconstruct whether the user
|
||||
* explicitly ignored the output.
|
||||
*/
|
||||
ret = output_ignored(scrn, name);
|
||||
goto cleanup_connector;
|
||||
}
|
||||
|
||||
sna_output = calloc(sizeof(struct sna_output), 1);
|
||||
if (!sna_output)
|
||||
|
|
@ -2470,7 +2504,7 @@ cleanup_output:
|
|||
xf86OutputDestroy(output);
|
||||
cleanup_connector:
|
||||
drmModeFreeConnector(koutput);
|
||||
return false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* We need to map from kms encoder based possible_clones mask to X output based
|
||||
|
|
@ -2830,7 +2864,7 @@ bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna)
|
|||
sna_mode_compute_possible_clones(scrn);
|
||||
|
||||
#if HAS_PIXMAP_SHARING
|
||||
xf86ProviderSetup(scrn, NULL, "Intel");
|
||||
xf86ProviderSetup(scrn, NULL, "Intel");
|
||||
#endif
|
||||
} else {
|
||||
if (!sna_mode_fake_init(sna))
|
||||
|
|
|
|||
Loading…
Reference in New Issue