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 "ovly.h"
0023 #include "atom.h"
0024 
0025 #include <nvif/push507c.h>
0026 
0027 #include <nvhw/class/cl907e.h>
0028 
0029 static int
0030 ovly907e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
0031 {
0032     struct nvif_push *push = wndw->wndw.push;
0033     int ret;
0034 
0035     if ((ret = PUSH_WAIT(push, 12)))
0036         return ret;
0037 
0038     PUSH_MTHD(push, NV907E, SET_PRESENT_CONTROL,
0039           NVDEF(NV907E, SET_PRESENT_CONTROL, BEGIN_MODE, ASAP) |
0040           NVVAL(NV907E, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval));
0041 
0042     PUSH_MTHD(push, NV907E, SET_CONTEXT_DMA_ISO, asyw->image.handle[0]);
0043 
0044     PUSH_MTHD(push, NV907E, SET_COMPOSITION_CONTROL,
0045           NVDEF(NV907E, SET_COMPOSITION_CONTROL, MODE, OPAQUE));
0046 
0047     PUSH_MTHD(push, NV907E, SURFACE_SET_OFFSET, asyw->image.offset[0] >> 8);
0048 
0049     PUSH_MTHD(push, NV907E, SURFACE_SET_SIZE,
0050           NVVAL(NV907E, SURFACE_SET_SIZE, WIDTH, asyw->image.w) |
0051           NVVAL(NV907E, SURFACE_SET_SIZE, HEIGHT, asyw->image.h),
0052 
0053                 SURFACE_SET_STORAGE,
0054           NVVAL(NV907E, SURFACE_SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh) |
0055           NVVAL(NV907E, SURFACE_SET_STORAGE, PITCH, (asyw->image.pitch[0] >> 8)) |
0056           NVVAL(NV907E, SURFACE_SET_STORAGE, PITCH, asyw->image.blocks[0]) |
0057           NVVAL(NV907E, SURFACE_SET_STORAGE, MEMORY_LAYOUT, asyw->image.layout),
0058 
0059                 SURFACE_SET_PARAMS,
0060           NVVAL(NV907E, SURFACE_SET_PARAMS, FORMAT, asyw->image.format) |
0061           NVVAL(NV907E, SURFACE_SET_PARAMS, COLOR_SPACE, asyw->image.colorspace));
0062     return 0;
0063 }
0064 
0065 const struct nv50_wndw_func
0066 ovly907e = {
0067     .acquire = ovly507e_acquire,
0068     .release = ovly507e_release,
0069     .ntfy_set = base507c_ntfy_set,
0070     .ntfy_clr = base507c_ntfy_clr,
0071     .ntfy_reset = ovly827e_ntfy_reset,
0072     .ntfy_wait_begun = ovly827e_ntfy_wait_begun,
0073     .image_set = ovly907e_image_set,
0074     .image_clr = base507c_image_clr,
0075     .scale_set = ovly507e_scale_set,
0076     .update = base507c_update,
0077 };
0078 
0079 static const u32
0080 ovly907e_format[] = {
0081     DRM_FORMAT_YUYV,
0082     DRM_FORMAT_UYVY,
0083     DRM_FORMAT_XRGB8888,
0084     DRM_FORMAT_XRGB1555,
0085     DRM_FORMAT_XBGR2101010,
0086     DRM_FORMAT_XBGR16161616F,
0087     0
0088 };
0089 
0090 int
0091 ovly907e_new(struct nouveau_drm *drm, int head, s32 oclass,
0092          struct nv50_wndw **pwndw)
0093 {
0094     return ovly507e_new_(&ovly907e, ovly907e_format, drm, head, oclass,
0095                  0x00000004 << (head * 4), pwndw);
0096 }