wndw.c (261fcfa96991d6652b061262c1879cc0bdd1aa3a) wndw.c (53e0a3e70de69dc9f498d26c6b5495b2771ee374)
1/*
2 * Copyright 2018 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 93 unchanged lines hidden (view full) ---

102 if (asyw->set.ntfy) {
103 return wndw->func->ntfy_wait_begun(disp->sync,
104 asyw->ntfy.offset,
105 wndw->wndw.base.device);
106 }
107 return 0;
108}
109
1/*
2 * Copyright 2018 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 93 unchanged lines hidden (view full) ---

102 if (asyw->set.ntfy) {
103 return wndw->func->ntfy_wait_begun(disp->sync,
104 asyw->ntfy.offset,
105 wndw->wndw.base.device);
106 }
107 return 0;
108}
109
110u32
111nv50_wndw_flush_clr(struct nv50_wndw *wndw, u32 interlock, bool flush,
110void
111nv50_wndw_flush_clr(struct nv50_wndw *wndw, u32 *interlock, bool flush,
112 struct nv50_wndw_atom *asyw)
113{
114 union nv50_wndw_atom_mask clr = {
115 .mask = asyw->clr.mask & ~(flush ? 0 : asyw->set.mask),
116 };
117 if (clr.sema ) wndw->func-> sema_clr(wndw);
118 if (clr.ntfy ) wndw->func-> ntfy_clr(wndw);
119 if (clr.image) wndw->func->image_clr(wndw);
120
112 struct nv50_wndw_atom *asyw)
113{
114 union nv50_wndw_atom_mask clr = {
115 .mask = asyw->clr.mask & ~(flush ? 0 : asyw->set.mask),
116 };
117 if (clr.sema ) wndw->func-> sema_clr(wndw);
118 if (clr.ntfy ) wndw->func-> ntfy_clr(wndw);
119 if (clr.image) wndw->func->image_clr(wndw);
120
121 return flush ? wndw->func->update(wndw, interlock) : 0;
121 interlock[wndw->interlock.type] |= wndw->interlock.data;
122 if (flush)
123 wndw->func->update(wndw, interlock);
122}
123
124}
125
124u32
125nv50_wndw_flush_set(struct nv50_wndw *wndw, u32 interlock,
126void
127nv50_wndw_flush_set(struct nv50_wndw *wndw, u32 *interlock,
126 struct nv50_wndw_atom *asyw)
127{
128 if (interlock) {
129 asyw->image.mode = 0;
130 asyw->image.interval = 1;
131 }
132
133 if (asyw->set.sema ) wndw->func->sema_set (wndw, asyw);
134 if (asyw->set.ntfy ) wndw->func->ntfy_set (wndw, asyw);
135 if (asyw->set.image) wndw->func->image_set(wndw, asyw);
136 if (asyw->set.lut ) wndw->func->lut (wndw, asyw);
137 if (asyw->set.point) {
138 wndw->immd->point(wndw, asyw);
139 wndw->immd->update(wndw, interlock);
140 }
141
128 struct nv50_wndw_atom *asyw)
129{
130 if (interlock) {
131 asyw->image.mode = 0;
132 asyw->image.interval = 1;
133 }
134
135 if (asyw->set.sema ) wndw->func->sema_set (wndw, asyw);
136 if (asyw->set.ntfy ) wndw->func->ntfy_set (wndw, asyw);
137 if (asyw->set.image) wndw->func->image_set(wndw, asyw);
138 if (asyw->set.lut ) wndw->func->lut (wndw, asyw);
139 if (asyw->set.point) {
140 wndw->immd->point(wndw, asyw);
141 wndw->immd->update(wndw, interlock);
142 }
143
142 return wndw->func->update ? wndw->func->update(wndw, interlock) : 0;
144 interlock[wndw->interlock.type] |= wndw->interlock.data;
145 if (wndw->func->update)
146 wndw->func->update(wndw, interlock);
143}
144
145void
146nv50_wndw_ntfy_enable(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
147{
148 struct nv50_disp *disp = nv50_disp(wndw->plane.dev);
149
150 asyw->ntfy.handle = wndw->wndw.sync.handle;

--- 289 unchanged lines hidden (view full) ---

440nv50_wndw_init(struct nv50_wndw *wndw)
441{
442 nvif_notify_get(&wndw->notify);
443}
444
445int
446nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
447 enum drm_plane_type type, const char *name, int index,
147}
148
149void
150nv50_wndw_ntfy_enable(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
151{
152 struct nv50_disp *disp = nv50_disp(wndw->plane.dev);
153
154 asyw->ntfy.handle = wndw->wndw.sync.handle;

--- 289 unchanged lines hidden (view full) ---

444nv50_wndw_init(struct nv50_wndw *wndw)
445{
446 nvif_notify_get(&wndw->notify);
447}
448
449int
450nv50_wndw_new_(const struct nv50_wndw_func *func, struct drm_device *dev,
451 enum drm_plane_type type, const char *name, int index,
448 const u32 *format, u32 heads, struct nv50_wndw **pwndw)
452 const u32 *format, u32 heads,
453 enum nv50_disp_interlock_type interlock_type, u32 interlock_data,
454 struct nv50_wndw **pwndw)
449{
450 struct nv50_wndw *wndw;
451 int nformat;
452 int ret;
453
454 if (!(wndw = *pwndw = kzalloc(sizeof(*wndw), GFP_KERNEL)))
455 return -ENOMEM;
456 wndw->func = func;
457 wndw->id = index;
455{
456 struct nv50_wndw *wndw;
457 int nformat;
458 int ret;
459
460 if (!(wndw = *pwndw = kzalloc(sizeof(*wndw), GFP_KERNEL)))
461 return -ENOMEM;
462 wndw->func = func;
463 wndw->id = index;
464 wndw->interlock.type = interlock_type;
465 wndw->interlock.data = interlock_data;
466 wndw->ctxdma.parent = &wndw->wndw.base.user;
458
459 wndw->ctxdma.parent = &wndw->wndw.base.user;
460 INIT_LIST_HEAD(&wndw->ctxdma.list);
461
462 for (nformat = 0; format[nformat]; nformat++);
463
464 ret = drm_universal_plane_init(dev, &wndw->plane, heads, &nv50_wndw,
465 format, nformat, NULL,

--- 12 unchanged lines hidden ---
467
468 wndw->ctxdma.parent = &wndw->wndw.base.user;
469 INIT_LIST_HEAD(&wndw->ctxdma.list);
470
471 for (nformat = 0; format[nformat]; nformat++);
472
473 ret = drm_universal_plane_init(dev, &wndw->plane, heads, &nv50_wndw,
474 format, nformat, NULL,

--- 12 unchanged lines hidden ---