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 "base.h"
0023 
0024 #include <nvif/push507c.h>
0025 
0026 #include <nvhw/class/cl827c.h>
0027 
0028 static int
0029 base827c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
0030 {
0031     struct nvif_push *push = wndw->wndw.push;
0032     int ret;
0033 
0034     if ((ret = PUSH_WAIT(push, 13)))
0035         return ret;
0036 
0037     PUSH_MTHD(push, NV827C, SET_PRESENT_CONTROL,
0038           NVVAL(NV827C, SET_PRESENT_CONTROL, BEGIN_MODE, asyw->image.mode) |
0039           NVVAL(NV827C, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval));
0040 
0041     PUSH_MTHD(push, NV827C, SET_CONTEXT_DMAS_ISO(0), asyw->image.handle, 1);
0042 
0043     if (asyw->image.format == NV827C_SURFACE_SET_PARAMS_FORMAT_RF16_GF16_BF16_AF16) {
0044         PUSH_MTHD(push, NV827C, SET_PROCESSING,
0045               NVDEF(NV827C, SET_PROCESSING, USE_GAIN_OFS, ENABLE),
0046 
0047                     SET_CONVERSION,
0048               NVVAL(NV827C, SET_CONVERSION, GAIN, 0) |
0049               NVVAL(NV827C, SET_CONVERSION, OFS, 0x64));
0050     } else {
0051         PUSH_MTHD(push, NV827C, SET_PROCESSING,
0052               NVDEF(NV827C, SET_PROCESSING, USE_GAIN_OFS, DISABLE),
0053 
0054                     SET_CONVERSION,
0055               NVVAL(NV827C, SET_CONVERSION, GAIN, 0) |
0056               NVVAL(NV827C, SET_CONVERSION, OFS, 0));
0057     }
0058 
0059     PUSH_MTHD(push, NV827C, SURFACE_SET_OFFSET(0, 0), asyw->image.offset[0] >> 8,
0060                 SURFACE_SET_OFFSET(0, 1), 0x00000000,
0061 
0062                 SURFACE_SET_SIZE(0),
0063           NVVAL(NV827C, SURFACE_SET_SIZE, WIDTH, asyw->image.w) |
0064           NVVAL(NV827C, SURFACE_SET_SIZE, HEIGHT, asyw->image.h),
0065 
0066                 SURFACE_SET_STORAGE(0),
0067           NVVAL(NV827C, SURFACE_SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh) |
0068           NVVAL(NV827C, SURFACE_SET_STORAGE, PITCH, asyw->image.pitch[0] >> 8) |
0069           NVVAL(NV827C, SURFACE_SET_STORAGE, PITCH, asyw->image.blocks[0]) |
0070           NVVAL(NV827C, SURFACE_SET_STORAGE, MEMORY_LAYOUT, asyw->image.layout),
0071 
0072                 SURFACE_SET_PARAMS(0),
0073           NVVAL(NV827C, SURFACE_SET_PARAMS, FORMAT, asyw->image.format) |
0074           NVDEF(NV827C, SURFACE_SET_PARAMS, SUPER_SAMPLE, X1_AA) |
0075           NVDEF(NV827C, SURFACE_SET_PARAMS, GAMMA, LINEAR) |
0076           NVDEF(NV827C, SURFACE_SET_PARAMS, LAYOUT, FRM));
0077     return 0;
0078 }
0079 
0080 static const struct nv50_wndw_func
0081 base827c = {
0082     .acquire = base507c_acquire,
0083     .release = base507c_release,
0084     .sema_set = base507c_sema_set,
0085     .sema_clr = base507c_sema_clr,
0086     .ntfy_reset = base507c_ntfy_reset,
0087     .ntfy_set = base507c_ntfy_set,
0088     .ntfy_clr = base507c_ntfy_clr,
0089     .ntfy_wait_begun = base507c_ntfy_wait_begun,
0090     .olut_core = 1,
0091     .xlut_set = base507c_xlut_set,
0092     .xlut_clr = base507c_xlut_clr,
0093     .image_set = base827c_image_set,
0094     .image_clr = base507c_image_clr,
0095     .update = base507c_update,
0096 };
0097 
0098 int
0099 base827c_new(struct nouveau_drm *drm, int head, s32 oclass,
0100          struct nv50_wndw **pwndw)
0101 {
0102     return base507c_new_(&base827c, base507c_format, drm, head, oclass,
0103                  0x00000002 << (head * 8), pwndw);
0104 }