aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_plane.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-07-10 01:59:35 -0400
committerDave Airlie <airlied@redhat.com>2015-07-10 01:59:35 -0400
commit2d28b633c3fa8f53b919a5de86eb1c8e78dde818 (patch)
tree791cc8b3a7c6ba0a55c2c2f2caf61e563ef7b5d8 /drivers/gpu/drm/omapdrm/omap_plane.c
parent59e7a16d60ffead64d1407bf8915b8b2078ba870 (diff)
parent743c16719f671c206923d23dae4ac57edfd9483c (diff)
Merge tag 'omapdrm-4.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-fixes
omapdrm fixes for 4.2 Small fixes for omapdrm, including: * Fix packed 24 bit color formats * Ensure the planes are inside the crtc * Handle out-of-dma-memory error * tag 'omapdrm-4.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: drm/omap: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN drm/omap: fix align_pitch() for 24 bits per pixel drm/omap: fix omap_gem_put_paddr() error handling drm/omap: fix omap_framebuffer_unpin() error handling drm/omap: increase DMM transaction timeout drm/omap: check that plane is inside crtc drm/omap: return error if dma_alloc_writecombine fails
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_plane.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index cfa8276c4deb..098904696a5c 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -17,6 +17,7 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <drm/drm_atomic.h>
20#include <drm/drm_atomic_helper.h> 21#include <drm/drm_atomic_helper.h>
21#include <drm/drm_plane_helper.h> 22#include <drm/drm_plane_helper.h>
22 23
@@ -153,9 +154,34 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
153 dispc_ovl_enable(omap_plane->id, false); 154 dispc_ovl_enable(omap_plane->id, false);
154} 155}
155 156
157static int omap_plane_atomic_check(struct drm_plane *plane,
158 struct drm_plane_state *state)
159{
160 struct drm_crtc_state *crtc_state;
161
162 if (!state->crtc)
163 return 0;
164
165 crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
166 if (IS_ERR(crtc_state))
167 return PTR_ERR(crtc_state);
168
169 if (state->crtc_x < 0 || state->crtc_y < 0)
170 return -EINVAL;
171
172 if (state->crtc_x + state->crtc_w > crtc_state->adjusted_mode.hdisplay)
173 return -EINVAL;
174
175 if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay)
176 return -EINVAL;
177
178 return 0;
179}
180
156static const struct drm_plane_helper_funcs omap_plane_helper_funcs = { 181static const struct drm_plane_helper_funcs omap_plane_helper_funcs = {
157 .prepare_fb = omap_plane_prepare_fb, 182 .prepare_fb = omap_plane_prepare_fb,
158 .cleanup_fb = omap_plane_cleanup_fb, 183 .cleanup_fb = omap_plane_cleanup_fb,
184 .atomic_check = omap_plane_atomic_check,
159 .atomic_update = omap_plane_atomic_update, 185 .atomic_update = omap_plane_atomic_update,
160 .atomic_disable = omap_plane_atomic_disable, 186 .atomic_disable = omap_plane_atomic_disable,
161}; 187};