aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c113
1 files changed, 55 insertions, 58 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index b47130eda521..45379f90acc8 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2175,21 +2175,8 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state)
2175 return 0; 2175 return 0;
2176} 2176}
2177 2177
2178/******************************************************************************
2179 * CRTC
2180 *****************************************************************************/
2181
2182static int
2183nv50_crtc_mode_set_base_atomic(struct drm_crtc *crtc,
2184 struct drm_framebuffer *fb, int x, int y,
2185 enum mode_set_atomic state)
2186{
2187 WARN_ON(1);
2188 return 0;
2189}
2190
2191static void 2178static void
2192nv50_crtc_lut_load(struct drm_crtc *crtc) 2179nv50_head_lut_load(struct drm_crtc *crtc)
2193{ 2180{
2194 struct nv50_disp *disp = nv50_disp(crtc->dev); 2181 struct nv50_disp *disp = nv50_disp(crtc->dev);
2195 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 2182 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
@@ -2214,45 +2201,18 @@ nv50_crtc_lut_load(struct drm_crtc *crtc)
2214} 2201}
2215 2202
2216static int 2203static int
2217nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 2204nv50_head_mode_set_base_atomic(struct drm_crtc *crtc,
2218 uint32_t size) 2205 struct drm_framebuffer *fb, int x, int y,
2206 enum mode_set_atomic state)
2219{ 2207{
2220 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 2208 WARN_ON(1);
2221 u32 i;
2222
2223 for (i = 0; i < size; i++) {
2224 nv_crtc->lut.r[i] = r[i];
2225 nv_crtc->lut.g[i] = g[i];
2226 nv_crtc->lut.b[i] = b[i];
2227 }
2228
2229 nv50_crtc_lut_load(crtc);
2230
2231 return 0; 2209 return 0;
2232} 2210}
2233 2211
2234static void 2212static const struct drm_crtc_helper_funcs
2235nv50_crtc_destroy(struct drm_crtc *crtc) 2213nv50_head_help = {
2236{ 2214 .mode_set_base_atomic = nv50_head_mode_set_base_atomic,
2237 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 2215 .load_lut = nv50_head_lut_load,
2238 struct nv50_disp *disp = nv50_disp(crtc->dev);
2239 struct nv50_head *head = nv50_head(crtc);
2240
2241 nv50_dmac_destroy(&head->ovly.base, disp->disp);
2242 nv50_pioc_destroy(&head->oimm.base);
2243
2244 nouveau_bo_unmap(nv_crtc->lut.nvbo);
2245 if (nv_crtc->lut.nvbo)
2246 nouveau_bo_unpin(nv_crtc->lut.nvbo);
2247 nouveau_bo_ref(NULL, &nv_crtc->lut.nvbo);
2248
2249 drm_crtc_cleanup(crtc);
2250 kfree(crtc);
2251}
2252
2253static const struct drm_crtc_helper_funcs nv50_crtc_hfunc = {
2254 .mode_set_base_atomic = nv50_crtc_mode_set_base_atomic,
2255 .load_lut = nv50_crtc_lut_load,
2256 .atomic_check = nv50_head_atomic_check, 2216 .atomic_check = nv50_head_atomic_check,
2257}; 2217};
2258 2218
@@ -2327,6 +2287,23 @@ backoff:
2327 goto retry; 2287 goto retry;
2328} 2288}
2329 2289
2290static int
2291nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
2292 uint32_t size)
2293{
2294 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
2295 u32 i;
2296
2297 for (i = 0; i < size; i++) {
2298 nv_crtc->lut.r[i] = r[i];
2299 nv_crtc->lut.g[i] = g[i];
2300 nv_crtc->lut.b[i] = b[i];
2301 }
2302
2303 nv50_head_lut_load(crtc);
2304 return 0;
2305}
2306
2330static void 2307static void
2331nv50_head_atomic_destroy_state(struct drm_crtc *crtc, 2308nv50_head_atomic_destroy_state(struct drm_crtc *crtc,
2332 struct drm_crtc_state *state) 2309 struct drm_crtc_state *state)
@@ -2379,10 +2356,30 @@ nv50_head_reset(struct drm_crtc *crtc)
2379 __drm_atomic_helper_crtc_reset(crtc, &asyh->state); 2356 __drm_atomic_helper_crtc_reset(crtc, &asyh->state);
2380} 2357}
2381 2358
2382static const struct drm_crtc_funcs nv50_crtc_func = { 2359static void
2360nv50_head_destroy(struct drm_crtc *crtc)
2361{
2362 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
2363 struct nv50_disp *disp = nv50_disp(crtc->dev);
2364 struct nv50_head *head = nv50_head(crtc);
2365
2366 nv50_dmac_destroy(&head->ovly.base, disp->disp);
2367 nv50_pioc_destroy(&head->oimm.base);
2368
2369 nouveau_bo_unmap(nv_crtc->lut.nvbo);
2370 if (nv_crtc->lut.nvbo)
2371 nouveau_bo_unpin(nv_crtc->lut.nvbo);
2372 nouveau_bo_ref(NULL, &nv_crtc->lut.nvbo);
2373
2374 drm_crtc_cleanup(crtc);
2375 kfree(crtc);
2376}
2377
2378static const struct drm_crtc_funcs
2379nv50_head_func = {
2383 .reset = nv50_head_reset, 2380 .reset = nv50_head_reset,
2384 .gamma_set = nv50_crtc_gamma_set, 2381 .gamma_set = nv50_head_gamma_set,
2385 .destroy = nv50_crtc_destroy, 2382 .destroy = nv50_head_destroy,
2386 .set_config = drm_atomic_helper_set_config, 2383 .set_config = drm_atomic_helper_set_config,
2387 .page_flip = nv50_head_page_flip, 2384 .page_flip = nv50_head_page_flip,
2388 .set_property = drm_atomic_helper_crtc_set_property, 2385 .set_property = drm_atomic_helper_crtc_set_property,
@@ -2391,7 +2388,7 @@ static const struct drm_crtc_funcs nv50_crtc_func = {
2391}; 2388};
2392 2389
2393static int 2390static int
2394nv50_crtc_create(struct drm_device *dev, int index) 2391nv50_head_create(struct drm_device *dev, int index)
2395{ 2392{
2396 struct nouveau_drm *drm = nouveau_drm(dev); 2393 struct nouveau_drm *drm = nouveau_drm(dev);
2397 struct nvif_device *device = &drm->device; 2394 struct nvif_device *device = &drm->device;
@@ -2423,9 +2420,9 @@ nv50_crtc_create(struct drm_device *dev, int index)
2423 2420
2424 crtc = &head->base.base; 2421 crtc = &head->base.base;
2425 drm_crtc_init_with_planes(dev, crtc, &base->wndw.plane, 2422 drm_crtc_init_with_planes(dev, crtc, &base->wndw.plane,
2426 &curs->wndw.plane, &nv50_crtc_func, 2423 &curs->wndw.plane, &nv50_head_func,
2427 "head-%d", head->base.index); 2424 "head-%d", head->base.index);
2428 drm_crtc_helper_add(crtc, &nv50_crtc_hfunc); 2425 drm_crtc_helper_add(crtc, &nv50_head_help);
2429 drm_mode_crtc_set_gamma_size(crtc, 256); 2426 drm_mode_crtc_set_gamma_size(crtc, 256);
2430 2427
2431 ret = nouveau_bo_new(dev, 8192, 0x100, TTM_PL_FLAG_VRAM, 2428 ret = nouveau_bo_new(dev, 8192, 0x100, TTM_PL_FLAG_VRAM,
@@ -2456,7 +2453,7 @@ nv50_crtc_create(struct drm_device *dev, int index)
2456 2453
2457out: 2454out:
2458 if (ret) 2455 if (ret)
2459 nv50_crtc_destroy(crtc); 2456 nv50_head_destroy(crtc);
2460 return ret; 2457 return ret;
2461} 2458}
2462 2459
@@ -3836,7 +3833,7 @@ nv50_display_init(struct drm_device *dev)
3836 } 3833 }
3837 3834
3838 drm_for_each_crtc(crtc, dev) { 3835 drm_for_each_crtc(crtc, dev) {
3839 nv50_crtc_lut_load(crtc); 3836 nv50_head_lut_load(crtc);
3840 } 3837 }
3841 3838
3842 drm_for_each_plane(plane, dev) { 3839 drm_for_each_plane(plane, dev) {
@@ -3925,7 +3922,7 @@ nv50_display_create(struct drm_device *dev)
3925 crtcs = 2; 3922 crtcs = 2;
3926 3923
3927 for (i = 0; i < crtcs; i++) { 3924 for (i = 0; i < crtcs; i++) {
3928 ret = nv50_crtc_create(dev, i); 3925 ret = nv50_head_create(dev, i);
3929 if (ret) 3926 if (ret)
3930 goto out; 3927 goto out;
3931 } 3928 }