Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174495
b: refs/heads/master
c: 7ac96a9
h: refs/heads/master
i:
  174493: 26d55fe
  174491: 267fab6
  174487: 1e303c4
  174479: b6ff25b
  174463: 9aae02c
v: v3
  • Loading branch information
Adam Jackson authored and Dave Airlie committed Dec 3, 2009
1 parent 04553a7 commit 2e504e3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9cf00977da092096c7a983276dad8b3002d23a99
refs/heads/master: 7ac96a9cb4982140e206bf3b58236efb2498ab3f
28 changes: 27 additions & 1 deletion trunk/drivers/gpu/drm/drm_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,40 @@ int drm_mode_height(struct drm_display_mode *mode)
}
EXPORT_SYMBOL(drm_mode_height);

/** drm_mode_hsync - get the hsync of a mode
* @mode: mode
*
* LOCKING:
* None.
*
* Return @modes's hsync rate in kHz, rounded to the nearest int.
*/
int drm_mode_hsync(struct drm_display_mode *mode)
{
unsigned int calc_val;

if (mode->hsync)
return mode->hsync;

if (mode->htotal < 0)
return 0;

calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */
calc_val += 500; /* round to 1000Hz */
calc_val /= 1000; /* truncate to kHz */

return calc_val;
}
EXPORT_SYMBOL(drm_mode_hsync);

/**
* drm_mode_vrefresh - get the vrefresh of a mode
* @mode: mode
*
* LOCKING:
* None.
*
* Return @mode's vrefresh rate or calculate it if necessary.
* Return @mode's vrefresh rate in Hz or calculate it if necessary.
*
* FIXME: why is this needed? shouldn't vrefresh be set already?
*
Expand Down
7 changes: 4 additions & 3 deletions trunk/include/drm/drm_crtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ struct drm_display_mode {
int type;

/* Proposed mode values */
int clock;
int clock; /* in kHz */
int hdisplay;
int hsync_start;
int hsync_end;
Expand Down Expand Up @@ -164,8 +164,8 @@ struct drm_display_mode {
int *private;
int private_flags;

int vrefresh;
float hsync;
int vrefresh; /* in Hz */
int hsync; /* in kHz */
};

enum drm_connector_status {
Expand Down Expand Up @@ -681,6 +681,7 @@ extern void drm_mode_validate_size(struct drm_device *dev,
extern void drm_mode_prune_invalid(struct drm_device *dev,
struct list_head *mode_list, bool verbose);
extern void drm_mode_sort(struct list_head *mode_list);
extern int drm_mode_hsync(struct drm_display_mode *mode);
extern int drm_mode_vrefresh(struct drm_display_mode *mode);
extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
int adjust_flags);
Expand Down

0 comments on commit 2e504e3

Please sign in to comment.