aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h97
1 files changed, 94 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 2af2678ddaf6..ffde1e9666e8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -38,11 +38,15 @@
38#include <drm/drm_crtc_helper.h> 38#include <drm/drm_crtc_helper.h>
39#include <drm/drm_fb_helper.h> 39#include <drm/drm_fb_helper.h>
40#include <drm/drm_plane_helper.h> 40#include <drm/drm_plane_helper.h>
41#include <drm/drm_fb_helper.h>
41#include <linux/i2c.h> 42#include <linux/i2c.h>
42#include <linux/i2c-algo-bit.h> 43#include <linux/i2c-algo-bit.h>
43#include <linux/hrtimer.h> 44#include <linux/hrtimer.h>
44#include "amdgpu_irq.h" 45#include "amdgpu_irq.h"
45 46
47#include <drm/drm_dp_mst_helper.h>
48#include "modules/inc/mod_freesync.h"
49
46struct amdgpu_bo; 50struct amdgpu_bo;
47struct amdgpu_device; 51struct amdgpu_device;
48struct amdgpu_encoder; 52struct amdgpu_encoder;
@@ -53,9 +57,13 @@ struct amdgpu_hpd;
53#define to_amdgpu_connector(x) container_of(x, struct amdgpu_connector, base) 57#define to_amdgpu_connector(x) container_of(x, struct amdgpu_connector, base)
54#define to_amdgpu_encoder(x) container_of(x, struct amdgpu_encoder, base) 58#define to_amdgpu_encoder(x) container_of(x, struct amdgpu_encoder, base)
55#define to_amdgpu_framebuffer(x) container_of(x, struct amdgpu_framebuffer, base) 59#define to_amdgpu_framebuffer(x) container_of(x, struct amdgpu_framebuffer, base)
60#define to_amdgpu_plane(x) container_of(x, struct amdgpu_plane, base)
61
62#define to_dm_plane_state(x) container_of(x, struct dm_plane_state, base);
56 63
57#define AMDGPU_MAX_HPD_PINS 6 64#define AMDGPU_MAX_HPD_PINS 6
58#define AMDGPU_MAX_CRTCS 6 65#define AMDGPU_MAX_CRTCS 6
66#define AMDGPU_MAX_PLANES 6
59#define AMDGPU_MAX_AFMT_BLOCKS 9 67#define AMDGPU_MAX_AFMT_BLOCKS 9
60 68
61enum amdgpu_rmx_type { 69enum amdgpu_rmx_type {
@@ -292,6 +300,30 @@ struct amdgpu_display_funcs {
292 uint16_t connector_object_id, 300 uint16_t connector_object_id,
293 struct amdgpu_hpd *hpd, 301 struct amdgpu_hpd *hpd,
294 struct amdgpu_router *router); 302 struct amdgpu_router *router);
303 /* it is used to enter or exit into free sync mode */
304 int (*notify_freesync)(struct drm_device *dev, void *data,
305 struct drm_file *filp);
306 /* it is used to allow enablement of freesync mode */
307 int (*set_freesync_property)(struct drm_connector *connector,
308 struct drm_property *property,
309 uint64_t val);
310
311
312};
313
314struct amdgpu_framebuffer {
315 struct drm_framebuffer base;
316 struct drm_gem_object *obj;
317
318 /* caching for later use */
319 uint64_t address;
320};
321
322struct amdgpu_fbdev {
323 struct drm_fb_helper helper;
324 struct amdgpu_framebuffer rfb;
325 struct list_head fbdev_list;
326 struct amdgpu_device *adev;
295}; 327};
296 328
297struct amdgpu_mode_info { 329struct amdgpu_mode_info {
@@ -299,6 +331,7 @@ struct amdgpu_mode_info {
299 struct card_info *atom_card_info; 331 struct card_info *atom_card_info;
300 bool mode_config_initialized; 332 bool mode_config_initialized;
301 struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS]; 333 struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS];
334 struct amdgpu_plane *planes[AMDGPU_MAX_PLANES];
302 struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS]; 335 struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS];
303 /* DVI-I properties */ 336 /* DVI-I properties */
304 struct drm_property *coherent_mode_property; 337 struct drm_property *coherent_mode_property;
@@ -328,6 +361,7 @@ struct amdgpu_mode_info {
328 int num_dig; /* number of dig blocks */ 361 int num_dig; /* number of dig blocks */
329 int disp_priority; 362 int disp_priority;
330 const struct amdgpu_display_funcs *funcs; 363 const struct amdgpu_display_funcs *funcs;
364 const enum drm_plane_type *plane_type;
331}; 365};
332 366
333#define AMDGPU_MAX_BL_LEVEL 0xFF 367#define AMDGPU_MAX_BL_LEVEL 0xFF
@@ -400,6 +434,14 @@ struct amdgpu_crtc {
400 /* for virtual dce */ 434 /* for virtual dce */
401 struct hrtimer vblank_timer; 435 struct hrtimer vblank_timer;
402 enum amdgpu_interrupt_state vsync_timer_enabled; 436 enum amdgpu_interrupt_state vsync_timer_enabled;
437
438 int otg_inst;
439 struct drm_pending_vblank_event *event;
440};
441
442struct amdgpu_plane {
443 struct drm_plane base;
444 enum drm_plane_type plane_type;
403}; 445};
404 446
405struct amdgpu_encoder_atom_dig { 447struct amdgpu_encoder_atom_dig {
@@ -489,6 +531,19 @@ enum amdgpu_connector_dither {
489 AMDGPU_FMT_DITHER_ENABLE = 1, 531 AMDGPU_FMT_DITHER_ENABLE = 1,
490}; 532};
491 533
534struct amdgpu_dm_dp_aux {
535 struct drm_dp_aux aux;
536 struct ddc_service *ddc_service;
537};
538
539struct amdgpu_i2c_adapter {
540 struct i2c_adapter base;
541
542 struct ddc_service *ddc_service;
543};
544
545#define TO_DM_AUX(x) container_of((x), struct amdgpu_dm_dp_aux, aux)
546
492struct amdgpu_connector { 547struct amdgpu_connector {
493 struct drm_connector base; 548 struct drm_connector base;
494 uint32_t connector_id; 549 uint32_t connector_id;
@@ -500,6 +555,14 @@ struct amdgpu_connector {
500 /* we need to mind the EDID between detect 555 /* we need to mind the EDID between detect
501 and get modes due to analog/digital/tvencoder */ 556 and get modes due to analog/digital/tvencoder */
502 struct edid *edid; 557 struct edid *edid;
558 /* number of modes generated from EDID at 'dc_sink' */
559 int num_modes;
560 /* The 'old' sink - before an HPD.
561 * The 'current' sink is in dc_link->sink. */
562 struct dc_sink *dc_sink;
563 struct dc_link *dc_link;
564 struct dc_sink *dc_em_sink;
565 const struct dc_stream *stream;
503 void *con_priv; 566 void *con_priv;
504 bool dac_load_detect; 567 bool dac_load_detect;
505 bool detected_by_load; /* if the connection status was determined by load */ 568 bool detected_by_load; /* if the connection status was determined by load */
@@ -510,11 +573,39 @@ struct amdgpu_connector {
510 enum amdgpu_connector_audio audio; 573 enum amdgpu_connector_audio audio;
511 enum amdgpu_connector_dither dither; 574 enum amdgpu_connector_dither dither;
512 unsigned pixelclock_for_modeset; 575 unsigned pixelclock_for_modeset;
576
577 struct drm_dp_mst_topology_mgr mst_mgr;
578 struct amdgpu_dm_dp_aux dm_dp_aux;
579 struct drm_dp_mst_port *port;
580 struct amdgpu_connector *mst_port;
581 struct amdgpu_encoder *mst_encoder;
582 struct semaphore mst_sem;
583
584 /* TODO see if we can merge with ddc_bus or make a dm_connector */
585 struct amdgpu_i2c_adapter *i2c;
586
587 /* Monitor range limits */
588 int min_vfreq ;
589 int max_vfreq ;
590 int pixel_clock_mhz;
591
592 /*freesync caps*/
593 struct mod_freesync_caps caps;
594
595 struct mutex hpd_lock;
596
513}; 597};
514 598
515struct amdgpu_framebuffer { 599/* TODO: start to use this struct and remove same field from base one */
516 struct drm_framebuffer base; 600struct amdgpu_mst_connector {
517 struct drm_gem_object *obj; 601 struct amdgpu_connector base;
602
603 struct drm_dp_mst_topology_mgr mst_mgr;
604 struct amdgpu_dm_dp_aux dm_dp_aux;
605 struct drm_dp_mst_port *port;
606 struct amdgpu_connector *mst_port;
607 bool is_mst_connector;
608 struct amdgpu_encoder *mst_encoder;
518}; 609};
519 610
520#define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \ 611#define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \