~ubuntu-branches/ubuntu/trusty/linux-lts-vivid/trusty-proposed

« back to all changes in this revision

Viewing changes to drivers/gpu/drm/qxl/qxl_display.c

  • Committer: Package Import Robot
  • Author(s): Luis Henriques, Kamal Mostafa, K. Y. Srinivasan
  • Date: 2015-11-23 13:24:32 UTC
  • Revision ID: package-import@ubuntu.com-20151123132432-903xk653el60bfun
[ Kamal Mostafa ]

* Release Tracking Bug
  - LP: #1518519

[ K. Y. Srinivasan ]

* SAUCE: Drivers: hv: vmbus: Fix a Host signaling bug
  - LP: #1508706

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
        *pwidth = head->width;
161
161
        *pheight = head->height;
162
162
        drm_mode_probed_add(connector, mode);
 
163
        /* remember the last custom size for mode validation */
 
164
        qdev->monitors_config_width = mode->hdisplay;
 
165
        qdev->monitors_config_height = mode->vdisplay;
163
166
        return 1;
164
167
}
165
168
 
 
169
static struct mode_size {
 
170
        int w;
 
171
        int h;
 
172
} common_modes[] = {
 
173
        { 640,  480},
 
174
        { 720,  480},
 
175
        { 800,  600},
 
176
        { 848,  480},
 
177
        {1024,  768},
 
178
        {1152,  768},
 
179
        {1280,  720},
 
180
        {1280,  800},
 
181
        {1280,  854},
 
182
        {1280,  960},
 
183
        {1280, 1024},
 
184
        {1440,  900},
 
185
        {1400, 1050},
 
186
        {1680, 1050},
 
187
        {1600, 1200},
 
188
        {1920, 1080},
 
189
        {1920, 1200}
 
190
};
 
191
 
166
192
static int qxl_add_common_modes(struct drm_connector *connector,
167
193
                                unsigned pwidth,
168
194
                                unsigned pheight)
170
196
        struct drm_device *dev = connector->dev;
171
197
        struct drm_display_mode *mode = NULL;
172
198
        int i;
173
 
        struct mode_size {
174
 
                int w;
175
 
                int h;
176
 
        } common_modes[] = {
177
 
                { 640,  480},
178
 
                { 720,  480},
179
 
                { 800,  600},
180
 
                { 848,  480},
181
 
                {1024,  768},
182
 
                {1152,  768},
183
 
                {1280,  720},
184
 
                {1280,  800},
185
 
                {1280,  854},
186
 
                {1280,  960},
187
 
                {1280, 1024},
188
 
                {1440,  900},
189
 
                {1400, 1050},
190
 
                {1680, 1050},
191
 
                {1600, 1200},
192
 
                {1920, 1080},
193
 
                {1920, 1200}
194
 
        };
195
 
 
196
199
        for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
197
200
                mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h,
198
201
                                    60, false, false, false);
823
826
static int qxl_conn_mode_valid(struct drm_connector *connector,
824
827
                               struct drm_display_mode *mode)
825
828
{
 
829
        struct drm_device *ddev = connector->dev;
 
830
        struct qxl_device *qdev = ddev->dev_private;
 
831
        int i;
 
832
 
826
833
        /* TODO: is this called for user defined modes? (xrandr --add-mode)
827
834
         * TODO: check that the mode fits in the framebuffer */
828
 
        DRM_DEBUG("%s: %dx%d status=%d\n", mode->name, mode->hdisplay,
829
 
                  mode->vdisplay, mode->status);
830
 
        return MODE_OK;
 
835
 
 
836
        if(qdev->monitors_config_width == mode->hdisplay &&
 
837
           qdev->monitors_config_height == mode->vdisplay)
 
838
                return MODE_OK;
 
839
 
 
840
        for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
 
841
                if (common_modes[i].w == mode->hdisplay && common_modes[i].h == mode->vdisplay)
 
842
                        return MODE_OK;
 
843
        }
 
844
        return MODE_BAD;
831
845
}
832
846
 
833
847
static struct drm_encoder *qxl_best_encoder(struct drm_connector *connector)
872
886
                drm_connector_to_qxl_output(connector);
873
887
        struct drm_device *ddev = connector->dev;
874
888
        struct qxl_device *qdev = ddev->dev_private;
875
 
        int connected;
 
889
        bool connected = false;
876
890
 
877
891
        /* The first monitor is always connected */
878
 
        connected = (output->index == 0) ||
879
 
                    (qdev->client_monitors_config &&
880
 
                     qdev->client_monitors_config->count > output->index &&
881
 
                     qxl_head_enabled(&qdev->client_monitors_config->heads[output->index]));
 
892
        if (!qdev->client_monitors_config) {
 
893
                if (output->index == 0)
 
894
                        connected = true;
 
895
        } else
 
896
                connected = qdev->client_monitors_config->count > output->index &&
 
897
                     qxl_head_enabled(&qdev->client_monitors_config->heads[output->index]);
882
898
 
883
899
        DRM_DEBUG("#%d connected: %d\n", output->index, connected);
884
900
        if (!connected)