mdp5_plane.c revision 8a57e95057acdc37362f09ede3d7520f71de6f93
106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark/* 206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * Copyright (C) 2013 Red Hat 306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * Author: Rob Clark <robdclark@gmail.com> 406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * 506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * This program is free software; you can redistribute it and/or modify it 606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * under the terms of the GNU General Public License version 2 as published by 706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * the Free Software Foundation. 806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * 906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * This program is distributed in the hope that it will be useful, but WITHOUT 1006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 1206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * more details. 1306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * 1406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * You should have received a copy of the GNU General Public License along with 1506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * this program. If not, see <http://www.gnu.org/licenses/>. 1606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark */ 1706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 1806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark#include "mdp5_kms.h" 1906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 2006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 2106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstruct mdp5_plane { 2206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_plane base; 2306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark const char *name; 2406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 2506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe; 2606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 2706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t nformats; 2806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t formats[32]; 2906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 3006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark bool enabled; 3106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark}; 3206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark#define to_mdp5_plane(x) container_of(x, struct mdp5_plane, base) 3306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 3406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstatic struct mdp5_kms *get_kms(struct drm_plane *plane) 3506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 3606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct msm_drm_private *priv = plane->dev->dev_private; 3706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return to_mdp5_kms(to_mdp_kms(priv->kms)); 3806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 3906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 4006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstatic int mdp5_plane_update(struct drm_plane *plane, 4106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_crtc *crtc, struct drm_framebuffer *fb, 4206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int crtc_x, int crtc_y, 4306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark unsigned int crtc_w, unsigned int crtc_h, 4406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t src_x, uint32_t src_y, 4506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t src_w, uint32_t src_h) 4606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 4706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 4806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 4906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane->enabled = true; 5006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 5106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (plane->fb) 5206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark drm_framebuffer_unreference(plane->fb); 5306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 5406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark drm_framebuffer_reference(fb); 5506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 5606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return mdp5_plane_mode_set(plane, crtc, fb, 5706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark crtc_x, crtc_y, crtc_w, crtc_h, 5806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark src_x, src_y, src_w, src_h); 5906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 6006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 6106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstatic int mdp5_plane_disable(struct drm_plane *plane) 6206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 6306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 6406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_kms *mdp5_kms = get_kms(plane); 6506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe = mdp5_plane->pipe; 6606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int i; 6706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 6806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark DBG("%s: disable", mdp5_plane->name); 6906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 7006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* update our SMP request to zero (release all our blks): */ 7106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark for (i = 0; i < pipe2nclients(pipe); i++) 7206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_smp_request(mdp5_kms, pipe2client(pipe, i), 0); 7306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 7406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* TODO detaching now will cause us not to get the last 7506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * vblank and mdp5_smp_commit().. so other planes will 7606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * still see smp blocks previously allocated to us as 7706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * in-use.. 7806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark */ 7906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (plane->crtc) 8006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_crtc_detach(plane->crtc, plane); 8106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 8206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return 0; 8306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 8406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 8506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstatic void mdp5_plane_destroy(struct drm_plane *plane) 8606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 8706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 888a57e95057acdc37362f09ede3d7520f71de6f93Rob Clark struct msm_drm_private *priv = plane->dev->dev_private; 898a57e95057acdc37362f09ede3d7520f71de6f93Rob Clark 908a57e95057acdc37362f09ede3d7520f71de6f93Rob Clark if (priv->kms) 918a57e95057acdc37362f09ede3d7520f71de6f93Rob Clark mdp5_plane_disable(plane); 9206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 9306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark drm_plane_cleanup(plane); 9406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 9506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark kfree(mdp5_plane); 9606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 9706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 9806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark/* helper to install properties which are common to planes and crtcs */ 9906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkvoid mdp5_plane_install_properties(struct drm_plane *plane, 10006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_mode_object *obj) 10106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 10206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark // XXX 10306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 10406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 10506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkint mdp5_plane_set_property(struct drm_plane *plane, 10606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_property *property, uint64_t val) 10706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 10806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark // XXX 10906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return -EINVAL; 11006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 11106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 11206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstatic const struct drm_plane_funcs mdp5_plane_funcs = { 11306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark .update_plane = mdp5_plane_update, 11406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark .disable_plane = mdp5_plane_disable, 11506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark .destroy = mdp5_plane_destroy, 11606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark .set_property = mdp5_plane_set_property, 11706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark}; 11806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 11906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkvoid mdp5_plane_set_scanout(struct drm_plane *plane, 12006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_framebuffer *fb) 12106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 12206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 12306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_kms *mdp5_kms = get_kms(plane); 12406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe = mdp5_plane->pipe; 12506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t nplanes = drm_format_num_planes(fb->pixel_format); 12606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t iova[4]; 12706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int i; 12806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 12906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark for (i = 0; i < nplanes; i++) { 13006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_gem_object *bo = msm_framebuffer_bo(fb, i); 13106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark msm_gem_get_iova(bo, mdp5_kms->id, &iova[i]); 13206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark } 13306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark for (; i < 4; i++) 13406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark iova[i] = 0; 13506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 13606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_STRIDE_A(pipe), 13706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_STRIDE_A_P0(fb->pitches[0]) | 13806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_STRIDE_A_P1(fb->pitches[1])); 13906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 14006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_STRIDE_B(pipe), 14106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_STRIDE_B_P2(fb->pitches[2]) | 14206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_STRIDE_B_P3(fb->pitches[3])); 14306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 14406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC0_ADDR(pipe), iova[0]); 14506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC1_ADDR(pipe), iova[1]); 14606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), iova[2]); 14706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), iova[3]); 14806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 14906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark plane->fb = fb; 15006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 15106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 15206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark/* NOTE: looks like if horizontal decimation is used (if we supported that) 15306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * then the width used to calculate SMP block requirements is the post- 15406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * decimated width. Ie. SMP buffering sits downstream of decimation (which 15506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * presumably happens during the dma from scanout buffer). 15606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark */ 15706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstatic int request_smp_blocks(struct drm_plane *plane, uint32_t format, 15806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t nplanes, uint32_t width) 15906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 16006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_device *dev = plane->dev; 16106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 16206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_kms *mdp5_kms = get_kms(plane); 16306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe = mdp5_plane->pipe; 16406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int i, hsub, nlines, nblks, ret; 16506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 16606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark hsub = drm_format_horz_chroma_subsampling(format); 16706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 16806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* different if BWC (compressed framebuffer?) enabled: */ 16906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark nlines = 2; 17006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 17106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark for (i = 0, nblks = 0; i < nplanes; i++) { 17206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int n, fetch_stride, cpp; 17306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 17406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark cpp = drm_format_plane_cpp(format, i); 17506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark fetch_stride = width * cpp / (i ? hsub : 1); 17606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 17706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark n = DIV_ROUND_UP(fetch_stride * nlines, SMP_BLK_SIZE); 17806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 17906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* for hw rev v1.00 */ 18006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (mdp5_kms->rev == 0) 18106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark n = roundup_pow_of_two(n); 18206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 18306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark DBG("%s[%d]: request %d SMP blocks", mdp5_plane->name, i, n); 18406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark ret = mdp5_smp_request(mdp5_kms, pipe2client(pipe, i), n); 18506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (ret) { 18606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark dev_err(dev->dev, "Could not allocate %d SMP blocks: %d\n", 18706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark n, ret); 18806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return ret; 18906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark } 19006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 19106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark nblks += n; 19206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark } 19306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 19406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* in success case, return total # of blocks allocated: */ 19506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return nblks; 19606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 19706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 19806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstatic void set_fifo_thresholds(struct drm_plane *plane, int nblks) 19906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 20006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 20106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_kms *mdp5_kms = get_kms(plane); 20206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe = mdp5_plane->pipe; 20306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t val; 20406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 20506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* 1/4 of SMP pool that is being fetched */ 20606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark val = (nblks * SMP_ENTRIES_PER_BLK) / 4; 20706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 20806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_REQPRIO_FIFO_WM_0(pipe), val * 1); 20906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_REQPRIO_FIFO_WM_1(pipe), val * 2); 21006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_REQPRIO_FIFO_WM_2(pipe), val * 3); 21106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 21206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 21306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 21406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkint mdp5_plane_mode_set(struct drm_plane *plane, 21506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_crtc *crtc, struct drm_framebuffer *fb, 21606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int crtc_x, int crtc_y, 21706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark unsigned int crtc_w, unsigned int crtc_h, 21806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t src_x, uint32_t src_y, 21906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t src_w, uint32_t src_h) 22006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 22106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 22206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_kms *mdp5_kms = get_kms(plane); 22306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe = mdp5_plane->pipe; 22406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark const struct mdp_format *format; 22506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t nplanes, config = 0; 22606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t phasex_step = 0, phasey_step = 0; 22706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark uint32_t hdecm = 0, vdecm = 0; 22806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int i, nblks; 22906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 23006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark nplanes = drm_format_num_planes(fb->pixel_format); 23106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 23206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* bad formats should already be rejected: */ 23306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (WARN_ON(nplanes > pipe2nclients(pipe))) 23406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return -EINVAL; 23506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 23606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* src values are in Q16 fixed point, convert to integer: */ 23706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark src_x = src_x >> 16; 23806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark src_y = src_y >> 16; 23906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark src_w = src_w >> 16; 24006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark src_h = src_h >> 16; 24106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 24206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark DBG("%s: FB[%u] %u,%u,%u,%u -> CRTC[%u] %d,%d,%u,%u", mdp5_plane->name, 24306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark fb->base.id, src_x, src_y, src_w, src_h, 24406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark crtc->base.id, crtc_x, crtc_y, crtc_w, crtc_h); 24506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 24606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* 24706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * Calculate and request required # of smp blocks: 24806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark */ 24906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark nblks = request_smp_blocks(plane, fb->pixel_format, nplanes, src_w); 25006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (nblks < 0) 25106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return nblks; 25206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 25306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* 25406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * Currently we update the hw for allocations/requests immediately, 25506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * but once atomic modeset/pageflip is in place, the allocation 25606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * would move into atomic->check_plane_state(), while updating the 25706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark * hw would remain here: 25806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark */ 25906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark for (i = 0; i < pipe2nclients(pipe); i++) 26006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_smp_configure(mdp5_kms, pipe2client(pipe, i)); 26106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 26206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (src_w != crtc_w) { 26306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark config |= MDP5_PIPE_SCALE_CONFIG_SCALEX_EN; 26406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* TODO calc phasex_step, hdecm */ 26506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark } 26606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 26706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (src_h != crtc_h) { 26806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark config |= MDP5_PIPE_SCALE_CONFIG_SCALEY_EN; 26906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* TODO calc phasey_step, vdecm */ 27006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark } 27106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 27206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_IMG_SIZE(pipe), 27306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_IMG_SIZE_WIDTH(src_w) | 27406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_IMG_SIZE_HEIGHT(src_h)); 27506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 27606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_SIZE(pipe), 27706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_SIZE_WIDTH(src_w) | 27806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_SIZE_HEIGHT(src_h)); 27906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 28006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_XY(pipe), 28106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_XY_X(src_x) | 28206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_XY_Y(src_y)); 28306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 28406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_OUT_SIZE(pipe), 28506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_OUT_SIZE_WIDTH(crtc_w) | 28606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_OUT_SIZE_HEIGHT(crtc_h)); 28706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 28806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_OUT_XY(pipe), 28906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_OUT_XY_X(crtc_x) | 29006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_OUT_XY_Y(crtc_y)); 29106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 29206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane_set_scanout(plane, fb); 29306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 29406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark format = to_mdp_format(msm_framebuffer_format(fb)); 29506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 29606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_FORMAT(pipe), 29706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_A_BPC(format->bpc_a) | 29806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_R_BPC(format->bpc_r) | 29906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_G_BPC(format->bpc_g) | 30006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_B_BPC(format->bpc_b) | 30106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark COND(format->alpha_enable, MDP5_PIPE_SRC_FORMAT_ALPHA_ENABLE) | 30206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_CPP(format->cpp - 1) | 30306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_UNPACK_COUNT(format->unpack_count - 1) | 30406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark COND(format->unpack_tight, MDP5_PIPE_SRC_FORMAT_UNPACK_TIGHT) | 30506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_NUM_PLANES(nplanes - 1) | 30606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_FORMAT_CHROMA_SAMP(CHROMA_RGB)); 30706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 30806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_UNPACK(pipe), 30906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_UNPACK_ELEM0(format->unpack[0]) | 31006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_UNPACK_ELEM1(format->unpack[1]) | 31106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_UNPACK_ELEM2(format->unpack[2]) | 31206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_UNPACK_ELEM3(format->unpack[3])); 31306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 31406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_OP_MODE(pipe), 31506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SRC_OP_MODE_BWC(BWC_LOSSLESS)); 31606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 31706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* not using secure mode: */ 31806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_ADDR_SW_STATUS(pipe), 0); 31906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 32006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SCALE_PHASE_STEP_X(pipe), phasex_step); 32106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SCALE_PHASE_STEP_Y(pipe), phasey_step); 32206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_DECIMATION(pipe), 32306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_DECIMATION_VERT(vdecm) | 32406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_DECIMATION_HORZ(hdecm)); 32506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_write(mdp5_kms, REG_MDP5_PIPE_SCALE_CONFIG(pipe), 32606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SCALE_CONFIG_SCALEX_MIN_FILTER(SCALE_FILTER_NEAREST) | 32706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SCALE_CONFIG_SCALEY_MIN_FILTER(SCALE_FILTER_NEAREST) | 32806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SCALE_CONFIG_SCALEX_CR_FILTER(SCALE_FILTER_NEAREST) | 32906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SCALE_CONFIG_SCALEY_CR_FILTER(SCALE_FILTER_NEAREST) | 33006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SCALE_CONFIG_SCALEX_MAX_FILTER(SCALE_FILTER_NEAREST) | 33106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark MDP5_PIPE_SCALE_CONFIG_SCALEY_MAX_FILTER(SCALE_FILTER_NEAREST)); 33206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 33306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark set_fifo_thresholds(plane, nblks); 33406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 33506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark /* TODO detach from old crtc (if we had more than one) */ 33606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_crtc_attach(crtc, plane); 33706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 33806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return 0; 33906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 34006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 34106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkvoid mdp5_plane_complete_flip(struct drm_plane *plane) 34206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 34306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_kms *mdp5_kms = get_kms(plane); 34406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe = to_mdp5_plane(plane)->pipe; 34506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int i; 34606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 34706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark for (i = 0; i < pipe2nclients(pipe); i++) 34806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_smp_commit(mdp5_kms, pipe2client(pipe, i)); 34906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 35006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 35106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkenum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane) 35206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 35306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); 35406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return mdp5_plane->pipe; 35506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 35606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 35706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark/* initialize plane */ 35806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkstruct drm_plane *mdp5_plane_init(struct drm_device *dev, 35906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark enum mdp5_pipe pipe, bool private_plane) 36006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark{ 36106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct drm_plane *plane = NULL; 36206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark struct mdp5_plane *mdp5_plane; 36306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark int ret; 3642d82d188b2cb11b6b221eb84dda2344ef3cd1bb4Matt Roper enum drm_plane_type type; 36506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 36606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane = kzalloc(sizeof(*mdp5_plane), GFP_KERNEL); 36706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (!mdp5_plane) { 36806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark ret = -ENOMEM; 36906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark goto fail; 37006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark } 37106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 37206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark plane = &mdp5_plane->base; 37306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 37406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane->pipe = pipe; 37506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane->name = pipe2name(pipe); 37606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 37706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane->nformats = mdp5_get_formats(pipe, mdp5_plane->formats, 37806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark ARRAY_SIZE(mdp5_plane->formats)); 37906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 3802d82d188b2cb11b6b221eb84dda2344ef3cd1bb4Matt Roper type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; 3812d82d188b2cb11b6b221eb84dda2344ef3cd1bb4Matt Roper drm_universal_plane_init(dev, plane, 0xff, &mdp5_plane_funcs, 3822d82d188b2cb11b6b221eb84dda2344ef3cd1bb4Matt Roper mdp5_plane->formats, mdp5_plane->nformats, 3832d82d188b2cb11b6b221eb84dda2344ef3cd1bb4Matt Roper type); 38406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 38506c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane_install_properties(plane, &plane->base); 38606c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 38706c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return plane; 38806c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 38906c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clarkfail: 39006c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark if (plane) 39106c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark mdp5_plane_destroy(plane); 39206c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark 39306c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark return ERR_PTR(ret); 39406c0dd96bfbba8a9368ffd7c4b12d3bfed37001dRob Clark} 395