From patchwork Thu Jul 30 07:03:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 6898911 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9FCEBC05AC for ; Thu, 30 Jul 2015 07:03:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1A382054C for ; Thu, 30 Jul 2015 07:03:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 054972054A for ; Thu, 30 Jul 2015 07:03:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 076B56E9D9; Thu, 30 Jul 2015 00:03:46 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 766C46E9D9; Thu, 30 Jul 2015 00:03:45 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 30 Jul 2015 00:03:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,575,1432623600"; d="scan'208";a="774293780" Received: from onoisett-mobl.ger.corp.intel.com (HELO patser.lan) ([10.252.3.40]) by orsmga002.jf.intel.com with ESMTP; 30 Jul 2015 00:03:43 -0700 To: Daniel Vetter , "dri-devel@lists.freedesktop.org" From: Maarten Lankhorst Subject: drm/atomic: Reject events for inactive crtc's. Message-ID: <55B9CC4E.2040306@linux.intel.com> Date: Thu, 30 Jul 2015 09:03:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Cc: Intel Graphics Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This will cause drm_atomic_helper_page_flip and drm_mode_atomic_ioctl to fail with -EINVAL if a event is requested on a inactive crtc. Signed-off-by: Maarten Lankhorst diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index d719ce0b10a0..679577e8e02d 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -476,6 +476,12 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc, return -EINVAL; } + if (!state->active && state->event) { + DRM_DEBUG_ATOMIC("[CRTC:%d] requesting event and not active\n", + crtc->base.id); + return -EINVAL; + } + /* The state->enable vs. state->mode_blob checks can be WARN_ON, * as this is a kernel-internal detail that userspace should never * be able to trigger. */