#include <drm/drm_gem.h>
#include <drm/drm_print.h>
-#include "i915_overlay.h"
#include "intel_color_regs.h"
#include "intel_de.h"
#include "intel_display_regs.h"
#include "intel_display_types.h"
#include "intel_frontbuffer.h"
#include "intel_overlay.h"
+#include "intel_parent.h"
#include "intel_pfit_regs.h"
/* Limits for overlay size. According to intel doc, the real limits are:
overlay->old_yscale = 0;
overlay->crtc = NULL;
- i915_overlay_reset(display->drm);
+ intel_parent_overlay_reset(display);
}
static int packed_depth_bytes(u32 format)
drm_WARN_ON(display->drm,
!drm_modeset_is_locked(&display->drm->mode_config.connection_mutex));
- ret = i915_overlay_release_old_vid(display->drm);
+ ret = intel_parent_overlay_release_old_vid(display);
if (ret != 0)
return ret;
atomic_inc(&display->restore.pending_fb_pin);
- vma = i915_overlay_pin_fb(display->drm, obj, &offset);
+ vma = intel_parent_overlay_pin_fb(display, obj, &offset);
if (IS_ERR(vma)) {
ret = PTR_ERR(vma);
goto out_pin_section;
}
- if (!i915_overlay_is_active(display->drm)) {
+ if (!intel_parent_overlay_is_active(display)) {
const struct intel_crtc_state *crtc_state =
overlay->crtc->config;
u32 oconfig = 0;
OCONF_PIPE_A : OCONF_PIPE_B;
iowrite32(oconfig, ®s->OCONFIG);
- ret = i915_overlay_on(display->drm, INTEL_FRONTBUFFER_OVERLAY(pipe));
+ ret = intel_parent_overlay_on(display, INTEL_FRONTBUFFER_OVERLAY(pipe));
if (ret != 0)
goto out_unpin;
}
if (tmp & (1 << 17))
drm_dbg(display->drm, "overlay underrun, DOVSTA: %x\n", tmp);
- ret = i915_overlay_continue(display->drm, vma, scale_changed);
+ ret = intel_parent_overlay_continue(display, vma, scale_changed);
if (ret)
goto out_unpin;
return 0;
out_unpin:
- i915_overlay_unpin_fb(display->drm, vma);
+ intel_parent_overlay_unpin_fb(display, vma);
out_pin_section:
atomic_dec(&display->restore.pending_fb_pin);
drm_WARN_ON(display->drm,
!drm_modeset_is_locked(&display->drm->mode_config.connection_mutex));
- ret = i915_overlay_recover_from_interrupt(display->drm);
+ ret = intel_parent_overlay_recover_from_interrupt(display);
if (ret != 0)
return ret;
- if (!i915_overlay_is_active(display->drm))
+ if (!intel_parent_overlay_is_active(display))
return 0;
- ret = i915_overlay_release_old_vid(display->drm);
+ ret = intel_parent_overlay_release_old_vid(display);
if (ret != 0)
return ret;
overlay->crtc->overlay = NULL;
overlay->crtc = NULL;
- return i915_overlay_off(display->drm);
+ return intel_parent_overlay_off(display);
}
static int check_overlay_possible_on_crtc(struct intel_overlay *overlay,
return -ENOENT;
crtc = to_intel_crtc(drmmode_crtc);
- obj = i915_overlay_obj_lookup(dev, file_priv, params->bo_handle);
+ obj = intel_parent_overlay_obj_lookup(display, file_priv, params->bo_handle);
if (IS_ERR(obj))
return PTR_ERR(obj);
drm_modeset_lock_all(dev);
- ret = i915_overlay_recover_from_interrupt(dev);
+ ret = intel_parent_overlay_recover_from_interrupt(display);
if (ret != 0)
goto out_unlock;
if (DISPLAY_VER(display) == 2)
goto out_unlock;
- if (i915_overlay_is_active(display->drm)) {
+ if (intel_parent_overlay_is_active(display)) {
ret = -EBUSY;
goto out_unlock;
}
if (!overlay)
return;
- regs = i915_overlay_setup(display->drm,
- OVERLAY_NEEDS_PHYSICAL(display));
+ regs = intel_parent_overlay_setup(display,
+ OVERLAY_NEEDS_PHYSICAL(display));
if (IS_ERR(regs))
goto out_free;
if (!display->overlay)
return;
- i915_overlay_cleanup(display->drm);
+ intel_parent_overlay_cleanup(display);
kfree(display->overlay);
display->overlay = NULL;
struct intel_display;
struct intel_overlay;
-#ifdef I915
void intel_overlay_setup(struct intel_display *display);
bool intel_overlay_available(struct intel_display *display);
void intel_overlay_cleanup(struct intel_display *display);
int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
void intel_overlay_reset(struct intel_display *display);
-#else
-static inline void intel_overlay_setup(struct intel_display *display)
-{
-}
-static inline bool intel_overlay_available(struct intel_display *display)
-{
- return false;
-}
-static inline void intel_overlay_cleanup(struct intel_display *display)
-{
-}
-static inline int intel_overlay_switch_off(struct intel_overlay *overlay)
-{
- return 0;
-}
-static inline int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- return 0;
-}
-static inline int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- return 0;
-}
-static inline void intel_overlay_reset(struct intel_display *display)
-{
-}
-#endif
#endif /* __INTEL_OVERLAY_H__ */
display->parent->irq->synchronize(display->drm);
}
+/* overlay */
+bool intel_parent_overlay_is_active(struct intel_display *display)
+{
+ return display->parent->overlay->is_active(display->drm);
+}
+
+int intel_parent_overlay_on(struct intel_display *display,
+ u32 frontbuffer_bits)
+{
+ return display->parent->overlay->overlay_on(display->drm,
+ frontbuffer_bits);
+}
+
+int intel_parent_overlay_continue(struct intel_display *display,
+ struct i915_vma *vma,
+ bool load_polyphase_filter)
+{
+ return display->parent->overlay->overlay_continue(display->drm, vma,
+ load_polyphase_filter);
+}
+
+int intel_parent_overlay_off(struct intel_display *display)
+{
+ return display->parent->overlay->overlay_off(display->drm);
+}
+
+int intel_parent_overlay_recover_from_interrupt(struct intel_display *display)
+{
+ return display->parent->overlay->recover_from_interrupt(display->drm);
+}
+
+int intel_parent_overlay_release_old_vid(struct intel_display *display)
+{
+ return display->parent->overlay->release_old_vid(display->drm);
+}
+
+void intel_parent_overlay_reset(struct intel_display *display)
+{
+ display->parent->overlay->reset(display->drm);
+}
+
+struct i915_vma *intel_parent_overlay_pin_fb(struct intel_display *display,
+ struct drm_gem_object *obj,
+ u32 *offset)
+{
+ return display->parent->overlay->pin_fb(display->drm, obj, offset);
+}
+
+void intel_parent_overlay_unpin_fb(struct intel_display *display,
+ struct i915_vma *vma)
+{
+ return display->parent->overlay->unpin_fb(display->drm, vma);
+}
+
+struct drm_gem_object *intel_parent_overlay_obj_lookup(struct intel_display *display,
+ struct drm_file *filp,
+ u32 handle)
+{
+ return display->parent->overlay->obj_lookup(display->drm,
+ filp, handle);
+}
+
+void __iomem *intel_parent_overlay_setup(struct intel_display *display,
+ bool needs_physical)
+{
+ if (drm_WARN_ON_ONCE(display->drm, !display->parent->overlay))
+ return ERR_PTR(-ENODEV);
+
+ return display->parent->overlay->setup(display->drm, needs_physical);
+}
+
+void intel_parent_overlay_cleanup(struct intel_display *display)
+{
+ display->parent->overlay->cleanup(display->drm);
+}
+
/* panic */
struct intel_panic *intel_parent_panic_alloc(struct intel_display *display)
{
#include <linux/types.h>
struct dma_fence;
+struct drm_file;
struct drm_gem_object;
struct drm_scanout_buffer;
+struct i915_vma;
struct intel_display;
struct intel_dpt;
struct intel_hdcp_gsc_context;
bool intel_parent_irq_enabled(struct intel_display *display);
void intel_parent_irq_synchronize(struct intel_display *display);
+/* overlay */
+bool intel_parent_overlay_is_active(struct intel_display *display);
+int intel_parent_overlay_on(struct intel_display *display,
+ u32 frontbuffer_bits);
+int intel_parent_overlay_continue(struct intel_display *display,
+ struct i915_vma *vma,
+ bool load_polyphase_filter);
+int intel_parent_overlay_off(struct intel_display *display);
+int intel_parent_overlay_recover_from_interrupt(struct intel_display *display);
+int intel_parent_overlay_release_old_vid(struct intel_display *display);
+void intel_parent_overlay_reset(struct intel_display *display);
+struct i915_vma *intel_parent_overlay_pin_fb(struct intel_display *display,
+ struct drm_gem_object *obj,
+ u32 *offset);
+void intel_parent_overlay_unpin_fb(struct intel_display *display,
+ struct i915_vma *vma);
+struct drm_gem_object *intel_parent_overlay_obj_lookup(struct intel_display *display,
+ struct drm_file *filp,
+ u32 handle);
+void __iomem *intel_parent_overlay_setup(struct intel_display *display,
+ bool needs_physical);
+void intel_parent_overlay_cleanup(struct intel_display *display);
+
/* panic */
struct intel_panic *intel_parent_panic_alloc(struct intel_display *display);
int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb);
#include "i915_ioctl.h"
#include "i915_irq.h"
#include "i915_memcpy.h"
+#include "i915_overlay.h"
#include "i915_panic.h"
#include "i915_perf.h"
#include "i915_query.h"
.hdcp = &i915_display_hdcp_interface,
.initial_plane = &i915_display_initial_plane_interface,
.irq = &i915_display_irq_interface,
+ .overlay = &i915_display_overlay_interface,
.panic = &i915_display_panic_interface,
.pc8 = &i915_display_pc8_interface,
.pcode = &i915_display_pcode_interface,
#include <drm/drm_print.h>
+#include <drm/intel/display_parent_interface.h>
#include <drm/intel/intel_gmd_interrupt_regs.h>
#include "gem/i915_gem_internal.h"
return rq;
}
-bool i915_overlay_is_active(struct drm_device *drm)
+static bool i915_overlay_is_active(struct drm_device *drm)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
}
/* overlay needs to be disable in OCMD reg */
-int i915_overlay_on(struct drm_device *drm,
- u32 frontbuffer_bits)
+static int i915_overlay_on(struct drm_device *drm,
+ u32 frontbuffer_bits)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
}
/* overlay needs to be enabled in OCMD reg */
-int i915_overlay_continue(struct drm_device *drm,
- struct i915_vma *vma,
- bool load_polyphase_filter)
+static int i915_overlay_continue(struct drm_device *drm,
+ struct i915_vma *vma,
+ bool load_polyphase_filter)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
i915_vma_put(vma);
}
-static void i915_overlay_release_old_vid_tail(struct i915_overlay *overlay)
+static void
+i915_overlay_release_old_vid_tail(struct i915_overlay *overlay)
{
i915_overlay_release_old_vma(overlay);
}
}
/* overlay needs to be disabled in OCMD reg */
-int i915_overlay_off(struct drm_device *drm)
+static int i915_overlay_off(struct drm_device *drm)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
* Recover from an interruption due to a signal.
* We have to be careful not to repeat work forever an make forward progress.
*/
-int i915_overlay_recover_from_interrupt(struct drm_device *drm)
+static int i915_overlay_recover_from_interrupt(struct drm_device *drm)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
* Needs to be called before the overlay register are changed
* via intel_overlay_(un)map_regs.
*/
-int i915_overlay_release_old_vid(struct drm_device *drm)
+static int i915_overlay_release_old_vid(struct drm_device *drm)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
return i915_active_wait(&overlay->last_flip);
}
-void i915_overlay_reset(struct drm_device *drm)
+static void i915_overlay_reset(struct drm_device *drm)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay = i915->overlay;
overlay->frontbuffer_bits = 0;
}
-struct i915_vma *i915_overlay_pin_fb(struct drm_device *drm,
- struct drm_gem_object *obj,
- u32 *offset)
+static struct i915_vma *i915_overlay_pin_fb(struct drm_device *drm,
+ struct drm_gem_object *obj,
+ u32 *offset)
{
struct drm_i915_gem_object *new_bo = to_intel_bo(obj);
struct i915_gem_ww_ctx ww;
return vma;
}
-void i915_overlay_unpin_fb(struct drm_device *drm,
- struct i915_vma *vma)
+static void i915_overlay_unpin_fb(struct drm_device *drm,
+ struct i915_vma *vma)
{
i915_vma_unpin(vma);
}
-struct drm_gem_object *
+static struct drm_gem_object *
i915_overlay_obj_lookup(struct drm_device *drm,
struct drm_file *file_priv,
u32 handle)
return err;
}
-void __iomem *i915_overlay_setup(struct drm_device *drm,
- bool needs_physical)
+static void __iomem *i915_overlay_setup(struct drm_device *drm,
+ bool needs_physical)
{
struct drm_i915_private *i915 = to_i915(drm);
struct intel_engine_cs *engine;
return overlay->regs;
}
-void i915_overlay_cleanup(struct drm_device *drm)
+static void i915_overlay_cleanup(struct drm_device *drm)
{
struct drm_i915_private *i915 = to_i915(drm);
struct i915_overlay *overlay;
kfree(overlay);
}
+
+const struct intel_display_overlay_interface i915_display_overlay_interface = {
+ .is_active = i915_overlay_is_active,
+ .overlay_on = i915_overlay_on,
+ .overlay_continue = i915_overlay_continue,
+ .overlay_off = i915_overlay_off,
+ .recover_from_interrupt = i915_overlay_recover_from_interrupt,
+ .release_old_vid = i915_overlay_release_old_vid,
+ .reset = i915_overlay_reset,
+ .obj_lookup = i915_overlay_obj_lookup,
+ .pin_fb = i915_overlay_pin_fb,
+ .unpin_fb = i915_overlay_unpin_fb,
+ .setup = i915_overlay_setup,
+ .cleanup = i915_overlay_cleanup,
+};
#ifndef __I915_OVERLAY_H__
#define __I915_OVERLAY_H__
-#include <linux/types.h>
-
-struct drm_device;
-struct drm_file;
-struct drm_gem_object;
-struct i915_vma;
-
-bool i915_overlay_is_active(struct drm_device *drm);
-int i915_overlay_on(struct drm_device *drm,
- u32 frontbuffer_bits);
-int i915_overlay_continue(struct drm_device *drm,
- struct i915_vma *vma,
- bool load_polyphase_filter);
-int i915_overlay_off(struct drm_device *drm);
-int i915_overlay_recover_from_interrupt(struct drm_device *drm);
-int i915_overlay_release_old_vid(struct drm_device *drm);
-
-void i915_overlay_reset(struct drm_device *drm);
-
-struct i915_vma *i915_overlay_pin_fb(struct drm_device *drm,
- struct drm_gem_object *obj,
- u32 *offset);
-void i915_overlay_unpin_fb(struct drm_device *drm,
- struct i915_vma *vma);
-
-struct drm_gem_object *
-i915_overlay_obj_lookup(struct drm_device *drm,
- struct drm_file *file_priv,
- u32 handle);
-
-void __iomem *i915_overlay_setup(struct drm_device *drm,
- bool needs_physical);
-void i915_overlay_cleanup(struct drm_device *drm);
+extern const struct intel_display_overlay_interface i915_display_overlay_interface;
#endif /* __I915_OVERLAY_H__ */
i915-display/intel_modeset_lock.o \
i915-display/intel_modeset_setup.o \
i915-display/intel_modeset_verify.o \
+ i915-display/intel_overlay.o \
i915-display/intel_panel.o \
i915-display/intel_parent.o \
i915-display/intel_pch.o \
struct dma_fence;
struct drm_crtc;
struct drm_device;
+struct drm_file;
struct drm_framebuffer;
struct drm_gem_object;
struct drm_plane_state;
void (*synchronize)(struct drm_device *drm);
};
+struct intel_display_overlay_interface {
+ bool (*is_active)(struct drm_device *drm);
+
+ int (*overlay_on)(struct drm_device *drm,
+ u32 frontbuffer_bits);
+ int (*overlay_continue)(struct drm_device *drm,
+ struct i915_vma *vma,
+ bool load_polyphase_filter);
+ int (*overlay_off)(struct drm_device *drm);
+ int (*recover_from_interrupt)(struct drm_device *drm);
+ int (*release_old_vid)(struct drm_device *drm);
+
+ void (*reset)(struct drm_device *drm);
+
+ struct i915_vma *(*pin_fb)(struct drm_device *drm,
+ struct drm_gem_object *obj,
+ u32 *offset);
+ void (*unpin_fb)(struct drm_device *drm,
+ struct i915_vma *vma);
+
+ struct drm_gem_object *(*obj_lookup)(struct drm_device *drm,
+ struct drm_file *filp,
+ u32 handle);
+
+ void __iomem *(*setup)(struct drm_device *drm,
+ bool needs_physical);
+ void (*cleanup)(struct drm_device *drm);
+};
+
struct intel_display_panic_interface {
struct intel_panic *(*alloc)(void);
int (*setup)(struct intel_panic *panic, struct drm_scanout_buffer *sb);
/** @panic: Panic interface */
const struct intel_display_panic_interface *panic;
+ /** @overlay: Overlay. Optional. */
+ const struct intel_display_overlay_interface *overlay;
+
/** @pc8: PC8 interface. Optional. */
const struct intel_display_pc8_interface *pc8;