177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#ifndef __NOUVEAU_DISPLAY_H__ 277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#define __NOUVEAU_DISPLAY_H__ 377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#include <subdev/vm.h> 577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 677145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#include "nouveau_drm.h" 777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsstruct nouveau_framebuffer { 977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_framebuffer base; 1077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct nouveau_bo *nvbo; 1177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct nouveau_vma vma; 128a42364701d6860e51d53bbcbe3c84fe93816861Ben Skeggs u32 r_handle; 1377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs u32 r_format; 1477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs u32 r_pitch; 150ad72863ea426d46b2786cba9430e122a40aad0bBen Skeggs struct nvif_object h_base[4]; 160ad72863ea426d46b2786cba9430e122a40aad0bBen Skeggs struct nvif_object h_core; 1777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs}; 1877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 1977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsstatic inline struct nouveau_framebuffer * 2077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsnouveau_framebuffer(struct drm_framebuffer *fb) 2177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs{ 2277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs return container_of(fb, struct nouveau_framebuffer, base); 2377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs} 2477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 2577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsint nouveau_framebuffer_init(struct drm_device *, struct nouveau_framebuffer *, 2677145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_mode_fb_cmd2 *, struct nouveau_bo *); 2777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 2877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsstruct nouveau_page_flip_state { 2977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct list_head head; 3077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_pending_vblank_event *event; 3177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs int crtc, bpp, pitch, x, y; 3277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs u64 offset; 3377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs}; 3477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 3577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsstruct nouveau_display { 3677145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs void *priv; 3777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs void (*dtor)(struct drm_device *); 3877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs int (*init)(struct drm_device *); 3977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs void (*fini)(struct drm_device *); 4077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 41ab0af559d34b6817768c1720859aef7d7009ee57Ben Skeggs int (*fb_ctor)(struct drm_framebuffer *); 42ab0af559d34b6817768c1720859aef7d7009ee57Ben Skeggs void (*fb_dtor)(struct drm_framebuffer *); 43ab0af559d34b6817768c1720859aef7d7009ee57Ben Skeggs 440ad72863ea426d46b2786cba9430e122a40aad0bBen Skeggs struct nvif_object disp; 45ab0af559d34b6817768c1720859aef7d7009ee57Ben Skeggs 4677145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_property *dithering_mode; 4777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_property *dithering_depth; 4877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_property *underscan_property; 4977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_property *underscan_hborder_property; 5077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_property *underscan_vborder_property; 5177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs /* not really hue and saturation: */ 5277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_property *vibrant_hue_property; 5377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_property *color_vibrance_property; 5477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs}; 5577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 5677145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsstatic inline struct nouveau_display * 5777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsnouveau_display(struct drm_device *dev) 5877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs{ 5977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs return nouveau_drm(dev)->display; 6077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs} 6177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 6277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsint nouveau_display_create(struct drm_device *dev); 6377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsvoid nouveau_display_destroy(struct drm_device *dev); 6477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsint nouveau_display_init(struct drm_device *dev); 6577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsvoid nouveau_display_fini(struct drm_device *dev); 666fbb702e27d78ad2458df048b58cca3454bc0965Ben Skeggsint nouveau_display_suspend(struct drm_device *dev, bool runtime); 676fbb702e27d78ad2458df048b58cca3454bc0965Ben Skeggsvoid nouveau_display_resume(struct drm_device *dev, bool runtime); 6851cb4b392a307a8293b4f1f300ab803d7ad3b036Ben Skeggsint nouveau_display_vblank_enable(struct drm_device *, int); 6951cb4b392a307a8293b4f1f300ab803d7ad3b036Ben Skeggsvoid nouveau_display_vblank_disable(struct drm_device *, int); 70d83ef85395c9c1fae7636dca59f95c64963b307dBen Skeggsint nouveau_display_scanoutpos(struct drm_device *, int, unsigned int, 71d83ef85395c9c1fae7636dca59f95c64963b307dBen Skeggs int *, int *, ktime_t *, ktime_t *); 72d83ef85395c9c1fae7636dca59f95c64963b307dBen Skeggsint nouveau_display_vblstamp(struct drm_device *, int, int *, 73d83ef85395c9c1fae7636dca59f95c64963b307dBen Skeggs struct timeval *, unsigned); 7477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 7577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsint nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, 76ed8d19756e80ec63003a93aa4d70406e6ba61522Keith Packard struct drm_pending_vblank_event *event, 77ed8d19756e80ec63003a93aa4d70406e6ba61522Keith Packard uint32_t page_flip_flags); 7877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsint nouveau_finish_page_flip(struct nouveau_channel *, 7977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct nouveau_page_flip_state *); 8077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 8177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsint nouveau_display_dumb_create(struct drm_file *, struct drm_device *, 8277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs struct drm_mode_create_dumb *args); 8377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsint nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, 8477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs u32 handle, u64 *offset); 8577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 8677145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsvoid nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *); 8777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 885addcf0a5f0fadceba6bd562d0616a1c5d4c1a4dDave Airlieint nouveau_crtc_set_config(struct drm_mode_set *set); 8977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT 9077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsextern int nouveau_backlight_init(struct drm_device *); 9177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsextern void nouveau_backlight_exit(struct drm_device *); 9277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#else 9377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsstatic inline int 9477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsnouveau_backlight_init(struct drm_device *dev) 9577145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs{ 9677145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs return 0; 9777145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs} 9877145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 9977145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsstatic inline void 10077145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggsnouveau_backlight_exit(struct drm_device *dev) { 10177145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs} 10277145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#endif 10377145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs 10477145f1cbdf8d28b46ff8070ca749bad821e0774Ben Skeggs#endif 105