[PATCH xf86-video-amdgpu 5/5] Modify output_create_resources to use configure & change helper
sunpeng.li at amd.com
sunpeng.li at amd.com
Mon Mar 26 20:00:18 UTC 2018
From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>
The conditionals within the for-loop do the same thing, since they're
essentially copied to the configure&change helper.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
---
src/drmmode_display.c | 82 ++-------------------------------------------------
1 file changed, 2 insertions(+), 80 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9c95abc..f55ba4d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1945,7 +1945,7 @@ static void drmmode_output_create_resources(xf86OutputPtr output)
drmModeConnectorPtr mode_output = drmmode_output->mode_output;
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(output->scrn);
drmModePropertyPtr drmmode_prop, tearfree_prop;
- int i, j, err;
+ int i, j;
drmmode_output->props =
calloc(mode_output->count_props + 1, sizeof(drmmode_prop_rec));
@@ -1985,85 +1985,7 @@ static void drmmode_output_create_resources(xf86OutputPtr output)
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];
- INT32 value = p->value;
-
- 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, &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);
- }
- }
+ __rr_configure_and_change_property (output, p, TRUE);
}
if (output->crtc)
--
2.7.4
More information about the amd-gfx
mailing list