Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xf86-video-nouveau/dist/src merge xf86-video-...



details:   https://anonhg.NetBSD.org/xsrc/rev/df017b31d46e
branches:  trunk
changeset: 10152:df017b31d46e
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Mar 03 09:44:37 2019 +0000

description:
merge xf86-video-nouveau 1.0.16.

diffstat:

 external/mit/xf86-video-nouveau/dist/src/drmmode_display.c |  411 +++++++++++-
 external/mit/xf86-video-nouveau/dist/src/nouveau_xv.c      |   18 +-
 external/mit/xf86-video-nouveau/dist/src/nv30_xv_tex.c     |    2 +-
 external/mit/xf86-video-nouveau/dist/src/nv40_xv_tex.c     |    2 +-
 external/mit/xf86-video-nouveau/dist/src/nv50_xv.c         |    3 +-
 external/mit/xf86-video-nouveau/dist/src/nv_driver.c       |   21 +-
 external/mit/xf86-video-nouveau/dist/src/nv_proto.h        |    1 -
 external/mit/xf86-video-nouveau/dist/src/nvc0_xv.c         |    3 +-
 8 files changed, 382 insertions(+), 79 deletions(-)

diffs (truncated from 808 to 300 lines):

diff -r d8a6aee968cd -r df017b31d46e external/mit/xf86-video-nouveau/dist/src/drmmode_display.c
--- a/external/mit/xf86-video-nouveau/dist/src/drmmode_display.c        Sun Mar 03 09:40:14 2019 +0000
+++ b/external/mit/xf86-video-nouveau/dist/src/drmmode_display.c        Sun Mar 03 09:44:37 2019 +0000
@@ -49,7 +49,6 @@
 typedef struct {
     int fd;
     uint32_t fb_id;
-    drmModeResPtr mode_res;
     int cpp;
     drmEventContext event_context;
 #ifdef HAVE_LIBUDEV
@@ -86,6 +85,7 @@
     drmModeConnectorPtr mode_output;
     drmModeEncoderPtr mode_encoder;
     drmModePropertyBlobPtr edid_blob;
+    drmModePropertyBlobPtr tile_blob;
     int num_props;
     drmmode_prop_ptr props;
 } drmmode_output_private_rec, *drmmode_output_private_ptr;
@@ -480,6 +480,8 @@
                        continue;
 
                drmmode_output = output->driver_private;
+               if (drmmode_output->output_id == -1)
+                       continue;
                output_ids[output_count] =
                        drmmode_output->mode_output->connector_id;
                output_count++;
@@ -525,7 +527,7 @@
 
 #ifdef HAVE_XF86_CURSOR_RESET_CURSOR
        xf86CursorResetCursor(crtc->scrn->pScreen);
-#else   
+#else
        xf86_reload_cursors(crtc->scrn->pScreen);
 #endif
 
@@ -685,7 +687,8 @@
                                  size, red, green, blue);
        if (ret != 0) {
                xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
-                          "failed to set gamma: %s\n", strerror(-ret));
+                          "failed to set gamma with %d entries: %s\n",
+                          size, strerror(-ret));
        }
 }
 
@@ -701,7 +704,11 @@
        int c, total_width = 0, max_height = 0, this_x = 0;
        if (!ppix) {
                if (crtc->randr_crtc->scanout_pixmap) {
-                       PixmapStopDirtyTracking((DrawablePtr)crtc->randr_crtc->scanout_pixmap, screenpix);
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+                       PixmapStopDirtyTracking(&crtc->randr_crtc->scanout_pixmap->drawable, screenpix);
+#else
+                       PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix);
+#endif
                        if (drmmode && drmmode->fb_id) {
                                drmModeRmFB(drmmode->fd, drmmode->fb_id);
                                drmmode->fb_id = 0;
@@ -747,8 +754,11 @@
                screen->height = screenpix->drawable.height = max_height;
        }
        drmmode_crtc->scanout_pixmap_x = this_x;
-#ifdef HAS_DIRTYTRACKING_ROTATION
-       PixmapStartDirtyTracking((DrawablePtr)ppix, screenpix, 0, 0, this_x, 0, RR_Rotate_0);
+
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+       PixmapStartDirtyTracking(&ppix->drawable, screenpix, 0, 0, this_x, 0, RR_Rotate_0);
+#elif defined(HAS_DIRTYTRACKING_ROTATION)
+       PixmapStartDirtyTracking(ppix, screenpix, 0, 0, this_x, 0, RR_Rotate_0);
 #elif defined(HAS_DIRTYTRACKING2)
        PixmapStartDirtyTracking2(ppix, screenpix, 0, 0, this_x, 0);
 #else
@@ -777,7 +787,7 @@
 
 
 static unsigned int
-drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
+drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res, int num)
 {
        NVPtr pNv = NVPTR(pScrn);
        NVEntPtr pNVEnt = NVEntPriv(pScrn);
@@ -791,7 +801,7 @@
 
        drmmode_crtc = xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
        drmmode_crtc->mode_crtc = drmModeGetCrtc(drmmode->fd,
-                                                drmmode->mode_res->crtcs[num]);
+                                                mode_res->crtcs[num]);
        drmmode_crtc->drmmode = drmmode;
        drmmode_crtc->hw_crtc_index = num;
 
@@ -816,13 +826,19 @@
        drmmode_output_private_ptr drmmode_output = output->driver_private;
        drmmode_ptr drmmode = drmmode_output->drmmode;
        xf86OutputStatus status;
+
+       if (drmmode_output->output_id == -1)
+               return XF86OutputStatusDisconnected;
+
        drmModeFreeConnector(drmmode_output->mode_output);
 
        drmmode_output->mode_output =
                drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
 
-       if (!drmmode_output->mode_output)
+       if (!drmmode_output->mode_output) {
+               drmmode_output->output_id = -1;
                return XF86OutputStatusDisconnected;
+       }
 
        switch (drmmode_output->mode_output->connection) {
        case DRM_MODE_CONNECTED:
@@ -849,6 +865,69 @@
        return MODE_OK;
 }
 
+static int
+koutput_get_prop_idx(int fd, drmModeConnectorPtr koutput,
+                    int type, const char *name)
+{
+       int idx = -1;
+
+       for (int i = 0; i < koutput->count_props; i++) {
+               drmModePropertyPtr prop = drmModeGetProperty(fd, koutput->props[i]);
+
+               if (!prop)
+                       continue;
+
+               if (drm_property_type_is(prop, type) && !strcmp(prop->name, name))
+                       idx = i;
+
+               drmModeFreeProperty(prop);
+
+               if (idx > -1)
+                       break;
+       }
+
+       return idx;
+}
+
+static drmModePropertyBlobPtr
+koutput_get_prop_blob(int fd, drmModeConnectorPtr koutput, const char *name)
+{
+       drmModePropertyBlobPtr blob = NULL;
+       int idx = koutput_get_prop_idx(fd, koutput, DRM_MODE_PROP_BLOB, name);
+
+       if (idx > -1)
+               blob = drmModeGetPropertyBlob(fd, koutput->prop_values[idx]);
+
+       return blob;
+}
+
+static void
+drmmode_output_attach_tile(xf86OutputPtr output)
+{
+       drmmode_output_private_ptr drmmode_output = output->driver_private;
+       drmModeConnectorPtr koutput = drmmode_output->mode_output;
+       drmmode_ptr drmmode = drmmode_output->drmmode;
+       struct xf86CrtcTileInfo tile_info, *set = NULL;
+
+       if (!koutput) {
+               xf86OutputSetTile(output, NULL);
+               return;
+       }
+
+       drmModeFreePropertyBlob(drmmode_output->tile_blob);
+
+       /* look for a TILE property */
+       drmmode_output->tile_blob =
+               koutput_get_prop_blob(drmmode->fd, koutput, "TILE");
+
+       if (drmmode_output->tile_blob) {
+               if (xf86OutputParseKMSTile(drmmode_output->tile_blob->data, drmmode_output->tile_blob->length, &tile_info) == TRUE)
+                       set = &tile_info;
+       }
+       xf86OutputSetTile(output, set);
+}
+
+
 static DisplayModePtr
 drmmode_output_get_modes(xf86OutputPtr output)
 {
@@ -857,27 +936,14 @@
        drmmode_ptr drmmode = drmmode_output->drmmode;
        int i;
        DisplayModePtr Modes = NULL, Mode;
-       drmModePropertyPtr props;
        xf86MonPtr ddc_mon = NULL;
 
        if (!koutput)
                return NULL;
 
        /* look for an EDID property */
-       for (i = 0; i < koutput->count_props; i++) {
-               props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
-               if (!props || !(props->flags & DRM_MODE_PROP_BLOB))
-                       continue;
-
-               if (!strcmp(props->name, "EDID")) {
-                       if (drmmode_output->edid_blob)
-                               drmModeFreePropertyBlob(drmmode_output->edid_blob);
-                       drmmode_output->edid_blob =
-                               drmModeGetPropertyBlob(drmmode->fd,
-                                                      koutput->prop_values[i]);
-               }
-               drmModeFreeProperty(props);
-       }
+       drmmode_output->edid_blob =
+               koutput_get_prop_blob(drmmode->fd, koutput, "EDID");
 
        if (drmmode_output->edid_blob) {
                ddc_mon = xf86InterpretEDID(output->scrn->scrnIndex,
@@ -887,6 +953,8 @@
        }
        xf86OutputSetEDID(output, ddc_mon);
 
+       drmmode_output_attach_tile(output);
+
        /* modes should already be available */
        for (i = 0; i < koutput->count_modes; i++) {
                Mode = xnfalloc(sizeof(DisplayModeRec));
@@ -907,6 +975,8 @@
 
        if (drmmode_output->edid_blob)
                drmModeFreePropertyBlob(drmmode_output->edid_blob);
+       if (drmmode_output->tile_blob)
+               drmModeFreePropertyBlob(drmmode_output->tile_blob);
        for (i = 0; i < drmmode_output->num_props; i++) {
                drmModeFreeProperty(drmmode_output->props[i].mode_prop);
                free(drmmode_output->props[i].atoms);
@@ -925,6 +995,9 @@
        drmmode_ptr drmmode = drmmode_output->drmmode;
        int mode_id = -1, i;
 
+       if (!koutput)
+               return;
+
        for (i = 0; i < koutput->count_props; i++) {
                props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
                if (props && (props->flags & DRM_MODE_PROP_ENUM)) {
@@ -1088,7 +1161,8 @@
                        if (value->type != XA_ATOM || value->format != 32 || value->size != 1)
                                return FALSE;
                        memcpy(&atom, value->data, 4);
-                       name = NameForAtom(atom);
+                       if (!(name = NameForAtom(atom)))
+                               return FALSE;
 
                        /* search for matching name string, then set its value down */
                        for (j = 0; j < p->mode_prop->count_enums; j++) {
@@ -1233,42 +1307,130 @@
     return FALSE;
 }
 
+static xf86OutputPtr find_output(ScrnInfoPtr pScrn, int id)
+{
+       xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+       int i;
+       for (i = 0; i < xf86_config->num_output; i++) {
+               xf86OutputPtr output = xf86_config->output[i];
+               drmmode_output_private_ptr drmmode_output;
+
+               drmmode_output = output->driver_private;
+               if (drmmode_output->output_id == id)
+                       return output;
+       }
+       return NULL;
+}
+
+static int parse_path_blob(drmModePropertyBlobPtr path_blob, int *conn_base_id, char **path)
+{
+       char *conn;
+       char conn_id[5];
+       int id, len;
+       char *blob_data;
+
+       if (!path_blob)
+               return -1;
+
+       blob_data = path_blob->data;
+       /* we only handle MST paths for now */
+       if (strncmp(blob_data, "mst:", 4))
+               return -1;
+
+       conn = strchr(blob_data + 4, '-');
+       if (!conn)
+               return -1;
+       len = conn - (blob_data + 4);
+       if (len + 1 > 5)
+               return -1;
+       memcpy(conn_id, blob_data + 4, len);
+       conn_id[len] = '\0';
+       id = strtoul(conn_id, NULL, 10);
+
+       *conn_base_id = id;
+
+       *path = conn + 1;
+       return 0;
+}



Home | Main Index | Thread Index | Old Index