Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2:Update
xf86-video-intel
U_05-sna-Only-shutdown-unknown-secondary-planes...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_05-sna-Only-shutdown-unknown-secondary-planes-on-CRTC-we-control.patch of Package xf86-video-intel
From: Chris Wilson <chris@chris-wilson.co.uk> Date: Tue Jun 21 21:17:15 2016 +0100 Subject: [PATCH 5/5]sna: Only shutdown unknown secondary planes on CRTC we control Patch-mainline: f1c757e4518f6835bbff6c940269a5c6be75f202 Git-repo: git://anongit.freedesktop.org/xorg/driver/xf86-video-intel References: boo#984747 Signed-off-by: Max Staudt <mstaudt@suse.de> In a ZaphodHead scenario, we do not own all the CRTC and so we should not be making changes outside of our zone of control. Also, we only want to disable secondary overlay planes and ignore the secondary cursor planes which are controlled through the normal modesetting. As we are now tracking all sprite planes on a CRTC, this leads to much simpler code. Reported-by: Egbert Eich <eich@freedesktop.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- src/sna/sna_display.c | 149 +++++++++----------------------------------------- 1 file changed, 26 insertions(+), 123 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 3b36159..059c1ca 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -7855,143 +7855,46 @@ static bool sna_mode_shutdown_crtc(xf86CrtcPtr crtc) return disabled; } -static xf86CrtcPtr -lookup_crtc_by_id(struct sna *sna, int id) +static bool +sna_mode_disable_secondary_planes(struct sna *sna) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn); + bool disabled = false; int c; + /* Disable all secondary planes on our CRTCs, just in case + * other userspace left garbage in them. + */ for (c = 0; c < sna->mode.num_real_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; - if (__sna_crtc_id(to_sna_crtc(crtc)) == id) - return crtc; - } - - return NULL; -} - -static int plane_type(struct sna *sna, int id) -{ - struct local_mode_obj_get_properties arg; - uint64_t stack_props[24]; - uint32_t *props = (uint32_t *)stack_props; - uint64_t *values = stack_props + 8; - int i, type = -1; - - memset(&arg, 0, sizeof(struct local_mode_obj_get_properties)); - arg.obj_id = id; - arg.obj_type = LOCAL_MODE_OBJECT_PLANE; - - arg.props_ptr = (uintptr_t)props; - arg.prop_values_ptr = (uintptr_t)values; - arg.count_props = 16; - - if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_OBJ_GETPROPERTIES, &arg)) - return -1; - - DBG(("%s: object %d (type %x) has %d props\n", __FUNCTION__, - id, LOCAL_MODE_OBJECT_PLANE, arg.count_props)); - - if (arg.count_props > 16) { - props = malloc(2*sizeof(uint64_t)*arg.count_props); - if (props == NULL) - return -1; - - values = (uint64_t *)props + arg.count_props; - - arg.props_ptr = (uintptr_t)props; - arg.prop_values_ptr = (uintptr_t)values; - - if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_OBJ_GETPROPERTIES, &arg)) - arg.count_props = 0; - } - VG(VALGRIND_MAKE_MEM_DEFINED(arg.props_ptr, sizeof(uint32_t)*arg.count_props)); - VG(VALGRIND_MAKE_MEM_DEFINED(arg.prop_values_ptr, sizeof(uint64_t)*arg.count_props)); - - for (i = 0; i < arg.count_props; i++) { - struct drm_mode_get_property prop; - - memset(&prop, 0, sizeof(prop)); - prop.prop_id = props[i]; - if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETPROPERTY, &prop)) { - ERR(("%s: prop[%d].id=%d GETPROPERTY failed with errno=%d\n", - __FUNCTION__, i, props[i], errno)); - continue; - } - - DBG(("%s: prop[%d] .id=%ld, .name=%s, .flags=%x, .value=%ld\n", __FUNCTION__, i, - (long)props[i], prop.name, (unsigned)prop.flags, (long)values[i])); - - if (strcmp(prop.name, "type") == 0) { - type = values[i]; - break; - } - } - - if (props != (uint32_t *)stack_props) - free(props); - - return type; -} - -static bool -sna_mode_disable_secondary_planes(struct sna *sna) -{ - struct local_mode_get_plane_res r; - uint32_t stack_planes[64]; - uint32_t *planes = stack_planes; - bool disabled = false; - int i; - - VG_CLEAR(r); - r.plane_id_ptr = (uintptr_t)planes; - r.count_planes = ARRAY_SIZE(stack_planes); - if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_GETPLANERESOURCES, &r)) - return false; - - DBG(("%s: %d planes\n", __FUNCTION__, (int)r.count_planes)); - - if (r.count_planes > ARRAY_SIZE(stack_planes)) { - planes = malloc(sizeof(uint32_t)*r.count_planes); - if (planes == NULL) - return false; - - r.plane_id_ptr = (uintptr_t)planes; - if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_GETPLANERESOURCES, &r)) - r.count_planes = 0; - } - - VG(VALGRIND_MAKE_MEM_DEFINED(planes, sizeof(uint32_t)*r.count_planes)); - - for (i = 0; i < r.count_planes; i++) { - struct local_mode_get_plane p; - struct local_mode_set_plane s; + struct sna_crtc *sna_crtc = to_sna_crtc(crtc); + struct plane *plane; - VG_CLEAR(p); - p.plane_id = planes[i]; - p.count_format_types = 0; - if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_GETPLANE, &p)) - continue; + list_for_each_entry(plane, &sna_crtc->sprites, link) { + struct local_mode_get_plane p; + struct local_mode_set_plane s; - if (p.fb_id == 0 || p.crtc_id == 0) - continue; + VG_CLEAR(p); + p.plane_id = plane->id; + p.count_format_types = 0; + if (drmIoctl(sna->kgem.fd, + LOCAL_IOCTL_MODE_GETPLANE, + &p)) + continue; - if (plane_type(sna, p.plane_id) == DRM_PLANE_TYPE_PRIMARY) - continue; + if (p.fb_id == 0 || p.crtc_id == 0) + continue; - memset(&s, 0, sizeof(s)); - s.plane_id = p.plane_id; - s.crtc_id = p.crtc_id; - if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s)) { - xf86CrtcPtr crtc = lookup_crtc_by_id(sna, p.crtc_id); - if (crtc) + memset(&s, 0, sizeof(s)); + s.plane_id = p.plane_id; + s.crtc_id = p.crtc_id; + if (drmIoctl(sna->kgem.fd, + LOCAL_IOCTL_MODE_SETPLANE, + &s)) disabled |= sna_mode_shutdown_crtc(crtc); } } - if (planes != stack_planes) - free(planes); - return disabled; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor