Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2018 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  */
0022 #include "core.h"
0023 #include "head.h"
0024 
0025 #include <nvif/pushc37b.h>
0026 
0027 #include <nvhw/class/clc57d.h>
0028 
0029 static int
0030 corec57d_init(struct nv50_core *core)
0031 {
0032     struct nvif_push *push = core->chan.push;
0033     const u32 windows = 8; /*XXX*/
0034     int ret, i;
0035 
0036     if ((ret = PUSH_WAIT(push, 2 + windows * 5)))
0037         return ret;
0038 
0039     PUSH_MTHD(push, NVC57D, SET_CONTEXT_DMA_NOTIFIER, core->chan.sync.handle);
0040 
0041     for (i = 0; i < windows; i++) {
0042         PUSH_MTHD(push, NVC57D, WINDOW_SET_WINDOW_FORMAT_USAGE_BOUNDS(i),
0043               NVDEF(NVC57D, WINDOW_SET_WINDOW_FORMAT_USAGE_BOUNDS, RGB_PACKED1BPP, TRUE) |
0044               NVDEF(NVC57D, WINDOW_SET_WINDOW_FORMAT_USAGE_BOUNDS, RGB_PACKED2BPP, TRUE) |
0045               NVDEF(NVC57D, WINDOW_SET_WINDOW_FORMAT_USAGE_BOUNDS, RGB_PACKED4BPP, TRUE) |
0046               NVDEF(NVC57D, WINDOW_SET_WINDOW_FORMAT_USAGE_BOUNDS, RGB_PACKED8BPP, TRUE),
0047 
0048                     WINDOW_SET_WINDOW_ROTATED_FORMAT_USAGE_BOUNDS(i), 0x00000000);
0049 
0050         PUSH_MTHD(push, NVC57D, WINDOW_SET_WINDOW_USAGE_BOUNDS(i),
0051               NVVAL(NVC57D, WINDOW_SET_WINDOW_USAGE_BOUNDS, MAX_PIXELS_FETCHED_PER_LINE, 0x7fff) |
0052               NVDEF(NVC57D, WINDOW_SET_WINDOW_USAGE_BOUNDS, ILUT_ALLOWED, TRUE) |
0053               NVDEF(NVC57D, WINDOW_SET_WINDOW_USAGE_BOUNDS, INPUT_SCALER_TAPS, TAPS_2) |
0054               NVDEF(NVC57D, WINDOW_SET_WINDOW_USAGE_BOUNDS, UPSCALING_ALLOWED, FALSE));
0055     }
0056 
0057     core->assign_windows = true;
0058     return PUSH_KICK(push);
0059 }
0060 
0061 static const struct nv50_core_func
0062 corec57d = {
0063     .init = corec57d_init,
0064     .ntfy_init = corec37d_ntfy_init,
0065     .caps_init = corec37d_caps_init,
0066     .ntfy_wait_done = corec37d_ntfy_wait_done,
0067     .update = corec37d_update,
0068     .wndw.owner = corec37d_wndw_owner,
0069     .head = &headc57d,
0070     .sor = &sorc37d,
0071 #if IS_ENABLED(CONFIG_DEBUG_FS)
0072     .crc = &crcc57d,
0073 #endif
0074 };
0075 
0076 int
0077 corec57d_new(struct nouveau_drm *drm, s32 oclass, struct nv50_core **pcore)
0078 {
0079     return core507d_new_(&corec57d, drm, oclass, pcore);
0080 }