static void G80SorCreateResources(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; G80Ptr pNv = G80PTR(pScrn); int data, err; const char *s; /******** dithering ********/ properties.dither.atom = MAKE_ATOM("dither"); properties.dither.range[0] = 0; properties.dither.range[1] = 1; err = RRConfigureOutputProperty(output->randr_output, properties.dither.atom, FALSE, TRUE, FALSE, 2, properties.dither.range); if(err) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to configure dithering property for %s: error %d\n", output->name, err); // Set the default value data = pNv->Dither; err = RRChangeOutputProperty(output->randr_output, properties.dither.atom, XA_INTEGER, 32, PropModeReplace, 1, &data, FALSE, FALSE); if(err) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set dithering property for %s: error %d\n", output->name, err); /******** scaling ********/ properties.scale.atom = MAKE_ATOM("scale"); err = RRConfigureOutputProperty(output->randr_output, properties.scale.atom, FALSE, FALSE, FALSE, 0, NULL); if(err) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to configure scaling property for %s: error %d\n", output->name, err); // Set the default value s = "aspect"; err = RRChangeOutputProperty(output->randr_output, properties.scale.atom, XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s, FALSE, FALSE); if(err) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set scaling property for %s: error %d\n", output->name, err); }
static Bool imxOutputGetProperty(xf86OutputPtr output, Atom property) { /** * Callback to get an updated property value */ /* Access the associated screen info. */ ScrnInfoPtr pScrn = output->scrn; /* Access driver private screen data */ ImxPtr imxPtr = IMXPTR(pScrn); /* Access driver private screen display data */ ImxDisplayPtr fPtr = IMXDISPLAYPTR(imxPtr); /* Request for raw EDID data? */ if (property == fPtr->atomEdid) { RRChangeOutputProperty( output->randr_output, /* RROutputPtr */ property, /* Atom property */ XA_INTEGER, /* Atom type */ 8, /* int format */ PropModeReplace, /* int mode */ sizeof(fPtr->edidDataBytes), /* unsigned len */ fPtr->edidDataBytes, /* pointer value */ FALSE, /* Bool sendEvent? */ TRUE); /* Bool pending */ return TRUE; } return FALSE; }
static Bool drmmode_output_get_property(xf86OutputPtr output, Atom property) { drmmode_output_private_ptr drmmode_output = output->driver_private; int err; if (property == backlight_atom || property == backlight_deprecated_atom) { INT32 val; if (! drmmode_output->backlight_iface) return FALSE; val = drmmode_backlight_get(output); if (val < 0) return FALSE; err = RRChangeOutputProperty(output->randr_output, property, XA_INTEGER, 32, PropModeReplace, 1, &val, FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); return FALSE; } return TRUE; } return TRUE; }
static void drmmode_output_create_resources(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; drmModeConnectorPtr mode_output = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; drmModePropertyPtr drmmode_prop; int i, j, err; drmmode_output->props = calloc(mode_output->count_props, sizeof(drmmode_prop_rec)); if (!drmmode_output->props) return; drmmode_output->num_props = 0; for (i = 0, j = 0; i < mode_output->count_props; i++) { drmmode_prop = drmModeGetProperty(drmmode->fd, mode_output->props[i]); if (drmmode_property_ignore(drmmode_prop)) { drmModeFreeProperty(drmmode_prop); continue; } drmmode_output->props[j].mode_prop = drmmode_prop; drmmode_output->props[j].value = mode_output->prop_values[i]; drmmode_output->num_props++; j++; } for (i = 0; i < drmmode_output->num_props; i++) { drmmode_prop_ptr p = &drmmode_output->props[i]; drmmode_prop = p->mode_prop; if (drmmode_prop->flags & DRM_MODE_PROP_RANGE) { INT32 range[2]; p->num_atoms = 1; p->atoms = calloc(p->num_atoms, sizeof(Atom)); if (!p->atoms) continue; p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE); range[0] = drmmode_prop->values[0]; range[1] = drmmode_prop->values[1]; err = RRConfigureOutputProperty(output->randr_output, p->atoms[0], FALSE, TRUE, drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE, 2, range); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); } err = RRChangeOutputProperty(output->randr_output, p->atoms[0], XA_INTEGER, 32, PropModeReplace, 1, &p->value, FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) { p->num_atoms = drmmode_prop->count_enums + 1; p->atoms = calloc(p->num_atoms, sizeof(Atom)); if (!p->atoms) continue; p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE); for (j = 1; j <= drmmode_prop->count_enums; j++) { struct drm_mode_property_enum *e = &drmmode_prop->enums[j-1]; p->atoms[j] = MakeAtom(e->name, strlen(e->name), TRUE); } err = RRConfigureOutputProperty(output->randr_output, p->atoms[0], FALSE, FALSE, drmmode_prop->flags & DRM_MODE_PROP_IMMUTABLE ? TRUE : FALSE, p->num_atoms - 1, (INT32 *)&p->atoms[1]); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); } for (j = 0; j < drmmode_prop->count_enums; j++) if (drmmode_prop->enums[j].value == p->value) break; /* there's always a matching value */ err = RRChangeOutputProperty(output->randr_output, p->atoms[0], XA_ATOM, 32, PropModeReplace, 1, &p->atoms[j+1], FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } } if (drmmode_output->backlight_iface) { INT32 data, backlight_range[2]; /* Set up the backlight property, which takes effect immediately * and accepts values only within the backlight_range. */ backlight_atom = MakeAtom(BACKLIGHT_NAME, sizeof(BACKLIGHT_NAME) - 1, TRUE); backlight_deprecated_atom = MakeAtom(BACKLIGHT_DEPRECATED_NAME, sizeof(BACKLIGHT_DEPRECATED_NAME) - 1, TRUE); backlight_range[0] = 0; backlight_range[1] = drmmode_output->backlight_max; err = RRConfigureOutputProperty(output->randr_output, backlight_atom, FALSE, TRUE, FALSE, 2, backlight_range); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); } err = RRConfigureOutputProperty(output->randr_output, backlight_deprecated_atom, FALSE, TRUE, FALSE, 2, backlight_range); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRConfigureOutputProperty error, %d\n", err); } /* Set the current value of the backlight property */ data = drmmode_output->backlight_active_level; err = RRChangeOutputProperty(output->randr_output, backlight_atom, XA_INTEGER, 32, PropModeReplace, 1, &data, FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } err = RRChangeOutputProperty(output->randr_output, backlight_deprecated_atom, XA_INTEGER, 32, PropModeReplace, 1, &data, FALSE, TRUE); if (err != 0) { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "RRChangeOutputProperty error, %d\n", err); } } }